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–119 unchanged (119 lines)
120 }
121
122 int visits = 0;
123 do {
124 Node c = node.getFirstChild();
125 while(c != null) {
126 traverse(c);
127 Node next = c.getNext();
128 c = next;
129 }
130
131 visit(node);
132 visits++;
133
…lines 134–212 unchanged (79 lines)

After

…lines 1–119 unchanged (119 lines)
120 }
121
122 int visits = 0;
123 do {
124 Node c = node.getFirstChild();
125 while(c != null) {
126 Node next = c.getNext();
127 traverse(c);
128 c = next;
129 }
130
131 visit(node);
132 visits++;
133
…lines 134–212 unchanged (79 lines)

Before

program
block_comment "/*\n * Copyright 2010 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 "common"
. "."
identifier "collect"
. "."
identifier "Lists"
; ";"
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
identifier "java"
. "."
identifier "util"
. "."
identifier "ArrayList"
; ";"
block_comment "/**\n * A compiler pass to run various peephole optimizations"...
class_declaration
class "class"
identifier "PeepholeOptimizationsPass"
super_interfaces
implements "implements"
type_list
type_identifier "CompilerPass"
class_body
{ "{"
field_declaration
modifiers
private "private"
type_identifier "AbstractCompiler"
variable_declarator
identifier "compiler"
; ";"
line_comment "// Use an array here for faster iteration compared to Immuta"...
field_declaration
modifiers
private "private"
final "final"
array_type
type_identifier "AbstractPeepholeOptimization"
dimensions
[ "["
] "]"
variable_declarator
identifier "peepholeOptimizations"
; ";"
line_comment "// Track whether the a scope has been modified so that it ca"...
line_comment "// immediately."
field_declaration
modifiers
private "private"
type_identifier "StateStack"
variable_declarator
identifier "traversalState"
= "="
object_creation_expression
new "new"
type_identifier "StateStack"
argument_list
( "("
) ")"
; ";"
class_declaration (+55 nodes collapsed)
class_declaration (+163 nodes collapsed)
class_declaration (+41 nodes collapsed)
block_comment "/**\n * Creates a peephole optimization pass that runs the "...
constructor_declaration (+35 nodes collapsed)
method_declaration
modifiers
public "public"
type_identifier "AbstractCompiler"
identifier "getCompiler"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
identifier "compiler"
; ";"
} "}"
method_declaration (+75 nodes collapsed)
method_declaration
modifiers
private "private"
void_type "void"
identifier "traverse"
formal_parameters
( "("
formal_parameter
type_identifier "Node"
identifier "node"
) ")"
block
{ "{"
line_comment "// The goal here is to avoid retraversing"
line_comment "// the entire AST to catch newly created opportunities."
line_comment "// So we track whether a \"unit of code\" has changed,"
line_comment "// and revisit immediately."
if_statement
if "if"
parenthesized_expression
( "("
unary_expression
! "!"
method_invocation
identifier "shouldVisit"
argument_list
( "("
identifier "node"
) ")"
) ")"
block
{ "{"
return_statement
return "return"
; ";"
} "}"
local_variable_declaration
integral_type
int "int"
variable_declarator
identifier "visits"
= "="
decimal_integer_literal "0"
; ";"
do_statement
do "do"
block
{ "{"
local_variable_declaration
type_identifier "Node"
variable_declarator
identifier "c"
= "="
method_invocation
identifier "node"
. "."
identifier "getFirstChild"
argument_list
( "("
) ")"
; ";"
while_statement
while "while"
parenthesized_expression
( "("
binary_expression
identifier "c"
!= "!="
null_literal "null"
) ")"
block
{ "{"
expression_statement
method_invocation
identifier "traverse"
argument_list
( "("
identifier "c"
) ")"
; ";"
local_variable_declaration
type_identifier "Node"
variable_declarator
identifier "next"
= "="
method_invocation
identifier "c"
. "."
identifier "getNext"
argument_list
( "("
) ")"
; ";"
expression_statement
assignment_expression
identifier "c"
= "="
identifier "next"
; ";"
} "}"
expression_statement
method_invocation
identifier "visit"
argument_list
( "("
identifier "node"
) ")"
; ";"
expression_statement
update_expression
identifier "visits"
++ "++"
; ";"
expression_statement
method_invocation
identifier "Preconditions"
. "."
identifier "checkState"
argument_list
( "("
binary_expression
identifier "visits"
< "<"
decimal_integer_literal "10000"
, ","
string_literal
" "\""
string_fragment "too many interations"
" "\""
) ")"
; ";"
} "}"
while "while"
parenthesized_expression
( "("
method_invocation
identifier "shouldRetraverse"
argument_list
( "("
identifier "node"
) ")"
) ")"
; ";"
expression_statement
method_invocation
identifier "exitNode"
argument_list
( "("
identifier "node"
) ")"
; ";"
} "}"
method_declaration (+105 nodes collapsed)
method_declaration (+82 nodes collapsed)
method_declaration (+47 nodes collapsed)
method_declaration (+109 nodes collapsed)
block_comment "/**\n * Make sure that all the optimizations have the curre"...
method_declaration (+32 nodes collapsed)
method_declaration (+32 nodes collapsed)
} "}"

After

program
block_comment "/*\n * Copyright 2010 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 "common"
. "."
identifier "collect"
. "."
identifier "Lists"
; ";"
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
identifier "java"
. "."
identifier "util"
. "."
identifier "ArrayList"
; ";"
block_comment "/**\n * A compiler pass to run various peephole optimizations"...
class_declaration
class "class"
identifier "PeepholeOptimizationsPass"
super_interfaces
implements "implements"
type_list
type_identifier "CompilerPass"
class_body
{ "{"
field_declaration
modifiers
private "private"
type_identifier "AbstractCompiler"
variable_declarator
identifier "compiler"
; ";"
line_comment "// Use an array here for faster iteration compared to Immuta"...
field_declaration
modifiers
private "private"
final "final"
array_type
type_identifier "AbstractPeepholeOptimization"
dimensions
[ "["
] "]"
variable_declarator
identifier "peepholeOptimizations"
; ";"
line_comment "// Track whether the a scope has been modified so that it ca"...
line_comment "// immediately."
field_declaration
modifiers
private "private"
type_identifier "StateStack"
variable_declarator
identifier "traversalState"
= "="
object_creation_expression
new "new"
type_identifier "StateStack"
argument_list
( "("
) ")"
; ";"
class_declaration (+55 nodes collapsed)
class_declaration (+163 nodes collapsed)
class_declaration (+41 nodes collapsed)
block_comment "/**\n * Creates a peephole optimization pass that runs the "...
constructor_declaration (+35 nodes collapsed)
method_declaration
modifiers
public "public"
type_identifier "AbstractCompiler"
identifier "getCompiler"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
identifier "compiler"
; ";"
} "}"
method_declaration (+75 nodes collapsed)
method_declaration
modifiers
private "private"
void_type "void"
identifier "traverse"
formal_parameters
( "("
formal_parameter
type_identifier "Node"
identifier "node"
) ")"
block
{ "{"
line_comment "// The goal here is to avoid retraversing"
line_comment "// the entire AST to catch newly created opportunities."
line_comment "// So we track whether a \"unit of code\" has changed,"
line_comment "// and revisit immediately."
if_statement
if "if"
parenthesized_expression
( "("
unary_expression
! "!"
method_invocation
identifier "shouldVisit"
argument_list
( "("
identifier "node"
) ")"
) ")"
block
{ "{"
return_statement
return "return"
; ";"
} "}"
local_variable_declaration
integral_type
int "int"
variable_declarator
identifier "visits"
= "="
decimal_integer_literal "0"
; ";"
do_statement
do "do"
block
{ "{"
local_variable_declaration
type_identifier "Node"
variable_declarator
identifier "c"
= "="
method_invocation
identifier "node"
. "."
identifier "getFirstChild"
argument_list
( "("
) ")"
; ";"
while_statement
while "while"
parenthesized_expression
( "("
binary_expression
identifier "c"
!= "!="
null_literal "null"
) ")"
block
{ "{"
local_variable_declaration
type_identifier "Node"
variable_declarator
identifier "next"
= "="
method_invocation
identifier "c"
. "."
identifier "getNext"
argument_list
( "("
) ")"
; ";"
expression_statement
method_invocation
identifier "traverse"
argument_list
( "("
identifier "c"
) ")"
; ";"
expression_statement
assignment_expression
identifier "c"
= "="
identifier "next"
; ";"
} "}"
expression_statement
method_invocation
identifier "visit"
argument_list
( "("
identifier "node"
) ")"
; ";"
expression_statement
update_expression
identifier "visits"
++ "++"
; ";"
expression_statement
method_invocation
identifier "Preconditions"
. "."
identifier "checkState"
argument_list
( "("
binary_expression
identifier "visits"
< "<"
decimal_integer_literal "10000"
, ","
string_literal
" "\""
string_fragment "too many interations"
" "\""
) ")"
; ";"
} "}"
while "while"
parenthesized_expression
( "("
method_invocation
identifier "shouldRetraverse"
argument_list
( "("
identifier "node"
) ")"
) ")"
; ";"
expression_statement
method_invocation
identifier "exitNode"
argument_list
( "("
identifier "node"
) ")"
; ";"
} "}"
method_declaration (+105 nodes collapsed)
method_declaration (+82 nodes collapsed)
method_declaration (+47 nodes collapsed)
method_declaration (+109 nodes collapsed)
block_comment "/**\n * Make sure that all the optimizations have the curre"...
method_declaration (+32 nodes collapsed)
method_declaration (+32 nodes collapsed)
} "}"