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–782 unchanged (782 lines)
783 replacementNode = createDeclarationNode();
784 if (firstModule == minimumModule) {
785 firstNode.getParent().addChildBefore(replacementNode, firstNode);
786 } else {
787 // In this case, the name was implicitly provided by two independent
788 // modules. We need to move this code up to a common module.
789 int indexOfDot = namespace.indexOf('.');
790 if (indexOfDot == -1) {
791 // Any old place is fine.
792 compiler.getNodeForCodeInsertion(minimumModule)
793 .addChildToBack(replacementNode);
794 } else {
795 // Add it after the parent namespace.
…lines 796–917 unchanged (122 lines)

After

…lines 1–782 unchanged (782 lines)
783 replacementNode = createDeclarationNode();
784 if (firstModule == minimumModule) {
785 firstNode.getParent().addChildBefore(replacementNode, firstNode);
786 } else {
787 // In this case, the name was implicitly provided by two independent
788 // modules. We need to move this code up to a common module.
789 int indexOfDot = namespace.lastIndexOf('.');
790 if (indexOfDot == -1) {
791 // Any old place is fine.
792 compiler.getNodeForCodeInsertion(minimumModule)
793 .addChildToBack(replacementNode);
794 } else {
795 // Add it after the parent namespace.
…lines 796–917 unchanged (122 lines)

Before

program
block_comment "/*\n * Copyright 2006 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
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 "List"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "Map"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "Set"
; ";"
block_comment "/**\n * Replaces goog.provide calls, removes goog.require cal"...
class_declaration
class "class"
identifier "ProcessClosurePrimitives"
superclass
extends "extends"
type_identifier "AbstractPostOrderCallback"
super_interfaces
implements "implements"
type_list
type_identifier "CompilerPass"
class_body
{ "{"
field_declaration (+29 nodes collapsed)
field_declaration (+29 nodes collapsed)
field_declaration (+29 nodes collapsed)
field_declaration (+29 nodes collapsed)
field_declaration (+28 nodes collapsed)
field_declaration (+29 nodes collapsed)
field_declaration (+29 nodes collapsed)
field_declaration (+28 nodes collapsed)
field_declaration (+35 nodes collapsed)
field_declaration (+25 nodes collapsed)
field_declaration (+25 nodes collapsed)
block_comment "/** The root Closure namespace */"
field_declaration
modifiers
static "static"
final "final"
type_identifier "String"
variable_declarator
identifier "GOOG"
= "="
string_literal
" "\""
string_fragment "goog"
" "\""
; ";"
field_declaration
modifiers
private "private"
final "final"
type_identifier "AbstractCompiler"
variable_declarator
identifier "compiler"
; ";"
field_declaration
modifiers
private "private"
final "final"
type_identifier "JSModuleGraph"
variable_declarator
identifier "moduleGraph"
; ";"
line_comment "// The goog.provides must be processed in a deterministic or"...
field_declaration (+23 nodes collapsed)
field_declaration (+21 nodes collapsed)
field_declaration (+21 nodes collapsed)
field_declaration
modifiers
private "private"
final "final"
type_identifier "CheckLevel"
variable_declarator
identifier "requiresLevel"
; ";"
field_declaration
modifiers
private "private"
final "final"
boolean_type "boolean"
variable_declarator
identifier "rewriteNewDateGoogNow"
; ";"
constructor_declaration (+87 nodes collapsed)
method_declaration
generic_type
type_identifier "Set"
type_arguments
< "<"
type_identifier "String"
> ">"
identifier "getExportedVariableNames"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
identifier "exportedVariables"
; ";"
} "}"
method_declaration (+185 nodes collapsed)
method_declaration (+836 nodes collapsed)
block_comment "/**\n * Handles a goog.require call.\n */"
method_declaration (+294 nodes collapsed)
block_comment "/**\n * Handles a goog.provide call.\n */"
method_declaration (+223 nodes collapsed)
block_comment "/**\n * Handles a candidate definition for a goog.provided "...
method_declaration (+238 nodes collapsed)
block_comment "/**\n * Processes the base class call.\n */"
method_declaration (+676 nodes collapsed)
block_comment "/**\n * Returns the qualified name node of the function who"...
method_declaration (+173 nodes collapsed)
block_comment "/** Reports an incorrect use of super-method calling. */"
method_declaration (+43 nodes collapsed)
block_comment "/**\n * Processes the output of processed-provide from a pr"...
method_declaration (+208 nodes collapsed)
block_comment "/**\n * Processes a call to goog.setCssNameMapping(). Eithe"...
method_declaration (+375 nodes collapsed)
block_comment "/**\n * Try to simplify \"new Date(goog.now())\" to \"new Date"...
method_declaration (+252 nodes collapsed)
block_comment "/**\n * Verifies that a provide method call has exactly one"...
method_declaration (+121 nodes collapsed)
block_comment "/**\n * Verifies that a method call has exactly one argumen"...
method_declaration (+40 nodes collapsed)
block_comment "/**\n * Verifies that a method call has exactly one argumen"...
method_declaration (+149 nodes collapsed)
block_comment "/**\n * Registers ProvidedNames for prefix namespaces if th"...
method_declaration (+152 nodes collapsed)
line_comment "// ---------------------------------------------------------"...
block_comment "/**\n * Information required to replace a goog.provide call"...
class_declaration
modifiers
private "private"
class "class"
identifier "ProvidedName"
class_body
{ "{"
field_declaration
modifiers
private "private"
final "final"
type_identifier "String"
variable_declarator
identifier "namespace"
; ";"
line_comment "// The node and module where the call was explicitly or impl"...
line_comment "// goog.provided."
field_declaration
modifiers
private "private"
final "final"
type_identifier "Node"
variable_declarator
identifier "firstNode"
; ";"
field_declaration
modifiers
private "private"
final "final"
type_identifier "JSModule"
variable_declarator
identifier "firstModule"
; ";"
line_comment "// The node where the call was explicitly goog.provided. May"...
line_comment "// if the namespace is always provided implicitly."
field_declaration
modifiers
private "private"
type_identifier "Node"
variable_declarator
identifier "explicitNode"
= "="
null_literal "null"
; ";"
field_declaration
modifiers
private "private"
type_identifier "JSModule"
variable_declarator
identifier "explicitModule"
= "="
null_literal "null"
; ";"
line_comment "// The candidate definition."
field_declaration
modifiers
private "private"
type_identifier "Node"
variable_declarator
identifier "candidateDefinition"
= "="
null_literal "null"
; ";"
line_comment "// The minimum module where the provide must appear."
field_declaration
modifiers
private "private"
type_identifier "JSModule"
variable_declarator
identifier "minimumModule"
= "="
null_literal "null"
; ";"
line_comment "// The replacement declaration."
field_declaration
modifiers
private "private"
type_identifier "Node"
variable_declarator
identifier "replacementNode"
= "="
null_literal "null"
; ";"
constructor_declaration (+86 nodes collapsed)
block_comment "/**\n * Add an implicit or explicit provide.\n */"
method_declaration (+79 nodes collapsed)
method_declaration
boolean_type "boolean"
identifier "isExplicitlyProvided"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
binary_expression
identifier "explicitNode"
!= "!="
null_literal "null"
; ";"
} "}"
block_comment "/**\n * Record function declaration, variable declaration"...
method_declaration (+108 nodes collapsed)
method_declaration (+84 nodes collapsed)
block_comment "/**\n * Replace the provide statement.\n *\n * If w"...
method_declaration
void_type "void"
identifier "replace"
formal_parameters
( "("
) ")"
block
{ "{"
if_statement (+22 nodes collapsed)
line_comment "// Handle the case where there is a duplicate definition for"...
line_comment "// provided symbol."
if_statement
if "if"
parenthesized_expression
( "("
binary_expression
binary_expression
identifier "candidateDefinition"
!= "!="
null_literal "null"
&& "&&"
binary_expression
identifier "explicitNode"
!= "!="
null_literal "null"
) ")"
block (+227 nodes collapsed)
else "else"
block
{ "{"
line_comment "// Handle the case where there's not a duplicate definition."
expression_statement
assignment_expression
identifier "replacementNode"
= "="
method_invocation
identifier "createDeclarationNode"
argument_list
( "("
) ")"
; ";"
if_statement
if "if"
parenthesized_expression
( "("
binary_expression
identifier "firstModule"
== "=="
identifier "minimumModule"
) ")"
block (+21 nodes collapsed)
else "else"
block
{ "{"
line_comment "// In this case, the name was implicitly provided by two ind"...
line_comment "// modules. We need to move this code up to a common module."
local_variable_declaration
integral_type
int "int"
variable_declarator
identifier "indexOfDot"
= "="
method_invocation
identifier "namespace"
. "."
identifier "indexOf"
argument_list
( "("
character_literal "'.'"
) ")"
; ";"
if_statement (+107 nodes collapsed)
} "}"
if_statement (+21 nodes collapsed)
expression_statement
method_invocation
identifier "compiler"
. "."
identifier "reportCodeChange"
argument_list
( "("
) ")"
; ";"
} "}"
} "}"
block_comment "/**\n * Create the declaration node for this name, withou"...
method_declaration (+58 nodes collapsed)
block_comment "/**\n * Creates a simple namespace variable declaration\n "...
method_declaration (+151 nodes collapsed)
block_comment "/**\n * There are some special cases where clients of the"...
method_declaration (+53 nodes collapsed)
block_comment "/**\n * Creates a dotted namespace assignment expression\n"...
method_declaration (+108 nodes collapsed)
} "}"
block_comment "/**\n * @return Whether the node is namespace placeholder.\n"...
method_declaration (+173 nodes collapsed)
line_comment "// ---------------------------------------------------------"...
block_comment "/**\n * Information required to create a {@code MISSING_PRO"...
class_declaration (+75 nodes collapsed)
} "}"

After

program
block_comment "/*\n * Copyright 2006 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
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 "List"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "Map"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "Set"
; ";"
block_comment "/**\n * Replaces goog.provide calls, removes goog.require cal"...
class_declaration
class "class"
identifier "ProcessClosurePrimitives"
superclass
extends "extends"
type_identifier "AbstractPostOrderCallback"
super_interfaces
implements "implements"
type_list
type_identifier "CompilerPass"
class_body
{ "{"
field_declaration (+29 nodes collapsed)
field_declaration (+29 nodes collapsed)
field_declaration (+29 nodes collapsed)
field_declaration (+29 nodes collapsed)
field_declaration (+28 nodes collapsed)
field_declaration (+29 nodes collapsed)
field_declaration (+29 nodes collapsed)
field_declaration (+28 nodes collapsed)
field_declaration (+35 nodes collapsed)
field_declaration (+25 nodes collapsed)
field_declaration (+25 nodes collapsed)
block_comment "/** The root Closure namespace */"
field_declaration
modifiers
static "static"
final "final"
type_identifier "String"
variable_declarator
identifier "GOOG"
= "="
string_literal
" "\""
string_fragment "goog"
" "\""
; ";"
field_declaration
modifiers
private "private"
final "final"
type_identifier "AbstractCompiler"
variable_declarator
identifier "compiler"
; ";"
field_declaration
modifiers
private "private"
final "final"
type_identifier "JSModuleGraph"
variable_declarator
identifier "moduleGraph"
; ";"
line_comment "// The goog.provides must be processed in a deterministic or"...
field_declaration (+23 nodes collapsed)
field_declaration (+21 nodes collapsed)
field_declaration (+21 nodes collapsed)
field_declaration
modifiers
private "private"
final "final"
type_identifier "CheckLevel"
variable_declarator
identifier "requiresLevel"
; ";"
field_declaration
modifiers
private "private"
final "final"
boolean_type "boolean"
variable_declarator
identifier "rewriteNewDateGoogNow"
; ";"
constructor_declaration (+87 nodes collapsed)
method_declaration
generic_type
type_identifier "Set"
type_arguments
< "<"
type_identifier "String"
> ">"
identifier "getExportedVariableNames"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
identifier "exportedVariables"
; ";"
} "}"
method_declaration (+185 nodes collapsed)
method_declaration (+836 nodes collapsed)
block_comment "/**\n * Handles a goog.require call.\n */"
method_declaration (+294 nodes collapsed)
block_comment "/**\n * Handles a goog.provide call.\n */"
method_declaration (+223 nodes collapsed)
block_comment "/**\n * Handles a candidate definition for a goog.provided "...
method_declaration (+238 nodes collapsed)
block_comment "/**\n * Processes the base class call.\n */"
method_declaration (+676 nodes collapsed)
block_comment "/**\n * Returns the qualified name node of the function who"...
method_declaration (+173 nodes collapsed)
block_comment "/** Reports an incorrect use of super-method calling. */"
method_declaration (+43 nodes collapsed)
block_comment "/**\n * Processes the output of processed-provide from a pr"...
method_declaration (+208 nodes collapsed)
block_comment "/**\n * Processes a call to goog.setCssNameMapping(). Eithe"...
method_declaration (+375 nodes collapsed)
block_comment "/**\n * Try to simplify \"new Date(goog.now())\" to \"new Date"...
method_declaration (+252 nodes collapsed)
block_comment "/**\n * Verifies that a provide method call has exactly one"...
method_declaration (+121 nodes collapsed)
block_comment "/**\n * Verifies that a method call has exactly one argumen"...
method_declaration (+40 nodes collapsed)
block_comment "/**\n * Verifies that a method call has exactly one argumen"...
method_declaration (+149 nodes collapsed)
block_comment "/**\n * Registers ProvidedNames for prefix namespaces if th"...
method_declaration (+152 nodes collapsed)
line_comment "// ---------------------------------------------------------"...
block_comment "/**\n * Information required to replace a goog.provide call"...
class_declaration
modifiers
private "private"
class "class"
identifier "ProvidedName"
class_body
{ "{"
field_declaration
modifiers
private "private"
final "final"
type_identifier "String"
variable_declarator
identifier "namespace"
; ";"
line_comment "// The node and module where the call was explicitly or impl"...
line_comment "// goog.provided."
field_declaration
modifiers
private "private"
final "final"
type_identifier "Node"
variable_declarator
identifier "firstNode"
; ";"
field_declaration
modifiers
private "private"
final "final"
type_identifier "JSModule"
variable_declarator
identifier "firstModule"
; ";"
line_comment "// The node where the call was explicitly goog.provided. May"...
line_comment "// if the namespace is always provided implicitly."
field_declaration
modifiers
private "private"
type_identifier "Node"
variable_declarator
identifier "explicitNode"
= "="
null_literal "null"
; ";"
field_declaration
modifiers
private "private"
type_identifier "JSModule"
variable_declarator
identifier "explicitModule"
= "="
null_literal "null"
; ";"
line_comment "// The candidate definition."
field_declaration
modifiers
private "private"
type_identifier "Node"
variable_declarator
identifier "candidateDefinition"
= "="
null_literal "null"
; ";"
line_comment "// The minimum module where the provide must appear."
field_declaration
modifiers
private "private"
type_identifier "JSModule"
variable_declarator
identifier "minimumModule"
= "="
null_literal "null"
; ";"
line_comment "// The replacement declaration."
field_declaration
modifiers
private "private"
type_identifier "Node"
variable_declarator
identifier "replacementNode"
= "="
null_literal "null"
; ";"
constructor_declaration (+86 nodes collapsed)
block_comment "/**\n * Add an implicit or explicit provide.\n */"
method_declaration (+79 nodes collapsed)
method_declaration
boolean_type "boolean"
identifier "isExplicitlyProvided"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
binary_expression
identifier "explicitNode"
!= "!="
null_literal "null"
; ";"
} "}"
block_comment "/**\n * Record function declaration, variable declaration"...
method_declaration (+108 nodes collapsed)
method_declaration (+84 nodes collapsed)
block_comment "/**\n * Replace the provide statement.\n *\n * If w"...
method_declaration
void_type "void"
identifier "replace"
formal_parameters
( "("
) ")"
block
{ "{"
if_statement (+22 nodes collapsed)
line_comment "// Handle the case where there is a duplicate definition for"...
line_comment "// provided symbol."
if_statement
if "if"
parenthesized_expression
( "("
binary_expression
binary_expression
identifier "candidateDefinition"
!= "!="
null_literal "null"
&& "&&"
binary_expression
identifier "explicitNode"
!= "!="
null_literal "null"
) ")"
block (+227 nodes collapsed)
else "else"
block
{ "{"
line_comment "// Handle the case where there's not a duplicate definition."
expression_statement
assignment_expression
identifier "replacementNode"
= "="
method_invocation
identifier "createDeclarationNode"
argument_list
( "("
) ")"
; ";"
if_statement
if "if"
parenthesized_expression
( "("
binary_expression
identifier "firstModule"
== "=="
identifier "minimumModule"
) ")"
block (+21 nodes collapsed)
else "else"
block
{ "{"
line_comment "// In this case, the name was implicitly provided by two ind"...
line_comment "// modules. We need to move this code up to a common module."
local_variable_declaration
integral_type
int "int"
variable_declarator
identifier "indexOfDot"
= "="
method_invocation
identifier "namespace"
. "."
identifier "lastIndexOf"
argument_list
( "("
character_literal "'.'"
) ")"
; ";"
if_statement (+107 nodes collapsed)
} "}"
if_statement (+21 nodes collapsed)
expression_statement
method_invocation
identifier "compiler"
. "."
identifier "reportCodeChange"
argument_list
( "("
) ")"
; ";"
} "}"
} "}"
block_comment "/**\n * Create the declaration node for this name, withou"...
method_declaration (+58 nodes collapsed)
block_comment "/**\n * Creates a simple namespace variable declaration\n "...
method_declaration (+151 nodes collapsed)
block_comment "/**\n * There are some special cases where clients of the"...
method_declaration (+53 nodes collapsed)
block_comment "/**\n * Creates a dotted namespace assignment expression\n"...
method_declaration (+108 nodes collapsed)
} "}"
block_comment "/**\n * @return Whether the node is namespace placeholder.\n"...
method_declaration (+173 nodes collapsed)
line_comment "// ---------------------------------------------------------"...
block_comment "/**\n * Information required to create a {@code MISSING_PRO"...
class_declaration (+75 nodes collapsed)
} "}"