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–75 unchanged (75 lines)
76 }
77
78 @Override
79 public void process(Node externs, Node root) {
80 NodeTraversal.traverse(compiler, root,
81 new NormalizeStatements(compiler, assertOnChange));
82 removeDuplicateDeclarations(root);
83 if (MAKE_LOCAL_NAMES_UNIQUE) {
84 MakeDeclaredNamesUnique renamer = new MakeDeclaredNamesUnique();
85 NodeTraversal t = new NodeTraversal(compiler, renamer);
86 t.traverseRoots(externs, root);
87 }
88 // It is important that removeDuplicateDeclarations runs after
…lines 89–565 unchanged (477 lines)

After

…lines 1–94 unchanged (94 lines)
95 // function f() {
96 // try {throw 0;} catch(e) {e; /* catch scope 'e'*/}
97 // var e = 1; // f scope 'e'
98 // }
99 // otherwise 'var e = 1' would be rewritten as 'e = 1'.
100 // TODO(johnlenz): Introduce a seperate scope for catch nodes.
101 removeDuplicateDeclarations(root);
102 new PropogateConstantAnnotations(compiler, assertOnChange)
103 .process(externs, root);
104 }
105
106 public static class PropogateConstantAnnotations
107 extends AbstractPostOrderCallback
…lines 108–565 unchanged (458 lines)

Before

program
block_comment "/*\n * Copyright 2008 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
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
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
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 "Map"
; ";"
block_comment "/**\n * The goal with this pass is to simplify the other pass"...
line_comment "// public for ReplaceDebugStringsTest"
class_declaration
class "class"
identifier "Normalize"
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"
; ";"
field_declaration
modifiers
private "private"
final "final"
boolean_type "boolean"
variable_declarator
identifier "assertOnChange"
; ";"
field_declaration
modifiers
private "private"
static "static"
final "final"
boolean_type "boolean"
variable_declarator
identifier "CONVERT_WHILE_TO_FOR"
= "="
true "true"
; ";"
field_declaration
modifiers
static "static"
final "final"
boolean_type "boolean"
variable_declarator
identifier "MAKE_LOCAL_NAMES_UNIQUE"
= "="
true "true"
; ";"
constructor_declaration (+33 nodes collapsed)
method_declaration (+49 nodes collapsed)
method_declaration
modifiers
marker_annotation
@ "@"
identifier "Override"
public "public"
void_type "void"
identifier "process"
formal_parameters
( "("
formal_parameter
type_identifier "Node"
identifier "externs"
, ","
formal_parameter
type_identifier "Node"
identifier "root"
) ")"
block
{ "{"
expression_statement (+22 nodes collapsed)
expression_statement
method_invocation
identifier "removeDuplicateDeclarations"
argument_list
( "("
identifier "root"
) ")"
; ";"
if_statement (+48 nodes collapsed)
line_comment "// It is important that removeDuplicateDeclarations runs aft"...
line_comment "// MakeDeclaredNamesUnique in order for catch block exceptio"...
line_comment "// handled properly. Specifically, catch block exception nam"...
line_comment "// only valid within the catch block, but our currect Scope "...
line_comment "// has no concept of this and includes it in the containing "...
line_comment "// (or global scope). MakeDeclaredNamesUnique makes the catc"...
line_comment "// names unique so that removeDuplicateDeclarations() will p"...
line_comment "// cases where a function scope variable conflict with a exc"...
line_comment "// function f() {"
line_comment "// try {throw 0;} catch(e) {e; /* catch scope 'e'*/}"
line_comment "// var e = 1; // f scope 'e'"
line_comment "// }"
line_comment "// otherwise 'var e = 1' would be rewritten as 'e = 1'."
line_comment "// TODO(johnlenz): Introduce a seperate scope for catch node"...
expression_statement
method_invocation
object_creation_expression
new "new"
type_identifier "PropogateConstantAnnotations"
argument_list
( "("
identifier "compiler"
, ","
identifier "assertOnChange"
) ")"
. "."
identifier "process"
argument_list
( "("
identifier "externs"
, ","
identifier "root"
) ")"
; ";"
} "}"
class_declaration (+372 nodes collapsed)
block_comment "/**\n * Walk the AST tree and verify that constant names ar"...
class_declaration (+585 nodes collapsed)
block_comment "/**\n * Simplify the AST:\n * - VAR declarations split, "...
class_declaration (+1416 nodes collapsed)
block_comment "/**\n * Remove duplicate VAR declarations.\n */"
method_declaration (+73 nodes collapsed)
block_comment "/**\n * ScopeCreator duplicate declaration handler.\n */"
class_declaration (+359 nodes collapsed)
block_comment "/**\n * A simple class that causes scope to be created.\n "...
class_declaration (+117 nodes collapsed)
} "}"

After

program
block_comment "/*\n * Copyright 2008 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
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
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
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 "Map"
; ";"
block_comment "/**\n * The goal with this pass is to simplify the other pass"...
line_comment "// public for ReplaceDebugStringsTest"
class_declaration
class "class"
identifier "Normalize"
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"
; ";"
field_declaration
modifiers
private "private"
final "final"
boolean_type "boolean"
variable_declarator
identifier "assertOnChange"
; ";"
field_declaration
modifiers
private "private"
static "static"
final "final"
boolean_type "boolean"
variable_declarator
identifier "CONVERT_WHILE_TO_FOR"
= "="
true "true"
; ";"
field_declaration
modifiers
static "static"
final "final"
boolean_type "boolean"
variable_declarator
identifier "MAKE_LOCAL_NAMES_UNIQUE"
= "="
true "true"
; ";"
constructor_declaration (+33 nodes collapsed)
method_declaration (+49 nodes collapsed)
method_declaration
modifiers
marker_annotation
@ "@"
identifier "Override"
public "public"
void_type "void"
identifier "process"
formal_parameters
( "("
formal_parameter
type_identifier "Node"
identifier "externs"
, ","
formal_parameter
type_identifier "Node"
identifier "root"
) ")"
block
{ "{"
expression_statement (+22 nodes collapsed)
if_statement (+48 nodes collapsed)
line_comment "// It is important that removeDuplicateDeclarations runs aft"...
line_comment "// MakeDeclaredNamesUnique in order for catch block exceptio"...
line_comment "// handled properly. Specifically, catch block exception nam"...
line_comment "// only valid within the catch block, but our currect Scope "...
line_comment "// has no concept of this and includes it in the containing "...
line_comment "// (or global scope). MakeDeclaredNamesUnique makes the catc"...
line_comment "// names unique so that removeDuplicateDeclarations() will p"...
line_comment "// cases where a function scope variable conflict with a exc"...
line_comment "// function f() {"
line_comment "// try {throw 0;} catch(e) {e; /* catch scope 'e'*/}"
line_comment "// var e = 1; // f scope 'e'"
line_comment "// }"
line_comment "// otherwise 'var e = 1' would be rewritten as 'e = 1'."
line_comment "// TODO(johnlenz): Introduce a seperate scope for catch node"...
expression_statement
method_invocation
identifier "removeDuplicateDeclarations"
argument_list
( "("
identifier "root"
) ")"
; ";"
expression_statement
method_invocation
object_creation_expression
new "new"
type_identifier "PropogateConstantAnnotations"
argument_list
( "("
identifier "compiler"
, ","
identifier "assertOnChange"
) ")"
. "."
identifier "process"
argument_list
( "("
identifier "externs"
, ","
identifier "root"
) ")"
; ";"
} "}"
class_declaration (+372 nodes collapsed)
block_comment "/**\n * Walk the AST tree and verify that constant names ar"...
class_declaration (+585 nodes collapsed)
block_comment "/**\n * Simplify the AST:\n * - VAR declarations split, "...
class_declaration (+1416 nodes collapsed)
block_comment "/**\n * Remove duplicate VAR declarations.\n */"
method_declaration (+73 nodes collapsed)
block_comment "/**\n * ScopeCreator duplicate declaration handler.\n */"
class_declaration (+359 nodes collapsed)
block_comment "/**\n * A simple class that causes scope to be created.\n "...
class_declaration (+117 nodes collapsed)
} "}"