| Index: pkg/analyzer/lib/src/summary/summarize_elements.dart
|
| diff --git a/pkg/analyzer/lib/src/summary/summarize_elements.dart b/pkg/analyzer/lib/src/summary/summarize_elements.dart
|
| index a3b8c030b6d27ce782d48561a4f11099a9c73f87..09fb448291de5673dfa2fc72ad3ddfb5b4d3a461 100644
|
| --- a/pkg/analyzer/lib/src/summary/summarize_elements.dart
|
| +++ b/pkg/analyzer/lib/src/summary/summarize_elements.dart
|
| @@ -369,6 +369,7 @@ class _CompilationUnitSerializer {
|
| unlinkedUnit.publicNamespace =
|
| new UnlinkedPublicNamespaceBuilder(names: names);
|
| }
|
| + serializeCodeRange(unlinkedUnit, compilationUnit);
|
| unlinkedUnit.classes = compilationUnit.types.map(serializeClass).toList();
|
| unlinkedUnit.enums = compilationUnit.enums.map(serializeEnum).toList();
|
| unlinkedUnit.typedefs =
|
| @@ -537,6 +538,7 @@ class _CompilationUnitSerializer {
|
| b.isMixinApplication = classElement.isMixinApplication;
|
| b.documentationComment = serializeDocumentation(classElement);
|
| b.annotations = serializeAnnotations(classElement);
|
| + serializeCodeRange(b, classElement);
|
| return b;
|
| }
|
|
|
| @@ -586,6 +588,44 @@ class _CompilationUnitSerializer {
|
| return null;
|
| }
|
|
|
| + void serializeCodeRange(Object b, Element element) {
|
| + if (element is ElementImpl && element.codeOffset != null) {
|
| + if (b is UnlinkedClassBuilder) {
|
| + b.hasCodeRange = true;
|
| + b.codeOffset = element.codeOffset;
|
| + b.codeLength = element.codeLength;
|
| + } else if (b is UnlinkedEnumBuilder) {
|
| + b.hasCodeRange = true;
|
| + b.codeOffset = element.codeOffset;
|
| + b.codeLength = element.codeLength;
|
| + } else if (b is UnlinkedExecutableBuilder) {
|
| + b.hasCodeRange = true;
|
| + b.codeOffset = element.codeOffset;
|
| + b.codeLength = element.codeLength;
|
| + } else if (b is UnlinkedParamBuilder) {
|
| + b.hasCodeRange = true;
|
| + b.codeOffset = element.codeOffset;
|
| + b.codeLength = element.codeLength;
|
| + } else if (b is UnlinkedTypedefBuilder) {
|
| + b.hasCodeRange = true;
|
| + b.codeOffset = element.codeOffset;
|
| + b.codeLength = element.codeLength;
|
| + } else if (b is UnlinkedTypeParamBuilder) {
|
| + b.hasCodeRange = true;
|
| + b.codeOffset = element.codeOffset;
|
| + b.codeLength = element.codeLength;
|
| + } else if (b is UnlinkedUnitBuilder) {
|
| + b.hasCodeRange = true;
|
| + b.codeOffset = element.codeOffset;
|
| + b.codeLength = element.codeLength;
|
| + } else if (b is UnlinkedVariableBuilder) {
|
| + b.hasCodeRange = true;
|
| + b.codeOffset = element.codeOffset;
|
| + b.codeLength = element.codeLength;
|
| + }
|
| + }
|
| + }
|
| +
|
| /**
|
| * Serialize the given [combinator] into an [UnlinkedCombinator].
|
| */
|
| @@ -648,6 +688,7 @@ class _CompilationUnitSerializer {
|
| b.values = values;
|
| b.documentationComment = serializeDocumentation(enumElement);
|
| b.annotations = serializeAnnotations(enumElement);
|
| + serializeCodeRange(b, enumElement);
|
| return b;
|
| }
|
|
|
| @@ -736,6 +777,7 @@ class _CompilationUnitSerializer {
|
| b.isExternal = executableElement.isExternal;
|
| b.documentationComment = serializeDocumentation(executableElement);
|
| b.annotations = serializeAnnotations(executableElement);
|
| + serializeCodeRange(b, executableElement);
|
| if (executableElement is FunctionElement) {
|
| SourceRange visibleRange = executableElement.visibleRange;
|
| if (visibleRange != null) {
|
| @@ -832,6 +874,7 @@ class _CompilationUnitSerializer {
|
| break;
|
| }
|
| b.annotations = serializeAnnotations(parameter);
|
| + serializeCodeRange(b, parameter);
|
| b.isInitializingFormal = parameter.isInitializingFormal;
|
| DartType type = parameter.type;
|
| if (parameter.hasImplicitType) {
|
| @@ -921,6 +964,7 @@ class _CompilationUnitSerializer {
|
| b.parameters = typedefElement.parameters.map(serializeParam).toList();
|
| b.documentationComment = serializeDocumentation(typedefElement);
|
| b.annotations = serializeAnnotations(typedefElement);
|
| + serializeCodeRange(b, typedefElement);
|
| return b;
|
| }
|
|
|
| @@ -936,6 +980,7 @@ class _CompilationUnitSerializer {
|
| b.bound = serializeTypeRef(typeParameter.bound, typeParameter);
|
| }
|
| b.annotations = serializeAnnotations(typeParameter);
|
| + serializeCodeRange(b, typeParameter);
|
| return b;
|
| }
|
|
|
| @@ -1085,6 +1130,7 @@ class _CompilationUnitSerializer {
|
| (variable.initializer != null || !variable.isStatic)) {
|
| b.inferredTypeSlot = storeInferredType(variable.type, variable);
|
| }
|
| + serializeCodeRange(b, variable);
|
| if (variable is LocalVariableElement) {
|
| SourceRange visibleRange = variable.visibleRange;
|
| if (visibleRange != null) {
|
| @@ -1100,6 +1146,18 @@ class _CompilationUnitSerializer {
|
| }
|
|
|
| /**
|
| + * Create a new slot id and return it. If [hasCycle] is `true`, arrange for
|
| + * the slot id to be included in [LinkedUnit.constCycles].
|
| + */
|
| + int storeConstCycle(bool hasCycle) {
|
| + int slot = ++numSlots;
|
| + if (hasCycle) {
|
| + constCycles.add(slot);
|
| + }
|
| + return slot;
|
| + }
|
| +
|
| + /**
|
| * Create a slot id for the given [type] (which is an inferred type). If
|
| * [type] is not `dynamic`, it is stored in [linkedTypes] so that once the
|
| * compilation unit has been fully visited, it will be serialized into
|
| @@ -1113,18 +1171,6 @@ class _CompilationUnitSerializer {
|
| }
|
|
|
| /**
|
| - * Create a new slot id and return it. If [hasCycle] is `true`, arrange for
|
| - * the slot id to be included in [LinkedUnit.constCycles].
|
| - */
|
| - int storeConstCycle(bool hasCycle) {
|
| - int slot = ++numSlots;
|
| - if (hasCycle) {
|
| - constCycles.add(slot);
|
| - }
|
| - return slot;
|
| - }
|
| -
|
| - /**
|
| * Create a slot id for the given [type] (which may be either a propagated
|
| * type or an inferred type). If [type] is not `null`, it is stored in
|
| * [linkedTypes] so that once the compilation unit has been fully visited,
|
|
|