…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)