This mapping has 4 all-to-all groups: every node on one side corresponds to every node on the other, and none is deleted or inserted. Each member carries an all N:M badge; selecting one highlights all of its counterparts, in the tree and in the code view alike.

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–170 unchanged (170 lines)
171 * @param definitionProvider The name reference graph
172 * @param name Query node
173 * @return non-empty definition list or null
174 */
175 private static Collection<Definition> getCallableDefinitions(
176 DefinitionProvider definitionProvider, Node name) {
177 List<Definition> result = Lists.newArrayList();
178
179 if (!NodeUtil.isGetProp(name) && !NodeUtil.isName(name)) {
180 return null;
181 }
182 Collection<Definition> decls =
183 definitionProvider.getDefinitionsReferencedAt(name);
184 if (decls == null) {
185 return null;
186 }
187
188 for (Definition current : decls) {
189 Node rValue = current.getRValue();
190 if ((rValue != null) && NodeUtil.isFunction(rValue)) {
191 result.add(current);
192 } else {
193 return null;
194 }
195 }
196
197 return result;
198 }
199
200 /**
201 * Propagate side effect information by building a graph based on
202 * call site information stored in FunctionInformation and the
203 * DefinitionProvider and then running GraphReachability to
204 * determine the set of functions that have side effects.
…lines 205–695 unchanged (491 lines)

After

…lines 1–170 unchanged (170 lines)
171 * @param definitionProvider The name reference graph
172 * @param name Query node
173 * @return non-empty definition list or null
174 */
175 private static Collection<Definition> getCallableDefinitions(
176 DefinitionProvider definitionProvider, Node name) {
177 if (NodeUtil.isGetProp(name) || NodeUtil.isName(name)) {
178 List<Definition> result = Lists.newArrayList();
179
180 Collection<Definition> decls =
181 definitionProvider.getDefinitionsReferencedAt(name);
182 if (decls == null) {
183 return null;
184 }
185
186 for (Definition current : decls) {
187 Node rValue = current.getRValue();
188 if ((rValue != null) && NodeUtil.isFunction(rValue)) {
189 result.add(current);
190 } else {
191 return null;
192 }
193 }
194
195 return result;
196 } else if (name.getType() == Token.OR || name.getType() == Token.HOOK) {
197 Node firstVal;
198 if (name.getType() == Token.HOOK) {
199 firstVal = name.getFirstChild().getNext();
200 } else {
201 firstVal = name.getFirstChild();
202 }
203
204 Collection<Definition> defs1 = getCallableDefinitions(definitionProvider,
205 firstVal);
206 Collection<Definition> defs2 = getCallableDefinitions(definitionProvider,
207 firstVal.getNext());
208 if (defs1 != null && defs2 != null) {
209 defs1.addAll(defs2);
210 return defs1;
211 } else {
212 return null;
213 }
214 } else {
215 return null;
216 }
217 }
218
219 /**
220 * Propagate side effect information by building a graph based on
221 * call site information stored in FunctionInformation and the
222 * DefinitionProvider and then running GraphReachability to
…lines 223–714 unchanged (492 lines)

Before

program
block_comment "/*\n * Copyright 2009 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 "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
identifier "com"
. "."
identifier "google"
. "."
identifier "common"
. "."
identifier "collect"
. "."
identifier "Maps"
; ";"
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 "DefinitionsRemover"
. "."
identifier "Definition"
; ";"
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
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 "graph"
. "."
identifier "DiGraph"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "jscomp"
. "."
identifier "graph"
. "."
identifier "FixedPointGraphTraversal"
; ";"
import_declaration (+22 nodes collapsed)
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "jscomp"
. "."
identifier "graph"
. "."
identifier "LinkedDirectedGraph"
; ";"
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
identifier "java"
. "."
identifier "util"
. "."
identifier "Collection"
; ";"
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 "Map"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "Set"
; ";"
block_comment "/**\n * Compiler pass that computes function purity. A funct"...
class_declaration
class "class"
identifier "PureFunctionIdentifier"
super_interfaces
implements "implements"
type_list
type_identifier "CompilerPass"
class_body
{ "{"
field_declaration (+25 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 "DefinitionProvider"
variable_declarator
identifier "definitionProvider"
; ";"
line_comment "// Function node -> function side effects map"
field_declaration
modifiers
private "private"
final "final"
generic_type
type_identifier "Map"
type_arguments
< "<"
type_identifier "Node"
, ","
type_identifier "FunctionInformation"
> ">"
variable_declarator
identifier "functionSideEffectMap"
; ";"
line_comment "// List of all function call sites; used to iterate in markP"...
field_declaration
modifiers
private "private"
final "final"
generic_type
type_identifier "List"
type_arguments
< "<"
type_identifier "Node"
> ">"
variable_declarator
identifier "allFunctionCalls"
; ";"
line_comment "// Externs and ast tree root, for use in getDebugReport. Th"...
line_comment "// fields are null until process is called."
field_declaration
modifiers
private "private"
type_identifier "Node"
variable_declarator
identifier "externs"
; ";"
field_declaration
modifiers
private "private"
type_identifier "Node"
variable_declarator
identifier "root"
; ";"
constructor_declaration (+83 nodes collapsed)
method_declaration (+130 nodes collapsed)
block_comment "/**\n * Compute debug report that includes:\n * - List of"...
method_declaration (+452 nodes collapsed)
block_comment "/**\n * Query the DefinitionProvider for the list of defini"...
method_declaration
modifiers
private "private"
static "static"
generic_type
type_identifier "Collection"
type_arguments
< "<"
type_identifier "Definition"
> ">"
identifier "getCallableDefinitions"
formal_parameters
( "("
formal_parameter
type_identifier "DefinitionProvider"
identifier "definitionProvider"
, ","
formal_parameter
type_identifier "Node"
identifier "name"
) ")"
block
{ "{"
local_variable_declaration
generic_type
type_identifier "List"
type_arguments
< "<"
type_identifier "Definition"
> ">"
variable_declarator
identifier "result"
= "="
method_invocation
identifier "Lists"
. "."
identifier "newArrayList"
argument_list
( "("
) ")"
; ";"
if_statement
if "if"
parenthesized_expression
( "("
binary_expression
unary_expression
! "!"
method_invocation
identifier "NodeUtil"
. "."
identifier "isGetProp"
argument_list
( "("
identifier "name"
) ")"
&& "&&"
unary_expression
! "!"
method_invocation
identifier "NodeUtil"
. "."
identifier "isName"
argument_list
( "("
identifier "name"
) ")"
) ")"
block
{ "{"
return_statement all 1:2
return "return" all 1:2
null_literal "null" all 1:2
; ";" all 1:2
} "}"
local_variable_declaration
generic_type
type_identifier "Collection"
type_arguments
< "<"
type_identifier "Definition"
> ">"
variable_declarator
identifier "decls"
= "="
method_invocation
identifier "definitionProvider"
. "."
identifier "getDefinitionsReferencedAt"
argument_list
( "("
identifier "name"
) ")"
; ";"
if_statement
if "if"
parenthesized_expression
( "("
binary_expression
identifier "decls"
== "=="
null_literal "null"
) ")"
block
{ "{"
return_statement
return "return"
null_literal "null"
; ";"
} "}"
enhanced_for_statement (+67 nodes collapsed)
return_statement
return "return"
identifier "result"
; ";"
} "}"
block_comment "/**\n * Propagate side effect information by building a gra"...
method_declaration (+310 nodes collapsed)
block_comment "/**\n * Set no side effect property at pure-function call s"...
method_declaration (+208 nodes collapsed)
block_comment "/**\n * Gather list of functions, functions with @nosideeff"...
class_declaration (+1011 nodes collapsed)
block_comment "/**\n * Callback that propagates side effect information ac"...
class_declaration (+309 nodes collapsed)
block_comment "/**\n * Analyze a call site and extract the node that will "...
method_declaration (+133 nodes collapsed)
block_comment "/**\n * Keeps track of a function's known side effects by t"...
class_declaration (+611 nodes collapsed)
} "}"

After

program
block_comment "/*\n * Copyright 2009 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 "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
identifier "com"
. "."
identifier "google"
. "."
identifier "common"
. "."
identifier "collect"
. "."
identifier "Maps"
; ";"
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 "DefinitionsRemover"
. "."
identifier "Definition"
; ";"
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
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 "graph"
. "."
identifier "DiGraph"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "jscomp"
. "."
identifier "graph"
. "."
identifier "FixedPointGraphTraversal"
; ";"
import_declaration (+22 nodes collapsed)
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "jscomp"
. "."
identifier "graph"
. "."
identifier "LinkedDirectedGraph"
; ";"
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
identifier "java"
. "."
identifier "util"
. "."
identifier "Collection"
; ";"
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 "Map"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "Set"
; ";"
block_comment "/**\n * Compiler pass that computes function purity. A funct"...
class_declaration
class "class"
identifier "PureFunctionIdentifier"
super_interfaces
implements "implements"
type_list
type_identifier "CompilerPass"
class_body
{ "{"
field_declaration (+25 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 "DefinitionProvider"
variable_declarator
identifier "definitionProvider"
; ";"
line_comment "// Function node -> function side effects map"
field_declaration
modifiers
private "private"
final "final"
generic_type
type_identifier "Map"
type_arguments
< "<"
type_identifier "Node"
, ","
type_identifier "FunctionInformation"
> ">"
variable_declarator
identifier "functionSideEffectMap"
; ";"
line_comment "// List of all function call sites; used to iterate in markP"...
field_declaration
modifiers
private "private"
final "final"
generic_type
type_identifier "List"
type_arguments
< "<"
type_identifier "Node"
> ">"
variable_declarator
identifier "allFunctionCalls"
; ";"
line_comment "// Externs and ast tree root, for use in getDebugReport. Th"...
line_comment "// fields are null until process is called."
field_declaration
modifiers
private "private"
type_identifier "Node"
variable_declarator
identifier "externs"
; ";"
field_declaration
modifiers
private "private"
type_identifier "Node"
variable_declarator
identifier "root"
; ";"
constructor_declaration (+83 nodes collapsed)
method_declaration (+130 nodes collapsed)
block_comment "/**\n * Compute debug report that includes:\n * - List of"...
method_declaration (+452 nodes collapsed)
block_comment "/**\n * Query the DefinitionProvider for the list of defini"...
method_declaration
modifiers
private "private"
static "static"
generic_type
type_identifier "Collection"
type_arguments
< "<"
type_identifier "Definition"
> ">"
identifier "getCallableDefinitions"
formal_parameters
( "("
formal_parameter
type_identifier "DefinitionProvider"
identifier "definitionProvider"
, ","
formal_parameter
type_identifier "Node"
identifier "name"
) ")"
block
{ "{"
if_statement
if "if"
parenthesized_expression
( "("
binary_expression
method_invocation
identifier "NodeUtil"
. "."
identifier "isGetProp"
argument_list
( "("
identifier "name"
) ")"
|| "||"
method_invocation
identifier "NodeUtil"
. "."
identifier "isName"
argument_list
( "("
identifier "name"
) ")"
) ")"
block
{ "{"
local_variable_declaration
generic_type
type_identifier "List"
type_arguments
< "<"
type_identifier "Definition"
> ">"
variable_declarator
identifier "result"
= "="
method_invocation
identifier "Lists"
. "."
identifier "newArrayList"
argument_list
( "("
) ")"
; ";"
local_variable_declaration
generic_type
type_identifier "Collection"
type_arguments
< "<"
type_identifier "Definition"
> ">"
variable_declarator
identifier "decls"
= "="
method_invocation
identifier "definitionProvider"
. "."
identifier "getDefinitionsReferencedAt"
argument_list
( "("
identifier "name"
) ")"
; ";"
if_statement
if "if"
parenthesized_expression
( "("
binary_expression
identifier "decls"
== "=="
null_literal "null"
) ")"
block
{ "{"
return_statement
return "return"
null_literal "null"
; ";"
} "}"
enhanced_for_statement (+67 nodes collapsed)
return_statement
return "return"
identifier "result"
; ";"
} "}"
else "else"
if_statement
if "if"
parenthesized_expression
( "("
binary_expression
binary_expression
method_invocation
identifier "name"
. "."
identifier "getType"
argument_list
( "("
) ")"
== "=="
field_access
identifier "Token"
. "."
identifier "OR"
|| "||"
binary_expression
method_invocation
identifier "name"
. "."
identifier "getType"
argument_list
( "("
) ")"
== "=="
field_access
identifier "Token"
. "."
identifier "HOOK"
) ")"
block
{ "{"
local_variable_declaration
type_identifier "Node"
variable_declarator
identifier "firstVal"
; ";"
if_statement
if "if"
parenthesized_expression
( "("
binary_expression
method_invocation
identifier "name"
. "."
identifier "getType"
argument_list
( "("
) ")"
== "=="
field_access
identifier "Token"
. "."
identifier "HOOK"
) ")"
block
{ "{"
expression_statement
assignment_expression
identifier "firstVal"
= "="
method_invocation
method_invocation
identifier "name"
. "."
identifier "getFirstChild"
argument_list
( "("
) ")"
. "."
identifier "getNext"
argument_list
( "("
) ")"
; ";"
} "}"
else "else"
block
{ "{"
expression_statement
assignment_expression
identifier "firstVal"
= "="
method_invocation
identifier "name"
. "."
identifier "getFirstChild"
argument_list
( "("
) ")"
; ";"
} "}"
local_variable_declaration
generic_type
type_identifier "Collection"
type_arguments
< "<"
type_identifier "Definition"
> ">"
variable_declarator
identifier "defs1"
= "="
method_invocation
identifier "getCallableDefinitions"
argument_list
( "("
identifier "definitionProvider"
, ","
identifier "firstVal"
) ")"
; ";"
local_variable_declaration
generic_type
type_identifier "Collection"
type_arguments
< "<"
type_identifier "Definition"
> ">"
variable_declarator
identifier "defs2"
= "="
method_invocation
identifier "getCallableDefinitions"
argument_list
( "("
identifier "definitionProvider"
, ","
method_invocation
identifier "firstVal"
. "."
identifier "getNext"
argument_list
( "("
) ")"
) ")"
; ";"
if_statement
if "if"
parenthesized_expression
( "("
binary_expression
binary_expression
identifier "defs1"
!= "!="
null_literal "null"
&& "&&"
binary_expression
identifier "defs2"
!= "!="
null_literal "null"
) ")"
block
{ "{"
expression_statement
method_invocation
identifier "defs1"
. "."
identifier "addAll"
argument_list
( "("
identifier "defs2"
) ")"
; ";"
return_statement
return "return"
identifier "defs1"
; ";"
} "}"
else "else"
block
{ "{"
return_statement all 1:2
return "return" all 1:2
null_literal "null" all 1:2
; ";" all 1:2
} "}"
} "}"
else "else"
block
{ "{"
return_statement all 1:2
return "return" all 1:2
null_literal "null" all 1:2
; ";" all 1:2
} "}"
} "}"
block_comment "/**\n * Propagate side effect information by building a gra"...
method_declaration (+310 nodes collapsed)
block_comment "/**\n * Set no side effect property at pure-function call s"...
method_declaration (+208 nodes collapsed)
block_comment "/**\n * Gather list of functions, functions with @nosideeff"...
class_declaration (+1011 nodes collapsed)
block_comment "/**\n * Callback that propagates side effect information ac"...
class_declaration (+309 nodes collapsed)
block_comment "/**\n * Analyze a call site and extract the node that will "...
method_declaration (+133 nodes collapsed)
block_comment "/**\n * Keeps track of a function's known side effects by t"...
class_declaration (+611 nodes collapsed)
} "}"