Chromium Code Reviews| Index: pkg/compiler/lib/src/info/info.dart |
| diff --git a/pkg/compiler/lib/src/info/info.dart b/pkg/compiler/lib/src/info/info.dart |
| index 1f35b2522b39792f92bd6fc1142ed458608a1376..c9fc7ef8c65e70bdcb58d10aab42f04168d1fe4f 100644 |
| --- a/pkg/compiler/lib/src/info/info.dart |
| +++ b/pkg/compiler/lib/src/info/info.dart |
| @@ -29,6 +29,9 @@ abstract class Info { |
| /// Bytes used in the generated code for the corresponding element. |
| int size; |
| + /// Info of the enclosing element. |
| + Info parent; |
| + |
| /// Serializes the information into a JSON format. |
| // TODO(sigmund): refactor and put toJson outside the class, so we can have 2 |
| // different serializer/deserializers at once. |
| @@ -44,6 +47,7 @@ abstract class BasicInfo implements Info { |
| final String kind; |
| final int id; |
| int size; |
| + Info parent; |
| String get serializedId => '$kind/$id'; |
| @@ -64,6 +68,7 @@ abstract class BasicInfo implements Info { |
| // TODO(sigmund): omit this also when outputUnit.id == 0 |
| // (most code is by default in the main output unit) |
| if (outputUnit != null) res['outputUnit'] = outputUnit.serializedId; |
| + if (parent != null) res['parent'] = parent.serializedId; |
| return res; |
| } |
| @@ -119,7 +124,7 @@ class AllInfo { |
| /// previous will continue to work after the change. This is typically |
| /// increased when adding new entries to the file format. |
| // Note: the dump-info.viewer app was written using a json parser version 3.2. |
| - final int minorVersion = 3; |
| + final int minorVersion = 4; |
| AllInfo(); |
| @@ -237,6 +242,7 @@ class _ParseHelper { |
| LibraryInfo parseLibrary(Map json) { |
| var result = parseId(json['id']) |
| ..name = json['name'] |
| + ..parent = parseId(json['parent']) |
|
Harry Terkelsen
2015/08/11 01:23:14
can libraries have parents?
Siggi Cherem (dart-lang)
2015/08/11 16:44:27
Good point, it's always going to be null. Removed.
|
| ..uri = Uri.parse(json['canonicalUri']) |
| ..outputUnit = parseId(json['outputUnit']) |
| ..size = json['size']; |
| @@ -259,6 +265,7 @@ class _ParseHelper { |
| ClassInfo parseClass(Map json) { |
| var result = parseId(json['id']) |
| ..name = json['name'] |
| + ..parent = parseId(json['parent']) |
| ..outputUnit = parseId(json['outputUnit']) |
| ..size = json['size'] |
| ..isAbstract = json['modifiers']['abstract'] == true; |
| @@ -277,6 +284,7 @@ class _ParseHelper { |
| FieldInfo parseField(Map json) { |
| return parseId(json['id']) |
| ..name = json['name'] |
| + ..parent = parseId(json['parent']) |
| ..outputUnit = parseId(json['outputUnit']) |
| ..size = json['size'] |
| ..type = json['type'] |
| @@ -287,6 +295,7 @@ class _ParseHelper { |
| TypedefInfo parseTypedef(Map json) => parseId(json['id']) |
| ..name = json['name'] |
| + ..parent = parseId(json['parent']) |
| ..type = json['type'] |
| ..size = 0; |
| @@ -295,6 +304,7 @@ class _ParseHelper { |
| FunctionInfo parseFunction(Map json) { |
| return parseId(json['id']) |
| + ..parent = parseId(json['parent']) |
| ..name = json['name'] |
| ..outputUnit = parseId(json['outputUnit']) |
| ..size = json['size'] |