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–178 unchanged (178 lines)
179 DiagnosticType.warning("JSC_HIDDEN_SUPERCLASS_PROPERTY_MISMATCH",
180 "mismatch of the {0} property type and the type " +
181 "of the property it overrides from superclass {1}\n" +
182 "original: {2}\n" +
183 "override: {3}");
184
185 static final DiagnosticType HIDDEN_INTERFACE_PROPERTY_MISMATCH =
186 DiagnosticType.warning(
187 "JSC_HIDDEN_INTERFACE_PROPERTY_MISMATCH",
188 "mismatch of the {0} property type and the type " +
189 "of the property it overrides from interface {1}\n" +
190 "original: {2}\n" +
191 "override: {3}");
192 static final DiagnosticType UNKNOWN_OVERRIDE =
193 DiagnosticType.warning(
194 "JSC_UNKNOWN_OVERRIDE",
195 "property {0} not defined on any superclass of {1}");
196
197 static final DiagnosticType INTERFACE_METHOD_OVERRIDE =
…lines 198–235 unchanged (38 lines)
236 INTERFACE_FUNCTION_NOT_EMPTY,
237 CONFLICTING_EXTENDED_TYPE,
238 BAD_IMPLEMENTED_TYPE,
239 HIDDEN_SUPERCLASS_PROPERTY,
240 HIDDEN_INTERFACE_PROPERTY,
241 HIDDEN_SUPERCLASS_PROPERTY_MISMATCH,
242 HIDDEN_INTERFACE_PROPERTY_MISMATCH,
243 UNKNOWN_OVERRIDE,
244 INTERFACE_METHOD_OVERRIDE,
245 UNKNOWN_EXPR_TYPE,
246 UNRESOLVED_TYPE,
247 WRONG_ARGUMENT_COUNT,
248 ILLEGAL_IMPLICIT_CAST,
…lines 249–1042 unchanged (794 lines)
1043 // @override not present, but the property does override an interface
1044 // property
1045 compiler.report(t.makeError(n, reportMissingOverride,
1046 HIDDEN_INTERFACE_PROPERTY, propertyName,
1047 interfaceType.getTopMostDefiningType(propertyName).toString()));
1048 }
1049 if (interfaceHasProperty) {
1050 JSType interfacePropType =
1051 interfaceType.getPrototype().getPropertyType(propertyName);
1052 if (!propertyType.canAssignTo(interfacePropType)) {
1053 compiler.report(t.makeError(n,
1054 HIDDEN_INTERFACE_PROPERTY_MISMATCH, propertyName,
1055 interfaceType.getTopMostDefiningType(propertyName).toString(),
1056 interfacePropType.toString(), propertyType.toString()));
1057 }
1058 }
1059 }
1060 }
1061
1062 if (!declaredOverride && !superClassHasProperty) {
1063 // nothing to do here, it's just a plain new property
1064 return;
…lines 1065–1811 unchanged (747 lines)

After

…lines 1–177 unchanged (177 lines)
178 static final DiagnosticType HIDDEN_SUPERCLASS_PROPERTY_MISMATCH =
179 DiagnosticType.warning("JSC_HIDDEN_SUPERCLASS_PROPERTY_MISMATCH",
180 "mismatch of the {0} property type and the type " +
181 "of the property it overrides from superclass {1}\n" +
182 "original: {2}\n" +
183 "override: {3}");
184
185 static final DiagnosticType UNKNOWN_OVERRIDE =
186 DiagnosticType.warning(
187 "JSC_UNKNOWN_OVERRIDE",
188 "property {0} not defined on any superclass of {1}");
189
190 static final DiagnosticType INTERFACE_METHOD_OVERRIDE =
…lines 191–228 unchanged (38 lines)
229 INTERFACE_FUNCTION_NOT_EMPTY,
230 CONFLICTING_EXTENDED_TYPE,
231 BAD_IMPLEMENTED_TYPE,
232 HIDDEN_SUPERCLASS_PROPERTY,
233 HIDDEN_INTERFACE_PROPERTY,
234 HIDDEN_SUPERCLASS_PROPERTY_MISMATCH,
235 UNKNOWN_OVERRIDE,
236 INTERFACE_METHOD_OVERRIDE,
237 UNKNOWN_EXPR_TYPE,
238 UNRESOLVED_TYPE,
239 WRONG_ARGUMENT_COUNT,
240 ILLEGAL_IMPLICIT_CAST,
241 TypedScopeCreator.UNKNOWN_LENDS,
…lines 242–1034 unchanged (793 lines)
1035 // @override not present, but the property does override an interface
1036 // property
1037 compiler.report(t.makeError(n, reportMissingOverride,
1038 HIDDEN_INTERFACE_PROPERTY, propertyName,
1039 interfaceType.getTopMostDefiningType(propertyName).toString()));
1040 }
1041 }
1042 }
1043
1044 if (!declaredOverride && !superClassHasProperty) {
1045 // nothing to do here, it's just a plain new property
1046 return;
1047 }
…lines 1048–1793 unchanged (746 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 (+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 "javascript"
. "."
identifier "jscomp"
. "."
identifier "CheckLevel"
; ";"
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
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 "TernaryValue"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "Iterator"
; ";"
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 errors"
line_comment "//"
field_declaration (+26 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 (+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 (+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 (+37 nodes collapsed)
field_declaration (+25 nodes collapsed)
field_declaration (+31 nodes collapsed)
field_declaration (+31 nodes collapsed)
field_declaration (+45 nodes collapsed)
field_declaration
modifiers
static "static"
final "final"
type_identifier "DiagnosticType"
variable_declarator
identifier "HIDDEN_INTERFACE_PROPERTY_MISMATCH"
= "="
method_invocation
identifier "DiagnosticType"
. "."
identifier "warning"
argument_list
( "("
string_literal
" "\""
string_fragment "JSC_HIDDEN_INTERFACE_PROPERTY_MISMATCH"
" "\""
, ","
binary_expression
binary_expression
binary_expression
string_literal
" "\""
string_fragment "mismatch of the {0} property type and the type "
" "\""
+ "+"
string_literal
" "\""
string_fragment "of the property it overrides from interface {1}"
escape_sequence "\\n"
" "\""
+ "+"
string_literal
" "\""
string_fragment "original: {2}"
escape_sequence "\\n"
" "\""
+ "+"
string_literal
" "\""
string_fragment "override: {3}"
" "\""
) ")"
; ";"
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
modifiers
static "static"
final "final"
type_identifier "DiagnosticGroup"
variable_declarator
identifier "ALL_DIAGNOSTICS"
= "="
object_creation_expression
new "new"
type_identifier "DiagnosticGroup"
argument_list
( "("
identifier "DETERMINISTIC_TEST"
, ","
identifier "DETERMINISTIC_TEST_NO_RESULT"
, ","
identifier "INEXISTENT_ENUM_ELEMENT"
, ","
identifier "INEXISTENT_PROPERTY"
, ","
identifier "NOT_A_CONSTRUCTOR"
, ","
identifier "BIT_OPERATION"
, ","
identifier "NOT_CALLABLE"
, ","
identifier "CONSTRUCTOR_NOT_CALLABLE"
, ","
identifier "FUNCTION_MASKS_VARIABLE"
, ","
identifier "MULTIPLE_VAR_DEF"
, ","
identifier "ENUM_DUP"
, ","
identifier "ENUM_NOT_CONSTANT"
, ","
identifier "INVALID_INTERFACE_MEMBER_DECLARATION"
, ","
identifier "INTERFACE_FUNCTION_NOT_EMPTY"
, ","
identifier "CONFLICTING_EXTENDED_TYPE"
, ","
identifier "BAD_IMPLEMENTED_TYPE"
, ","
identifier "HIDDEN_SUPERCLASS_PROPERTY"
, ","
identifier "HIDDEN_INTERFACE_PROPERTY"
, ","
identifier "HIDDEN_SUPERCLASS_PROPERTY_MISMATCH"
, ","
identifier "HIDDEN_INTERFACE_PROPERTY_MISMATCH"
, ","
identifier "UNKNOWN_OVERRIDE"
, ","
identifier "INTERFACE_METHOD_OVERRIDE"
, ","
identifier "UNKNOWN_EXPR_TYPE"
, ","
identifier "UNRESOLVED_TYPE"
, ","
identifier "WRONG_ARGUMENT_COUNT"
, ","
identifier "ILLEGAL_IMPLICIT_CAST"
, ","
field_access
identifier "TypedScopeCreator"
. "."
identifier "UNKNOWN_LENDS"
, ","
field_access
identifier "TypedScopeCreator"
. "."
identifier "LENDS_ON_NON_OBJECT"
, ","
field_access
identifier "TypedScopeCreator"
. "."
identifier "CTOR_INITIALIZER"
, ","
field_access
identifier "TypedScopeCreator"
. "."
identifier "IFACE_INITIALIZER"
, ","
field_access
identifier "FunctionTypeBuilder"
. "."
identifier "THIS_TYPE_NON_OBJECT"
) ")"
; ";"
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 "ScopeCreator"
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"
type_identifier "CheckLevel"
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"
; ";"
constructor_declaration (+130 nodes collapsed)
constructor_declaration (+48 nodes collapsed)
constructor_declaration (+44 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 (+119 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 (+207 nodes collapsed)
block_comment "/**\n * This is the meat of the type checking. It is basic"...
method_declaration (+2709 nodes collapsed)
block_comment "/**\n * Counts the given node in the typed statistics.\n *"...
method_declaration (+114 nodes collapsed)
block_comment "/**\n * Visits an assignment <code>lvalue = rvalue</code>. "...
method_declaration (+899 nodes collapsed)
block_comment "/**\n * Visits an object literal field definition <code>key"...
method_declaration (+302 nodes collapsed)
block_comment "/**\n * Returns true if any type in the chain has an implic"...
method_declaration (+84 nodes collapsed)
block_comment "/**\n * Given a constructor type and a property name, check"...
method_declaration
modifiers
private "private"
void_type "void"
identifier "checkDeclaredPropertyInheritance"
formal_parameters (+26 nodes collapsed)
block
{ "{"
line_comment "// If the supertype doesn't resolve correctly, we've warned "...
line_comment "// already."
if_statement
if "if"
parenthesized_expression
( "("
method_invocation
identifier "hasUnknownOrEmptySupertype"
argument_list
( "("
identifier "ctorType"
) ")"
) ")"
block
{ "{"
return_statement
return "return"
; ";"
} "}"
local_variable_declaration
type_identifier "FunctionType"
variable_declarator
identifier "superClass"
= "="
method_invocation
identifier "ctorType"
. "."
identifier "getSuperClassConstructor"
argument_list
( "("
) ")"
; ";"
local_variable_declaration (+26 nodes collapsed)
local_variable_declaration
boolean_type "boolean"
variable_declarator
identifier "declaredOverride"
= "="
binary_expression
binary_expression
identifier "info"
!= "!="
null_literal "null"
&& "&&"
method_invocation
identifier "info"
. "."
identifier "isOverride"
argument_list
( "("
) ")"
; ";"
local_variable_declaration
boolean_type "boolean"
variable_declarator
identifier "foundInterfaceProperty"
= "="
false "false"
; ";"
if_statement
if "if"
parenthesized_expression
( "("
method_invocation
identifier "ctorType"
. "."
identifier "isConstructor"
argument_list
( "("
) ")"
) ")"
block
{ "{"
enhanced_for_statement
for "for"
( "("
type_identifier "JSType"
identifier "implementedInterface"
: ":"
method_invocation
identifier "ctorType"
. "."
identifier "getImplementedInterfaces"
argument_list
( "("
) ")"
) ")"
block
{ "{"
if_statement (+27 nodes collapsed)
local_variable_declaration
type_identifier "FunctionType"
variable_declarator
identifier "interfaceType"
= "="
method_invocation
method_invocation
identifier "implementedInterface"
. "."
identifier "toObjectType"
argument_list
( "("
) ")"
. "."
identifier "getConstructor"
argument_list
( "("
) ")"
; ";"
expression_statement
method_invocation
identifier "Preconditions"
. "."
identifier "checkNotNull"
argument_list
( "("
identifier "interfaceType"
) ")"
; ";"
local_variable_declaration
boolean_type "boolean"
variable_declarator
identifier "interfaceHasProperty"
= "="
method_invocation
method_invocation
identifier "interfaceType"
. "."
identifier "getPrototype"
argument_list
( "("
) ")"
. "."
identifier "hasProperty"
argument_list
( "("
identifier "propertyName"
) ")"
; ";"
expression_statement
assignment_expression
identifier "foundInterfaceProperty"
= "="
binary_expression
identifier "foundInterfaceProperty"
|| "||"
identifier "interfaceHasProperty"
; ";"
if_statement (+63 nodes collapsed)
if_statement
if "if"
parenthesized_expression
( "("
identifier "interfaceHasProperty"
) ")"
block
{ "{"
local_variable_declaration
type_identifier "JSType"
variable_declarator
identifier "interfacePropType"
= "="
method_invocation
method_invocation
identifier "interfaceType"
. "."
identifier "getPrototype"
argument_list
( "("
) ")"
. "."
identifier "getPropertyType"
argument_list
( "("
identifier "propertyName"
) ")"
; ";"
if_statement
if "if"
parenthesized_expression
( "("
unary_expression
! "!"
method_invocation
identifier "propertyType"
. "."
identifier "canAssignTo"
argument_list
( "("
identifier "interfacePropType"
) ")"
) ")"
block
{ "{"
expression_statement
method_invocation
identifier "compiler"
. "."
identifier "report"
argument_list
( "("
method_invocation
identifier "t"
. "."
identifier "makeError"
argument_list
( "("
identifier "n"
, ","
identifier "HIDDEN_INTERFACE_PROPERTY_MISMATCH"
, ","
identifier "propertyName"
, ","
method_invocation
method_invocation
identifier "interfaceType"
. "."
identifier "getTopMostDefiningType"
argument_list
( "("
identifier "propertyName"
) ")"
. "."
identifier "toString"
argument_list
( "("
) ")"
, ","
method_invocation
identifier "interfacePropType"
. "."
identifier "toString"
argument_list
( "("
) ")"
, ","
method_invocation
identifier "propertyType"
. "."
identifier "toString"
argument_list
( "("
) ")"
) ")"
) ")"
; ";"
} "}"
} "}"
} "}"
} "}"
if_statement
if "if"
parenthesized_expression
( "("
binary_expression
unary_expression
! "!"
identifier "declaredOverride"
&& "&&"
unary_expression
! "!"
identifier "superClassHasProperty"
) ")"
block
{ "{"
line_comment "// nothing to do here, it's just a plain new property"
return_statement
return "return"
; ";"
} "}"
local_variable_declaration
type_identifier "JSType"
variable_declarator
identifier "topInstanceType"
= "="
ternary_expression
identifier "superClassHasProperty"
? "?"
method_invocation
identifier "superClass"
. "."
identifier "getTopMostDefiningType"
argument_list
( "("
identifier "propertyName"
) ")"
: ":"
null_literal "null"
; ";"
if_statement (+65 nodes collapsed)
if_statement
if "if"
parenthesized_expression
( "("
unary_expression
! "!"
identifier "declaredOverride"
) ")"
block
{ "{"
line_comment "// there's no @override to check"
return_statement
return "return"
; ";"
} "}"
line_comment "// @override is present and we have to check that it is ok"
if_statement (+141 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 (+237 nodes collapsed)
block_comment "/**\n * Visits an ASSIGN node for cases such as\n * <pre>\n"...
method_declaration (+60 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 (+185 nodes collapsed)
block_comment "/**\n * Make sure that the access of this property is ok.\n "...
method_declaration (+232 nodes collapsed)
block_comment "/**\n * Determines whether this node is testing for the exi"...
method_declaration (+226 nodes collapsed)
block_comment "/**\n * Visits a GETELEM node.\n *\n * @param t The node "...
method_declaration (+80 nodes collapsed)
block_comment "/**\n * Visits a VAR node.\n *\n * @param t The node trav"...
method_declaration (+301 nodes collapsed)
block_comment "/**\n * Visits a NEW node.\n */"
method_declaration (+196 nodes collapsed)
block_comment "/**\n * Visits a {@link Token#FUNCTION} node.\n *\n * @pa"...
method_declaration (+353 nodes collapsed)
block_comment "/**\n * Visits a CALL node.\n *\n * @param t The node tra"...
method_declaration (+218 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 (+206 nodes collapsed)
block_comment "/**\n * This function unifies the type checking involved in"...
method_declaration (+485 nodes collapsed)
block_comment "/**\n * <p>Checks the initializer of an enum. An enum can b"...
method_declaration (+204 nodes collapsed)
block_comment "/**\n * This predicate is used to determine if the node rep"...
method_declaration (+66 nodes collapsed)
block_comment "/**\n * This method gets the JSType from the Node argument "...
method_declaration (+60 nodes collapsed)
block_comment "/**\n * Gets the type of the node or {@code null} if the no"...
method_declaration (+87 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 (+258 nodes collapsed)
block_comment "/**\n * Returns the percentage of nodes typed by the type c"...
method_declaration (+57 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 (+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 "javascript"
. "."
identifier "jscomp"
. "."
identifier "CheckLevel"
; ";"
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
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 "TernaryValue"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "Iterator"
; ";"
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 errors"
line_comment "//"
field_declaration (+26 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 (+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 (+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 (+37 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
modifiers
static "static"
final "final"
type_identifier "DiagnosticGroup"
variable_declarator
identifier "ALL_DIAGNOSTICS"
= "="
object_creation_expression
new "new"
type_identifier "DiagnosticGroup"
argument_list
( "("
identifier "DETERMINISTIC_TEST"
, ","
identifier "DETERMINISTIC_TEST_NO_RESULT"
, ","
identifier "INEXISTENT_ENUM_ELEMENT"
, ","
identifier "INEXISTENT_PROPERTY"
, ","
identifier "NOT_A_CONSTRUCTOR"
, ","
identifier "BIT_OPERATION"
, ","
identifier "NOT_CALLABLE"
, ","
identifier "CONSTRUCTOR_NOT_CALLABLE"
, ","
identifier "FUNCTION_MASKS_VARIABLE"
, ","
identifier "MULTIPLE_VAR_DEF"
, ","
identifier "ENUM_DUP"
, ","
identifier "ENUM_NOT_CONSTANT"
, ","
identifier "INVALID_INTERFACE_MEMBER_DECLARATION"
, ","
identifier "INTERFACE_FUNCTION_NOT_EMPTY"
, ","
identifier "CONFLICTING_EXTENDED_TYPE"
, ","
identifier "BAD_IMPLEMENTED_TYPE"
, ","
identifier "HIDDEN_SUPERCLASS_PROPERTY"
, ","
identifier "HIDDEN_INTERFACE_PROPERTY"
, ","
identifier "HIDDEN_SUPERCLASS_PROPERTY_MISMATCH"
, ","
identifier "UNKNOWN_OVERRIDE"
, ","
identifier "INTERFACE_METHOD_OVERRIDE"
, ","
identifier "UNKNOWN_EXPR_TYPE"
, ","
identifier "UNRESOLVED_TYPE"
, ","
identifier "WRONG_ARGUMENT_COUNT"
, ","
identifier "ILLEGAL_IMPLICIT_CAST"
, ","
field_access
identifier "TypedScopeCreator"
. "."
identifier "UNKNOWN_LENDS"
, ","
field_access
identifier "TypedScopeCreator"
. "."
identifier "LENDS_ON_NON_OBJECT"
, ","
field_access
identifier "TypedScopeCreator"
. "."
identifier "CTOR_INITIALIZER"
, ","
field_access
identifier "TypedScopeCreator"
. "."
identifier "IFACE_INITIALIZER"
, ","
field_access
identifier "FunctionTypeBuilder"
. "."
identifier "THIS_TYPE_NON_OBJECT"
) ")"
; ";"
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 "ScopeCreator"
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"
type_identifier "CheckLevel"
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"
; ";"
constructor_declaration (+130 nodes collapsed)
constructor_declaration (+48 nodes collapsed)
constructor_declaration (+44 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 (+119 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 (+207 nodes collapsed)
block_comment "/**\n * This is the meat of the type checking. It is basic"...
method_declaration (+2709 nodes collapsed)
block_comment "/**\n * Counts the given node in the typed statistics.\n *"...
method_declaration (+114 nodes collapsed)
block_comment "/**\n * Visits an assignment <code>lvalue = rvalue</code>. "...
method_declaration (+899 nodes collapsed)
block_comment "/**\n * Visits an object literal field definition <code>key"...
method_declaration (+302 nodes collapsed)
block_comment "/**\n * Returns true if any type in the chain has an implic"...
method_declaration (+84 nodes collapsed)
block_comment "/**\n * Given a constructor type and a property name, check"...
method_declaration
modifiers
private "private"
void_type "void"
identifier "checkDeclaredPropertyInheritance"
formal_parameters (+26 nodes collapsed)
block
{ "{"
line_comment "// If the supertype doesn't resolve correctly, we've warned "...
line_comment "// already."
if_statement
if "if"
parenthesized_expression
( "("
method_invocation
identifier "hasUnknownOrEmptySupertype"
argument_list
( "("
identifier "ctorType"
) ")"
) ")"
block
{ "{"
return_statement
return "return"
; ";"
} "}"
local_variable_declaration
type_identifier "FunctionType"
variable_declarator
identifier "superClass"
= "="
method_invocation
identifier "ctorType"
. "."
identifier "getSuperClassConstructor"
argument_list
( "("
) ")"
; ";"
local_variable_declaration (+26 nodes collapsed)
local_variable_declaration
boolean_type "boolean"
variable_declarator
identifier "declaredOverride"
= "="
binary_expression
binary_expression
identifier "info"
!= "!="
null_literal "null"
&& "&&"
method_invocation
identifier "info"
. "."
identifier "isOverride"
argument_list
( "("
) ")"
; ";"
local_variable_declaration
boolean_type "boolean"
variable_declarator
identifier "foundInterfaceProperty"
= "="
false "false"
; ";"
if_statement
if "if"
parenthesized_expression
( "("
method_invocation
identifier "ctorType"
. "."
identifier "isConstructor"
argument_list
( "("
) ")"
) ")"
block
{ "{"
enhanced_for_statement
for "for"
( "("
type_identifier "JSType"
identifier "implementedInterface"
: ":"
method_invocation
identifier "ctorType"
. "."
identifier "getImplementedInterfaces"
argument_list
( "("
) ")"
) ")"
block
{ "{"
if_statement (+27 nodes collapsed)
local_variable_declaration
type_identifier "FunctionType"
variable_declarator
identifier "interfaceType"
= "="
method_invocation
method_invocation
identifier "implementedInterface"
. "."
identifier "toObjectType"
argument_list
( "("
) ")"
. "."
identifier "getConstructor"
argument_list
( "("
) ")"
; ";"
expression_statement
method_invocation
identifier "Preconditions"
. "."
identifier "checkNotNull"
argument_list
( "("
identifier "interfaceType"
) ")"
; ";"
local_variable_declaration
boolean_type "boolean"
variable_declarator
identifier "interfaceHasProperty"
= "="
method_invocation
method_invocation
identifier "interfaceType"
. "."
identifier "getPrototype"
argument_list
( "("
) ")"
. "."
identifier "hasProperty"
argument_list
( "("
identifier "propertyName"
) ")"
; ";"
expression_statement
assignment_expression
identifier "foundInterfaceProperty"
= "="
binary_expression
identifier "foundInterfaceProperty"
|| "||"
identifier "interfaceHasProperty"
; ";"
if_statement (+63 nodes collapsed)
} "}"
} "}"
if_statement
if "if"
parenthesized_expression
( "("
binary_expression
unary_expression
! "!"
identifier "declaredOverride"
&& "&&"
unary_expression
! "!"
identifier "superClassHasProperty"
) ")"
block
{ "{"
line_comment "// nothing to do here, it's just a plain new property"
return_statement
return "return"
; ";"
} "}"
local_variable_declaration
type_identifier "JSType"
variable_declarator
identifier "topInstanceType"
= "="
ternary_expression
identifier "superClassHasProperty"
? "?"
method_invocation
identifier "superClass"
. "."
identifier "getTopMostDefiningType"
argument_list
( "("
identifier "propertyName"
) ")"
: ":"
null_literal "null"
; ";"
if_statement (+65 nodes collapsed)
if_statement
if "if"
parenthesized_expression
( "("
unary_expression
! "!"
identifier "declaredOverride"
) ")"
block
{ "{"
line_comment "// there's no @override to check"
return_statement
return "return"
; ";"
} "}"
line_comment "// @override is present and we have to check that it is ok"
if_statement (+141 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 (+237 nodes collapsed)
block_comment "/**\n * Visits an ASSIGN node for cases such as\n * <pre>\n"...
method_declaration (+60 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 (+185 nodes collapsed)
block_comment "/**\n * Make sure that the access of this property is ok.\n "...
method_declaration (+232 nodes collapsed)
block_comment "/**\n * Determines whether this node is testing for the exi"...
method_declaration (+226 nodes collapsed)
block_comment "/**\n * Visits a GETELEM node.\n *\n * @param t The node "...
method_declaration (+80 nodes collapsed)
block_comment "/**\n * Visits a VAR node.\n *\n * @param t The node trav"...
method_declaration (+301 nodes collapsed)
block_comment "/**\n * Visits a NEW node.\n */"
method_declaration (+196 nodes collapsed)
block_comment "/**\n * Visits a {@link Token#FUNCTION} node.\n *\n * @pa"...
method_declaration (+353 nodes collapsed)
block_comment "/**\n * Visits a CALL node.\n *\n * @param t The node tra"...
method_declaration (+218 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 (+206 nodes collapsed)
block_comment "/**\n * This function unifies the type checking involved in"...
method_declaration (+485 nodes collapsed)
block_comment "/**\n * <p>Checks the initializer of an enum. An enum can b"...
method_declaration (+204 nodes collapsed)
block_comment "/**\n * This predicate is used to determine if the node rep"...
method_declaration (+66 nodes collapsed)
block_comment "/**\n * This method gets the JSType from the Node argument "...
method_declaration (+60 nodes collapsed)
block_comment "/**\n * Gets the type of the node or {@code null} if the no"...
method_declaration (+87 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 (+258 nodes collapsed)
block_comment "/**\n * Returns the percentage of nodes typed by the type c"...
method_declaration (+57 nodes collapsed)
method_declaration (+25 nodes collapsed)
} "}"