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–84 unchanged (84 lines)
85 if (node.getType() != Token.EXPR_RESULT) {
86 return;
87 }
88
89 Node exprBody = node.getFirstChild();
90 if (!NodeUtil.nodeTypeMayHaveSideEffects(exprBody)
91 ) {
92 changeProxy.replaceWith(parent, node, getSideEffectNodes(exprBody));
93 }
94 }
95
96 /**
97 * Extracts a list of replacement nodes to use.
98 */
99 private List<Node> getSideEffectNodes(Node node) {
…lines 100–136 unchanged (37 lines)

After

…lines 1–84 unchanged (84 lines)
85 if (node.getType() != Token.EXPR_RESULT) {
86 return;
87 }
88
89 Node exprBody = node.getFirstChild();
90 if (!NodeUtil.nodeTypeMayHaveSideEffects(exprBody)
91 || exprBody.getType() == Token.NEW
92 || exprBody.getType() == Token.CALL) {
93 changeProxy.replaceWith(parent, node, getSideEffectNodes(exprBody));
94 }
95 }
96
97 /**
98 * Extracts a list of replacement nodes to use.
99 */
100 private List<Node> getSideEffectNodes(Node node) {
…lines 101–137 unchanged (37 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 "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 "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 "ParallelCompilerPass"
. "."
identifier "Result"
; ";"
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"
; ";"
block_comment "/**\n * Pass that simplifies expression statements by replaci"...
class_declaration
modifiers
final "final"
class "class"
identifier "RemoveConstantExpressions"
super_interfaces
implements "implements"
type_list
type_identifier "CompilerPass"
class_body
{ "{"
field_declaration
modifiers
private "private"
final "final"
type_identifier "AbstractCompiler"
variable_declarator
identifier "compiler"
; ";"
constructor_declaration
identifier "RemoveConstantExpressions"
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 (+63 nodes collapsed)
block_comment "/**\n * Used to simplify expressions by removing subexpress"...
class_declaration
modifiers
static "static"
class "class"
identifier "RemoveConstantRValuesCallback"
superclass
extends "extends"
type_identifier "AbstractPostOrderCallback"
class_body
{ "{"
field_declaration
modifiers
private "private"
final "final"
type_identifier "AstChangeProxy"
variable_declarator
identifier "changeProxy"
; ";"
field_declaration
modifiers
private "private"
final "final"
type_identifier "Result"
variable_declarator
identifier "result"
= "="
object_creation_expression
new "new"
type_identifier "Result"
argument_list
( "("
) ")"
; ";"
block_comment "/**\n * Instantiates AstChangeProxy and registers ChangeL"...
constructor_declaration (+41 nodes collapsed)
method_declaration (+35 nodes collapsed)
block_comment "/**\n * Attempts to replace the input node with a simpler"...
method_declaration
modifiers
private "private"
void_type "void"
identifier "trySimplify"
formal_parameters
( "("
formal_parameter
type_identifier "Node"
identifier "parent"
, ","
formal_parameter
type_identifier "Node"
identifier "node"
) ")"
block
{ "{"
if_statement (+24 nodes collapsed)
local_variable_declaration
type_identifier "Node"
variable_declarator
identifier "exprBody"
= "="
method_invocation
identifier "node"
. "."
identifier "getFirstChild"
argument_list
( "("
) ")"
; ";"
if_statement
if "if"
parenthesized_expression
( "("
unary_expression
! "!"
method_invocation
identifier "NodeUtil"
. "."
identifier "nodeTypeMayHaveSideEffects"
argument_list
( "("
identifier "exprBody"
) ")"
) ")"
block (+22 nodes collapsed)
} "}"
block_comment "/**\n * Extracts a list of replacement nodes to use.\n "...
method_declaration (+124 nodes collapsed)
method_declaration
modifiers
public "public"
type_identifier "Result"
identifier "getResult"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
identifier "result"
; ";"
} "}"
} "}"
block_comment "/**\n * Used to reports code changes to the compiler as the"...
class_declaration (+72 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 "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 "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 "ParallelCompilerPass"
. "."
identifier "Result"
; ";"
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"
; ";"
block_comment "/**\n * Pass that simplifies expression statements by replaci"...
class_declaration
modifiers
final "final"
class "class"
identifier "RemoveConstantExpressions"
super_interfaces
implements "implements"
type_list
type_identifier "CompilerPass"
class_body
{ "{"
field_declaration
modifiers
private "private"
final "final"
type_identifier "AbstractCompiler"
variable_declarator
identifier "compiler"
; ";"
constructor_declaration
identifier "RemoveConstantExpressions"
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 (+63 nodes collapsed)
block_comment "/**\n * Used to simplify expressions by removing subexpress"...
class_declaration
modifiers
static "static"
class "class"
identifier "RemoveConstantRValuesCallback"
superclass
extends "extends"
type_identifier "AbstractPostOrderCallback"
class_body
{ "{"
field_declaration
modifiers
private "private"
final "final"
type_identifier "AstChangeProxy"
variable_declarator
identifier "changeProxy"
; ";"
field_declaration
modifiers
private "private"
final "final"
type_identifier "Result"
variable_declarator
identifier "result"
= "="
object_creation_expression
new "new"
type_identifier "Result"
argument_list
( "("
) ")"
; ";"
block_comment "/**\n * Instantiates AstChangeProxy and registers ChangeL"...
constructor_declaration (+41 nodes collapsed)
method_declaration (+35 nodes collapsed)
block_comment "/**\n * Attempts to replace the input node with a simpler"...
method_declaration
modifiers
private "private"
void_type "void"
identifier "trySimplify"
formal_parameters
( "("
formal_parameter
type_identifier "Node"
identifier "parent"
, ","
formal_parameter
type_identifier "Node"
identifier "node"
) ")"
block
{ "{"
if_statement (+24 nodes collapsed)
local_variable_declaration
type_identifier "Node"
variable_declarator
identifier "exprBody"
= "="
method_invocation
identifier "node"
. "."
identifier "getFirstChild"
argument_list
( "("
) ")"
; ";"
if_statement
if "if"
parenthesized_expression
( "("
binary_expression
binary_expression
unary_expression
! "!"
method_invocation
identifier "NodeUtil"
. "."
identifier "nodeTypeMayHaveSideEffects"
argument_list
( "("
identifier "exprBody"
) ")"
|| "||"
binary_expression
method_invocation
identifier "exprBody"
. "."
identifier "getType"
argument_list
( "("
) ")"
== "=="
field_access
identifier "Token"
. "."
identifier "NEW"
|| "||"
binary_expression
method_invocation
identifier "exprBody"
. "."
identifier "getType"
argument_list
( "("
) ")"
== "=="
field_access
identifier "Token"
. "."
identifier "CALL"
) ")"
block (+22 nodes collapsed)
} "}"
block_comment "/**\n * Extracts a list of replacement nodes to use.\n "...
method_declaration (+124 nodes collapsed)
method_declaration
modifiers
public "public"
type_identifier "Result"
identifier "getResult"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
identifier "result"
; ";"
} "}"
} "}"
block_comment "/**\n * Used to reports code changes to the compiler as the"...
class_declaration (+72 nodes collapsed)
} "}"