Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(541)

Unified Diff: pkg/compiler/lib/src/info/info.dart

Issue 1287533002: dart2js: add parent references to some info objects (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/compiler/lib/src/dump_info.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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']
« no previous file with comments | « pkg/compiler/lib/src/dump_info.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698