| 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 8cf8cd0f39174f98087f60d4ff4dd21500fe4ad2..d4cc5ff124053e28e44abd71f45f7b614a4148e6 100644
|
| --- a/pkg/compiler/lib/src/info/info.dart
|
| +++ b/pkg/compiler/lib/src/info/info.dart
|
| @@ -26,6 +26,10 @@ abstract class Info {
|
| /// A globally unique id combining [kind] and [id] together.
|
| String get serializedId;
|
|
|
| + /// Id used by the compiler when instrumenting code for code coverage.
|
| + // TODO(sigmund): unify all ids.
|
| + String coverageId;
|
| +
|
| /// Bytes used in the generated code for the corresponding element.
|
| int size;
|
|
|
| @@ -46,6 +50,7 @@ abstract class Info {
|
| abstract class BasicInfo implements Info {
|
| final InfoKind kind;
|
| final int id;
|
| + String coverageId;
|
| int size;
|
| Info parent;
|
|
|
| @@ -57,7 +62,8 @@ abstract class BasicInfo implements Info {
|
| /// is generated.
|
| OutputUnitInfo outputUnit;
|
|
|
| - BasicInfo(this.kind, this.id, this.name, this.outputUnit, this.size);
|
| + BasicInfo(this.kind, this.id, this.name, this.outputUnit, this.size,
|
| + this.coverageId);
|
|
|
| BasicInfo._fromId(String serializedId)
|
| : kind = _kindFromSerializedId(serializedId),
|
| @@ -73,6 +79,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 (coverageId != null) res['coverageId'] = coverageId;
|
| if (parent != null) res['parent'] = parent.serializedId;
|
| return res;
|
| }
|
| @@ -308,6 +315,7 @@ class _ParseHelper {
|
| FieldInfo result = parseId(json['id']);
|
| return result..name = json['name']
|
| ..parent = parseId(json['parent'])
|
| + ..coverageId = json['coverageId']
|
| ..outputUnit = parseId(json['outputUnit'])
|
| ..size = json['size']
|
| ..type = json['type']
|
| @@ -331,6 +339,7 @@ class _ParseHelper {
|
| FunctionInfo result = parseId(json['id']);
|
| return result..name = json['name']
|
| ..parent = parseId(json['parent'])
|
| + ..coverageId = json['coverageId']
|
| ..outputUnit = parseId(json['outputUnit'])
|
| ..size = json['size']
|
| ..type = json['type']
|
| @@ -398,7 +407,7 @@ class LibraryInfo extends BasicInfo {
|
| topLevelFunctions.isEmpty && topLevelVariables.isEmpty && classes.isEmpty;
|
|
|
| LibraryInfo(String name, this.uri, OutputUnitInfo outputUnit, int size)
|
| - : super(InfoKind.library, _id++, name, outputUnit, size);
|
| + : super(InfoKind.library, _id++, name, outputUnit, size, null);
|
|
|
| LibraryInfo._(String serializedId) : super._fromId(serializedId);
|
|
|
| @@ -421,7 +430,7 @@ class LibraryInfo extends BasicInfo {
|
| class OutputUnitInfo extends BasicInfo {
|
| static int _ids = 0;
|
| OutputUnitInfo(String name, int size)
|
| - : super(InfoKind.outputUnit, _ids++, name, null, size);
|
| + : super(InfoKind.outputUnit, _ids++, name, null, size, null);
|
|
|
| OutputUnitInfo._(String serializedId) : super._fromId(serializedId);
|
|
|
| @@ -445,7 +454,7 @@ class ClassInfo extends BasicInfo {
|
|
|
| ClassInfo(
|
| {String name, this.isAbstract, OutputUnitInfo outputUnit, int size: 0})
|
| - : super(InfoKind.clazz, _ids++, name, outputUnit, size);
|
| + : super(InfoKind.clazz, _ids++, name, outputUnit, size, null);
|
|
|
| ClassInfo._(String serializedId) : super._fromId(serializedId);
|
|
|
| @@ -478,13 +487,14 @@ class FieldInfo extends BasicInfo with CodeInfo {
|
| static int _ids = 0;
|
| FieldInfo(
|
| {String name,
|
| + String coverageId,
|
| int size: 0,
|
| this.type,
|
| this.inferredType,
|
| this.closures,
|
| this.code,
|
| OutputUnitInfo outputUnit})
|
| - : super(InfoKind.field, _ids++, name, outputUnit, size);
|
| + : super(InfoKind.field, _ids++, name, outputUnit, size, coverageId);
|
|
|
| FieldInfo._(String serializedId) : super._fromId(serializedId);
|
|
|
| @@ -506,7 +516,7 @@ class TypedefInfo extends BasicInfo {
|
|
|
| static int _ids = 0;
|
| TypedefInfo(String name, this.type, OutputUnitInfo outputUnit)
|
| - : super(InfoKind.typedef, _ids++, name, outputUnit, 0);
|
| + : super(InfoKind.typedef, _ids++, name, outputUnit, 0, null);
|
|
|
| TypedefInfo._(String serializedId) : super._fromId(serializedId);
|
|
|
| @@ -556,6 +566,7 @@ class FunctionInfo extends BasicInfo with CodeInfo {
|
|
|
| FunctionInfo(
|
| {String name,
|
| + String coverageId,
|
| OutputUnitInfo outputUnit,
|
| int size: 0,
|
| this.functionKind,
|
| @@ -568,7 +579,7 @@ class FunctionInfo extends BasicInfo with CodeInfo {
|
| this.sideEffects,
|
| this.inlinedCount,
|
| this.code})
|
| - : super(InfoKind.function, _ids++, name, outputUnit, size);
|
| + : super(InfoKind.function, _ids++, name, outputUnit, size, coverageId);
|
|
|
| FunctionInfo._(String serializedId) : super._fromId(serializedId);
|
|
|
|
|