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–571 unchanged (571 lines)
572 // logic.
573 if (parent.getFirstChild().getNext() != n) {
574 recordDepScope(recordNode, ns);
575 } else {
576 recordDepScope(nameNode, ns);
577 }
578 } else {
579 // The rhs of the assignment is the caller, so it's used by the
580 // context. Don't associate it w/ the lhs.
581 // FYI: this fixes only the specific case where the assignment is the
582 // caller expression, but it could be nested deeper in the caller and
583 // we would still get a bug.
584 // See testAssignWithCall2 for an example of this.
…lines 585–1888 unchanged (1304 lines)

After

…lines 1–571 unchanged (571 lines)
572 // logic.
573 if (parent.getFirstChild().getNext() != n) {
574 recordDepScope(recordNode, ns);
575 } else {
576 recordDepScope(nameNode, ns);
577 }
578 } else if (!(parent.isCall() && parent.getFirstChild() == n)) {
579 // The rhs of the assignment is the caller, so it's used by the
580 // context. Don't associate it w/ the lhs.
581 // FYI: this fixes only the specific case where the assignment is the
582 // caller expression, but it could be nested deeper in the caller and
583 // we would still get a bug.
584 // See testAssignWithCall2 for an example of this.
…lines 585–1888 unchanged (1304 lines)

Before

program
block_comment "/*\n * Copyright 2006 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 "base"
. "."
identifier "Predicate"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "common"
. "."
identifier "collect"
. "."
identifier "ImmutableSet"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "common"
. "."
identifier "collect"
. "."
identifier "LinkedListMultimap"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "common"
. "."
identifier "collect"
. "."
identifier "ListMultimap"
; ";"
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 "CodingConvention"
. "."
identifier "SubclassRelationship"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "jscomp"
. "."
identifier "GatherSideEffectSubexpressionsCallback"
. "."
identifier "GetReplacementSideEffectSubexpressions"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "jscomp"
. "."
identifier "GatherSideEffectSubexpressionsCallback"
. "."
identifier "SideEffectAccumulator"
; ";"
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
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "jscomp"
. "."
identifier "graph"
. "."
identifier "DiGraph"
; ";"
import_declaration (+22 nodes collapsed)
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "jscomp"
. "."
identifier "graph"
. "."
identifier "FixedPointGraphTraversal"
; ";"
import_declaration (+22 nodes collapsed)
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "jscomp"
. "."
identifier "graph"
. "."
identifier "LinkedDirectedGraph"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "rhino"
. "."
identifier "IR"
; ";"
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 "Collections"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "Iterator"
; ";"
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 * This pass identifies all global names, simple (e.g. <"...
class_declaration
modifiers
final "final"
class "class"
identifier "NameAnalyzer"
super_interfaces
implements "implements"
type_list
type_identifier "CompilerPass"
class_body
{ "{"
block_comment "/** Reference to the JS compiler */"
field_declaration
modifiers
private "private"
final "final"
type_identifier "AbstractCompiler"
variable_declarator
identifier "compiler"
; ";"
block_comment "/** Map of all JS names found */"
field_declaration (+23 nodes collapsed)
block_comment "/** Reference dependency graph */"
field_declaration (+22 nodes collapsed)
block_comment "/**\n * Map of name scopes - all children of the Node key h"...
field_declaration (+23 nodes collapsed)
block_comment "/** Used to parse prototype names */"
field_declaration
modifiers
private "private"
static "static"
final "final"
type_identifier "String"
variable_declarator
identifier "PROTOTYPE_SUBSTRING"
= "="
string_literal
" "\""
string_fragment ".prototype."
" "\""
; ";"
field_declaration
modifiers
private "private"
static "static"
final "final"
integral_type
int "int"
variable_declarator
identifier "PROTOTYPE_SUBSTRING_LEN"
= "="
method_invocation
identifier "PROTOTYPE_SUBSTRING"
. "."
identifier "length"
argument_list
( "("
) ")"
; ";"
field_declaration (+21 nodes collapsed)
block_comment "/** Window root */"
field_declaration
modifiers
private "private"
static "static"
final "final"
type_identifier "String"
variable_declarator
identifier "WINDOW"
= "="
string_literal
" "\""
string_fragment "window"
" "\""
; ";"
block_comment "/** Function class name */"
field_declaration
modifiers
private "private"
static "static"
final "final"
type_identifier "String"
variable_declarator
identifier "FUNCTION"
= "="
string_literal
" "\""
string_fragment "Function"
" "\""
; ";"
block_comment "/** All of these refer to global scope. These can be moved t"...
field_declaration (+30 nodes collapsed)
block_comment "/** Whether to remove unreferenced variables in main pass */"
field_declaration
modifiers
private "private"
final "final"
boolean_type "boolean"
variable_declarator
identifier "removeUnreferenced"
; ";"
block_comment "/** Names that refer to the global scope */"
field_declaration
modifiers
private "private"
final "final"
generic_type
type_identifier "Set"
type_arguments
< "<"
type_identifier "String"
> ">"
variable_declarator
identifier "globalNames"
; ";"
block_comment "/** Ast change helper */"
field_declaration
modifiers
private "private"
final "final"
type_identifier "AstChangeProxy"
variable_declarator
identifier "changeProxy"
; ";"
block_comment "/** Names that are externally defined */"
field_declaration (+21 nodes collapsed)
block_comment "/** Name declarations or assignments, in post-order traversa"...
field_declaration (+21 nodes collapsed)
block_comment "/**\n * When multiple names in the global scope point to th"...
field_declaration (+23 nodes collapsed)
block_comment "/**\n * All the aliases in a program form a graph, where ea"...
class_declaration (+63 nodes collapsed)
block_comment "/**\n * Relationship between the two names.\n * Currently "...
enum_declaration
modifiers
private "private"
static "static"
enum "enum"
identifier "RefType"
enum_body
{ "{"
enum_constant
identifier "REGULAR"
, ","
enum_constant
identifier "INHERITANCE"
, ","
} "}"
block_comment "/**\n * Callback that propagates reference information.\n "...
class_declaration (+86 nodes collapsed)
block_comment "/**\n * Class to hold information that can be determined fr"...
class_declaration (+63 nodes collapsed)
block_comment "/**\n * Struct to hold information about a fully qualified "...
class_declaration (+279 nodes collapsed)
block_comment "/**\n * Interface to get information about and remove unref"...
interface_declaration
interface "interface"
identifier "RefNode"
interface_body
{ "{"
method_declaration
type_identifier "JsName"
identifier "name"
formal_parameters
( "("
) ")"
; ";"
method_declaration
void_type "void"
identifier "remove"
formal_parameters
( "("
) ")"
; ";"
} "}"
block_comment "/**\n * Class for nodes that reference a fully-qualified JS"...
class_declaration (+280 nodes collapsed)
block_comment "/**\n * Class for nodes that set prototype properties or me"...
class_declaration (+150 nodes collapsed)
block_comment "/**\n * Base class for special reference nodes.\n */"
class_declaration (+135 nodes collapsed)
block_comment "/**\n * Class for nodes that are function calls that may ch"...
class_declaration (+156 nodes collapsed)
block_comment "/**\n * Class for nodes that check instanceof\n */"
class_declaration (+114 nodes collapsed)
block_comment "/**\n * Walk through externs and mark nodes as externally d"...
class_declaration (+159 nodes collapsed)
block_comment "/**\n * <p>Identifies all dependency scopes.\n *\n * <p>A"...
class_declaration
modifiers
private "private"
class "class"
identifier "FindDependencyScopes"
superclass
extends "extends"
type_identifier "AbstractPostOrderCallback"
class_body
{ "{"
method_declaration (+281 nodes collapsed)
method_declaration (+220 nodes collapsed)
method_declaration
modifiers
private "private"
void_type "void"
identifier "recordAssignment"
formal_parameters
( "("
formal_parameter
type_identifier "NodeTraversal"
identifier "t"
, ","
formal_parameter
type_identifier "Node"
identifier "n"
, ","
formal_parameter
type_identifier "Node"
identifier "recordNode"
) ")"
block
{ "{"
local_variable_declaration
type_identifier "Node"
variable_declarator
identifier "nameNode"
= "="
method_invocation
identifier "n"
. "."
identifier "getFirstChild"
argument_list
( "("
) ")"
; ";"
local_variable_declaration
type_identifier "Node"
variable_declarator
identifier "parent"
= "="
method_invocation
identifier "n"
. "."
identifier "getParent"
argument_list
( "("
) ")"
; ";"
local_variable_declaration
type_identifier "NameInformation"
variable_declarator
identifier "ns"
= "="
method_invocation
identifier "createNameInformation"
argument_list
( "("
identifier "t"
, ","
identifier "nameNode"
) ")"
; ";"
if_statement
if "if"
parenthesized_expression
( "("
binary_expression
identifier "ns"
!= "!="
null_literal "null"
) ")"
block
{ "{"
if_statement
if "if"
parenthesized_expression (+22 nodes collapsed)
block (+60 nodes collapsed)
else "else"
block
{ "{"
line_comment "// The rhs of the assignment is the caller, so it's used by "...
line_comment "// context. Don't associate it w/ the lhs."
line_comment "// FYI: this fixes only the specific case where the assignme"...
line_comment "// caller expression, but it could be nested deeper in the c"...
line_comment "// we would still get a bug."
line_comment "// See testAssignWithCall2 for an example of this."
expression_statement
method_invocation
identifier "recordDepScope"
argument_list
( "("
identifier "recordNode"
, ","
identifier "ns"
) ")"
; ";"
} "}"
} "}"
} "}"
block_comment "/**\n * Defines a dependency scope.\n */"
method_declaration (+40 nodes collapsed)
} "}"
block_comment "/**\n * Create JsName objects for variable and function dec"...
class_declaration (+168 nodes collapsed)
block_comment "/**\n * Identifies all declarations of global names and set"...
class_declaration (+769 nodes collapsed)
field_declaration (+72 nodes collapsed)
block_comment "/**\n * <p>Identifies all references between global names.\n"...
class_declaration (+2146 nodes collapsed)
class_declaration (+41 nodes collapsed)
block_comment "/**\n * Creates a name analyzer, with option to remove unre"...
constructor_declaration (+56 nodes collapsed)
method_declaration (+157 nodes collapsed)
block_comment "/**\n * Records an alias of one name to another name.\n */"
method_declaration (+255 nodes collapsed)
block_comment "/**\n * Records a reference from one name to another name.\n"...
method_declaration (+126 nodes collapsed)
block_comment "/**\n * Removes all unreferenced variables.\n */"
method_declaration (+96 nodes collapsed)
block_comment "/**\n * Generates an HTML report\n *\n * @return The repo"...
method_declaration (+837 nodes collapsed)
method_declaration (+41 nodes collapsed)
method_declaration (+42 nodes collapsed)
method_declaration (+41 nodes collapsed)
block_comment "/**\n * Looks up a {@link JsName} by name, optionally creat"...
method_declaration (+46 nodes collapsed)
block_comment "/**\n * Creates a {@link JsName} for the given name if it d"...
method_declaration (+72 nodes collapsed)
block_comment "/**\n * The NameAnalyzer algorithm works best when all obje"...
method_declaration (+117 nodes collapsed)
block_comment "/**\n * Adds mutual references between all known global nam"...
method_declaration (+196 nodes collapsed)
block_comment "/**\n * Creates name information for the current node durin"...
method_declaration (+802 nodes collapsed)
block_comment "/**\n * Creates name information for a particular qualified"...
method_declaration (+243 nodes collapsed)
block_comment "/**\n * Checks whether a name can be referenced outside of "...
method_declaration (+98 nodes collapsed)
block_comment "/**\n * Gets the nearest enclosing dependency scope, or nul"...
method_declaration (+86 nodes collapsed)
block_comment "/**\n * Get dependency scope defined by the enclosing funct"...
method_declaration (+212 nodes collapsed)
block_comment "/**\n * Propagate \"referenced\" property down the graph.\n "...
method_declaration (+80 nodes collapsed)
block_comment "/**\n * Enum for saying a value can be true, false, or eith"...
enum_declaration
modifiers
private "private"
enum "enum"
identifier "TriState"
enum_body
{ "{"
block_comment "/** If value is true */"
enum_constant
identifier "TRUE"
, ","
block_comment "/** If value is false */"
enum_constant
identifier "FALSE"
, ","
block_comment "/** If value can be true or false */"
enum_constant
identifier "BOTH"
} "}"
block_comment "/**\n * Gets the count of nodes matching the criteria\n *\n"...
method_declaration (+188 nodes collapsed)
block_comment "/**\n * Extract a list of replacement nodes to use.\n */"
method_declaration (+124 nodes collapsed)
block_comment "/**\n * Replace n with a simpler expression, while preservi"...
method_declaration (+268 nodes collapsed)
block_comment "/**\n * Simplify a toplevel expression, while preserving pr"...
method_declaration (+370 nodes collapsed)
block_comment "/**\n * Determine if the parent reads the value of a child "...
method_declaration (+204 nodes collapsed)
block_comment "/**\n * Merge a list of nodes into a single expression. Th"...
method_declaration (+114 nodes collapsed)
block_comment "/**\n * Extract a list of subexpressions that act as right "...
method_declaration (+276 nodes collapsed)
} "}"

After

program
block_comment "/*\n * Copyright 2006 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 "base"
. "."
identifier "Predicate"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "common"
. "."
identifier "collect"
. "."
identifier "ImmutableSet"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "common"
. "."
identifier "collect"
. "."
identifier "LinkedListMultimap"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "common"
. "."
identifier "collect"
. "."
identifier "ListMultimap"
; ";"
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 "CodingConvention"
. "."
identifier "SubclassRelationship"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "jscomp"
. "."
identifier "GatherSideEffectSubexpressionsCallback"
. "."
identifier "GetReplacementSideEffectSubexpressions"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "jscomp"
. "."
identifier "GatherSideEffectSubexpressionsCallback"
. "."
identifier "SideEffectAccumulator"
; ";"
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
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "jscomp"
. "."
identifier "graph"
. "."
identifier "DiGraph"
; ";"
import_declaration (+22 nodes collapsed)
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "jscomp"
. "."
identifier "graph"
. "."
identifier "FixedPointGraphTraversal"
; ";"
import_declaration (+22 nodes collapsed)
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "jscomp"
. "."
identifier "graph"
. "."
identifier "LinkedDirectedGraph"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "rhino"
. "."
identifier "IR"
; ";"
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 "Collections"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "Iterator"
; ";"
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 * This pass identifies all global names, simple (e.g. <"...
class_declaration
modifiers
final "final"
class "class"
identifier "NameAnalyzer"
super_interfaces
implements "implements"
type_list
type_identifier "CompilerPass"
class_body
{ "{"
block_comment "/** Reference to the JS compiler */"
field_declaration
modifiers
private "private"
final "final"
type_identifier "AbstractCompiler"
variable_declarator
identifier "compiler"
; ";"
block_comment "/** Map of all JS names found */"
field_declaration (+23 nodes collapsed)
block_comment "/** Reference dependency graph */"
field_declaration (+22 nodes collapsed)
block_comment "/**\n * Map of name scopes - all children of the Node key h"...
field_declaration (+23 nodes collapsed)
block_comment "/** Used to parse prototype names */"
field_declaration
modifiers
private "private"
static "static"
final "final"
type_identifier "String"
variable_declarator
identifier "PROTOTYPE_SUBSTRING"
= "="
string_literal
" "\""
string_fragment ".prototype."
" "\""
; ";"
field_declaration
modifiers
private "private"
static "static"
final "final"
integral_type
int "int"
variable_declarator
identifier "PROTOTYPE_SUBSTRING_LEN"
= "="
method_invocation
identifier "PROTOTYPE_SUBSTRING"
. "."
identifier "length"
argument_list
( "("
) ")"
; ";"
field_declaration (+21 nodes collapsed)
block_comment "/** Window root */"
field_declaration
modifiers
private "private"
static "static"
final "final"
type_identifier "String"
variable_declarator
identifier "WINDOW"
= "="
string_literal
" "\""
string_fragment "window"
" "\""
; ";"
block_comment "/** Function class name */"
field_declaration
modifiers
private "private"
static "static"
final "final"
type_identifier "String"
variable_declarator
identifier "FUNCTION"
= "="
string_literal
" "\""
string_fragment "Function"
" "\""
; ";"
block_comment "/** All of these refer to global scope. These can be moved t"...
field_declaration (+30 nodes collapsed)
block_comment "/** Whether to remove unreferenced variables in main pass */"
field_declaration
modifiers
private "private"
final "final"
boolean_type "boolean"
variable_declarator
identifier "removeUnreferenced"
; ";"
block_comment "/** Names that refer to the global scope */"
field_declaration
modifiers
private "private"
final "final"
generic_type
type_identifier "Set"
type_arguments
< "<"
type_identifier "String"
> ">"
variable_declarator
identifier "globalNames"
; ";"
block_comment "/** Ast change helper */"
field_declaration
modifiers
private "private"
final "final"
type_identifier "AstChangeProxy"
variable_declarator
identifier "changeProxy"
; ";"
block_comment "/** Names that are externally defined */"
field_declaration (+21 nodes collapsed)
block_comment "/** Name declarations or assignments, in post-order traversa"...
field_declaration (+21 nodes collapsed)
block_comment "/**\n * When multiple names in the global scope point to th"...
field_declaration (+23 nodes collapsed)
block_comment "/**\n * All the aliases in a program form a graph, where ea"...
class_declaration (+63 nodes collapsed)
block_comment "/**\n * Relationship between the two names.\n * Currently "...
enum_declaration
modifiers
private "private"
static "static"
enum "enum"
identifier "RefType"
enum_body
{ "{"
enum_constant
identifier "REGULAR"
, ","
enum_constant
identifier "INHERITANCE"
, ","
} "}"
block_comment "/**\n * Callback that propagates reference information.\n "...
class_declaration (+86 nodes collapsed)
block_comment "/**\n * Class to hold information that can be determined fr"...
class_declaration (+63 nodes collapsed)
block_comment "/**\n * Struct to hold information about a fully qualified "...
class_declaration (+279 nodes collapsed)
block_comment "/**\n * Interface to get information about and remove unref"...
interface_declaration
interface "interface"
identifier "RefNode"
interface_body
{ "{"
method_declaration
type_identifier "JsName"
identifier "name"
formal_parameters
( "("
) ")"
; ";"
method_declaration
void_type "void"
identifier "remove"
formal_parameters
( "("
) ")"
; ";"
} "}"
block_comment "/**\n * Class for nodes that reference a fully-qualified JS"...
class_declaration (+280 nodes collapsed)
block_comment "/**\n * Class for nodes that set prototype properties or me"...
class_declaration (+150 nodes collapsed)
block_comment "/**\n * Base class for special reference nodes.\n */"
class_declaration (+135 nodes collapsed)
block_comment "/**\n * Class for nodes that are function calls that may ch"...
class_declaration (+156 nodes collapsed)
block_comment "/**\n * Class for nodes that check instanceof\n */"
class_declaration (+114 nodes collapsed)
block_comment "/**\n * Walk through externs and mark nodes as externally d"...
class_declaration (+159 nodes collapsed)
block_comment "/**\n * <p>Identifies all dependency scopes.\n *\n * <p>A"...
class_declaration
modifiers
private "private"
class "class"
identifier "FindDependencyScopes"
superclass
extends "extends"
type_identifier "AbstractPostOrderCallback"
class_body
{ "{"
method_declaration (+281 nodes collapsed)
method_declaration (+220 nodes collapsed)
method_declaration
modifiers
private "private"
void_type "void"
identifier "recordAssignment"
formal_parameters
( "("
formal_parameter
type_identifier "NodeTraversal"
identifier "t"
, ","
formal_parameter
type_identifier "Node"
identifier "n"
, ","
formal_parameter
type_identifier "Node"
identifier "recordNode"
) ")"
block
{ "{"
local_variable_declaration
type_identifier "Node"
variable_declarator
identifier "nameNode"
= "="
method_invocation
identifier "n"
. "."
identifier "getFirstChild"
argument_list
( "("
) ")"
; ";"
local_variable_declaration
type_identifier "Node"
variable_declarator
identifier "parent"
= "="
method_invocation
identifier "n"
. "."
identifier "getParent"
argument_list
( "("
) ")"
; ";"
local_variable_declaration
type_identifier "NameInformation"
variable_declarator
identifier "ns"
= "="
method_invocation
identifier "createNameInformation"
argument_list
( "("
identifier "t"
, ","
identifier "nameNode"
) ")"
; ";"
if_statement
if "if"
parenthesized_expression
( "("
binary_expression
identifier "ns"
!= "!="
null_literal "null"
) ")"
block
{ "{"
if_statement
if "if"
parenthesized_expression (+22 nodes collapsed)
block (+60 nodes collapsed)
else "else"
if_statement
if "if"
parenthesized_expression
( "("
unary_expression
! "!"
parenthesized_expression
( "("
binary_expression
method_invocation
identifier "parent"
. "."
identifier "isCall"
argument_list
( "("
) ")"
&& "&&"
binary_expression
method_invocation
identifier "parent"
. "."
identifier "getFirstChild"
argument_list
( "("
) ")"
== "=="
identifier "n"
) ")"
) ")"
block
{ "{"
line_comment "// The rhs of the assignment is the caller, so it's used by "...
line_comment "// context. Don't associate it w/ the lhs."
line_comment "// FYI: this fixes only the specific case where the assignme"...
line_comment "// caller expression, but it could be nested deeper in the c"...
line_comment "// we would still get a bug."
line_comment "// See testAssignWithCall2 for an example of this."
expression_statement
method_invocation
identifier "recordDepScope"
argument_list
( "("
identifier "recordNode"
, ","
identifier "ns"
) ")"
; ";"
} "}"
} "}"
} "}"
block_comment "/**\n * Defines a dependency scope.\n */"
method_declaration (+40 nodes collapsed)
} "}"
block_comment "/**\n * Create JsName objects for variable and function dec"...
class_declaration (+168 nodes collapsed)
block_comment "/**\n * Identifies all declarations of global names and set"...
class_declaration (+769 nodes collapsed)
field_declaration (+72 nodes collapsed)
block_comment "/**\n * <p>Identifies all references between global names.\n"...
class_declaration (+2146 nodes collapsed)
class_declaration (+41 nodes collapsed)
block_comment "/**\n * Creates a name analyzer, with option to remove unre"...
constructor_declaration (+56 nodes collapsed)
method_declaration (+157 nodes collapsed)
block_comment "/**\n * Records an alias of one name to another name.\n */"
method_declaration (+255 nodes collapsed)
block_comment "/**\n * Records a reference from one name to another name.\n"...
method_declaration (+126 nodes collapsed)
block_comment "/**\n * Removes all unreferenced variables.\n */"
method_declaration (+96 nodes collapsed)
block_comment "/**\n * Generates an HTML report\n *\n * @return The repo"...
method_declaration (+837 nodes collapsed)
method_declaration (+41 nodes collapsed)
method_declaration (+42 nodes collapsed)
method_declaration (+41 nodes collapsed)
block_comment "/**\n * Looks up a {@link JsName} by name, optionally creat"...
method_declaration (+46 nodes collapsed)
block_comment "/**\n * Creates a {@link JsName} for the given name if it d"...
method_declaration (+72 nodes collapsed)
block_comment "/**\n * The NameAnalyzer algorithm works best when all obje"...
method_declaration (+117 nodes collapsed)
block_comment "/**\n * Adds mutual references between all known global nam"...
method_declaration (+196 nodes collapsed)
block_comment "/**\n * Creates name information for the current node durin"...
method_declaration (+802 nodes collapsed)
block_comment "/**\n * Creates name information for a particular qualified"...
method_declaration (+243 nodes collapsed)
block_comment "/**\n * Checks whether a name can be referenced outside of "...
method_declaration (+98 nodes collapsed)
block_comment "/**\n * Gets the nearest enclosing dependency scope, or nul"...
method_declaration (+86 nodes collapsed)
block_comment "/**\n * Get dependency scope defined by the enclosing funct"...
method_declaration (+212 nodes collapsed)
block_comment "/**\n * Propagate \"referenced\" property down the graph.\n "...
method_declaration (+80 nodes collapsed)
block_comment "/**\n * Enum for saying a value can be true, false, or eith"...
enum_declaration
modifiers
private "private"
enum "enum"
identifier "TriState"
enum_body
{ "{"
block_comment "/** If value is true */"
enum_constant
identifier "TRUE"
, ","
block_comment "/** If value is false */"
enum_constant
identifier "FALSE"
, ","
block_comment "/** If value can be true or false */"
enum_constant
identifier "BOTH"
} "}"
block_comment "/**\n * Gets the count of nodes matching the criteria\n *\n"...
method_declaration (+188 nodes collapsed)
block_comment "/**\n * Extract a list of replacement nodes to use.\n */"
method_declaration (+124 nodes collapsed)
block_comment "/**\n * Replace n with a simpler expression, while preservi"...
method_declaration (+268 nodes collapsed)
block_comment "/**\n * Simplify a toplevel expression, while preserving pr"...
method_declaration (+370 nodes collapsed)
block_comment "/**\n * Determine if the parent reads the value of a child "...
method_declaration (+204 nodes collapsed)
block_comment "/**\n * Merge a list of nodes into a single expression. Th"...
method_declaration (+114 nodes collapsed)
block_comment "/**\n * Extract a list of subexpressions that act as right "...
method_declaration (+276 nodes collapsed)
} "}"