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–205 unchanged (205 lines)
206 private boolean isSafeReplacement(Node node, Node replacement) {
207 // No checks are needed for simple names.
208 if (node.isName()) {
209 return true;
210 }
211 Preconditions.checkArgument(node.isGetProp());
212
213 node = node.getFirstChild();
214 if (node.isName()
215 && isNameAssignedTo(node.getString(), replacement)) {
216 return false;
217 }
218
219 return true;
220 }
…lines 221–244 unchanged (24 lines)

After

…lines 1–206 unchanged (206 lines)
207 // No checks are needed for simple names.
208 if (node.isName()) {
209 return true;
210 }
211 Preconditions.checkArgument(node.isGetProp());
212
213 while (node.isGetProp()) {
214 node = node.getFirstChild();
215 }
216 if (node.isName()
217 && isNameAssignedTo(node.getString(), replacement)) {
218 return false;
219 }
220
221 return true;
…lines 222–246 unchanged (25 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
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 "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"
; ";"
block_comment "/**\n * Tries to chain assignments together.\n *\n * @author ni"...
class_declaration
class "class"
identifier "ExploitAssigns"
superclass
extends "extends"
type_identifier "AbstractPeepholeOptimization"
class_body
{ "{"
method_declaration (+98 nodes collapsed)
block_comment "/**\n * Try to collapse the given assign into subsequent ex"...
method_declaration (+148 nodes collapsed)
block_comment "/**\n * Determines whether we know enough about the given v"...
method_declaration (+94 nodes collapsed)
block_comment "/**\n * Collapse the given assign expression into the expre"...
method_declaration (+533 nodes collapsed)
block_comment "/**\n * Checks name referenced in node to determine if it m"...
method_declaration
modifiers
private "private"
boolean_type "boolean"
identifier "isSafeReplacement"
formal_parameters
( "("
formal_parameter
type_identifier "Node"
identifier "node"
, ","
formal_parameter
type_identifier "Node"
identifier "replacement"
) ")"
block
{ "{"
line_comment "// No checks are needed for simple names."
if_statement
if "if"
parenthesized_expression
( "("
method_invocation
identifier "node"
. "."
identifier "isName"
argument_list
( "("
) ")"
) ")"
block
{ "{"
return_statement
return "return"
true "true"
; ";"
} "}"
expression_statement
method_invocation
identifier "Preconditions"
. "."
identifier "checkArgument"
argument_list
( "("
method_invocation
identifier "node"
. "."
identifier "isGetProp"
argument_list
( "("
) ")"
) ")"
; ";"
expression_statement
assignment_expression
identifier "node"
= "="
method_invocation
identifier "node"
. "."
identifier "getFirstChild"
argument_list
( "("
) ")"
; ";"
if_statement (+35 nodes collapsed)
return_statement
return "return"
true "true"
; ";"
} "}"
block_comment "/**\n * @return Whether name is assigned in the expression "...
method_declaration (+158 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
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 "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"
; ";"
block_comment "/**\n * Tries to chain assignments together.\n *\n * @author ni"...
class_declaration
class "class"
identifier "ExploitAssigns"
superclass
extends "extends"
type_identifier "AbstractPeepholeOptimization"
class_body
{ "{"
method_declaration (+98 nodes collapsed)
block_comment "/**\n * Try to collapse the given assign into subsequent ex"...
method_declaration (+148 nodes collapsed)
block_comment "/**\n * Determines whether we know enough about the given v"...
method_declaration (+94 nodes collapsed)
block_comment "/**\n * Collapse the given assign expression into the expre"...
method_declaration (+533 nodes collapsed)
block_comment "/**\n * Checks name referenced in node to determine if it m"...
method_declaration
modifiers
private "private"
boolean_type "boolean"
identifier "isSafeReplacement"
formal_parameters
( "("
formal_parameter
type_identifier "Node"
identifier "node"
, ","
formal_parameter
type_identifier "Node"
identifier "replacement"
) ")"
block
{ "{"
line_comment "// No checks are needed for simple names."
if_statement
if "if"
parenthesized_expression
( "("
method_invocation
identifier "node"
. "."
identifier "isName"
argument_list
( "("
) ")"
) ")"
block
{ "{"
return_statement
return "return"
true "true"
; ";"
} "}"
expression_statement
method_invocation
identifier "Preconditions"
. "."
identifier "checkArgument"
argument_list
( "("
method_invocation
identifier "node"
. "."
identifier "isGetProp"
argument_list
( "("
) ")"
) ")"
; ";"
while_statement
while "while"
parenthesized_expression
( "("
method_invocation
identifier "node"
. "."
identifier "isGetProp"
argument_list
( "("
) ")"
) ")"
block
{ "{"
expression_statement
assignment_expression
identifier "node"
= "="
method_invocation
identifier "node"
. "."
identifier "getFirstChild"
argument_list
( "("
) ")"
; ";"
} "}"
if_statement (+35 nodes collapsed)
return_statement
return "return"
true "true"
; ";"
} "}"
block_comment "/**\n * @return Whether name is assigned in the expression "...
method_declaration (+158 nodes collapsed)
} "}"