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

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

Issue 1642483002: Improve 'length' instance property reference encoding. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 11 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
Index: pkg/analyzer/lib/src/summary/prelink.dart
diff --git a/pkg/analyzer/lib/src/summary/prelink.dart b/pkg/analyzer/lib/src/summary/prelink.dart
index c1dd640b8787c8e2dcd1a76982ace615a26e7fb3..1e3caad8ac3830578673473d2069fb3651a7c4bd 100644
--- a/pkg/analyzer/lib/src/summary/prelink.dart
+++ b/pkg/analyzer/lib/src/summary/prelink.dart
@@ -412,6 +412,17 @@ class _Prelinker {
// Prefix references must always point backward.
assert(reference.prefixReference < i);
namespace = prefixNamespaces[reference.prefixReference];
+ // If in `a.length` the `a` prefix is a top-level variable or a field,
+ // then it must be the `String.length` property reference.
+ if (namespace == null && reference.name == 'length') {
+ ReferenceKind prefixKind = references[reference.prefixReference].kind;
+ if (prefixKind == ReferenceKind.topLevelPropertyAccessor ||
+ prefixKind == ReferenceKind.constField) {
+ references
+ .add(new LinkedReferenceBuilder(kind: ReferenceKind.length));
+ continue;
+ }
+ }
// Prefix references must always point to proper prefixes.
assert(namespace != null);
}

Powered by Google App Engine
This is Rietveld 408576698