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

Unified Diff: dart/sdk/lib/_internal/compiler/implementation/elements/elements.dart

Issue 13866010: Correctly compile unresolved for-in loops. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Additional problems found during testing. Created 7 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
Index: dart/sdk/lib/_internal/compiler/implementation/elements/elements.dart
diff --git a/dart/sdk/lib/_internal/compiler/implementation/elements/elements.dart b/dart/sdk/lib/_internal/compiler/implementation/elements/elements.dart
index b9a396d7076d1d390b622218e4b8eca129230ed4..e67600310290e80067a67772ff7545dfb1f04ac6 100644
--- a/dart/sdk/lib/_internal/compiler/implementation/elements/elements.dart
+++ b/dart/sdk/lib/_internal/compiler/implementation/elements/elements.dart
@@ -185,7 +185,6 @@ abstract class Element implements Spannable {
bool isClosure();
bool isMember();
bool isInstanceMember();
- bool isInStaticMember();
bool isFactoryConstructor();
bool isGenerativeConstructor();
@@ -294,6 +293,20 @@ class Elements {
element.enclosingElement.kind == ElementKind.LIBRARY);
}
+ static bool isInStaticContext(Element element) {
+ if (isUnresolved(element)) return true;
+ if (element.enclosingElement.isClosure()) {
+ var closureClass = element.enclosingElement;
+ element = closureClass.methodElement;
+ }
+ Element outer = element.getOutermostEnclosingMemberOrTopLevel();
+ if (isUnresolved(outer)) return true;
+ if (outer.isTopLevel()) return true;
+ if (outer.isGenerativeConstructor()) return false;
+ if (outer.isInstanceMember()) return false;
+ return true;
+ }
+
static bool isStaticOrTopLevelField(Element element) {
return isStaticOrTopLevel(element)
&& (identical(element.kind, ElementKind.FIELD)

Powered by Google App Engine
This is Rietveld 408576698