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

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

Issue 1896023005: Issue 26207. Fix for renaming top-level functions with offset 0. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 8 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/test/src/summary/index_unit_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/summary/index_unit.dart
diff --git a/pkg/analyzer/lib/src/summary/index_unit.dart b/pkg/analyzer/lib/src/summary/index_unit.dart
index 610fba4f8c3df46b9ccbb76340159f2ae2fee7c1..bc09ee345e6d6729afd049f7d1e51ac9e337d4c2 100644
--- a/pkg/analyzer/lib/src/summary/index_unit.dart
+++ b/pkg/analyzer/lib/src/summary/index_unit.dart
@@ -204,6 +204,7 @@ class PackageIndexAssembler {
* This method is static, so it cannot add any information to the index.
*/
static ElementInfo newElementInfo(int unitId, Element element) {
+ int offset = null;
IndexSyntheticElementKind kind = IndexSyntheticElementKind.notSynthetic;
if (element.isSynthetic) {
if (element is ConstructorElement) {
@@ -242,11 +243,11 @@ class PackageIndexAssembler {
throw new ArgumentError(
'Unsupported synthetic element ${element.runtimeType}');
}
- }
- int offset = element.nameOffset;
- if (element is LibraryElement || element is CompilationUnitElement) {
+ } else if (element is LibraryElement || element is CompilationUnitElement) {
+ kind = IndexSyntheticElementKind.unit;
offset = 0;
}
+ offset ??= element.nameOffset;
return new ElementInfo(unitId, offset, kind);
}
}
« no previous file with comments | « pkg/analyzer/lib/src/summary/idl.dart ('k') | pkg/analyzer/test/src/summary/index_unit_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698