@@ -27,14 +27,6 @@ abstract class Info {
2727 /// Name of the element associated with this info.
2828 String name;
2929
30- /// An id to uniquely identify this info among infos of the same [kind] .
31- // TODO(kevmoo) Consider removing `id` entirely. Make it an impl detail of
32- // the JSON encoder
33- int get id;
34-
35- /// A globally unique id combining [kind] and [id] together.
36- String get serializedId;
37-
3830 /// Id used by the compiler when instrumenting code for code coverage.
3931 // TODO(sigmund): It would be nice if we could use the same id for
4032 // serialization and for coverage. Could we unify them?
@@ -53,46 +45,12 @@ abstract class Info {
5345// TODO(sigmund): add more:
5446// - inputSize: bytes used in the Dart source program
5547abstract class BasicInfo implements Info {
56- static final Set <int > _ids = new Set <int >();
57-
58- /// Frees internal cache used for id uniqueness.
59- static void resetIds () => BasicInfo ._ids.clear ();
60-
6148 final InfoKind kind;
6249
63- int _id;
64- // TODO(kevmoo) Make computation of id explicit and not on-demand.
65- int get id {
66- if (_id == null ) {
67- assert (this is LibraryInfo ||
68- this is ConstantInfo ||
69- this is OutputUnitInfo ||
70- this .parent != null );
71-
72- if (this is ConstantInfo ) {
73- // No name and no parent, so `longName` isn't helpful
74- assert (this .name == null );
75- assert (this .parent == null );
76- assert ((this as ConstantInfo ).code != null );
77- // Instead, use the content of the code.
78- _id = (this as ConstantInfo ).code.hashCode;
79- } else {
80- _id = longName (this , useLibraryUri: true , forId: true ).hashCode;
81- }
82- while (! _ids.add (_id)) {
83- _id++ ;
84- }
85- }
86-
87- return _id;
88- }
89-
9050 String coverageId;
9151 int size;
9252 Info parent;
9353
94- String get serializedId => '${kindToString (kind )}/$id ' ;
95-
9654 String name;
9755
9856 /// If using deferred libraries, where the element associated with this info
@@ -101,18 +59,16 @@ abstract class BasicInfo implements Info {
10159
10260 BasicInfo (this .kind, this .name, this .outputUnit, this .size, this .coverageId);
10361
104- BasicInfo ._fromId (String serializedId)
105- : kind = _kindFromSerializedId (serializedId),
106- _id = _idFromSerializedId (serializedId);
62+ BasicInfo ._(this .kind);
10763
108- String toString () => '$serializedId $name [$size ]' ;
64+ String toString () => '$kind $name [$size ]' ;
10965}
11066
11167/// Info associated with elements containing executable code (like fields and
11268/// methods)
11369abstract class CodeInfo implements Info {
11470 /// How does this function or field depend on others.
115- final Set <DependencyInfo > uses = new SplayTreeSet < DependencyInfo >() ;
71+ final List <DependencyInfo > uses = [] ;
11672}
11773
11874/// The entire information produced while compiling a program.
@@ -250,7 +206,7 @@ class LibraryInfo extends BasicInfo {
250206 LibraryInfo (String name, this .uri, OutputUnitInfo outputUnit, int size)
251207 : super (InfoKind .library, name, outputUnit, size, null );
252208
253- LibraryInfo ._(String serializedId ) : super ._fromId (serializedId );
209+ LibraryInfo ._() : super ._( InfoKind .library );
254210
255211 T accept <T >(InfoVisitor <T > visitor) => visitor.visitLibrary (this );
256212}
@@ -265,7 +221,7 @@ class OutputUnitInfo extends BasicInfo {
265221 OutputUnitInfo (String name, int size)
266222 : super (InfoKind .outputUnit, name, null , size, null );
267223
268- OutputUnitInfo ._(String serializedId ) : super ._fromId (serializedId );
224+ OutputUnitInfo ._() : super ._( InfoKind .outputUnit );
269225
270226 T accept <T >(InfoVisitor <T > visitor) => visitor.visitOutput (this );
271227}
@@ -288,7 +244,7 @@ class ClassInfo extends BasicInfo {
288244 {String name, this .isAbstract, OutputUnitInfo outputUnit, int size: 0 })
289245 : super (InfoKind .clazz, name, outputUnit, size, null );
290246
291- ClassInfo ._(String serializedId ) : super ._fromId (serializedId );
247+ ClassInfo ._() : super ._( InfoKind .clazz );
292248
293249 T accept <T >(InfoVisitor <T > visitor) => visitor.visitClass (this );
294250}
@@ -303,7 +259,7 @@ class ConstantInfo extends BasicInfo {
303259 ConstantInfo ({int size: 0 , this .code, OutputUnitInfo outputUnit})
304260 : super (InfoKind .constant, null , outputUnit, size, null );
305261
306- ConstantInfo ._(String serializedId ) : super ._fromId (serializedId );
262+ ConstantInfo ._() : super ._( InfoKind .constant );
307263
308264 T accept <T >(InfoVisitor <T > visitor) => visitor.visitConstant (this );
309265}
@@ -340,7 +296,7 @@ class FieldInfo extends BasicInfo with CodeInfo {
340296 this .isConst})
341297 : super (InfoKind .field, name, outputUnit, size, coverageId);
342298
343- FieldInfo ._(String serializedId ) : super ._fromId (serializedId );
299+ FieldInfo ._() : super ._( InfoKind .field );
344300
345301 T accept <T >(InfoVisitor <T > visitor) => visitor.visitField (this );
346302}
@@ -353,7 +309,7 @@ class TypedefInfo extends BasicInfo {
353309 TypedefInfo (String name, this .type, OutputUnitInfo outputUnit)
354310 : super (InfoKind .typedef , name, outputUnit, 0 , null );
355311
356- TypedefInfo ._(String serializedId ) : super ._fromId (serializedId );
312+ TypedefInfo ._() : super ._( InfoKind . typedef );
357313
358314 T accept <T >(InfoVisitor <T > visitor) => visitor.visitTypedef (this );
359315}
@@ -417,7 +373,7 @@ class FunctionInfo extends BasicInfo with CodeInfo {
417373 this .measurements})
418374 : super (InfoKind .function, name, outputUnit, size, coverageId);
419375
420- FunctionInfo ._(String serializedId ) : super ._fromId (serializedId );
376+ FunctionInfo ._() : super ._( InfoKind .function );
421377
422378 T accept <T >(InfoVisitor <T > visitor) => visitor.visitFunction (this );
423379}
@@ -431,13 +387,13 @@ class ClosureInfo extends BasicInfo {
431387 {String name, OutputUnitInfo outputUnit, int size: 0 , this .function})
432388 : super (InfoKind .closure, name, outputUnit, size, null );
433389
434- ClosureInfo ._(String serializedId ) : super ._fromId (serializedId );
390+ ClosureInfo ._() : super ._( InfoKind .closure );
435391
436392 T accept <T >(InfoVisitor <T > visitor) => visitor.visitClosure (this );
437393}
438394
439395/// Information about how a dependency is used.
440- class DependencyInfo implements Comparable < DependencyInfo > {
396+ class DependencyInfo {
441397 /// The dependency, either a FunctionInfo or FieldInfo.
442398 final Info target;
443399
@@ -447,21 +403,6 @@ class DependencyInfo implements Comparable<DependencyInfo> {
447403 final String mask;
448404
449405 DependencyInfo (this .target, this .mask);
450-
451- int compareTo (DependencyInfo other) {
452- var value = target.serializedId.compareTo (other.target.serializedId);
453- if (value == 0 ) {
454- value = mask.compareTo (other.mask);
455- }
456- return value;
457- }
458-
459- bool operator == (other) =>
460- other is DependencyInfo &&
461- target.serializedId == other.target.serializedId &&
462- mask == other.mask;
463-
464- int get hashCode => target.serializedId.hashCode * 37 ^ mask.hashCode;
465406}
466407
467408/// Name and type information about a function parameter.
@@ -522,12 +463,6 @@ String kindToString(InfoKind kind) {
522463 }
523464}
524465
525- int _idFromSerializedId (String serializedId) =>
526- int .parse (serializedId.substring (serializedId.indexOf ('/' ) + 1 ));
527-
528- InfoKind _kindFromSerializedId (String serializedId) =>
529- kindFromString (serializedId.substring (0 , serializedId.indexOf ('/' )));
530-
531466InfoKind kindFromString (String kind) {
532467 switch (kind) {
533468 case 'library' :
0 commit comments