This mapping has 1 multi-map group: several pairings are equally correct there. The code view shows one arbitrary valid pairing, not the only one.

Code view:

A painting is a person's account of this edit as text, recorded independently of the node mapping - a rendering often has several equally defensible answers where the mapping has one. Deletions and insertions carry no position on the opposite side in a painting, so that panel draws no caret for them.

Before

…lines 1–67 unchanged (67 lines)
68 private final JSTypeRegistry typeRegistry;
69 private final Node errorRoot;
70 private final String sourceName;
71 private final Scope scope;
72
73 private JSType returnType = null;
74 private List<ObjectType> implementedInterfaces = null;
75 private ObjectType baseType = null;
76 private ObjectType thisType = null;
77 private boolean isConstructor = false;
78 private boolean isInterface = false;
79 private Node parametersNode = null;
80 private Node sourceNode = null;
…lines 81–194 unchanged (114 lines)
195 /**
196 * Infer the return type from JSDocInfo.
197 */
198 FunctionTypeBuilder inferReturnType(@Nullable JSDocInfo info) {
199 returnType = info != null && info.hasReturnType() ?
200 info.getReturnType().evaluate(scope, typeRegistry) :
201 typeRegistry.getNativeType(UNKNOWN_TYPE);
202 if (templateTypeName != null &&
203 returnType.restrictByNotNullOrUndefined().isTemplateType()) {
204 reportError(TEMPLATE_TYPE_EXPECTED, fnName);
205 }
206 return this;
207 }
208
209 /**
210 * If we haven't found a return value yet, try to look at the "return"
211 * statements in the function.
212 */
213
214
215 /**
216 * Infer the role of the function (whether it's a constructor or interface)
217 * and what it inherits from in JSDocInfo.
218 */
219 FunctionTypeBuilder inferInheritance(@Nullable JSDocInfo info) {
…lines 220–489 unchanged (270 lines)
490 maybeSetBaseType(fnType);
491 } else {
492 fnType = new FunctionBuilder(typeRegistry)
493 .withName(fnName)
494 .withSourceNode(sourceNode)
495 .withParamsNode(parametersNode)
496 .withReturnType(returnType)
497 .withTypeOfThis(thisType)
498 .withTemplateName(templateTypeName)
499 .build();
500 maybeSetBaseType(fnType);
501 }
502
…lines 503–588 unchanged (86 lines)

After

…lines 1–67 unchanged (67 lines)
68 private final JSTypeRegistry typeRegistry;
69 private final Node errorRoot;
70 private final String sourceName;
71 private final Scope scope;
72
73 private JSType returnType = null;
74 private boolean returnTypeInferred = false;
75 private List<ObjectType> implementedInterfaces = null;
76 private ObjectType baseType = null;
77 private ObjectType thisType = null;
78 private boolean isConstructor = false;
79 private boolean isInterface = false;
80 private Node parametersNode = null;
…lines 81–194 unchanged (114 lines)
195
196 /**
197 * Infer the return type from JSDocInfo.
198 */
199 FunctionTypeBuilder inferReturnType(@Nullable JSDocInfo info) {
200 returnType = info != null && info.hasReturnType() ?
201 info.getReturnType().evaluate(scope, typeRegistry) : null;
202 if (templateTypeName != null &&
203 returnType != null &&
204 returnType.restrictByNotNullOrUndefined().isTemplateType()) {
205 reportError(TEMPLATE_TYPE_EXPECTED, fnName);
206 }
207 return this;
208 }
209
210 /**
211 * If we haven't found a return value yet, try to look at the "return"
212 * statements in the function.
213 */
214 FunctionTypeBuilder inferReturnStatements(@Nullable Node functionBlock) {
215 if (functionBlock == null || compiler.getInput(sourceName).isExtern()) {
216 return this;
217 }
218 Preconditions.checkArgument(functionBlock.getType() == Token.BLOCK);
219 if (returnType == null) {
220 boolean hasNonEmptyReturns = false;
221 List<Node> worklist = Lists.newArrayList(functionBlock);
222 while (!worklist.isEmpty()) {
223 Node current = worklist.remove(worklist.size() - 1);
224 int cType = current.getType();
225 if (cType == Token.RETURN && current.getFirstChild() != null ||
226 cType == Token.THROW) {
227 hasNonEmptyReturns = true;
228 break;
229 } else if (NodeUtil.isStatementBlock(current) ||
230 NodeUtil.isControlStructure(current)) {
231 for (Node child = current.getFirstChild();
232 child != null; child = child.getNext()) {
233 worklist.add(child);
234 }
235 }
236 }
237
238 if (!hasNonEmptyReturns) {
239 returnType = typeRegistry.getNativeType(VOID_TYPE);
240 returnTypeInferred = true;
241 }
242 }
243 return this;
244 }
245
246 /**
247 * Infer the role of the function (whether it's a constructor or interface)
248 * and what it inherits from in JSDocInfo.
249 */
250 FunctionTypeBuilder inferInheritance(@Nullable JSDocInfo info) {
…lines 251–520 unchanged (270 lines)
521 maybeSetBaseType(fnType);
522 } else {
523 fnType = new FunctionBuilder(typeRegistry)
524 .withName(fnName)
525 .withSourceNode(sourceNode)
526 .withParamsNode(parametersNode)
527 .withReturnType(returnType, returnTypeInferred)
528 .withTypeOfThis(thisType)
529 .withTemplateName(templateTypeName)
530 .build();
531 maybeSetBaseType(fnType);
532 }
533
…lines 534–619 unchanged (86 lines)

Before

program
block_comment "/*\n * Copyright 2008 Google Inc.\n *\n * Licensed under the Ap"...
package_declaration
package "package"
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "jscomp"
; ";"
import_declaration
import "import"
static "static"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "jscomp"
. "."
identifier "TypeCheck"
. "."
identifier "BAD_IMPLEMENTED_TYPE"
; ";"
import_declaration (+23 nodes collapsed)
import_declaration (+23 nodes collapsed)
import_declaration (+23 nodes collapsed)
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "common"
. "."
identifier "base"
. "."
identifier "Preconditions"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "common"
. "."
identifier "collect"
. "."
identifier "Iterables"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "common"
. "."
identifier "collect"
. "."
identifier "Lists"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "common"
. "."
identifier "collect"
. "."
identifier "Sets"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "rhino"
. "."
identifier "JSDocInfo"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "rhino"
. "."
identifier "JSTypeExpression"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "rhino"
. "."
identifier "Node"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "rhino"
. "."
identifier "Token"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "rhino"
. "."
identifier "jstype"
. "."
identifier "FunctionBuilder"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "rhino"
. "."
identifier "jstype"
. "."
identifier "FunctionParamBuilder"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "rhino"
. "."
identifier "jstype"
. "."
identifier "FunctionType"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "rhino"
. "."
identifier "jstype"
. "."
identifier "InstanceObjectType"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "rhino"
. "."
identifier "jstype"
. "."
identifier "JSType"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "rhino"
. "."
identifier "jstype"
. "."
identifier "JSTypeRegistry"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "rhino"
. "."
identifier "jstype"
. "."
identifier "ObjectType"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "Iterator"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "List"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "Set"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "javax"
. "."
identifier "annotation"
. "."
identifier "Nullable"
; ";"
block_comment "/**\n * A builder for FunctionTypes, because FunctionTypes ar"...
class_declaration
modifiers
final "final"
class "class"
identifier "FunctionTypeBuilder"
class_body
{ "{"
field_declaration
modifiers
private "private"
final "final"
type_identifier "String"
variable_declarator
identifier "fnName"
; ";"
field_declaration
modifiers
private "private"
final "final"
type_identifier "AbstractCompiler"
variable_declarator
identifier "compiler"
; ";"
field_declaration
modifiers
private "private"
final "final"
type_identifier "CodingConvention"
variable_declarator
identifier "codingConvention"
; ";"
field_declaration
modifiers
private "private"
final "final"
type_identifier "JSTypeRegistry"
variable_declarator
identifier "typeRegistry"
; ";"
field_declaration
modifiers
private "private"
final "final"
type_identifier "Node"
variable_declarator
identifier "errorRoot"
; ";"
field_declaration
modifiers
private "private"
final "final"
type_identifier "String"
variable_declarator
identifier "sourceName"
; ";"
field_declaration
modifiers
private "private"
final "final"
type_identifier "Scope"
variable_declarator
identifier "scope"
; ";"
field_declaration
modifiers
private "private"
type_identifier "JSType"
variable_declarator
identifier "returnType"
= "="
null_literal "null"
; ";"
field_declaration
modifiers
private "private"
generic_type
type_identifier "List"
type_arguments
< "<"
type_identifier "ObjectType"
> ">"
variable_declarator
identifier "implementedInterfaces"
= "="
null_literal "null"
; ";"
field_declaration
modifiers
private "private"
type_identifier "ObjectType"
variable_declarator
identifier "baseType"
= "="
null_literal "null"
; ";"
field_declaration
modifiers
private "private"
type_identifier "ObjectType"
variable_declarator
identifier "thisType"
= "="
null_literal "null"
; ";"
field_declaration
modifiers
private "private"
boolean_type "boolean"
variable_declarator
identifier "isConstructor"
= "="
false "false"
; ";"
field_declaration
modifiers
private "private"
boolean_type "boolean"
variable_declarator
identifier "isInterface"
= "="
false "false"
; ";"
field_declaration
modifiers
private "private"
type_identifier "Node"
variable_declarator
identifier "parametersNode"
= "="
null_literal "null"
; ";"
field_declaration
modifiers
private "private"
type_identifier "Node"
variable_declarator
identifier "sourceNode"
= "="
null_literal "null"
; ";"
field_declaration
modifiers
private "private"
type_identifier "String"
variable_declarator
identifier "templateTypeName"
= "="
null_literal "null"
; ";"
field_declaration (+25 nodes collapsed)
field_declaration (+25 nodes collapsed)
field_declaration (+25 nodes collapsed)
field_declaration (+25 nodes collapsed)
field_declaration (+25 nodes collapsed)
field_declaration (+25 nodes collapsed)
field_declaration (+39 nodes collapsed)
field_declaration (+25 nodes collapsed)
field_declaration (+25 nodes collapsed)
block_comment "/**\n * @param fnName The function name.\n * @param compil"...
constructor_declaration (+122 nodes collapsed)
block_comment "/**\n * Sets the FUNCTION node of this function.\n */"
method_declaration (+29 nodes collapsed)
block_comment "/**\n * Infer the parameter and return types of a function "...
method_declaration (+263 nodes collapsed)
block_comment "/**\n * Infer the return type from JSDocInfo.\n */"
method_declaration
type_identifier "FunctionTypeBuilder"
identifier "inferReturnType"
formal_parameters
( "("
formal_parameter
modifiers
marker_annotation
@ "@"
identifier "Nullable"
type_identifier "JSDocInfo"
identifier "info"
) ")"
block
{ "{"
expression_statement
assignment_expression
identifier "returnType"
= "="
ternary_expression
binary_expression
binary_expression
identifier "info"
!= "!="
null_literal "null"
&& "&&"
method_invocation
identifier "info"
. "."
identifier "hasReturnType"
argument_list
( "("
) ")"
? "?"
method_invocation
method_invocation
identifier "info"
. "."
identifier "getReturnType"
argument_list
( "("
) ")"
. "."
identifier "evaluate"
argument_list
( "("
identifier "scope"
, ","
identifier "typeRegistry"
) ")"
: ":"
method_invocation
identifier "typeRegistry"
. "."
identifier "getNativeType"
argument_list
( "("
identifier "UNKNOWN_TYPE"
) ")"
; ";"
if_statement
if "if"
parenthesized_expression
( "("
binary_expression any 2:3
binary_expression any 2:3
identifier "templateTypeName"
!= "!="
null_literal "null"
&& "&&"
method_invocation
method_invocation
identifier "returnType"
. "."
identifier "restrictByNotNullOrUndefined"
argument_list
( "("
) ")"
. "."
identifier "isTemplateType"
argument_list
( "("
) ")"
) ")"
block
{ "{"
expression_statement
method_invocation
identifier "reportError"
argument_list
( "("
identifier "TEMPLATE_TYPE_EXPECTED"
, ","
identifier "fnName"
) ")"
; ";"
} "}"
return_statement
return "return"
this "this"
; ";"
} "}"
block_comment "/**\n * If we haven't found a return value yet, try to look"...
block_comment "/**\n * Infer the role of the function (whether it's a cons"...
method_declaration (+354 nodes collapsed)
block_comment "/**\n * Infers the type of {@code this}.\n * @param type T"...
method_declaration (+72 nodes collapsed)
block_comment "/**\n * Infers the type of {@code this}.\n * @param info T"...
method_declaration (+215 nodes collapsed)
block_comment "/**\n * Infer the parameter types from the doc info alone.\n"...
method_declaration (+79 nodes collapsed)
block_comment "/**\n * Infer the parameter types from the list of argument"...
method_declaration (+379 nodes collapsed)
block_comment "/**\n * @return Whether the given param is an optional para"...
method_declaration (+88 nodes collapsed)
block_comment "/**\n * Determine whether this is a var args parameter.\n "...
method_declaration (+88 nodes collapsed)
block_comment "/**\n * Infer the template type from the doc info.\n */"
method_declaration (+54 nodes collapsed)
block_comment "/**\n * Add a parameter to the param list.\n * @param buil"...
method_declaration (+207 nodes collapsed)
block_comment "/**\n * Builds the function type, and puts it in the regist"...
method_declaration
type_identifier "FunctionType"
identifier "buildAndRegister"
formal_parameters
( "("
) ")"
block
{ "{"
if_statement (+25 nodes collapsed)
if_statement (+25 nodes collapsed)
local_variable_declaration
type_identifier "FunctionType"
variable_declarator
identifier "fnType"
; ";"
if_statement
if "if"
parenthesized_expression
( "("
identifier "isConstructor"
) ")"
block
{ "{"
expression_statement
assignment_expression
identifier "fnType"
= "="
method_invocation
identifier "getOrCreateConstructor"
argument_list
( "("
) ")"
; ";"
} "}"
else "else"
if_statement
if "if"
parenthesized_expression
( "("
identifier "isInterface"
) ")"
block (+70 nodes collapsed)
else "else"
block
{ "{"
expression_statement
assignment_expression
identifier "fnType"
= "="
method_invocation
method_invocation
method_invocation
method_invocation
method_invocation (+28 nodes collapsed)
. "."
identifier "withReturnType"
argument_list
( "("
identifier "returnType"
) ")"
. "."
identifier "withTypeOfThis"
argument_list
( "("
identifier "thisType"
) ")"
. "."
identifier "withTemplateName"
argument_list
( "("
identifier "templateTypeName"
) ")"
. "."
identifier "build"
argument_list
( "("
) ")"
; ";"
expression_statement
method_invocation
identifier "maybeSetBaseType"
argument_list
( "("
identifier "fnType"
) ")"
; ";"
} "}"
if_statement (+22 nodes collapsed)
expression_statement
method_invocation
identifier "typeRegistry"
. "."
identifier "clearTemplateTypeName"
argument_list
( "("
) ")"
; ";"
return_statement
return "return"
identifier "fnType"
; ";"
} "}"
method_declaration (+36 nodes collapsed)
block_comment "/**\n * Returns a constructor function either by returning "...
method_declaration (+260 nodes collapsed)
method_declaration (+43 nodes collapsed)
method_declaration (+43 nodes collapsed)
block_comment "/**\n * Determines whether the given jsdoc info declares a "...
method_declaration (+63 nodes collapsed)
} "}"

After

program
block_comment "/*\n * Copyright 2008 Google Inc.\n *\n * Licensed under the Ap"...
package_declaration
package "package"
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "jscomp"
; ";"
import_declaration
import "import"
static "static"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "jscomp"
. "."
identifier "TypeCheck"
. "."
identifier "BAD_IMPLEMENTED_TYPE"
; ";"
import_declaration (+23 nodes collapsed)
import_declaration (+23 nodes collapsed)
import_declaration (+23 nodes collapsed)
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "common"
. "."
identifier "base"
. "."
identifier "Preconditions"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "common"
. "."
identifier "collect"
. "."
identifier "Iterables"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "common"
. "."
identifier "collect"
. "."
identifier "Lists"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "common"
. "."
identifier "collect"
. "."
identifier "Sets"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "rhino"
. "."
identifier "JSDocInfo"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "rhino"
. "."
identifier "JSTypeExpression"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "rhino"
. "."
identifier "Node"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "rhino"
. "."
identifier "Token"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "rhino"
. "."
identifier "jstype"
. "."
identifier "FunctionBuilder"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "rhino"
. "."
identifier "jstype"
. "."
identifier "FunctionParamBuilder"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "rhino"
. "."
identifier "jstype"
. "."
identifier "FunctionType"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "rhino"
. "."
identifier "jstype"
. "."
identifier "InstanceObjectType"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "rhino"
. "."
identifier "jstype"
. "."
identifier "JSType"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "rhino"
. "."
identifier "jstype"
. "."
identifier "JSTypeRegistry"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "rhino"
. "."
identifier "jstype"
. "."
identifier "ObjectType"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "Iterator"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "List"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "Set"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "javax"
. "."
identifier "annotation"
. "."
identifier "Nullable"
; ";"
block_comment "/**\n * A builder for FunctionTypes, because FunctionTypes ar"...
class_declaration
modifiers
final "final"
class "class"
identifier "FunctionTypeBuilder"
class_body
{ "{"
field_declaration
modifiers
private "private"
final "final"
type_identifier "String"
variable_declarator
identifier "fnName"
; ";"
field_declaration
modifiers
private "private"
final "final"
type_identifier "AbstractCompiler"
variable_declarator
identifier "compiler"
; ";"
field_declaration
modifiers
private "private"
final "final"
type_identifier "CodingConvention"
variable_declarator
identifier "codingConvention"
; ";"
field_declaration
modifiers
private "private"
final "final"
type_identifier "JSTypeRegistry"
variable_declarator
identifier "typeRegistry"
; ";"
field_declaration
modifiers
private "private"
final "final"
type_identifier "Node"
variable_declarator
identifier "errorRoot"
; ";"
field_declaration
modifiers
private "private"
final "final"
type_identifier "String"
variable_declarator
identifier "sourceName"
; ";"
field_declaration
modifiers
private "private"
final "final"
type_identifier "Scope"
variable_declarator
identifier "scope"
; ";"
field_declaration
modifiers
private "private"
type_identifier "JSType"
variable_declarator
identifier "returnType"
= "="
null_literal "null"
; ";"
field_declaration
modifiers
private "private"
boolean_type "boolean"
variable_declarator
identifier "returnTypeInferred"
= "="
false "false"
; ";"
field_declaration
modifiers
private "private"
generic_type
type_identifier "List"
type_arguments
< "<"
type_identifier "ObjectType"
> ">"
variable_declarator
identifier "implementedInterfaces"
= "="
null_literal "null"
; ";"
field_declaration
modifiers
private "private"
type_identifier "ObjectType"
variable_declarator
identifier "baseType"
= "="
null_literal "null"
; ";"
field_declaration
modifiers
private "private"
type_identifier "ObjectType"
variable_declarator
identifier "thisType"
= "="
null_literal "null"
; ";"
field_declaration
modifiers
private "private"
boolean_type "boolean"
variable_declarator
identifier "isConstructor"
= "="
false "false"
; ";"
field_declaration
modifiers
private "private"
boolean_type "boolean"
variable_declarator
identifier "isInterface"
= "="
false "false"
; ";"
field_declaration
modifiers
private "private"
type_identifier "Node"
variable_declarator
identifier "parametersNode"
= "="
null_literal "null"
; ";"
field_declaration
modifiers
private "private"
type_identifier "Node"
variable_declarator
identifier "sourceNode"
= "="
null_literal "null"
; ";"
field_declaration
modifiers
private "private"
type_identifier "String"
variable_declarator
identifier "templateTypeName"
= "="
null_literal "null"
; ";"
field_declaration (+25 nodes collapsed)
field_declaration (+25 nodes collapsed)
field_declaration (+25 nodes collapsed)
field_declaration (+25 nodes collapsed)
field_declaration (+25 nodes collapsed)
field_declaration (+25 nodes collapsed)
field_declaration (+39 nodes collapsed)
field_declaration (+25 nodes collapsed)
field_declaration (+25 nodes collapsed)
block_comment "/**\n * @param fnName The function name.\n * @param compil"...
constructor_declaration (+122 nodes collapsed)
block_comment "/**\n * Sets the FUNCTION node of this function.\n */"
method_declaration (+29 nodes collapsed)
block_comment "/**\n * Infer the parameter and return types of a function "...
method_declaration (+263 nodes collapsed)
block_comment "/**\n * Infer the return type from JSDocInfo.\n */"
method_declaration
type_identifier "FunctionTypeBuilder"
identifier "inferReturnType"
formal_parameters
( "("
formal_parameter
modifiers
marker_annotation
@ "@"
identifier "Nullable"
type_identifier "JSDocInfo"
identifier "info"
) ")"
block
{ "{"
expression_statement
assignment_expression
identifier "returnType"
= "="
ternary_expression
binary_expression
binary_expression
identifier "info"
!= "!="
null_literal "null"
&& "&&"
method_invocation
identifier "info"
. "."
identifier "hasReturnType"
argument_list
( "("
) ")"
? "?"
method_invocation
method_invocation
identifier "info"
. "."
identifier "getReturnType"
argument_list
( "("
) ")"
. "."
identifier "evaluate"
argument_list
( "("
identifier "scope"
, ","
identifier "typeRegistry"
) ")"
: ":"
null_literal "null"
; ";"
if_statement
if "if"
parenthesized_expression
( "("
binary_expression any 2:3
binary_expression any 2:3
binary_expression any 2:3
identifier "templateTypeName"
!= "!="
null_literal "null"
&& "&&"
binary_expression
identifier "returnType"
!= "!="
null_literal "null"
&& "&&"
method_invocation
method_invocation
identifier "returnType"
. "."
identifier "restrictByNotNullOrUndefined"
argument_list
( "("
) ")"
. "."
identifier "isTemplateType"
argument_list
( "("
) ")"
) ")"
block
{ "{"
expression_statement
method_invocation
identifier "reportError"
argument_list
( "("
identifier "TEMPLATE_TYPE_EXPECTED"
, ","
identifier "fnName"
) ")"
; ";"
} "}"
return_statement
return "return"
this "this"
; ";"
} "}"
block_comment "/**\n * If we haven't found a return value yet, try to look"...
method_declaration
type_identifier "FunctionTypeBuilder"
identifier "inferReturnStatements"
formal_parameters
( "("
formal_parameter
modifiers
marker_annotation
@ "@"
identifier "Nullable"
type_identifier "Node"
identifier "functionBlock"
) ")"
block
{ "{"
if_statement
if "if"
parenthesized_expression
( "("
binary_expression
binary_expression
identifier "functionBlock"
== "=="
null_literal "null"
|| "||"
method_invocation
method_invocation
identifier "compiler"
. "."
identifier "getInput"
argument_list
( "("
identifier "sourceName"
) ")"
. "."
identifier "isExtern"
argument_list
( "("
) ")"
) ")"
block
{ "{"
return_statement
return "return"
this "this"
; ";"
} "}"
expression_statement
method_invocation
identifier "Preconditions"
. "."
identifier "checkArgument"
argument_list
( "("
binary_expression
method_invocation
identifier "functionBlock"
. "."
identifier "getType"
argument_list
( "("
) ")"
== "=="
field_access
identifier "Token"
. "."
identifier "BLOCK"
) ")"
; ";"
if_statement
if "if"
parenthesized_expression
( "("
binary_expression
identifier "returnType"
== "=="
null_literal "null"
) ")"
block
{ "{"
local_variable_declaration
boolean_type "boolean"
variable_declarator
identifier "hasNonEmptyReturns"
= "="
false "false"
; ";"
local_variable_declaration
generic_type
type_identifier "List"
type_arguments
< "<"
type_identifier "Node"
> ">"
variable_declarator
identifier "worklist"
= "="
method_invocation
identifier "Lists"
. "."
identifier "newArrayList"
argument_list
( "("
identifier "functionBlock"
) ")"
; ";"
while_statement
while "while"
parenthesized_expression
( "("
unary_expression
! "!"
method_invocation
identifier "worklist"
. "."
identifier "isEmpty"
argument_list
( "("
) ")"
) ")"
block
{ "{"
local_variable_declaration
type_identifier "Node"
variable_declarator
identifier "current"
= "="
method_invocation
identifier "worklist"
. "."
identifier "remove"
argument_list
( "("
binary_expression
method_invocation
identifier "worklist"
. "."
identifier "size"
argument_list
( "("
) ")"
- "-"
decimal_integer_literal "1"
) ")"
; ";"
local_variable_declaration
integral_type
int "int"
variable_declarator
identifier "cType"
= "="
method_invocation
identifier "current"
. "."
identifier "getType"
argument_list
( "("
) ")"
; ";"
if_statement
if "if"
parenthesized_expression
( "("
binary_expression
binary_expression
binary_expression
identifier "cType"
== "=="
field_access
identifier "Token"
. "."
identifier "RETURN"
&& "&&"
binary_expression
method_invocation
identifier "current"
. "."
identifier "getFirstChild"
argument_list
( "("
) ")"
!= "!="
null_literal "null"
|| "||"
binary_expression
identifier "cType"
== "=="
field_access
identifier "Token"
. "."
identifier "THROW"
) ")"
block
{ "{"
expression_statement
assignment_expression
identifier "hasNonEmptyReturns"
= "="
true "true"
; ";"
break_statement
break "break"
; ";"
} "}"
else "else"
if_statement
if "if"
parenthesized_expression
( "("
binary_expression
method_invocation
identifier "NodeUtil"
. "."
identifier "isStatementBlock"
argument_list
( "("
identifier "current"
) ")"
|| "||"
method_invocation
identifier "NodeUtil"
. "."
identifier "isControlStructure"
argument_list
( "("
identifier "current"
) ")"
) ")"
block
{ "{"
for_statement
for "for"
( "("
local_variable_declaration
type_identifier "Node"
variable_declarator
identifier "child"
= "="
method_invocation
identifier "current"
. "."
identifier "getFirstChild"
argument_list
( "("
) ")"
; ";"
binary_expression
identifier "child"
!= "!="
null_literal "null"
; ";"
assignment_expression
identifier "child"
= "="
method_invocation
identifier "child"
. "."
identifier "getNext"
argument_list
( "("
) ")"
) ")"
block
{ "{"
expression_statement
method_invocation
identifier "worklist"
. "."
identifier "add"
argument_list
( "("
identifier "child"
) ")"
; ";"
} "}"
} "}"
} "}"
if_statement
if "if"
parenthesized_expression
( "("
unary_expression
! "!"
identifier "hasNonEmptyReturns"
) ")"
block
{ "{"
expression_statement
assignment_expression
identifier "returnType"
= "="
method_invocation
identifier "typeRegistry"
. "."
identifier "getNativeType"
argument_list
( "("
identifier "VOID_TYPE"
) ")"
; ";"
expression_statement
assignment_expression
identifier "returnTypeInferred"
= "="
true "true"
; ";"
} "}"
} "}"
return_statement
return "return"
this "this"
; ";"
} "}"
block_comment "/**\n * Infer the role of the function (whether it's a cons"...
method_declaration (+354 nodes collapsed)
block_comment "/**\n * Infers the type of {@code this}.\n * @param type T"...
method_declaration (+72 nodes collapsed)
block_comment "/**\n * Infers the type of {@code this}.\n * @param info T"...
method_declaration (+215 nodes collapsed)
block_comment "/**\n * Infer the parameter types from the doc info alone.\n"...
method_declaration (+79 nodes collapsed)
block_comment "/**\n * Infer the parameter types from the list of argument"...
method_declaration (+379 nodes collapsed)
block_comment "/**\n * @return Whether the given param is an optional para"...
method_declaration (+88 nodes collapsed)
block_comment "/**\n * Determine whether this is a var args parameter.\n "...
method_declaration (+88 nodes collapsed)
block_comment "/**\n * Infer the template type from the doc info.\n */"
method_declaration (+54 nodes collapsed)
block_comment "/**\n * Add a parameter to the param list.\n * @param buil"...
method_declaration (+207 nodes collapsed)
block_comment "/**\n * Builds the function type, and puts it in the regist"...
method_declaration
type_identifier "FunctionType"
identifier "buildAndRegister"
formal_parameters
( "("
) ")"
block
{ "{"
if_statement (+25 nodes collapsed)
if_statement (+25 nodes collapsed)
local_variable_declaration
type_identifier "FunctionType"
variable_declarator
identifier "fnType"
; ";"
if_statement
if "if"
parenthesized_expression
( "("
identifier "isConstructor"
) ")"
block
{ "{"
expression_statement
assignment_expression
identifier "fnType"
= "="
method_invocation
identifier "getOrCreateConstructor"
argument_list
( "("
) ")"
; ";"
} "}"
else "else"
if_statement
if "if"
parenthesized_expression
( "("
identifier "isInterface"
) ")"
block (+70 nodes collapsed)
else "else"
block
{ "{"
expression_statement
assignment_expression
identifier "fnType"
= "="
method_invocation
method_invocation
method_invocation
method_invocation
method_invocation (+28 nodes collapsed)
. "."
identifier "withReturnType"
argument_list
( "("
identifier "returnType"
, ","
identifier "returnTypeInferred"
) ")"
. "."
identifier "withTypeOfThis"
argument_list
( "("
identifier "thisType"
) ")"
. "."
identifier "withTemplateName"
argument_list
( "("
identifier "templateTypeName"
) ")"
. "."
identifier "build"
argument_list
( "("
) ")"
; ";"
expression_statement
method_invocation
identifier "maybeSetBaseType"
argument_list
( "("
identifier "fnType"
) ")"
; ";"
} "}"
if_statement (+22 nodes collapsed)
expression_statement
method_invocation
identifier "typeRegistry"
. "."
identifier "clearTemplateTypeName"
argument_list
( "("
) ")"
; ";"
return_statement
return "return"
identifier "fnType"
; ";"
} "}"
method_declaration (+36 nodes collapsed)
block_comment "/**\n * Returns a constructor function either by returning "...
method_declaration (+260 nodes collapsed)
method_declaration (+43 nodes collapsed)
method_declaration (+43 nodes collapsed)
block_comment "/**\n * Determines whether the given jsdoc info declares a "...
method_declaration (+63 nodes collapsed)
} "}"