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–1654 unchanged (1654 lines)
1655 */
1656 private void visitNew(NodeTraversal t, Node n) {
1657 Node constructor = n.getFirstChild();
1658 JSType type = getJSType(constructor).restrictByNotNullOrUndefined();
1659 if (type.isConstructor() || type.isEmptyType() || type.isUnknownType()) {
1660 FunctionType fnType = type.toMaybeFunctionType();
1661 if (fnType != null) {
1662 visitParameterList(t, n, fnType);
1663 ensureTyped(t, n, fnType.getInstanceType());
1664 } else {
1665 ensureTyped(t, n);
1666 }
1667 } else {
…lines 1668–2120 unchanged (453 lines)

After

…lines 1–1654 unchanged (1654 lines)
1655 */
1656 private void visitNew(NodeTraversal t, Node n) {
1657 Node constructor = n.getFirstChild();
1658 JSType type = getJSType(constructor).restrictByNotNullOrUndefined();
1659 if (type.isConstructor() || type.isEmptyType() || type.isUnknownType()) {
1660 FunctionType fnType = type.toMaybeFunctionType();
1661 if (fnType != null && fnType.hasInstanceType()) {
1662 visitParameterList(t, n, fnType);
1663 ensureTyped(t, n, fnType.getInstanceType());
1664 } else {
1665 ensureTyped(t, n);
1666 }
1667 } else {
…lines 1668–2120 unchanged (453 lines)

Before

program
block_comment "/*\n * Copyright 2006 The Closure Compiler Authors.\n *\n * Lic"...
package_declaration
package "package"
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "jscomp"
; ";"
import_declaration (+23 nodes collapsed)
import_declaration (+23 nodes collapsed)
import_declaration (+23 nodes collapsed)
import_declaration (+23 nodes collapsed)
import_declaration (+23 nodes collapsed)
import_declaration (+23 nodes collapsed)
import_declaration (+23 nodes collapsed)
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 "ImmutableSet"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "jscomp"
. "."
identifier "Scope"
. "."
identifier "Var"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "jscomp"
. "."
identifier "type"
. "."
identifier "ReverseAbstractInterpreter"
; ";"
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 "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 "EnumType"
; ";"
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 "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 "JSTypeNative"
; ";"
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
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "rhino"
. "."
identifier "jstype"
. "."
identifier "TemplateTypeMap"
; ";"
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 "TemplateTypeMapReplacer"
; ";"
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 "TernaryValue"
; ";"
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 "UnionType"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "lang"
. "."
identifier "reflect"
. "."
identifier "Method"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "HashMap"
; ";"
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 "Set"
; ";"
block_comment "/**\n * <p>Checks the types of JS expressions against any dec"...
class_declaration
modifiers
public "public"
class "class"
identifier "TypeCheck"
super_interfaces
implements "implements"
type_list
scoped_type_identifier
type_identifier "NodeTraversal"
. "."
type_identifier "Callback"
, ","
type_identifier "CompilerPass"
class_body
{ "{"
line_comment "//"
line_comment "// Internal errors"
line_comment "//"
field_declaration (+25 nodes collapsed)
line_comment "//"
line_comment "// User warnings"
line_comment "//"
field_declaration
modifiers
protected "protected"
static "static"
final "final"
type_identifier "String"
variable_declarator
identifier "OVERRIDING_PROTOTYPE_WITH_NON_OBJECT"
= "="
string_literal
" "\""
string_fragment "overriding prototype with non-object"
" "\""
; ";"
line_comment "// TODO(user): make all the non private messages private onc"...
line_comment "// TypedScopeCreator has been merged with the type checker."
field_declaration (+39 nodes collapsed)
field_declaration (+25 nodes collapsed)
line_comment "// disabled by default. This one only makes sense if you're "...
line_comment "// well-typed externs."
field_declaration (+25 nodes collapsed)
field_declaration (+25 nodes collapsed)
field_declaration (+26 nodes collapsed)
field_declaration (+25 nodes collapsed)
field_declaration (+25 nodes collapsed)
field_declaration (+29 nodes collapsed)
field_declaration (+25 nodes collapsed)
field_declaration (+25 nodes collapsed)
field_declaration (+25 nodes collapsed)
field_declaration (+25 nodes collapsed)
field_declaration (+31 nodes collapsed)
field_declaration (+25 nodes collapsed)
field_declaration (+25 nodes collapsed)
field_declaration (+25 nodes collapsed)
field_declaration (+31 nodes collapsed)
field_declaration (+25 nodes collapsed)
field_declaration (+31 nodes collapsed)
field_declaration (+31 nodes collapsed)
field_declaration (+45 nodes collapsed)
field_declaration (+25 nodes collapsed)
field_declaration (+25 nodes collapsed)
field_declaration (+25 nodes collapsed)
field_declaration (+25 nodes collapsed)
field_declaration (+31 nodes collapsed)
field_declaration (+31 nodes collapsed)
field_declaration (+31 nodes collapsed)
field_declaration (+32 nodes collapsed)
field_declaration (+25 nodes collapsed)
field_declaration (+31 nodes collapsed)
field_declaration (+25 nodes collapsed)
line_comment "// If a diagnostic is disabled by default, do not add it in "...
line_comment "// TODO(user): Either INEXISTENT_PROPERTY shouldn't be here,"...
line_comment "// change DiagnosticGroups.setWarningLevel to not accidental"...
field_declaration (+104 nodes collapsed)
field_declaration
modifiers
private "private"
final "final"
type_identifier "AbstractCompiler"
variable_declarator
identifier "compiler"
; ";"
field_declaration
modifiers
private "private"
final "final"
type_identifier "TypeValidator"
variable_declarator
identifier "validator"
; ";"
field_declaration
modifiers
private "private"
final "final"
type_identifier "ReverseAbstractInterpreter"
variable_declarator
identifier "reverseInterpreter"
; ";"
field_declaration
modifiers
private "private"
final "final"
type_identifier "JSTypeRegistry"
variable_declarator
identifier "typeRegistry"
; ";"
field_declaration
modifiers
private "private"
type_identifier "Scope"
variable_declarator
identifier "topScope"
; ";"
field_declaration
modifiers
private "private"
type_identifier "MemoizedScopeCreator"
variable_declarator
identifier "scopeCreator"
; ";"
field_declaration
modifiers
private "private"
final "final"
type_identifier "CheckLevel"
variable_declarator
identifier "reportMissingOverride"
; ";"
field_declaration
modifiers
private "private"
final "final"
boolean_type "boolean"
variable_declarator
identifier "reportUnknownTypes"
; ";"
line_comment "// This may be expensive, so don't emit these warnings if th"...
line_comment "// explicitly turned off."
field_declaration
modifiers
private "private"
boolean_type "boolean"
variable_declarator
identifier "reportMissingProperties"
= "="
true "true"
; ";"
field_declaration
modifiers
private "private"
type_identifier "InferJSDocInfo"
variable_declarator
identifier "inferJSDocInfo"
= "="
null_literal "null"
; ";"
line_comment "// These fields are used to calculate the percentage of expr"...
field_declaration
modifiers
private "private"
integral_type
int "int"
variable_declarator
identifier "typedCount"
= "="
decimal_integer_literal "0"
; ";"
field_declaration
modifiers
private "private"
integral_type
int "int"
variable_declarator
identifier "nullCount"
= "="
decimal_integer_literal "0"
; ";"
field_declaration
modifiers
private "private"
integral_type
int "int"
variable_declarator
identifier "unknownCount"
= "="
decimal_integer_literal "0"
; ";"
field_declaration
modifiers
private "private"
boolean_type "boolean"
variable_declarator
identifier "inExterns"
; ";"
line_comment "// A state boolean to see we are currently in @notypecheck s"...
line_comment "// code."
field_declaration
modifiers
private "private"
integral_type
int "int"
variable_declarator
identifier "noTypeCheckSection"
= "="
decimal_integer_literal "0"
; ";"
field_declaration
modifiers
private "private"
type_identifier "Method"
variable_declarator
identifier "editDistance"
; ";"
class_declaration (+62 nodes collapsed)
constructor_declaration (+241 nodes collapsed)
constructor_declaration (+42 nodes collapsed)
constructor_declaration (+39 nodes collapsed)
block_comment "/** Turn on the missing property check. Returns this for eas"...
method_declaration (+22 nodes collapsed)
block_comment "/**\n * Main entry point for this phase of processing. This"...
method_declaration (+122 nodes collapsed)
block_comment "/** Main entry point of this phase for testing code. */"
method_declaration (+154 nodes collapsed)
method_declaration (+100 nodes collapsed)
method_declaration (+146 nodes collapsed)
method_declaration (+54 nodes collapsed)
method_declaration (+182 nodes collapsed)
block_comment "/**\n * This is the meat of the type checking. It is basic"...
method_declaration (+2847 nodes collapsed)
method_declaration (+138 nodes collapsed)
block_comment "/**\n * Counts the given node in the typed statistics.\n *"...
method_declaration (+106 nodes collapsed)
block_comment "/**\n * Visits an assignment <code>lvalue = rvalue</code>. "...
method_declaration (+834 nodes collapsed)
block_comment "/**\n * After a struct object is created, we can't add new "...
method_declaration (+356 nodes collapsed)
method_declaration (+194 nodes collapsed)
block_comment "/**\n * Visits an object literal field definition <code>key"...
method_declaration (+462 nodes collapsed)
block_comment "/**\n * Returns true if any type in the chain has an implic"...
method_declaration (+85 nodes collapsed)
block_comment "/**\n * Given a constructor type and a property name, check"...
method_declaration (+903 nodes collapsed)
block_comment "/**\n * Given a constructor or an interface type, find out "...
method_declaration (+185 nodes collapsed)
block_comment "/**\n * Visits an ASSIGN node for cases such as\n * <pre>\n"...
method_declaration (+201 nodes collapsed)
block_comment "/**\n * Visits a NAME node.\n *\n * @param t The node tra"...
method_declaration (+208 nodes collapsed)
block_comment "/**\n * Visits a GETPROP node.\n *\n * @param t The node "...
method_declaration (+167 nodes collapsed)
block_comment "/**\n * Emit a warning if we can prove that a property cann"...
method_declaration (+203 nodes collapsed)
method_declaration (+203 nodes collapsed)
method_declaration (+384 nodes collapsed)
block_comment "/**\n * Determines whether this node is testing for the exi"...
method_declaration (+237 nodes collapsed)
block_comment "/**\n * Visits a GETELEM node.\n *\n * @param t The node "...
method_declaration (+66 nodes collapsed)
block_comment "/**\n * Visits a VAR node.\n *\n * @param t The node trav"...
method_declaration (+256 nodes collapsed)
block_comment "/**\n * Visits a NEW node.\n */"
method_declaration
modifiers
private "private"
void_type "void"
identifier "visitNew"
formal_parameters
( "("
formal_parameter
type_identifier "NodeTraversal"
identifier "t"
, ","
formal_parameter
type_identifier "Node"
identifier "n"
) ")"
block
{ "{"
local_variable_declaration
type_identifier "Node"
variable_declarator
identifier "constructor"
= "="
method_invocation
identifier "n"
. "."
identifier "getFirstChild"
argument_list
( "("
) ")"
; ";"
local_variable_declaration
type_identifier "JSType"
variable_declarator
identifier "type"
= "="
method_invocation
method_invocation
identifier "getJSType"
argument_list
( "("
identifier "constructor"
) ")"
. "."
identifier "restrictByNotNullOrUndefined"
argument_list
( "("
) ")"
; ";"
if_statement
if "if"
parenthesized_expression (+28 nodes collapsed)
block
{ "{"
local_variable_declaration
type_identifier "FunctionType"
variable_declarator
identifier "fnType"
= "="
method_invocation
identifier "type"
. "."
identifier "toMaybeFunctionType"
argument_list
( "("
) ")"
; ";"
if_statement
if "if"
parenthesized_expression
( "("
binary_expression
identifier "fnType"
!= "!="
null_literal "null"
) ")"
block (+33 nodes collapsed)
else "else"
block
{ "{"
expression_statement
method_invocation
identifier "ensureTyped"
argument_list
( "("
identifier "t"
, ","
identifier "n"
) ")"
; ";"
} "}"
} "}"
else "else"
block (+25 nodes collapsed)
} "}"
block_comment "/**\n * Check whether there's any property conflict for for"...
method_declaration (+268 nodes collapsed)
block_comment "/**\n * Visits a {@link Token#FUNCTION} node.\n *\n * @pa"...
method_declaration (+644 nodes collapsed)
block_comment "/**\n * Visits a CALL node.\n *\n * @param t The node tra"...
method_declaration (+446 nodes collapsed)
block_comment "/**\n * Visits the parameters of a CALL or a NEW node.\n *"...
method_declaration (+357 nodes collapsed)
block_comment "/**\n * Visits a RETURN node.\n *\n * @param t The node t"...
method_declaration (+187 nodes collapsed)
block_comment "/**\n * This function unifies the type checking involved in"...
method_declaration (+485 nodes collapsed)
block_comment "/**\n * <p>Checks enum aliases.\n *\n * <p>We verify that"...
method_declaration (+154 nodes collapsed)
block_comment "/**\n * This method gets the JSType from the Node argument "...
method_declaration (+60 nodes collapsed)
line_comment "// TODO(nicksantos): TypeCheck should never be attaching typ"...
line_comment "// All types should be attached by TypeInference. This is no"...
line_comment "// for legacy reasons. There are a number of places where Ty"...
line_comment "// doesn't attach a type, as a signal to TypeCheck that it n"...
line_comment "// that node's type."
block_comment "/**\n * Ensure that the given node has a type. If it does n"...
method_declaration (+35 nodes collapsed)
method_declaration (+39 nodes collapsed)
block_comment "/**\n * Enforces type casts, and ensures the node is typed."...
method_declaration (+187 nodes collapsed)
block_comment "/**\n * Returns the percentage of nodes typed by the type c"...
method_declaration (+48 nodes collapsed)
method_declaration (+25 nodes collapsed)
} "}"

After

program
block_comment "/*\n * Copyright 2006 The Closure Compiler Authors.\n *\n * Lic"...
package_declaration
package "package"
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "jscomp"
; ";"
import_declaration (+23 nodes collapsed)
import_declaration (+23 nodes collapsed)
import_declaration (+23 nodes collapsed)
import_declaration (+23 nodes collapsed)
import_declaration (+23 nodes collapsed)
import_declaration (+23 nodes collapsed)
import_declaration (+23 nodes collapsed)
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 "ImmutableSet"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "jscomp"
. "."
identifier "Scope"
. "."
identifier "Var"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "jscomp"
. "."
identifier "type"
. "."
identifier "ReverseAbstractInterpreter"
; ";"
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 "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 "EnumType"
; ";"
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 "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 "JSTypeNative"
; ";"
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
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "rhino"
. "."
identifier "jstype"
. "."
identifier "TemplateTypeMap"
; ";"
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 "TemplateTypeMapReplacer"
; ";"
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 "TernaryValue"
; ";"
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 "UnionType"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "lang"
. "."
identifier "reflect"
. "."
identifier "Method"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "HashMap"
; ";"
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 "Set"
; ";"
block_comment "/**\n * <p>Checks the types of JS expressions against any dec"...
class_declaration
modifiers
public "public"
class "class"
identifier "TypeCheck"
super_interfaces
implements "implements"
type_list
scoped_type_identifier
type_identifier "NodeTraversal"
. "."
type_identifier "Callback"
, ","
type_identifier "CompilerPass"
class_body
{ "{"
line_comment "//"
line_comment "// Internal errors"
line_comment "//"
field_declaration (+25 nodes collapsed)
line_comment "//"
line_comment "// User warnings"
line_comment "//"
field_declaration
modifiers
protected "protected"
static "static"
final "final"
type_identifier "String"
variable_declarator
identifier "OVERRIDING_PROTOTYPE_WITH_NON_OBJECT"
= "="
string_literal
" "\""
string_fragment "overriding prototype with non-object"
" "\""
; ";"
line_comment "// TODO(user): make all the non private messages private onc"...
line_comment "// TypedScopeCreator has been merged with the type checker."
field_declaration (+39 nodes collapsed)
field_declaration (+25 nodes collapsed)
line_comment "// disabled by default. This one only makes sense if you're "...
line_comment "// well-typed externs."
field_declaration (+25 nodes collapsed)
field_declaration (+25 nodes collapsed)
field_declaration (+26 nodes collapsed)
field_declaration (+25 nodes collapsed)
field_declaration (+25 nodes collapsed)
field_declaration (+29 nodes collapsed)
field_declaration (+25 nodes collapsed)
field_declaration (+25 nodes collapsed)
field_declaration (+25 nodes collapsed)
field_declaration (+25 nodes collapsed)
field_declaration (+31 nodes collapsed)
field_declaration (+25 nodes collapsed)
field_declaration (+25 nodes collapsed)
field_declaration (+25 nodes collapsed)
field_declaration (+31 nodes collapsed)
field_declaration (+25 nodes collapsed)
field_declaration (+31 nodes collapsed)
field_declaration (+31 nodes collapsed)
field_declaration (+45 nodes collapsed)
field_declaration (+25 nodes collapsed)
field_declaration (+25 nodes collapsed)
field_declaration (+25 nodes collapsed)
field_declaration (+25 nodes collapsed)
field_declaration (+31 nodes collapsed)
field_declaration (+31 nodes collapsed)
field_declaration (+31 nodes collapsed)
field_declaration (+32 nodes collapsed)
field_declaration (+25 nodes collapsed)
field_declaration (+31 nodes collapsed)
field_declaration (+25 nodes collapsed)
line_comment "// If a diagnostic is disabled by default, do not add it in "...
line_comment "// TODO(user): Either INEXISTENT_PROPERTY shouldn't be here,"...
line_comment "// change DiagnosticGroups.setWarningLevel to not accidental"...
field_declaration (+104 nodes collapsed)
field_declaration
modifiers
private "private"
final "final"
type_identifier "AbstractCompiler"
variable_declarator
identifier "compiler"
; ";"
field_declaration
modifiers
private "private"
final "final"
type_identifier "TypeValidator"
variable_declarator
identifier "validator"
; ";"
field_declaration
modifiers
private "private"
final "final"
type_identifier "ReverseAbstractInterpreter"
variable_declarator
identifier "reverseInterpreter"
; ";"
field_declaration
modifiers
private "private"
final "final"
type_identifier "JSTypeRegistry"
variable_declarator
identifier "typeRegistry"
; ";"
field_declaration
modifiers
private "private"
type_identifier "Scope"
variable_declarator
identifier "topScope"
; ";"
field_declaration
modifiers
private "private"
type_identifier "MemoizedScopeCreator"
variable_declarator
identifier "scopeCreator"
; ";"
field_declaration
modifiers
private "private"
final "final"
type_identifier "CheckLevel"
variable_declarator
identifier "reportMissingOverride"
; ";"
field_declaration
modifiers
private "private"
final "final"
boolean_type "boolean"
variable_declarator
identifier "reportUnknownTypes"
; ";"
line_comment "// This may be expensive, so don't emit these warnings if th"...
line_comment "// explicitly turned off."
field_declaration
modifiers
private "private"
boolean_type "boolean"
variable_declarator
identifier "reportMissingProperties"
= "="
true "true"
; ";"
field_declaration
modifiers
private "private"
type_identifier "InferJSDocInfo"
variable_declarator
identifier "inferJSDocInfo"
= "="
null_literal "null"
; ";"
line_comment "// These fields are used to calculate the percentage of expr"...
field_declaration
modifiers
private "private"
integral_type
int "int"
variable_declarator
identifier "typedCount"
= "="
decimal_integer_literal "0"
; ";"
field_declaration
modifiers
private "private"
integral_type
int "int"
variable_declarator
identifier "nullCount"
= "="
decimal_integer_literal "0"
; ";"
field_declaration
modifiers
private "private"
integral_type
int "int"
variable_declarator
identifier "unknownCount"
= "="
decimal_integer_literal "0"
; ";"
field_declaration
modifiers
private "private"
boolean_type "boolean"
variable_declarator
identifier "inExterns"
; ";"
line_comment "// A state boolean to see we are currently in @notypecheck s"...
line_comment "// code."
field_declaration
modifiers
private "private"
integral_type
int "int"
variable_declarator
identifier "noTypeCheckSection"
= "="
decimal_integer_literal "0"
; ";"
field_declaration
modifiers
private "private"
type_identifier "Method"
variable_declarator
identifier "editDistance"
; ";"
class_declaration (+62 nodes collapsed)
constructor_declaration (+241 nodes collapsed)
constructor_declaration (+42 nodes collapsed)
constructor_declaration (+39 nodes collapsed)
block_comment "/** Turn on the missing property check. Returns this for eas"...
method_declaration (+22 nodes collapsed)
block_comment "/**\n * Main entry point for this phase of processing. This"...
method_declaration (+122 nodes collapsed)
block_comment "/** Main entry point of this phase for testing code. */"
method_declaration (+154 nodes collapsed)
method_declaration (+100 nodes collapsed)
method_declaration (+146 nodes collapsed)
method_declaration (+54 nodes collapsed)
method_declaration (+182 nodes collapsed)
block_comment "/**\n * This is the meat of the type checking. It is basic"...
method_declaration (+2847 nodes collapsed)
method_declaration (+138 nodes collapsed)
block_comment "/**\n * Counts the given node in the typed statistics.\n *"...
method_declaration (+106 nodes collapsed)
block_comment "/**\n * Visits an assignment <code>lvalue = rvalue</code>. "...
method_declaration (+834 nodes collapsed)
block_comment "/**\n * After a struct object is created, we can't add new "...
method_declaration (+356 nodes collapsed)
method_declaration (+194 nodes collapsed)
block_comment "/**\n * Visits an object literal field definition <code>key"...
method_declaration (+462 nodes collapsed)
block_comment "/**\n * Returns true if any type in the chain has an implic"...
method_declaration (+85 nodes collapsed)
block_comment "/**\n * Given a constructor type and a property name, check"...
method_declaration (+903 nodes collapsed)
block_comment "/**\n * Given a constructor or an interface type, find out "...
method_declaration (+185 nodes collapsed)
block_comment "/**\n * Visits an ASSIGN node for cases such as\n * <pre>\n"...
method_declaration (+201 nodes collapsed)
block_comment "/**\n * Visits a NAME node.\n *\n * @param t The node tra"...
method_declaration (+208 nodes collapsed)
block_comment "/**\n * Visits a GETPROP node.\n *\n * @param t The node "...
method_declaration (+167 nodes collapsed)
block_comment "/**\n * Emit a warning if we can prove that a property cann"...
method_declaration (+203 nodes collapsed)
method_declaration (+203 nodes collapsed)
method_declaration (+384 nodes collapsed)
block_comment "/**\n * Determines whether this node is testing for the exi"...
method_declaration (+237 nodes collapsed)
block_comment "/**\n * Visits a GETELEM node.\n *\n * @param t The node "...
method_declaration (+66 nodes collapsed)
block_comment "/**\n * Visits a VAR node.\n *\n * @param t The node trav"...
method_declaration (+256 nodes collapsed)
block_comment "/**\n * Visits a NEW node.\n */"
method_declaration
modifiers
private "private"
void_type "void"
identifier "visitNew"
formal_parameters
( "("
formal_parameter
type_identifier "NodeTraversal"
identifier "t"
, ","
formal_parameter
type_identifier "Node"
identifier "n"
) ")"
block
{ "{"
local_variable_declaration
type_identifier "Node"
variable_declarator
identifier "constructor"
= "="
method_invocation
identifier "n"
. "."
identifier "getFirstChild"
argument_list
( "("
) ")"
; ";"
local_variable_declaration
type_identifier "JSType"
variable_declarator
identifier "type"
= "="
method_invocation
method_invocation
identifier "getJSType"
argument_list
( "("
identifier "constructor"
) ")"
. "."
identifier "restrictByNotNullOrUndefined"
argument_list
( "("
) ")"
; ";"
if_statement
if "if"
parenthesized_expression (+28 nodes collapsed)
block
{ "{"
local_variable_declaration
type_identifier "FunctionType"
variable_declarator
identifier "fnType"
= "="
method_invocation
identifier "type"
. "."
identifier "toMaybeFunctionType"
argument_list
( "("
) ")"
; ";"
if_statement
if "if"
parenthesized_expression
( "("
binary_expression
binary_expression
identifier "fnType"
!= "!="
null_literal "null"
&& "&&"
method_invocation
identifier "fnType"
. "."
identifier "hasInstanceType"
argument_list
( "("
) ")"
) ")"
block (+33 nodes collapsed)
else "else"
block
{ "{"
expression_statement
method_invocation
identifier "ensureTyped"
argument_list
( "("
identifier "t"
, ","
identifier "n"
) ")"
; ";"
} "}"
} "}"
else "else"
block (+25 nodes collapsed)
} "}"
block_comment "/**\n * Check whether there's any property conflict for for"...
method_declaration (+268 nodes collapsed)
block_comment "/**\n * Visits a {@link Token#FUNCTION} node.\n *\n * @pa"...
method_declaration (+644 nodes collapsed)
block_comment "/**\n * Visits a CALL node.\n *\n * @param t The node tra"...
method_declaration (+446 nodes collapsed)
block_comment "/**\n * Visits the parameters of a CALL or a NEW node.\n *"...
method_declaration (+357 nodes collapsed)
block_comment "/**\n * Visits a RETURN node.\n *\n * @param t The node t"...
method_declaration (+187 nodes collapsed)
block_comment "/**\n * This function unifies the type checking involved in"...
method_declaration (+485 nodes collapsed)
block_comment "/**\n * <p>Checks enum aliases.\n *\n * <p>We verify that"...
method_declaration (+154 nodes collapsed)
block_comment "/**\n * This method gets the JSType from the Node argument "...
method_declaration (+60 nodes collapsed)
line_comment "// TODO(nicksantos): TypeCheck should never be attaching typ"...
line_comment "// All types should be attached by TypeInference. This is no"...
line_comment "// for legacy reasons. There are a number of places where Ty"...
line_comment "// doesn't attach a type, as a signal to TypeCheck that it n"...
line_comment "// that node's type."
block_comment "/**\n * Ensure that the given node has a type. If it does n"...
method_declaration (+35 nodes collapsed)
method_declaration (+39 nodes collapsed)
block_comment "/**\n * Enforces type casts, and ensures the node is typed."...
method_declaration (+187 nodes collapsed)
block_comment "/**\n * Returns the percentage of nodes typed by the type c"...
method_declaration (+48 nodes collapsed)
method_declaration (+25 nodes collapsed)
} "}"