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

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

Issue 1841283002: When building summaries from ASTs, handle circularities involving .length. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 9 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 | « no previous file | pkg/analyzer/test/src/summary/summary_common.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/summary/link.dart
diff --git a/pkg/analyzer/lib/src/summary/link.dart b/pkg/analyzer/lib/src/summary/link.dart
index 474981790302651f38c6c7740fe1cf4afac2d1b1..602b357d0959a8cc2913aaf201c012c5f7cedf81 100644
--- a/pkg/analyzer/lib/src/summary/link.dart
+++ b/pkg/analyzer/lib/src/summary/link.dart
@@ -1327,6 +1327,35 @@ abstract class Node<NodeType> {
}
/**
+ * Element used for references that result from trying to access a nonstatic
+ * member of an element that is not a container (e.g. accessing the "length"
+ * property of a constant).
+ */
+class NonstaticMemberElementForLink implements ReferenceableElementForLink {
+ /**
+ * If the thing from which a member was accessed is a constant, the
+ * associated [ConstNode]. Otherwise `null`.
+ */
+ final ConstVariableNode _constNode;
+
+ NonstaticMemberElementForLink(this._constNode);
+
+ @override
+ ConstructorElementForLink get asConstructor => null;
+
+ @override
+ ConstVariableNode get asConstVariable => _constNode;
+
+ @override
+ DartTypeForLink buildType(DartTypeForLink getTypeArgument(int i),
+ List<int> implicitFunctionTypeIndices) =>
+ DynamicTypeForLink.instance;
+
+ @override
+ ReferenceableElementForLink getContainedName(String name) => this;
+}
+
+/**
* Element representing a function or method parameter resynthesized
* from a summary during linking.
*/
@@ -1505,10 +1534,7 @@ class VariableElementForLink
DynamicTypeForLink.instance;
ReferenceableElementForLink getContainedName(String name) {
- // TODO(paulberry): implement.
- // TODO(paulberry): make sure that circularities involving
- // ".length" are handled correctly.
- return UndefinedElementForLink.instance;
+ return new NonstaticMemberElementForLink(_constNode);
}
@override
« no previous file with comments | « no previous file | pkg/analyzer/test/src/summary/summary_common.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698