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

Unified Diff: pkg/analyzer/lib/src/summary/resynthesize.dart

Issue 1762193002: Resynthesize codeOffset/codeLength properties. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Use CodeRange object. Created 4 years, 10 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/analyzer/lib/src/summary/idl.dart ('k') | pkg/analyzer/lib/src/summary/summarize_ast.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/summary/resynthesize.dart
diff --git a/pkg/analyzer/lib/src/summary/resynthesize.dart b/pkg/analyzer/lib/src/summary/resynthesize.dart
index df23151bff8c755ddd6b2946a0793a126f1c36a5..8c9869f6bbf1e2f96cc9339ddaff74b8e3f66885 100644
--- a/pkg/analyzer/lib/src/summary/resynthesize.dart
+++ b/pkg/analyzer/lib/src/summary/resynthesize.dart
@@ -1020,6 +1020,7 @@ class _LibraryResynthesizer {
classElement.type = correspondingType;
buildDocumentation(classElement, serializedClass.documentationComment);
buildAnnotations(classElement, serializedClass.annotations);
+ buildCodeRange(classElement, serializedClass.codeRange);
resolveConstructorInitializers(classElement);
unitHolder.addType(classElement);
currentTypeParameters.removeLast();
@@ -1028,6 +1029,12 @@ class _LibraryResynthesizer {
constructors = null;
}
+ void buildCodeRange(ElementImpl element, CodeRange codeRange) {
+ if (codeRange != null) {
+ element.setCodeRange(codeRange.offset, codeRange.length);
+ }
+ }
+
/**
* Resynthesize a [NamespaceCombinator].
*/
@@ -1151,6 +1158,7 @@ class _LibraryResynthesizer {
classElement.supertype = summaryResynthesizer.typeProvider.objectType;
buildDocumentation(classElement, serializedEnum.documentationComment);
buildAnnotations(classElement, serializedEnum.annotations);
+ buildCodeRange(classElement, serializedEnum.codeRange);
ElementHolder memberHolder = new ElementHolder();
// Build the 'index' field.
FieldElementImpl indexField = new FieldElementImpl('index', -1);
@@ -1306,6 +1314,7 @@ class _LibraryResynthesizer {
buildDocumentation(
executableElement, serializedExecutable.documentationComment);
buildAnnotations(executableElement, serializedExecutable.annotations);
+ buildCodeRange(executableElement, serializedExecutable.codeRange);
executableElement.functions =
serializedExecutable.localFunctions.map(buildLocalFunction).toList();
executableElement.labels =
@@ -1707,6 +1716,7 @@ class _LibraryResynthesizer {
}
parameterElement.synthetic = synthetic;
buildAnnotations(parameterElement, serializedParameter.annotations);
+ buildCodeRange(parameterElement, serializedParameter.codeRange);
if (serializedParameter.isFunctionTyped) {
FunctionElementImpl parameterTypeElement =
new FunctionElementImpl('', -1);
@@ -1840,6 +1850,7 @@ class _LibraryResynthesizer {
buildDocumentation(
functionTypeAliasElement, serializedTypedef.documentationComment);
buildAnnotations(functionTypeAliasElement, serializedTypedef.annotations);
+ buildCodeRange(functionTypeAliasElement, serializedTypedef.codeRange);
unitHolder.addTypeAlias(functionTypeAliasElement);
currentTypeParameters.removeLast();
assert(currentTypeParameters.isEmpty);
@@ -1860,6 +1871,7 @@ class _LibraryResynthesizer {
serializedTypeParameter.name, serializedTypeParameter.nameOffset);
typeParameterElement.type = new TypeParameterTypeImpl(typeParameterElement);
buildAnnotations(typeParameterElement, serializedTypeParameter.annotations);
+ buildCodeRange(typeParameterElement, serializedTypeParameter.codeRange);
return typeParameterElement;
}
@@ -1933,6 +1945,7 @@ class _LibraryResynthesizer {
buildVariableInitializer(element, serializedVariable.initializer);
buildDocumentation(element, serializedVariable.documentationComment);
buildAnnotations(element, serializedVariable.annotations);
+ buildCodeRange(element, serializedVariable.codeRange);
}
/**
@@ -1947,6 +1960,7 @@ class _LibraryResynthesizer {
FunctionElementImpl initializerElement =
buildLocalFunction(serializedInitializer);
initializerElement.synthetic = true;
+ initializerElement.setCodeRange(null, null);
variable.initializer = initializerElement;
}
@@ -2204,6 +2218,7 @@ class _LibraryResynthesizer {
for (PropertyAccessorElementImpl accessor in unit.accessors) {
elementMap[accessor.identifier] = accessor;
}
+ buildCodeRange(unit, unlinkedUnit.codeRange);
resynthesizedUnits[absoluteUri] = unit;
resynthesizedElements[absoluteUri] = elementMap;
assert(currentTypeParameters.isEmpty);
« no previous file with comments | « pkg/analyzer/lib/src/summary/idl.dart ('k') | pkg/analyzer/lib/src/summary/summarize_ast.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698