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–47 unchanged (47 lines)
48/**
49 * A builder for record types.
50 *
51 */
52public class RecordTypeBuilder {
53 private boolean isEmpty = true;
54 private final JSTypeRegistry registry;
55 private final HashMap<String, RecordProperty> properties = Maps.newHashMap();
56
57 public RecordTypeBuilder(JSTypeRegistry registry) {
58 this.registry = registry;
59 }
60
61 /** See the comments on RecordType about synthetic types. */
62
63 /**
64 * Adds a property with the given name and type to the record type.
65 * @param name the name of the new property
66 * @param type the JSType of the new property
67 * @param propertyNode the node that holds this property definition
68 * @return The builder itself for chaining purposes, or null if there's
…lines 69–85 unchanged (17 lines)
86 // If we have an empty record, simply return the object type.
87 if (isEmpty) {
88 return registry.getNativeObjectType(JSTypeNative.OBJECT_TYPE);
89 }
90
91 return new RecordType(
92 registry, Collections.unmodifiableMap(properties));
93 }
94
95 static class RecordProperty {
96 private final JSType type;
97 private final Node propertyNode;
98
…lines 99–113 unchanged (15 lines)

After

…lines 1–47 unchanged (47 lines)
48/**
49 * A builder for record types.
50 *
51 */
52public class RecordTypeBuilder {
53 private boolean isEmpty = true;
54 private boolean isDeclared = true;
55 private final JSTypeRegistry registry;
56 private final HashMap<String, RecordProperty> properties = Maps.newHashMap();
57
58 public RecordTypeBuilder(JSTypeRegistry registry) {
59 this.registry = registry;
60 }
61
62 /** See the comments on RecordType about synthetic types. */
63 void setSynthesized(boolean synthesized) {
64 isDeclared = !synthesized;
65 }
66
67 /**
68 * Adds a property with the given name and type to the record type.
69 * @param name the name of the new property
70 * @param type the JSType of the new property
71 * @param propertyNode the node that holds this property definition
…lines 72–89 unchanged (18 lines)
90 // If we have an empty record, simply return the object type.
91 if (isEmpty) {
92 return registry.getNativeObjectType(JSTypeNative.OBJECT_TYPE);
93 }
94
95 return new RecordType(
96 registry, Collections.unmodifiableMap(properties), isDeclared);
97 }
98
99 static class RecordProperty {
100 private final JSType type;
101 private final Node propertyNode;
102
…lines 103–117 unchanged (15 lines)

Before

program
block_comment "/*\n *\n * ***** BEGIN LICENSE BLOCK *****\n * Version: MPL 1.1"...
package_declaration
package "package"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "rhino"
. "."
identifier "jstype"
; ";"
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 "javascript"
. "."
identifier "rhino"
. "."
identifier "Node"
; ";"
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 "HashMap"
; ";"
block_comment "/**\n * A builder for record types.\n *\n */"
class_declaration
modifiers
public "public"
class "class"
identifier "RecordTypeBuilder"
class_body
{ "{"
field_declaration
modifiers
private "private"
boolean_type "boolean"
variable_declarator
identifier "isEmpty"
= "="
true "true"
; ";"
field_declaration
modifiers
private "private"
final "final"
type_identifier "JSTypeRegistry"
variable_declarator
identifier "registry"
; ";"
field_declaration (+23 nodes collapsed)
constructor_declaration (+22 nodes collapsed)
block_comment "/** See the comments on RecordType about synthetic types. */"
block_comment "/**\n * Adds a property with the given name and type to the"...
method_declaration (+72 nodes collapsed)
block_comment "/**\n * Creates a record.\n * @return The record type.\n "...
method_declaration
modifiers
public "public"
type_identifier "JSType"
identifier "build"
formal_parameters
( "("
) ")"
block
{ "{"
line_comment "// If we have an empty record, simply return the object type"...
if_statement (+23 nodes collapsed)
return_statement
return "return"
object_creation_expression
new "new"
type_identifier "RecordType"
argument_list
( "("
identifier "registry"
, ","
method_invocation
identifier "Collections"
. "."
identifier "unmodifiableMap"
argument_list
( "("
identifier "properties"
) ")"
) ")"
; ";"
} "}"
class_declaration (+87 nodes collapsed)
} "}"

After

program
block_comment "/*\n *\n * ***** BEGIN LICENSE BLOCK *****\n * Version: MPL 1.1"...
package_declaration
package "package"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "rhino"
. "."
identifier "jstype"
; ";"
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 "javascript"
. "."
identifier "rhino"
. "."
identifier "Node"
; ";"
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 "HashMap"
; ";"
block_comment "/**\n * A builder for record types.\n *\n */"
class_declaration
modifiers
public "public"
class "class"
identifier "RecordTypeBuilder"
class_body
{ "{"
field_declaration
modifiers
private "private"
boolean_type "boolean"
variable_declarator
identifier "isEmpty"
= "="
true "true"
; ";"
field_declaration
modifiers
private "private"
boolean_type "boolean"
variable_declarator
identifier "isDeclared"
= "="
true "true"
; ";"
field_declaration
modifiers
private "private"
final "final"
type_identifier "JSTypeRegistry"
variable_declarator
identifier "registry"
; ";"
field_declaration (+23 nodes collapsed)
constructor_declaration (+22 nodes collapsed)
block_comment "/** See the comments on RecordType about synthetic types. */"
method_declaration
void_type "void"
identifier "setSynthesized"
formal_parameters
( "("
formal_parameter
boolean_type "boolean"
identifier "synthesized"
) ")"
block
{ "{"
expression_statement
assignment_expression
identifier "isDeclared"
= "="
unary_expression
! "!"
identifier "synthesized"
; ";"
} "}"
block_comment "/**\n * Adds a property with the given name and type to the"...
method_declaration (+72 nodes collapsed)
block_comment "/**\n * Creates a record.\n * @return The record type.\n "...
method_declaration
modifiers
public "public"
type_identifier "JSType"
identifier "build"
formal_parameters
( "("
) ")"
block
{ "{"
line_comment "// If we have an empty record, simply return the object type"...
if_statement (+23 nodes collapsed)
return_statement
return "return"
object_creation_expression
new "new"
type_identifier "RecordType"
argument_list
( "("
identifier "registry"
, ","
method_invocation
identifier "Collections"
. "."
identifier "unmodifiableMap"
argument_list
( "("
identifier "properties"
) ")"
, ","
identifier "isDeclared"
) ")"
; ";"
} "}"
class_declaration (+87 nodes collapsed)
} "}"