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–214 unchanged (214 lines)
215 nameNode.putBooleanProp(Node.IS_CONSTANT_NAME, true);
216 }
217
218 getSynthesizedExternsRoot().addChildToBack(
219 new Node(Token.VAR, nameNode));
220 varsToDeclareInExterns.remove(varName);
221 }
222
223 /**
224 * A check for name references in the externs inputs. These used to prevent
225 * a variable from getting renamed, but no longer have any effect.
226 */
227 private class NameRefInExternsCheck extends AbstractPostOrderCallback {
…lines 228–278 unchanged (51 lines)

After

…lines 1–214 unchanged (214 lines)
215 nameNode.putBooleanProp(Node.IS_CONSTANT_NAME, true);
216 }
217
218 getSynthesizedExternsRoot().addChildToBack(
219 new Node(Token.VAR, nameNode));
220 varsToDeclareInExterns.remove(varName);
221 compiler.reportCodeChange();
222 }
223
224 /**
225 * A check for name references in the externs inputs. These used to prevent
226 * a variable from getting renamed, but no longer have any effect.
227 */
…lines 228–279 unchanged (52 lines)

Before

program
block_comment "/*\n * Copyright 2004 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 "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 "NodeTraversal"
. "."
identifier "AbstractPostOrderCallback"
; ";"
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 "Set"
; ";"
block_comment "/**\n * Checks that all variables are declared, that file-pri"...
class_declaration
class "class"
identifier "VarCheck"
superclass
extends "extends"
type_identifier "AbstractPostOrderCallback"
super_interfaces
implements "implements"
type_list
type_identifier "CompilerPass"
class_body
{ "{"
field_declaration (+25 nodes collapsed)
field_declaration (+31 nodes collapsed)
field_declaration (+31 nodes collapsed)
field_declaration (+31 nodes collapsed)
field_declaration (+25 nodes collapsed)
field_declaration (+25 nodes collapsed)
field_declaration (+25 nodes collapsed)
field_declaration
modifiers
private "private"
type_identifier "CompilerInput"
variable_declarator
identifier "synthesizedExternsInput"
= "="
null_literal "null"
; ";"
field_declaration
modifiers
private "private"
type_identifier "Node"
variable_declarator
identifier "synthesizedExternsRoot"
= "="
null_literal "null"
; ";"
line_comment "// Vars that still need to be declared in externs. These wil"...
line_comment "// at the end of the pass, or when we see the equivalent var"...
line_comment "// in the normal code."
field_declaration
modifiers
private "private"
generic_type
type_identifier "Set"
type_arguments
< "<"
type_identifier "String"
> ">"
variable_declarator
identifier "varsToDeclareInExterns"
= "="
method_invocation
identifier "Sets"
. "."
identifier "newHashSet"
argument_list
( "("
) ")"
; ";"
field_declaration
modifiers
private "private"
final "final"
type_identifier "AbstractCompiler"
variable_declarator
identifier "compiler"
; ";"
line_comment "// Whether this is the post-processing sanity check."
field_declaration
modifiers
private "private"
final "final"
boolean_type "boolean"
variable_declarator
identifier "sanityCheck"
; ";"
line_comment "// Whether extern checks emit error."
field_declaration
modifiers
private "private"
boolean_type "boolean"
variable_declarator
identifier "strictExternCheck"
; ";"
constructor_declaration
identifier "VarCheck"
formal_parameters
( "("
formal_parameter
type_identifier "AbstractCompiler"
identifier "compiler"
) ")"
constructor_body
{ "{"
explicit_constructor_invocation
this "this"
argument_list
( "("
identifier "compiler"
, ","
false "false"
) ")"
; ";"
} "}"
constructor_declaration (+70 nodes collapsed)
method_declaration (+96 nodes collapsed)
method_declaration (+649 nodes collapsed)
block_comment "/**\n * Create a new variable in a synthetic script. This w"...
method_declaration
modifiers
private "private"
void_type "void"
identifier "createSynthesizedExternVar"
formal_parameters
( "("
formal_parameter
type_identifier "String"
identifier "varName"
) ")"
block
{ "{"
local_variable_declaration
type_identifier "Node"
variable_declarator
identifier "nameNode"
= "="
method_invocation
identifier "Node"
. "."
identifier "newString"
argument_list
( "("
field_access
identifier "Token"
. "."
identifier "NAME"
, ","
identifier "varName"
) ")"
; ";"
line_comment "// Mark the variable as constant if it matches the coding co"...
line_comment "// for constant vars."
line_comment "// NOTE(nicksantos): honestly, i'm not sure how much this ma"...
line_comment "// AFAIK, all people who use the CONST coding convention als"...
line_comment "// compile with undeclaredVars as errors. We have some test"
line_comment "// cases for this configuration though, and it makes them ha"...
if_statement (+37 nodes collapsed)
expression_statement (+25 nodes collapsed)
expression_statement
method_invocation
identifier "varsToDeclareInExterns"
. "."
identifier "remove"
argument_list
( "("
identifier "varName"
) ")"
; ";"
} "}"
block_comment "/**\n * A check for name references in the externs inputs. "...
class_declaration (+301 nodes collapsed)
block_comment "/** Lazily create a \"new\" externs input for undeclared varia"...
method_declaration (+43 nodes collapsed)
block_comment "/** Lazily create a \"new\" externs root for undeclared variab"...
method_declaration (+51 nodes collapsed)
} "}"

After

program
block_comment "/*\n * Copyright 2004 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 "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 "NodeTraversal"
. "."
identifier "AbstractPostOrderCallback"
; ";"
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 "Set"
; ";"
block_comment "/**\n * Checks that all variables are declared, that file-pri"...
class_declaration
class "class"
identifier "VarCheck"
superclass
extends "extends"
type_identifier "AbstractPostOrderCallback"
super_interfaces
implements "implements"
type_list
type_identifier "CompilerPass"
class_body
{ "{"
field_declaration (+25 nodes collapsed)
field_declaration (+31 nodes collapsed)
field_declaration (+31 nodes collapsed)
field_declaration (+31 nodes collapsed)
field_declaration (+25 nodes collapsed)
field_declaration (+25 nodes collapsed)
field_declaration (+25 nodes collapsed)
field_declaration
modifiers
private "private"
type_identifier "CompilerInput"
variable_declarator
identifier "synthesizedExternsInput"
= "="
null_literal "null"
; ";"
field_declaration
modifiers
private "private"
type_identifier "Node"
variable_declarator
identifier "synthesizedExternsRoot"
= "="
null_literal "null"
; ";"
line_comment "// Vars that still need to be declared in externs. These wil"...
line_comment "// at the end of the pass, or when we see the equivalent var"...
line_comment "// in the normal code."
field_declaration
modifiers
private "private"
generic_type
type_identifier "Set"
type_arguments
< "<"
type_identifier "String"
> ">"
variable_declarator
identifier "varsToDeclareInExterns"
= "="
method_invocation
identifier "Sets"
. "."
identifier "newHashSet"
argument_list
( "("
) ")"
; ";"
field_declaration
modifiers
private "private"
final "final"
type_identifier "AbstractCompiler"
variable_declarator
identifier "compiler"
; ";"
line_comment "// Whether this is the post-processing sanity check."
field_declaration
modifiers
private "private"
final "final"
boolean_type "boolean"
variable_declarator
identifier "sanityCheck"
; ";"
line_comment "// Whether extern checks emit error."
field_declaration
modifiers
private "private"
boolean_type "boolean"
variable_declarator
identifier "strictExternCheck"
; ";"
constructor_declaration
identifier "VarCheck"
formal_parameters
( "("
formal_parameter
type_identifier "AbstractCompiler"
identifier "compiler"
) ")"
constructor_body
{ "{"
explicit_constructor_invocation
this "this"
argument_list
( "("
identifier "compiler"
, ","
false "false"
) ")"
; ";"
} "}"
constructor_declaration (+70 nodes collapsed)
method_declaration (+96 nodes collapsed)
method_declaration (+649 nodes collapsed)
block_comment "/**\n * Create a new variable in a synthetic script. This w"...
method_declaration
modifiers
private "private"
void_type "void"
identifier "createSynthesizedExternVar"
formal_parameters
( "("
formal_parameter
type_identifier "String"
identifier "varName"
) ")"
block
{ "{"
local_variable_declaration
type_identifier "Node"
variable_declarator
identifier "nameNode"
= "="
method_invocation
identifier "Node"
. "."
identifier "newString"
argument_list
( "("
field_access
identifier "Token"
. "."
identifier "NAME"
, ","
identifier "varName"
) ")"
; ";"
line_comment "// Mark the variable as constant if it matches the coding co"...
line_comment "// for constant vars."
line_comment "// NOTE(nicksantos): honestly, i'm not sure how much this ma"...
line_comment "// AFAIK, all people who use the CONST coding convention als"...
line_comment "// compile with undeclaredVars as errors. We have some test"
line_comment "// cases for this configuration though, and it makes them ha"...
if_statement (+37 nodes collapsed)
expression_statement (+25 nodes collapsed)
expression_statement
method_invocation
identifier "varsToDeclareInExterns"
. "."
identifier "remove"
argument_list
( "("
identifier "varName"
) ")"
; ";"
expression_statement
method_invocation
identifier "compiler"
. "."
identifier "reportCodeChange"
argument_list
( "("
) ")"
; ";"
} "}"
block_comment "/**\n * A check for name references in the externs inputs. "...
class_declaration (+301 nodes collapsed)
block_comment "/** Lazily create a \"new\" externs input for undeclared varia"...
method_declaration (+43 nodes collapsed)
block_comment "/** Lazily create a \"new\" externs root for undeclared variab"...
method_declaration (+51 nodes collapsed)
} "}"