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

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

Issue 9086010: closure calls (just the invocation part). (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comment. Created 8 years, 12 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/leg.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 437c819ed233101092b7f8680ff14a22ac06ea08..3f0f6ecc5470f5e0ee82aafbce3084eaa735b585 100644
--- a/frog/leg/elements/elements.dart
+++ b/frog/leg/elements/elements.dart
@@ -54,6 +54,8 @@ class Element implements Hashable {
bool isInstanceMember() => false;
bool isFactoryConstructor() => modifiers != null && modifiers.isFactory();
bool isGenerativeConstructor() => kind == ElementKind.GENERATIVE_CONSTRUCTOR;
+ bool isVariable() => kind == ElementKind.VARIABLE;
+ bool isParameter() => kind == ElementKind.PARAMETER;
bool isAssignable() {
if (modifiers != null && modifiers.isFinal()) return false;
@@ -356,4 +358,14 @@ class Elements {
&& element.isInstanceMember()
&& (element.kind === ElementKind.FUNCTION);
}
+
+ static bool isClosureSend(Send send, TreeElements elements) {
+ if (send.isPropertyAccess) return false;
+ if (send.receiver !== null) return false;
+ Element element = elements[send];
+ // (o)() or foo()().
+ if (element === null && send.selector.asIdentifier() === null) return true;
+ // foo() with foo a local or a parameter.
+ return element.isVariable() || element.isParameter();
+ }
}
« no previous file with comments | « no previous file | frog/leg/leg.dart » ('j') | frog/leg/ssa/builder.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698