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

Unified Diff: frog/leg/elements/elements.dart

Issue 9378040: Allow self-referencing closures. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Revert last update to CL. Created 8 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 | « no previous file | frog/leg/ssa/builder.dart » ('j') | frog/leg/ssa/builder.dart » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: frog/leg/elements/elements.dart
diff --git a/frog/leg/elements/elements.dart b/frog/leg/elements/elements.dart
index f39d2457d8771d8bb38585ba63fd171751bd1637..28a6cfedecc4272d5ca4e0f799a48e251b223506 100644
--- a/frog/leg/elements/elements.dart
+++ b/frog/leg/elements/elements.dart
@@ -627,6 +627,9 @@ class Elements {
static bool isStaticOrTopLevelField(Element element) {
return (element != null)
&& !element.isInstanceMember()
+ && (element.enclosingElement.kind == ElementKind.CLASS ||
+ element.enclosingElement.kind == ElementKind.COMPILATION_UNIT ||
+ element.enclosingElement.kind == ElementKind.LIBRARY)
ngeoffray 2012/02/13 10:13:38 I believe element.enclosing is null for library el
floitsch 2012/02/13 12:03:42 done (null check). refactored into a isStaticOrTop
&& (element.kind === ElementKind.FIELD
|| element.kind === ElementKind.GETTER
|| element.kind === ElementKind.SETTER);
ngeoffray 2012/02/13 10:13:38 Which of these kinds do not have an enclosing as c
floitsch 2012/02/13 12:03:42 refactored.
@@ -635,6 +638,9 @@ class Elements {
static bool isStaticOrTopLevelFunction(Element element) {
return (element != null)
&& !element.isInstanceMember()
+ && (element.enclosingElement.kind == ElementKind.CLASS ||
+ element.enclosingElement.kind == ElementKind.COMPILATION_UNIT ||
+ element.enclosingElement.kind == ElementKind.LIBRARY)
ngeoffray 2012/02/13 10:13:38 Same comments as above.
floitsch 2012/02/13 12:03:42 the enclosing element of JS is LIBRARY.
&& (element.kind === ElementKind.FUNCTION);
}
@@ -658,7 +664,9 @@ class Elements {
if (element === null && send.selector.asIdentifier() === null) return true;
if (element === null) return false;
// foo() with foo a local or a parameter.
- return element.isVariable() || element.isParameter();
+ if (element.isVariable() || element.isParameter()) return true;
ngeoffray 2012/02/13 10:13:38 Could that just be return element.isLocal()?
floitsch 2012/02/13 12:03:42 Done.
+ if (element.kind == ElementKind.FUNCTION && isLocal(element)) return true;
+ return false;
}
static SourceString constructConstructorName(SourceString receiver,
« no previous file with comments | « no previous file | frog/leg/ssa/builder.dart » ('j') | frog/leg/ssa/builder.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698