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–102 unchanged (102 lines)
103 "override: {3}");
104
105 static final DiagnosticType INTERFACE_METHOD_NOT_IMPLEMENTED =
106 DiagnosticType.warning(
107 "JSC_INTERFACE_METHOD_NOT_IMPLEMENTED",
108 "property {0} on interface {1} is not implemented by type {2}");
109
110
111 static final DiagnosticGroup ALL_DIAGNOSTICS = new DiagnosticGroup(
112 INVALID_CAST,
113 TYPE_MISMATCH_WARNING,
114 MISSING_EXTENDS_TAG_WARNING,
115 DUP_VAR_DECLARATION,
116 HIDDEN_PROPERTY_MISMATCH,
117 INTERFACE_METHOD_NOT_IMPLEMENTED);
118
119 TypeValidator(AbstractCompiler compiler) {
120 this.compiler = compiler;
121 this.typeRegistry = compiler.getTypeRegistry();
122 this.allValueTypes = typeRegistry.createUnionType(
123 STRING_TYPE, NUMBER_TYPE, BOOLEAN_TYPE, NULL_TYPE, VOID_TYPE);
…lines 124–582 unchanged (459 lines)
583 compiler.report(JSError.make(sourceName, n,
584 INTERFACE_METHOD_NOT_IMPLEMENTED,
585 prop, implementedInterface.toString(), instance.toString()));
586 }
587 registerMismatch(instance, implementedInterface);
588 // Implemented, but not correctly typed
589 }
590 }
591
592 /**
593 * Report a type mismatch
594 */
595 private void mismatch(NodeTraversal t, Node n,
596 String msg, JSType found, JSType required) {
…lines 597–771 unchanged (175 lines)

After

…lines 1–103 unchanged (103 lines)
104
105 static final DiagnosticType INTERFACE_METHOD_NOT_IMPLEMENTED =
106 DiagnosticType.warning(
107 "JSC_INTERFACE_METHOD_NOT_IMPLEMENTED",
108 "property {0} on interface {1} is not implemented by type {2}");
109
110 static final DiagnosticType HIDDEN_INTERFACE_PROPERTY_MISMATCH =
111 DiagnosticType.warning(
112 "JSC_HIDDEN_INTERFACE_PROPERTY_MISMATCH",
113 "mismatch of the {0} property type and the type " +
114 "of the property it overrides from interface {1}\n" +
115 "original: {2}\n" +
116 "override: {3}");
117
118 static final DiagnosticGroup ALL_DIAGNOSTICS = new DiagnosticGroup(
119 INVALID_CAST,
120 TYPE_MISMATCH_WARNING,
121 MISSING_EXTENDS_TAG_WARNING,
122 DUP_VAR_DECLARATION,
123 HIDDEN_PROPERTY_MISMATCH,
124 INTERFACE_METHOD_NOT_IMPLEMENTED,
125 HIDDEN_INTERFACE_PROPERTY_MISMATCH);
126
127 TypeValidator(AbstractCompiler compiler) {
128 this.compiler = compiler;
129 this.typeRegistry = compiler.getTypeRegistry();
130 this.allValueTypes = typeRegistry.createUnionType(
131 STRING_TYPE, NUMBER_TYPE, BOOLEAN_TYPE, NULL_TYPE, VOID_TYPE);
…lines 132–589 unchanged (458 lines)
590 if (shouldReport) {
591 compiler.report(JSError.make(sourceName, n,
592 INTERFACE_METHOD_NOT_IMPLEMENTED,
593 prop, implementedInterface.toString(), instance.toString()));
594 }
595 registerMismatch(instance, implementedInterface);
596 } else {
597 JSType found = instance.getPropertyType(prop);
598 JSType required
599 = implementedInterface.getImplicitPrototype().getPropertyType(prop);
600 found = found.restrictByNotNullOrUndefined();
601 required = required.restrictByNotNullOrUndefined();
602 if (!found.canAssignTo(required)) {
603 // Implemented, but not correctly typed
604 if (shouldReport) {
605 FunctionType constructor
606 = implementedInterface.toObjectType().getConstructor();
607 compiler.report(t.makeError(n,
608 HIDDEN_INTERFACE_PROPERTY_MISMATCH, prop,
609 constructor.getTopMostDefiningType(prop).toString(),
610 required.toString(), found.toString()));
611 }
612 registerMismatch(found, required);
613 }
614 }
615 }
616
617 /**
618 * Report a type mismatch
619 */
620 private void mismatch(NodeTraversal t, Node n,
…lines 621–796 unchanged (176 lines)

Before

program
block_comment "/*\n * Copyright 2009 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 "Objects"
; ";"
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 "Lists"
; ";"
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 "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 "UnionType"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "text"
. "."
identifier "MessageFormat"
; ";"
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"
; ";"
block_comment "/**\n * A central reporter for all type violations: places wh"...
class_declaration
class "class"
identifier "TypeValidator"
class_body
{ "{"
field_declaration
modifiers
private "private"
final "final"
type_identifier "AbstractCompiler"
variable_declarator
identifier "compiler"
; ";"
field_declaration
modifiers
private "private"
final "final"
type_identifier "JSTypeRegistry"
variable_declarator
identifier "typeRegistry"
; ";"
field_declaration
modifiers
private "private"
final "final"
type_identifier "JSType"
variable_declarator
identifier "allValueTypes"
; ";"
field_declaration
modifiers
private "private"
boolean_type "boolean"
variable_declarator
identifier "shouldReport"
= "="
true "true"
; ";"
field_declaration
modifiers
private "private"
final "final"
type_identifier "JSType"
variable_declarator
identifier "nullOrUndefined"
; ";"
line_comment "// TODO(nicksantos): Provide accessors to better filter the "...
line_comment "// mismatches. For example, if we pass (Cake|null) where onl"...
line_comment "// allowed, that doesn't mean we should invalidate all Cakes"...
field_declaration (+21 nodes collapsed)
line_comment "// User warnings"
field_declaration (+28 nodes collapsed)
field_declaration (+39 nodes collapsed)
field_declaration (+25 nodes collapsed)
field_declaration (+25 nodes collapsed)
field_declaration (+31 nodes collapsed)
field_declaration (+45 nodes collapsed)
field_declaration (+25 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 "INVALID_CAST"
, ","
identifier "TYPE_MISMATCH_WARNING"
, ","
identifier "MISSING_EXTENDS_TAG_WARNING"
, ","
identifier "DUP_VAR_DECLARATION"
, ","
identifier "HIDDEN_PROPERTY_MISMATCH"
, ","
identifier "INTERFACE_METHOD_NOT_IMPLEMENTED"
) ")"
; ";"
constructor_declaration (+77 nodes collapsed)
block_comment "/**\n * Gets a list of type violations.\n *\n * For each "...
method_declaration
generic_type
type_identifier "Iterable"
type_arguments
< "<"
type_identifier "TypeMismatch"
> ">"
identifier "getMismatches"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
identifier "mismatches"
; ";"
} "}"
method_declaration (+21 nodes collapsed)
line_comment "// All non-private methods should have the form:"
line_comment "// expectCondition(NodeTraversal t, Node n, ...);"
line_comment "// If there is a mismatch, the {@code expect} method should "...
line_comment "// a warning and attempt to correct the mismatch, when possi"...
block_comment "/**\n * Expect the type to be an object, or a type converti"...
method_declaration (+65 nodes collapsed)
block_comment "/**\n * Expect the type to be an object. Unlike expectObjec"...
method_declaration (+57 nodes collapsed)
block_comment "/**\n * Expect the type to contain an object sometimes. If "...
method_declaration (+81 nodes collapsed)
block_comment "/**\n * Expect the type to be a string, or a type convertib"...
method_declaration (+57 nodes collapsed)
block_comment "/**\n * Expect the type to be a number, or a type convertib"...
method_declaration (+57 nodes collapsed)
block_comment "/**\n * Expect the type to be a valid operand to a bitwise "...
method_declaration (+69 nodes collapsed)
block_comment "/**\n * Expect the type to be a number or string, or a type"...
method_declaration (+68 nodes collapsed)
block_comment "/**\n * Expect the type to be anything but the null or void"...
method_declaration (+156 nodes collapsed)
method_declaration (+78 nodes collapsed)
block_comment "/**\n * Expect that the type of a switch condition matches "...
method_declaration (+104 nodes collapsed)
block_comment "/**\n * Expect that the first type can be addressed with GE"...
method_declaration (+222 nodes collapsed)
block_comment "/**\n * Expect that the first type can be assigned to a sym"...
method_declaration (+140 nodes collapsed)
block_comment "/**\n * Expect that the first type can be assigned to a sym"...
method_declaration (+102 nodes collapsed)
method_declaration (+61 nodes collapsed)
block_comment "/**\n * Expect that the type of an argument matches the typ"...
method_declaration (+100 nodes collapsed)
block_comment "/**\n * Expect that the first type can override a property "...
method_declaration (+114 nodes collapsed)
block_comment "/**\n * Expect that the first type is the direct superclass"...
method_declaration (+198 nodes collapsed)
block_comment "/**\n * Expect that the first type can be cast to the secon"...
method_declaration (+132 nodes collapsed)
block_comment "/**\n * Expect that the given variable has not been declare"...
method_declaration (+436 nodes collapsed)
block_comment "/**\n * Expect that all properties on interfaces that this "...
method_declaration (+107 nodes collapsed)
block_comment "/**\n * Expect that the peroperty in an interface that this"...
method_declaration
modifiers
private "private"
void_type "void"
identifier "expectInterfaceProperty"
formal_parameters (+22 nodes collapsed)
block
{ "{"
if_statement
if "if"
parenthesized_expression
( "("
unary_expression
! "!"
method_invocation
identifier "instance"
. "."
identifier "hasProperty"
argument_list
( "("
identifier "prop"
) ")"
) ")"
block
{ "{"
line_comment "// Not implemented"
local_variable_declaration (+21 nodes collapsed)
expression_statement
assignment_expression
identifier "sourceName"
= "="
ternary_expression
binary_expression
identifier "sourceName"
== "=="
null_literal "null"
? "?"
string_literal
" "\""
" "\""
: ":"
identifier "sourceName"
; ";"
if_statement (+48 nodes collapsed)
expression_statement
method_invocation
identifier "registerMismatch"
argument_list
( "("
identifier "instance"
, ","
identifier "implementedInterface"
) ")"
; ";"
line_comment "// Implemented, but not correctly typed"
} "}"
} "}"
block_comment "/**\n * Report a type mismatch\n */"
method_declaration (+52 nodes collapsed)
method_declaration (+51 nodes collapsed)
method_declaration (+81 nodes collapsed)
method_declaration (+265 nodes collapsed)
method_declaration (+58 nodes collapsed)
block_comment "/**\n * Formats a found/required error message.\n */"
method_declaration (+39 nodes collapsed)
block_comment "/**\n * Given a node, get a human-readable name for the typ"...
method_declaration (+363 nodes collapsed)
block_comment "/**\n * This method gets the JSType from the Node argument "...
method_declaration (+60 nodes collapsed)
method_declaration (+25 nodes collapsed)
block_comment "/**\n * Signals that the first type and the second type hav"...
class_declaration (+238 nodes collapsed)
} "}"

After

program
block_comment "/*\n * Copyright 2009 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 "Objects"
; ";"
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 "Lists"
; ";"
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 "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 "UnionType"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "text"
. "."
identifier "MessageFormat"
; ";"
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"
; ";"
block_comment "/**\n * A central reporter for all type violations: places wh"...
class_declaration
class "class"
identifier "TypeValidator"
class_body
{ "{"
field_declaration
modifiers
private "private"
final "final"
type_identifier "AbstractCompiler"
variable_declarator
identifier "compiler"
; ";"
field_declaration
modifiers
private "private"
final "final"
type_identifier "JSTypeRegistry"
variable_declarator
identifier "typeRegistry"
; ";"
field_declaration
modifiers
private "private"
final "final"
type_identifier "JSType"
variable_declarator
identifier "allValueTypes"
; ";"
field_declaration
modifiers
private "private"
boolean_type "boolean"
variable_declarator
identifier "shouldReport"
= "="
true "true"
; ";"
field_declaration
modifiers
private "private"
final "final"
type_identifier "JSType"
variable_declarator
identifier "nullOrUndefined"
; ";"
line_comment "// TODO(nicksantos): Provide accessors to better filter the "...
line_comment "// mismatches. For example, if we pass (Cake|null) where onl"...
line_comment "// allowed, that doesn't mean we should invalidate all Cakes"...
field_declaration (+21 nodes collapsed)
line_comment "// User warnings"
field_declaration (+28 nodes collapsed)
field_declaration (+39 nodes collapsed)
field_declaration (+25 nodes collapsed)
field_declaration (+25 nodes collapsed)
field_declaration (+31 nodes collapsed)
field_declaration (+45 nodes collapsed)
field_declaration (+25 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
modifiers
static "static"
final "final"
type_identifier "DiagnosticGroup"
variable_declarator
identifier "ALL_DIAGNOSTICS"
= "="
object_creation_expression
new "new"
type_identifier "DiagnosticGroup"
argument_list
( "("
identifier "INVALID_CAST"
, ","
identifier "TYPE_MISMATCH_WARNING"
, ","
identifier "MISSING_EXTENDS_TAG_WARNING"
, ","
identifier "DUP_VAR_DECLARATION"
, ","
identifier "HIDDEN_PROPERTY_MISMATCH"
, ","
identifier "INTERFACE_METHOD_NOT_IMPLEMENTED"
, ","
identifier "HIDDEN_INTERFACE_PROPERTY_MISMATCH"
) ")"
; ";"
constructor_declaration (+77 nodes collapsed)
block_comment "/**\n * Gets a list of type violations.\n *\n * For each "...
method_declaration
generic_type
type_identifier "Iterable"
type_arguments
< "<"
type_identifier "TypeMismatch"
> ">"
identifier "getMismatches"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
identifier "mismatches"
; ";"
} "}"
method_declaration (+21 nodes collapsed)
line_comment "// All non-private methods should have the form:"
line_comment "// expectCondition(NodeTraversal t, Node n, ...);"
line_comment "// If there is a mismatch, the {@code expect} method should "...
line_comment "// a warning and attempt to correct the mismatch, when possi"...
block_comment "/**\n * Expect the type to be an object, or a type converti"...
method_declaration (+65 nodes collapsed)
block_comment "/**\n * Expect the type to be an object. Unlike expectObjec"...
method_declaration (+57 nodes collapsed)
block_comment "/**\n * Expect the type to contain an object sometimes. If "...
method_declaration (+81 nodes collapsed)
block_comment "/**\n * Expect the type to be a string, or a type convertib"...
method_declaration (+57 nodes collapsed)
block_comment "/**\n * Expect the type to be a number, or a type convertib"...
method_declaration (+57 nodes collapsed)
block_comment "/**\n * Expect the type to be a valid operand to a bitwise "...
method_declaration (+69 nodes collapsed)
block_comment "/**\n * Expect the type to be a number or string, or a type"...
method_declaration (+68 nodes collapsed)
block_comment "/**\n * Expect the type to be anything but the null or void"...
method_declaration (+156 nodes collapsed)
method_declaration (+78 nodes collapsed)
block_comment "/**\n * Expect that the type of a switch condition matches "...
method_declaration (+104 nodes collapsed)
block_comment "/**\n * Expect that the first type can be addressed with GE"...
method_declaration (+222 nodes collapsed)
block_comment "/**\n * Expect that the first type can be assigned to a sym"...
method_declaration (+140 nodes collapsed)
block_comment "/**\n * Expect that the first type can be assigned to a sym"...
method_declaration (+102 nodes collapsed)
method_declaration (+61 nodes collapsed)
block_comment "/**\n * Expect that the type of an argument matches the typ"...
method_declaration (+100 nodes collapsed)
block_comment "/**\n * Expect that the first type can override a property "...
method_declaration (+114 nodes collapsed)
block_comment "/**\n * Expect that the first type is the direct superclass"...
method_declaration (+198 nodes collapsed)
block_comment "/**\n * Expect that the first type can be cast to the secon"...
method_declaration (+132 nodes collapsed)
block_comment "/**\n * Expect that the given variable has not been declare"...
method_declaration (+436 nodes collapsed)
block_comment "/**\n * Expect that all properties on interfaces that this "...
method_declaration (+107 nodes collapsed)
block_comment "/**\n * Expect that the peroperty in an interface that this"...
method_declaration
modifiers
private "private"
void_type "void"
identifier "expectInterfaceProperty"
formal_parameters (+22 nodes collapsed)
block
{ "{"
if_statement
if "if"
parenthesized_expression
( "("
unary_expression
! "!"
method_invocation
identifier "instance"
. "."
identifier "hasProperty"
argument_list
( "("
identifier "prop"
) ")"
) ")"
block
{ "{"
line_comment "// Not implemented"
local_variable_declaration (+21 nodes collapsed)
expression_statement
assignment_expression
identifier "sourceName"
= "="
ternary_expression
binary_expression
identifier "sourceName"
== "=="
null_literal "null"
? "?"
string_literal
" "\""
" "\""
: ":"
identifier "sourceName"
; ";"
if_statement (+48 nodes collapsed)
expression_statement
method_invocation
identifier "registerMismatch"
argument_list
( "("
identifier "instance"
, ","
identifier "implementedInterface"
) ")"
; ";"
} "}"
else "else"
block
{ "{"
local_variable_declaration
type_identifier "JSType"
variable_declarator
identifier "found"
= "="
method_invocation
identifier "instance"
. "."
identifier "getPropertyType"
argument_list
( "("
identifier "prop"
) ")"
; ";"
local_variable_declaration
type_identifier "JSType"
variable_declarator
identifier "required"
= "="
method_invocation
method_invocation
identifier "implementedInterface"
. "."
identifier "getImplicitPrototype"
argument_list
( "("
) ")"
. "."
identifier "getPropertyType"
argument_list
( "("
identifier "prop"
) ")"
; ";"
expression_statement
assignment_expression
identifier "found"
= "="
method_invocation
identifier "found"
. "."
identifier "restrictByNotNullOrUndefined"
argument_list
( "("
) ")"
; ";"
expression_statement
assignment_expression
identifier "required"
= "="
method_invocation
identifier "required"
. "."
identifier "restrictByNotNullOrUndefined"
argument_list
( "("
) ")"
; ";"
if_statement
if "if"
parenthesized_expression
( "("
unary_expression
! "!"
method_invocation
identifier "found"
. "."
identifier "canAssignTo"
argument_list
( "("
identifier "required"
) ")"
) ")"
block
{ "{"
line_comment "// Implemented, but not correctly typed"
if_statement
if "if"
parenthesized_expression
( "("
identifier "shouldReport"
) ")"
block
{ "{"
local_variable_declaration
type_identifier "FunctionType"
variable_declarator
identifier "constructor"
= "="
method_invocation
method_invocation
identifier "implementedInterface"
. "."
identifier "toObjectType"
argument_list
( "("
) ")"
. "."
identifier "getConstructor"
argument_list
( "("
) ")"
; ";"
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 "prop"
, ","
method_invocation
method_invocation
identifier "constructor"
. "."
identifier "getTopMostDefiningType"
argument_list
( "("
identifier "prop"
) ")"
. "."
identifier "toString"
argument_list
( "("
) ")"
, ","
method_invocation
identifier "required"
. "."
identifier "toString"
argument_list
( "("
) ")"
, ","
method_invocation
identifier "found"
. "."
identifier "toString"
argument_list
( "("
) ")"
) ")"
) ")"
; ";"
} "}"
expression_statement
method_invocation
identifier "registerMismatch"
argument_list
( "("
identifier "found"
, ","
identifier "required"
) ")"
; ";"
} "}"
} "}"
} "}"
block_comment "/**\n * Report a type mismatch\n */"
method_declaration (+52 nodes collapsed)
method_declaration (+51 nodes collapsed)
method_declaration (+81 nodes collapsed)
method_declaration (+265 nodes collapsed)
method_declaration (+58 nodes collapsed)
block_comment "/**\n * Formats a found/required error message.\n */"
method_declaration (+39 nodes collapsed)
block_comment "/**\n * Given a node, get a human-readable name for the typ"...
method_declaration (+363 nodes collapsed)
block_comment "/**\n * This method gets the JSType from the Node argument "...
method_declaration (+60 nodes collapsed)
method_declaration (+25 nodes collapsed)
block_comment "/**\n * Signals that the first type and the second type hav"...
class_declaration (+238 nodes collapsed)
} "}"