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

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: Update test status file. 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 | « frog/leg/compiler.dart ('k') | frog/leg/namer.dart » ('j') | no next file with comments »
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 683353dd1b6f5e9c709c3afe0f3d7ab6a459965d..bec786a4ef10e97d5d931a20cb3bb2cf170ff6a6 100644
--- a/frog/leg/elements/elements.dart
+++ b/frog/leg/elements/elements.dart
@@ -57,6 +57,8 @@ class Element implements Hashable {
bool isFactoryConstructor() => modifiers != null && modifiers.isFactory();
bool isGenerativeConstructor() => kind == ElementKind.GENERATIVE_CONSTRUCTOR;
bool isCompilationUnit() => kind == ElementKind.COMPILATION_UNIT;
+ bool isVariable() => kind == ElementKind.VARIABLE;
+ bool isParameter() => kind == ElementKind.PARAMETER;
bool isAssignable() {
if (modifiers != null && modifiers.isFinal()) return false;
@@ -369,4 +371,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 | « frog/leg/compiler.dart ('k') | frog/leg/namer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698