This mapping has 1 multi-map group: several pairings are equally correct there. The code view shows one arbitrary valid pairing, not the only one.

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–203 unchanged (203 lines)
204 int numRenamedPropertyNames = 0;
205 int numSkippedPropertyNames = 0;
206 Set<Property> propsByFreq = new TreeSet<Property>(FREQUENCY_COMPARATOR);
207 for (Property p : propertyMap.values()) {
208 if (!p.skipAmbiguating) {
209 ++numRenamedPropertyNames;
210 computeRelatedTypes(p.type);
211 propsByFreq.add(p);
212 } else {
213 ++numSkippedPropertyNames;
214 reservedNames.add(p.oldName);
215 }
216 }
…lines 217–349 unchanged (133 lines)
350 * of the types in the sub graph.
351 */
352 public boolean isIndependentOf(Property prop) {
353 if (typesRelatedToSet.intersects(prop.typesSet)) {
354 return false;
355 }
356 return !getRelated(prop.type).intersects(typesInSet);
357 }
358
359 /**
360 * Adds the node to the sub graph, adding all of its types to the set of
361 * types in the sub graph and all of its related types to the related types
362 * for the sub graph.
363 */
364 public void addNode(Property prop) {
365 typesInSet.or(prop.typesSet);
366 typesRelatedToSet.or(getRelated(prop.type));
367 }
368
369 /**
370 * Finds all types related to the provided type and returns a BitSet with
371 * their bits to true.
372 */
…lines 373–546 unchanged (174 lines)
547 }
548 }
549
550 /** Encapsulates the information needed for renaming a property. */
551 private class Property {
552 final String oldName;
553 JSType type;
554 String newName;
555 int numOccurrences;
556 boolean skipAmbiguating;
557 JSTypeBitSet typesSet = new JSTypeBitSet(intForType.size());
558
559 Property(String name) {
560 this.oldName = name;
561
562 // Properties with this suffix are handled in RenameProperties.
563 if (name.startsWith(SKIP_PREFIX)) {
564 skipAmbiguating = true;
…lines 565–586 unchanged (22 lines)
587
588 private void addNonUnionType(JSType newType) {
589 if (skipAmbiguating || isInvalidatingType(newType)) {
590 skipAmbiguating = true;
591 return;
592 }
593
594 if (type == null) {
595 type = newType;
596 } else {
597 type = type.getLeastSupertype(newType);
598 }
599 typesSet.set(getIntForType(newType));
600 }
601 }
602
603 // A BitSet that stores type info. Adds pretty-print routines.
604 private class JSTypeBitSet extends BitSet {
605 private static final long serialVersionUID = 1L;
…lines 606–631 unchanged (26 lines)

After

…lines 1–203 unchanged (203 lines)
204 int numRenamedPropertyNames = 0;
205 int numSkippedPropertyNames = 0;
206 Set<Property> propsByFreq = new TreeSet<Property>(FREQUENCY_COMPARATOR);
207 for (Property p : propertyMap.values()) {
208 if (!p.skipAmbiguating) {
209 ++numRenamedPropertyNames;
210 propsByFreq.add(p);
211 } else {
212 ++numSkippedPropertyNames;
213 reservedNames.add(p.oldName);
214 }
215 }
216
…lines 217–348 unchanged (132 lines)
349 * of the types in the sub graph.
350 */
351 public boolean isIndependentOf(Property prop) {
352 if (typesRelatedToSet.intersects(prop.typesSet)) {
353 return false;
354 }
355 return !prop.relatedTypesSet.intersects(typesInSet);
356 }
357
358 /**
359 * Adds the node to the sub graph, adding all of its types to the set of
360 * types in the sub graph and all of its related types to the related types
361 * for the sub graph.
362 */
363 public void addNode(Property prop) {
364 typesInSet.or(prop.typesSet);
365 typesRelatedToSet.or(prop.relatedTypesSet);
366 }
367
368 /**
369 * Finds all types related to the provided type and returns a BitSet with
370 * their bits to true.
371 */
…lines 372–545 unchanged (174 lines)
546 }
547 }
548
549 /** Encapsulates the information needed for renaming a property. */
550 private class Property {
551 final String oldName;
552 String newName;
553 int numOccurrences;
554 boolean skipAmbiguating;
555 JSTypeBitSet typesSet = new JSTypeBitSet(intForType.size());
556 JSTypeBitSet relatedTypesSet = new JSTypeBitSet(intForType.size());
557
558 Property(String name) {
559 this.oldName = name;
560
561 // Properties with this suffix are handled in RenameProperties.
562 if (name.startsWith(SKIP_PREFIX)) {
…lines 563–586 unchanged (24 lines)
587 private void addNonUnionType(JSType newType) {
588 if (skipAmbiguating || isInvalidatingType(newType)) {
589 skipAmbiguating = true;
590 return;
591 }
592
593 int typeInt = getIntForType(newType);
594 if (!typesSet.get(typeInt)) {
595 computeRelatedTypes(newType);
596 typesSet.set(typeInt);
597 relatedTypesSet.or(getRelatedTypesOnNonUnion(newType));
598 }
599 }
600 }
601
602 // A BitSet that stores type info. Adds pretty-print routines.
603 private class JSTypeBitSet extends BitSet {
604 private static final long serialVersionUID = 1L;
605
…lines 606–630 unchanged (25 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 "Joiner"
; ";"
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 "BiMap"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "common"
. "."
identifier "collect"
. "."
identifier "HashBiMap"
; ";"
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
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "jscomp"
. "."
identifier "TypeValidator"
. "."
identifier "TypeMismatch"
; ";"
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 "AdjacencyGraph"
; ";"
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 "Annotation"
; ";"
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 "GraphColoring"
; ";"
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 "GraphNode"
; ";"
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 "SubGraph"
; ";"
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
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "rhino"
. "."
identifier "jstype"
. "."
identifier "FunctionPrototypeType"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "rhino"
. "."
identifier "jstype"
. "."
identifier "FunctionType"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "rhino"
. "."
identifier "jstype"
. "."
identifier "InstanceObjectType"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "rhino"
. "."
identifier "jstype"
. "."
identifier "JSType"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "rhino"
. "."
identifier "jstype"
. "."
identifier "JSTypeNative"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "rhino"
. "."
identifier "jstype"
. "."
identifier "JSTypeRegistry"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "rhino"
. "."
identifier "jstype"
. "."
identifier "ObjectType"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "rhino"
. "."
identifier "jstype"
. "."
identifier "UnionType"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "BitSet"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "Collection"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "Comparator"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "HashSet"
; ";"
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"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "TreeSet"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "logging"
. "."
identifier "Logger"
; ";"
block_comment "/**\n * Renames unrelated properties to the same name, using "...
class_declaration
class "class"
identifier "AmbiguateProperties"
super_interfaces
implements "implements"
type_list
type_identifier "CompilerPass"
class_body
{ "{"
field_declaration (+27 nodes collapsed)
field_declaration
modifiers
private "private"
final "final"
type_identifier "AbstractCompiler"
variable_declarator
identifier "compiler"
; ";"
field_declaration (+21 nodes collapsed)
field_declaration
modifiers
private "private"
final "final"
array_type
integral_type
char "char"
dimensions
[ "["
] "]"
variable_declarator
identifier "reservedCharacters"
; ";"
block_comment "/** Map from property name to Property object */"
field_declaration (+23 nodes collapsed)
block_comment "/** Property names that don't get renamed */"
field_declaration (+21 nodes collapsed)
block_comment "/** Names to which properties shouldn't be renamed, to avoid"...
field_declaration (+21 nodes collapsed)
block_comment "/** Map from original property name to new name. */"
field_declaration (+23 nodes collapsed)
block_comment "/** Map from color assigned by GraphColoring to new name. */"
field_declaration (+23 nodes collapsed)
block_comment "/**\n * Sorts Property objects by their count, breaking tie"...
field_declaration (+96 nodes collapsed)
block_comment "/** A map from JSType to a unique representative Integer. */"
field_declaration (+22 nodes collapsed)
block_comment "/**\n * A map from JSType to JSTypeBitSet representing the "...
field_declaration (+22 nodes collapsed)
block_comment "/** A set of types that invalidate properties from ambiguati"...
field_declaration
modifiers
private "private"
final "final"
generic_type
type_identifier "Set"
type_arguments
< "<"
type_identifier "JSType"
> ">"
variable_declarator
identifier "invalidatingTypes"
; ";"
block_comment "/**\n * Prefix of properties to skip renaming. These shoul"...
field_declaration
modifiers
static "static"
final "final"
type_identifier "String"
variable_declarator
identifier "SKIP_PREFIX"
= "="
string_literal
" "\""
string_fragment "JSAbstractCompiler"
" "\""
; ";"
constructor_declaration (+263 nodes collapsed)
block_comment "/**\n * Invalidates the given type, so that no properties o"...
method_declaration (+122 nodes collapsed)
method_declaration
generic_type
type_identifier "Map"
type_arguments
< "<"
type_identifier "String"
, ","
type_identifier "String"
> ">"
identifier "getRenamingMap"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
identifier "renamingMap"
; ";"
} "}"
block_comment "/** Returns an integer that uniquely identifies a JSType. */"
method_declaration (+81 nodes collapsed)
method_declaration
modifiers
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
method_invocation
identifier "NodeTraversal"
. "."
identifier "traverse"
argument_list
( "("
identifier "compiler"
, ","
identifier "externs"
, ","
object_creation_expression
new "new"
type_identifier "ProcessExterns"
argument_list
( "("
) ")"
) ")"
; ";"
expression_statement
method_invocation
identifier "NodeTraversal"
. "."
identifier "traverse"
argument_list
( "("
identifier "compiler"
, ","
identifier "root"
, ","
object_creation_expression
new "new"
type_identifier "ProcessProperties"
argument_list
( "("
) ")"
) ")"
; ";"
local_variable_declaration (+38 nodes collapsed)
expression_statement
method_invocation
identifier "reservedNames"
. "."
identifier "addAll"
argument_list
( "("
identifier "externedNames"
) ")"
; ";"
expression_statement
method_invocation
identifier "reservedNames"
. "."
identifier "addAll"
argument_list
( "("
identifier "quotedNames"
) ")"
; ";"
local_variable_declaration
integral_type
int "int"
variable_declarator
identifier "numRenamedPropertyNames"
= "="
decimal_integer_literal "0"
; ";"
local_variable_declaration
integral_type
int "int"
variable_declarator
identifier "numSkippedPropertyNames"
= "="
decimal_integer_literal "0"
; ";"
local_variable_declaration (+23 nodes collapsed)
enhanced_for_statement
for "for"
( "("
type_identifier "Property"
identifier "p"
: ":"
method_invocation
identifier "propertyMap"
. "."
identifier "values"
argument_list
( "("
) ")"
) ")"
block
{ "{"
if_statement
if "if"
parenthesized_expression
( "("
unary_expression
! "!"
field_access
identifier "p"
. "."
identifier "skipAmbiguating"
) ")"
block
{ "{"
expression_statement
update_expression
++ "++"
identifier "numRenamedPropertyNames"
; ";"
expression_statement
method_invocation
identifier "computeRelatedTypes"
argument_list
( "("
field_access
identifier "p"
. "."
identifier "type"
) ")"
; ";"
expression_statement
method_invocation
identifier "propsByFreq"
. "."
identifier "add"
argument_list
( "("
identifier "p"
) ")"
; ";"
} "}"
else "else"
block (+21 nodes collapsed)
} "}"
local_variable_declaration
type_identifier "PropertyGraph"
variable_declarator
identifier "graph"
= "="
object_creation_expression
new "new"
type_identifier "PropertyGraph"
argument_list
( "("
method_invocation
identifier "Lists"
. "."
identifier "newLinkedList"
argument_list
( "("
identifier "propsByFreq"
) ")"
) ")"
; ";"
local_variable_declaration (+29 nodes collapsed)
local_variable_declaration
integral_type
int "int"
variable_declarator
identifier "numNewPropertyNames"
= "="
method_invocation
identifier "coloring"
. "."
identifier "color"
argument_list
( "("
) ")"
; ";"
local_variable_declaration
type_identifier "NameGenerator"
variable_declarator
identifier "nameGen"
= "="
object_creation_expression
new "new"
type_identifier "NameGenerator"
argument_list
( "("
identifier "reservedNames"
, ","
string_literal
" "\""
" "\""
, ","
identifier "reservedCharacters"
) ")"
; ";"
for_statement (+41 nodes collapsed)
enhanced_for_statement (+88 nodes collapsed)
line_comment "// Update the string nodes."
enhanced_for_statement (+122 nodes collapsed)
expression_statement (+40 nodes collapsed)
} "}"
method_declaration (+75 nodes collapsed)
block_comment "/** Add supertypes of the type to its JSTypeBitSet of relate"...
method_declaration (+315 nodes collapsed)
class_declaration (+255 nodes collapsed)
block_comment "/**\n * A {@link SubGraph} that represents properties. The "...
class_declaration
class "class"
identifier "PropertySubGraph"
super_interfaces
implements "implements"
type_list
generic_type
type_identifier "SubGraph"
type_arguments
< "<"
type_identifier "Property"
, ","
type_identifier "Void"
> ">"
class_body
{ "{"
block_comment "/** Types from which properties in this subgraph are referen"...
field_declaration
type_identifier "JSTypeBitSet"
variable_declarator
identifier "typesInSet"
= "="
object_creation_expression
new "new"
type_identifier "JSTypeBitSet"
argument_list
( "("
method_invocation
identifier "intForType"
. "."
identifier "size"
argument_list
( "("
) ")"
) ")"
; ";"
block_comment "/** Types related to types in {@code typesInSet}. */"
field_declaration
type_identifier "JSTypeBitSet"
variable_declarator
identifier "typesRelatedToSet"
= "="
object_creation_expression
new "new"
type_identifier "JSTypeBitSet"
argument_list
( "("
method_invocation
identifier "intForType"
. "."
identifier "size"
argument_list
( "("
) ")"
) ")"
; ";"
block_comment "/**\n * Returns true if prop is in an independent set fro"...
method_declaration
modifiers
public "public"
boolean_type "boolean"
identifier "isIndependentOf"
formal_parameters
( "("
formal_parameter
type_identifier "Property"
identifier "prop"
) ")"
block
{ "{"
if_statement (+23 nodes collapsed)
return_statement
return "return"
unary_expression
! "!"
method_invocation any 2:1
method_invocation any 2:1
identifier "getRelated"
argument_list
( "("
field_access
identifier "prop"
. "."
identifier "type"
) ")"
. "."
identifier "intersects"
argument_list
( "("
identifier "typesInSet"
) ")"
; ";"
} "}"
block_comment "/**\n * Adds the node to the sub graph, adding all of its"...
method_declaration
modifiers
public "public"
void_type "void"
identifier "addNode"
formal_parameters
( "("
formal_parameter
type_identifier "Property"
identifier "prop"
) ")"
block
{ "{"
expression_statement
method_invocation
identifier "typesInSet"
. "."
identifier "or"
argument_list
( "("
field_access
identifier "prop"
. "."
identifier "typesSet"
) ")"
; ";"
expression_statement
method_invocation
identifier "typesRelatedToSet"
. "."
identifier "or"
argument_list
( "("
method_invocation
identifier "getRelated"
argument_list
( "("
field_access
identifier "prop"
. "."
identifier "type"
) ")"
) ")"
; ";"
} "}"
block_comment "/**\n * Finds all types related to the provided type and "...
method_declaration (+97 nodes collapsed)
block_comment "/**\n * Finds all types related to the provided type and "...
method_declaration (+33 nodes collapsed)
} "}"
class_declaration (+121 nodes collapsed)
block_comment "/** A traversal callback that collects externed property nam"...
class_declaration (+184 nodes collapsed)
block_comment "/** Finds all property references, recording the types on wh"...
class_declaration (+439 nodes collapsed)
block_comment "/** Returns true if properties on this type should not be re"...
method_declaration (+180 nodes collapsed)
method_declaration (+68 nodes collapsed)
block_comment "/**\n * This method gets the JSType from the Node argument "...
method_declaration (+71 nodes collapsed)
block_comment "/** Encapsulates the information needed for renaming a prope"...
class_declaration
modifiers
private "private"
class "class"
identifier "Property"
class_body
{ "{"
field_declaration
modifiers
final "final"
type_identifier "String"
variable_declarator
identifier "oldName"
; ";"
field_declaration
type_identifier "JSType"
variable_declarator
identifier "type"
; ";"
field_declaration
type_identifier "String"
variable_declarator
identifier "newName"
; ";"
field_declaration
integral_type
int "int"
variable_declarator
identifier "numOccurrences"
; ";"
field_declaration
boolean_type "boolean"
variable_declarator
identifier "skipAmbiguating"
; ";"
field_declaration
type_identifier "JSTypeBitSet"
variable_declarator
identifier "typesSet"
= "="
object_creation_expression
new "new"
type_identifier "JSTypeBitSet"
argument_list
( "("
method_invocation
identifier "intForType"
. "."
identifier "size"
argument_list
( "("
) ")"
) ")"
; ";"
constructor_declaration (+43 nodes collapsed)
block_comment "/** Add this type to this property, calculating */"
method_declaration (+108 nodes collapsed)
method_declaration
modifiers
private "private"
void_type "void"
identifier "addNonUnionType"
formal_parameters
( "("
formal_parameter
type_identifier "JSType"
identifier "newType"
) ")"
block
{ "{"
if_statement (+26 nodes collapsed)
if_statement
if "if"
parenthesized_expression
( "("
binary_expression
identifier "type"
== "=="
null_literal "null"
) ")"
block
{ "{"
expression_statement
assignment_expression
identifier "type"
= "="
identifier "newType"
; ";"
} "}"
else "else"
block
{ "{"
expression_statement
assignment_expression
identifier "type"
= "="
method_invocation
identifier "type"
. "."
identifier "getLeastSupertype"
argument_list
( "("
identifier "newType"
) ")"
; ";"
} "}"
expression_statement
method_invocation
identifier "typesSet"
. "."
identifier "set"
argument_list
( "("
method_invocation
identifier "getIntForType"
argument_list
( "("
identifier "newType"
) ")"
) ")"
; ";"
} "}"
} "}"
line_comment "// A BitSet that stores type info. Adds pretty-print routine"...
class_declaration (+193 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 "Joiner"
; ";"
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 "BiMap"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "common"
. "."
identifier "collect"
. "."
identifier "HashBiMap"
; ";"
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
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "jscomp"
. "."
identifier "TypeValidator"
. "."
identifier "TypeMismatch"
; ";"
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 "AdjacencyGraph"
; ";"
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 "Annotation"
; ";"
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 "GraphColoring"
; ";"
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 "GraphNode"
; ";"
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 "SubGraph"
; ";"
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
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "rhino"
. "."
identifier "jstype"
. "."
identifier "FunctionPrototypeType"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "rhino"
. "."
identifier "jstype"
. "."
identifier "FunctionType"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "rhino"
. "."
identifier "jstype"
. "."
identifier "InstanceObjectType"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "rhino"
. "."
identifier "jstype"
. "."
identifier "JSType"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "rhino"
. "."
identifier "jstype"
. "."
identifier "JSTypeNative"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "rhino"
. "."
identifier "jstype"
. "."
identifier "JSTypeRegistry"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "rhino"
. "."
identifier "jstype"
. "."
identifier "ObjectType"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "rhino"
. "."
identifier "jstype"
. "."
identifier "UnionType"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "BitSet"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "Collection"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "Comparator"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "HashSet"
; ";"
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"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "TreeSet"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "logging"
. "."
identifier "Logger"
; ";"
block_comment "/**\n * Renames unrelated properties to the same name, using "...
class_declaration
class "class"
identifier "AmbiguateProperties"
super_interfaces
implements "implements"
type_list
type_identifier "CompilerPass"
class_body
{ "{"
field_declaration (+27 nodes collapsed)
field_declaration
modifiers
private "private"
final "final"
type_identifier "AbstractCompiler"
variable_declarator
identifier "compiler"
; ";"
field_declaration (+21 nodes collapsed)
field_declaration
modifiers
private "private"
final "final"
array_type
integral_type
char "char"
dimensions
[ "["
] "]"
variable_declarator
identifier "reservedCharacters"
; ";"
block_comment "/** Map from property name to Property object */"
field_declaration (+23 nodes collapsed)
block_comment "/** Property names that don't get renamed */"
field_declaration (+21 nodes collapsed)
block_comment "/** Names to which properties shouldn't be renamed, to avoid"...
field_declaration (+21 nodes collapsed)
block_comment "/** Map from original property name to new name. */"
field_declaration (+23 nodes collapsed)
block_comment "/** Map from color assigned by GraphColoring to new name. */"
field_declaration (+23 nodes collapsed)
block_comment "/**\n * Sorts Property objects by their count, breaking tie"...
field_declaration (+96 nodes collapsed)
block_comment "/** A map from JSType to a unique representative Integer. */"
field_declaration (+22 nodes collapsed)
block_comment "/**\n * A map from JSType to JSTypeBitSet representing the "...
field_declaration (+22 nodes collapsed)
block_comment "/** A set of types that invalidate properties from ambiguati"...
field_declaration
modifiers
private "private"
final "final"
generic_type
type_identifier "Set"
type_arguments
< "<"
type_identifier "JSType"
> ">"
variable_declarator
identifier "invalidatingTypes"
; ";"
block_comment "/**\n * Prefix of properties to skip renaming. These shoul"...
field_declaration
modifiers
static "static"
final "final"
type_identifier "String"
variable_declarator
identifier "SKIP_PREFIX"
= "="
string_literal
" "\""
string_fragment "JSAbstractCompiler"
" "\""
; ";"
constructor_declaration (+263 nodes collapsed)
block_comment "/**\n * Invalidates the given type, so that no properties o"...
method_declaration (+122 nodes collapsed)
method_declaration
generic_type
type_identifier "Map"
type_arguments
< "<"
type_identifier "String"
, ","
type_identifier "String"
> ">"
identifier "getRenamingMap"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
identifier "renamingMap"
; ";"
} "}"
block_comment "/** Returns an integer that uniquely identifies a JSType. */"
method_declaration (+81 nodes collapsed)
method_declaration
modifiers
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
method_invocation
identifier "NodeTraversal"
. "."
identifier "traverse"
argument_list
( "("
identifier "compiler"
, ","
identifier "externs"
, ","
object_creation_expression
new "new"
type_identifier "ProcessExterns"
argument_list
( "("
) ")"
) ")"
; ";"
expression_statement
method_invocation
identifier "NodeTraversal"
. "."
identifier "traverse"
argument_list
( "("
identifier "compiler"
, ","
identifier "root"
, ","
object_creation_expression
new "new"
type_identifier "ProcessProperties"
argument_list
( "("
) ")"
) ")"
; ";"
local_variable_declaration (+38 nodes collapsed)
expression_statement
method_invocation
identifier "reservedNames"
. "."
identifier "addAll"
argument_list
( "("
identifier "externedNames"
) ")"
; ";"
expression_statement
method_invocation
identifier "reservedNames"
. "."
identifier "addAll"
argument_list
( "("
identifier "quotedNames"
) ")"
; ";"
local_variable_declaration
integral_type
int "int"
variable_declarator
identifier "numRenamedPropertyNames"
= "="
decimal_integer_literal "0"
; ";"
local_variable_declaration
integral_type
int "int"
variable_declarator
identifier "numSkippedPropertyNames"
= "="
decimal_integer_literal "0"
; ";"
local_variable_declaration (+23 nodes collapsed)
enhanced_for_statement
for "for"
( "("
type_identifier "Property"
identifier "p"
: ":"
method_invocation
identifier "propertyMap"
. "."
identifier "values"
argument_list
( "("
) ")"
) ")"
block
{ "{"
if_statement
if "if"
parenthesized_expression
( "("
unary_expression
! "!"
field_access
identifier "p"
. "."
identifier "skipAmbiguating"
) ")"
block
{ "{"
expression_statement
update_expression
++ "++"
identifier "numRenamedPropertyNames"
; ";"
expression_statement
method_invocation
identifier "propsByFreq"
. "."
identifier "add"
argument_list
( "("
identifier "p"
) ")"
; ";"
} "}"
else "else"
block (+21 nodes collapsed)
} "}"
local_variable_declaration
type_identifier "PropertyGraph"
variable_declarator
identifier "graph"
= "="
object_creation_expression
new "new"
type_identifier "PropertyGraph"
argument_list
( "("
method_invocation
identifier "Lists"
. "."
identifier "newLinkedList"
argument_list
( "("
identifier "propsByFreq"
) ")"
) ")"
; ";"
local_variable_declaration (+29 nodes collapsed)
local_variable_declaration
integral_type
int "int"
variable_declarator
identifier "numNewPropertyNames"
= "="
method_invocation
identifier "coloring"
. "."
identifier "color"
argument_list
( "("
) ")"
; ";"
local_variable_declaration
type_identifier "NameGenerator"
variable_declarator
identifier "nameGen"
= "="
object_creation_expression
new "new"
type_identifier "NameGenerator"
argument_list
( "("
identifier "reservedNames"
, ","
string_literal
" "\""
" "\""
, ","
identifier "reservedCharacters"
) ")"
; ";"
for_statement (+41 nodes collapsed)
enhanced_for_statement (+88 nodes collapsed)
line_comment "// Update the string nodes."
enhanced_for_statement (+122 nodes collapsed)
expression_statement (+40 nodes collapsed)
} "}"
method_declaration (+75 nodes collapsed)
block_comment "/** Add supertypes of the type to its JSTypeBitSet of relate"...
method_declaration (+315 nodes collapsed)
class_declaration (+255 nodes collapsed)
block_comment "/**\n * A {@link SubGraph} that represents properties. The "...
class_declaration
class "class"
identifier "PropertySubGraph"
super_interfaces
implements "implements"
type_list
generic_type
type_identifier "SubGraph"
type_arguments
< "<"
type_identifier "Property"
, ","
type_identifier "Void"
> ">"
class_body
{ "{"
block_comment "/** Types from which properties in this subgraph are referen"...
field_declaration
type_identifier "JSTypeBitSet"
variable_declarator
identifier "typesInSet"
= "="
object_creation_expression
new "new"
type_identifier "JSTypeBitSet"
argument_list
( "("
method_invocation
identifier "intForType"
. "."
identifier "size"
argument_list
( "("
) ")"
) ")"
; ";"
block_comment "/** Types related to types in {@code typesInSet}. */"
field_declaration
type_identifier "JSTypeBitSet"
variable_declarator
identifier "typesRelatedToSet"
= "="
object_creation_expression
new "new"
type_identifier "JSTypeBitSet"
argument_list
( "("
method_invocation
identifier "intForType"
. "."
identifier "size"
argument_list
( "("
) ")"
) ")"
; ";"
block_comment "/**\n * Returns true if prop is in an independent set fro"...
method_declaration
modifiers
public "public"
boolean_type "boolean"
identifier "isIndependentOf"
formal_parameters
( "("
formal_parameter
type_identifier "Property"
identifier "prop"
) ")"
block
{ "{"
if_statement (+23 nodes collapsed)
return_statement
return "return"
unary_expression
! "!"
method_invocation any 2:1
field_access
identifier "prop"
. "."
identifier "relatedTypesSet"
. "."
identifier "intersects"
argument_list
( "("
identifier "typesInSet"
) ")"
; ";"
} "}"
block_comment "/**\n * Adds the node to the sub graph, adding all of its"...
method_declaration
modifiers
public "public"
void_type "void"
identifier "addNode"
formal_parameters
( "("
formal_parameter
type_identifier "Property"
identifier "prop"
) ")"
block
{ "{"
expression_statement
method_invocation
identifier "typesInSet"
. "."
identifier "or"
argument_list
( "("
field_access
identifier "prop"
. "."
identifier "typesSet"
) ")"
; ";"
expression_statement
method_invocation
identifier "typesRelatedToSet"
. "."
identifier "or"
argument_list
( "("
field_access
identifier "prop"
. "."
identifier "relatedTypesSet"
) ")"
; ";"
} "}"
block_comment "/**\n * Finds all types related to the provided type and "...
method_declaration (+97 nodes collapsed)
block_comment "/**\n * Finds all types related to the provided type and "...
method_declaration (+33 nodes collapsed)
} "}"
class_declaration (+121 nodes collapsed)
block_comment "/** A traversal callback that collects externed property nam"...
class_declaration (+184 nodes collapsed)
block_comment "/** Finds all property references, recording the types on wh"...
class_declaration (+439 nodes collapsed)
block_comment "/** Returns true if properties on this type should not be re"...
method_declaration (+180 nodes collapsed)
method_declaration (+68 nodes collapsed)
block_comment "/**\n * This method gets the JSType from the Node argument "...
method_declaration (+71 nodes collapsed)
block_comment "/** Encapsulates the information needed for renaming a prope"...
class_declaration
modifiers
private "private"
class "class"
identifier "Property"
class_body
{ "{"
field_declaration
modifiers
final "final"
type_identifier "String"
variable_declarator
identifier "oldName"
; ";"
field_declaration
type_identifier "String"
variable_declarator
identifier "newName"
; ";"
field_declaration
integral_type
int "int"
variable_declarator
identifier "numOccurrences"
; ";"
field_declaration
boolean_type "boolean"
variable_declarator
identifier "skipAmbiguating"
; ";"
field_declaration
type_identifier "JSTypeBitSet"
variable_declarator
identifier "typesSet"
= "="
object_creation_expression
new "new"
type_identifier "JSTypeBitSet"
argument_list
( "("
method_invocation
identifier "intForType"
. "."
identifier "size"
argument_list
( "("
) ")"
) ")"
; ";"
field_declaration
type_identifier "JSTypeBitSet"
variable_declarator
identifier "relatedTypesSet"
= "="
object_creation_expression
new "new"
type_identifier "JSTypeBitSet"
argument_list
( "("
method_invocation
identifier "intForType"
. "."
identifier "size"
argument_list
( "("
) ")"
) ")"
; ";"
constructor_declaration (+43 nodes collapsed)
block_comment "/** Add this type to this property, calculating */"
method_declaration (+108 nodes collapsed)
method_declaration
modifiers
private "private"
void_type "void"
identifier "addNonUnionType"
formal_parameters
( "("
formal_parameter
type_identifier "JSType"
identifier "newType"
) ")"
block
{ "{"
if_statement (+26 nodes collapsed)
local_variable_declaration
integral_type
int "int"
variable_declarator
identifier "typeInt"
= "="
method_invocation
identifier "getIntForType"
argument_list
( "("
identifier "newType"
) ")"
; ";"
if_statement
if "if"
parenthesized_expression
( "("
unary_expression
! "!"
method_invocation
identifier "typesSet"
. "."
identifier "get"
argument_list
( "("
identifier "typeInt"
) ")"
) ")"
block
{ "{"
expression_statement
method_invocation
identifier "computeRelatedTypes"
argument_list
( "("
identifier "newType"
) ")"
; ";"
expression_statement
method_invocation
identifier "typesSet"
. "."
identifier "set"
argument_list
( "("
identifier "typeInt"
) ")"
; ";"
expression_statement
method_invocation
identifier "relatedTypesSet"
. "."
identifier "or"
argument_list
( "("
method_invocation
identifier "getRelatedTypesOnNonUnion"
argument_list
( "("
identifier "newType"
) ")"
) ")"
; ";"
} "}"
} "}"
} "}"
line_comment "// A BitSet that stores type info. Adds pretty-print routine"...
class_declaration (+193 nodes collapsed)
} "}"