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–95 unchanged (95 lines)
96
97 /**
98 * Adds a node that may represent a function signature (if it's a function
99 * itself or the name of a function).
100 */
101 private void addPossibleSignature(String name, Node node, NodeTraversal t) {
102 boolean signatureAdded = false;
103 if (node.getType() == Token.FUNCTION) {
104 // The node we're looking at is a function, so we can add it directly
105 addSignature(name, node, t.getSourceName());
106 signatureAdded = true;
107 } else if (node.getType() == Token.NAME) {
108 String functionName = node.getString();
109 Scope.Var v = t.getScope().getVar(functionName);
110 if (v == null) {
111 if (compiler.isIdeMode()) {
112 return;
113 } else {
114 throw new IllegalStateException(
115 "VarCheck should have caught this undefined function");
116 }
117 }
118 Node function = v.getInitialValue();
119 if (function != null &&
120 function.getType() == Token.FUNCTION) {
121 addSignature(name, function, v.getInputName());
122 signatureAdded = true;
123 }
124 }
125 if (!signatureAdded) {
126 nonMethodProperties.add(name);
127 }
128 }
129
130 private void addSignature(String name, Node function, String fnSourceName) {
131 if (externMethodsWithoutSignatures.contains(name)) {
132 return;
133 }
…lines 134–276 unchanged (143 lines)

After

…lines 1–95 unchanged (95 lines)
96
97 /**
98 * Adds a node that may represent a function signature (if it's a function
99 * itself or the name of a function).
100 */
101 private void addPossibleSignature(String name, Node node, NodeTraversal t) {
102 if (node.getType() == Token.FUNCTION) {
103 // The node we're looking at is a function, so we can add it directly
104 addSignature(name, node, t.getSourceName());
105 } else {
106 nonMethodProperties.add(name);
107 }
108 }
109
110 private void addSignature(String name, Node function, String fnSourceName) {
111 if (externMethodsWithoutSignatures.contains(name)) {
112 return;
113 }
…lines 114–256 unchanged (143 lines)

Before

program
block_comment "/*\n * Copyright 2007 Google Inc.\n *\n * Licensed under the Ap"...
package_declaration
package "package"
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "jscomp"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "common"
. "."
identifier "collect"
. "."
identifier "HashMultimap"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "common"
. "."
identifier "collect"
. "."
identifier "Lists"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "common"
. "."
identifier "collect"
. "."
identifier "Multimap"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "common"
. "."
identifier "collect"
. "."
identifier "Sets"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "jscomp"
. "."
identifier "NodeTraversal"
. "."
identifier "AbstractPostOrderCallback"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "jscomp"
. "."
identifier "NodeTraversal"
. "."
identifier "Callback"
; ";"
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
identifier "java"
. "."
identifier "util"
. "."
identifier "List"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "Set"
; ";"
block_comment "/**\n * Finds all method declarations and pulls them into dat"...
class_declaration
modifiers
abstract "abstract"
class "class"
identifier "MethodCompilerPass"
super_interfaces
implements "implements"
type_list
type_identifier "CompilerPass"
class_body
{ "{"
block_comment "/** List of methods defined in externs */"
field_declaration
modifiers
final "final"
generic_type
type_identifier "Set"
type_arguments
< "<"
type_identifier "String"
> ">"
variable_declarator
identifier "externMethods"
= "="
method_invocation
identifier "Sets"
. "."
identifier "newHashSet"
argument_list
( "("
) ")"
; ";"
block_comment "/** List of extern methods without signatures that we can't "...
field_declaration
modifiers
final "final"
generic_type
type_identifier "Set"
type_arguments
< "<"
type_identifier "String"
> ">"
variable_declarator
identifier "externMethodsWithoutSignatures"
= "="
method_invocation
identifier "Sets"
. "."
identifier "newHashSet"
argument_list
( "("
) ")"
; ";"
block_comment "/** List of property names that may not be methods */"
field_declaration
modifiers
final "final"
generic_type
type_identifier "Set"
type_arguments
< "<"
type_identifier "String"
> ">"
variable_declarator
identifier "nonMethodProperties"
= "="
method_invocation
identifier "Sets"
. "."
identifier "newHashSet"
argument_list
( "("
) ")"
; ";"
field_declaration (+22 nodes collapsed)
field_declaration
modifiers
final "final"
type_identifier "AbstractCompiler"
variable_declarator
identifier "compiler"
; ";"
block_comment "/**\n * The signature storage is provided by the implementi"...
interface_declaration (+47 nodes collapsed)
constructor_declaration
identifier "MethodCompilerPass"
formal_parameters
( "("
formal_parameter
type_identifier "AbstractCompiler"
identifier "compiler"
) ")"
constructor_body
{ "{"
expression_statement
assignment_expression
field_access
this "this"
. "."
identifier "compiler"
= "="
identifier "compiler"
; ";"
} "}"
method_declaration (+156 nodes collapsed)
block_comment "/**\n * Subclasses should return a callback that does the a"...
method_declaration
modifiers
abstract "abstract"
type_identifier "Callback"
identifier "getActingCallback"
formal_parameters
( "("
) ")"
; ";"
block_comment "/**\n * Subclasses should return a SignatureStore for stori"...
method_declaration
modifiers
abstract "abstract"
type_identifier "SignatureStore"
identifier "getSignatureStore"
formal_parameters
( "("
) ")"
; ";"
block_comment "/**\n * Adds a node that may represent a function signature"...
method_declaration
modifiers
private "private"
void_type "void"
identifier "addPossibleSignature"
formal_parameters
( "("
formal_parameter
type_identifier "String"
identifier "name"
, ","
formal_parameter
type_identifier "Node"
identifier "node"
, ","
formal_parameter
type_identifier "NodeTraversal"
identifier "t"
) ")"
block
{ "{"
local_variable_declaration
boolean_type "boolean"
variable_declarator
identifier "signatureAdded"
= "="
false "false"
; ";"
if_statement
if "if"
parenthesized_expression
( "("
binary_expression
method_invocation
identifier "node"
. "."
identifier "getType"
argument_list
( "("
) ")"
== "=="
field_access
identifier "Token"
. "."
identifier "FUNCTION"
) ")"
block
{ "{"
line_comment "// The node we're looking at is a function, so we can add it"...
expression_statement
method_invocation
identifier "addSignature"
argument_list
( "("
identifier "name"
, ","
identifier "node"
, ","
method_invocation
identifier "t"
. "."
identifier "getSourceName"
argument_list
( "("
) ")"
) ")"
; ";"
expression_statement
assignment_expression
identifier "signatureAdded"
= "="
true "true"
; ";"
} "}"
else "else"
if_statement
if "if"
parenthesized_expression
( "("
binary_expression
method_invocation
identifier "node"
. "."
identifier "getType"
argument_list
( "("
) ")"
== "=="
field_access
identifier "Token"
. "."
identifier "NAME"
) ")"
block
{ "{"
local_variable_declaration
type_identifier "String"
variable_declarator
identifier "functionName"
= "="
method_invocation
identifier "node"
. "."
identifier "getString"
argument_list
( "("
) ")"
; ";"
local_variable_declaration
scoped_type_identifier
type_identifier "Scope"
. "."
type_identifier "Var"
variable_declarator
identifier "v"
= "="
method_invocation
method_invocation
identifier "t"
. "."
identifier "getScope"
argument_list
( "("
) ")"
. "."
identifier "getVar"
argument_list
( "("
identifier "functionName"
) ")"
; ";"
if_statement
if "if"
parenthesized_expression
( "("
binary_expression
identifier "v"
== "=="
null_literal "null"
) ")"
block
{ "{"
if_statement
if "if"
parenthesized_expression
( "("
method_invocation
identifier "compiler"
. "."
identifier "isIdeMode"
argument_list
( "("
) ")"
) ")"
block
{ "{"
return_statement
return "return"
; ";"
} "}"
else "else"
block
{ "{"
throw_statement
throw "throw"
object_creation_expression
new "new"
type_identifier "IllegalStateException"
argument_list
( "("
string_literal
" "\""
string_fragment "VarCheck should have caught this undefined function"
" "\""
) ")"
; ";"
} "}"
} "}"
local_variable_declaration
type_identifier "Node"
variable_declarator
identifier "function"
= "="
method_invocation
identifier "v"
. "."
identifier "getInitialValue"
argument_list
( "("
) ")"
; ";"
if_statement
if "if"
parenthesized_expression
( "("
binary_expression
binary_expression
identifier "function"
!= "!="
null_literal "null"
&& "&&"
binary_expression
method_invocation
identifier "function"
. "."
identifier "getType"
argument_list
( "("
) ")"
== "=="
field_access
identifier "Token"
. "."
identifier "FUNCTION"
) ")"
block
{ "{"
expression_statement
method_invocation
identifier "addSignature"
argument_list
( "("
identifier "name"
, ","
identifier "function"
, ","
method_invocation
identifier "v"
. "."
identifier "getInputName"
argument_list
( "("
) ")"
) ")"
; ";"
expression_statement
assignment_expression
identifier "signatureAdded"
= "="
true "true"
; ";"
} "}"
} "}"
if_statement
if "if"
parenthesized_expression
( "("
unary_expression
! "!"
identifier "signatureAdded"
) ")"
block
{ "{"
expression_statement
method_invocation
identifier "nonMethodProperties"
. "."
identifier "add"
argument_list
( "("
identifier "name"
) ")"
; ";"
} "}"
} "}"
method_declaration (+71 nodes collapsed)
block_comment "/**\n * Gathers methods from the externs file. Methods that"...
class_declaration (+429 nodes collapsed)
block_comment "/**\n * Gather signatures from the source to be compiled.\n "...
class_declaration (+491 nodes collapsed)
} "}"

After

program
block_comment "/*\n * Copyright 2007 Google Inc.\n *\n * Licensed under the Ap"...
package_declaration
package "package"
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "jscomp"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "common"
. "."
identifier "collect"
. "."
identifier "HashMultimap"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "common"
. "."
identifier "collect"
. "."
identifier "Lists"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "common"
. "."
identifier "collect"
. "."
identifier "Multimap"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "common"
. "."
identifier "collect"
. "."
identifier "Sets"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "jscomp"
. "."
identifier "NodeTraversal"
. "."
identifier "AbstractPostOrderCallback"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "jscomp"
. "."
identifier "NodeTraversal"
. "."
identifier "Callback"
; ";"
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
identifier "java"
. "."
identifier "util"
. "."
identifier "List"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "Set"
; ";"
block_comment "/**\n * Finds all method declarations and pulls them into dat"...
class_declaration
modifiers
abstract "abstract"
class "class"
identifier "MethodCompilerPass"
super_interfaces
implements "implements"
type_list
type_identifier "CompilerPass"
class_body
{ "{"
block_comment "/** List of methods defined in externs */"
field_declaration
modifiers
final "final"
generic_type
type_identifier "Set"
type_arguments
< "<"
type_identifier "String"
> ">"
variable_declarator
identifier "externMethods"
= "="
method_invocation
identifier "Sets"
. "."
identifier "newHashSet"
argument_list
( "("
) ")"
; ";"
block_comment "/** List of extern methods without signatures that we can't "...
field_declaration
modifiers
final "final"
generic_type
type_identifier "Set"
type_arguments
< "<"
type_identifier "String"
> ">"
variable_declarator
identifier "externMethodsWithoutSignatures"
= "="
method_invocation
identifier "Sets"
. "."
identifier "newHashSet"
argument_list
( "("
) ")"
; ";"
block_comment "/** List of property names that may not be methods */"
field_declaration
modifiers
final "final"
generic_type
type_identifier "Set"
type_arguments
< "<"
type_identifier "String"
> ">"
variable_declarator
identifier "nonMethodProperties"
= "="
method_invocation
identifier "Sets"
. "."
identifier "newHashSet"
argument_list
( "("
) ")"
; ";"
field_declaration (+22 nodes collapsed)
field_declaration
modifiers
final "final"
type_identifier "AbstractCompiler"
variable_declarator
identifier "compiler"
; ";"
block_comment "/**\n * The signature storage is provided by the implementi"...
interface_declaration (+47 nodes collapsed)
constructor_declaration
identifier "MethodCompilerPass"
formal_parameters
( "("
formal_parameter
type_identifier "AbstractCompiler"
identifier "compiler"
) ")"
constructor_body
{ "{"
expression_statement
assignment_expression
field_access
this "this"
. "."
identifier "compiler"
= "="
identifier "compiler"
; ";"
} "}"
method_declaration (+156 nodes collapsed)
block_comment "/**\n * Subclasses should return a callback that does the a"...
method_declaration
modifiers
abstract "abstract"
type_identifier "Callback"
identifier "getActingCallback"
formal_parameters
( "("
) ")"
; ";"
block_comment "/**\n * Subclasses should return a SignatureStore for stori"...
method_declaration
modifiers
abstract "abstract"
type_identifier "SignatureStore"
identifier "getSignatureStore"
formal_parameters
( "("
) ")"
; ";"
block_comment "/**\n * Adds a node that may represent a function signature"...
method_declaration
modifiers
private "private"
void_type "void"
identifier "addPossibleSignature"
formal_parameters
( "("
formal_parameter
type_identifier "String"
identifier "name"
, ","
formal_parameter
type_identifier "Node"
identifier "node"
, ","
formal_parameter
type_identifier "NodeTraversal"
identifier "t"
) ")"
block
{ "{"
if_statement
if "if"
parenthesized_expression
( "("
binary_expression
method_invocation
identifier "node"
. "."
identifier "getType"
argument_list
( "("
) ")"
== "=="
field_access
identifier "Token"
. "."
identifier "FUNCTION"
) ")"
block
{ "{"
line_comment "// The node we're looking at is a function, so we can add it"...
expression_statement
method_invocation
identifier "addSignature"
argument_list
( "("
identifier "name"
, ","
identifier "node"
, ","
method_invocation
identifier "t"
. "."
identifier "getSourceName"
argument_list
( "("
) ")"
) ")"
; ";"
} "}"
else "else"
block
{ "{"
expression_statement
method_invocation
identifier "nonMethodProperties"
. "."
identifier "add"
argument_list
( "("
identifier "name"
) ")"
; ";"
} "}"
} "}"
method_declaration (+71 nodes collapsed)
block_comment "/**\n * Gathers methods from the externs file. Methods that"...
class_declaration (+429 nodes collapsed)
block_comment "/**\n * Gather signatures from the source to be compiled.\n "...
class_declaration (+491 nodes collapsed)
} "}"