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

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 comments. 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..71bb69b08166955a03088b741bb6f1c120f5eedb 100644
--- a/frog/leg/elements/elements.dart
+++ b/frog/leg/elements/elements.dart
@@ -356,4 +356,18 @@ 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.
+ if (element.kind === ElementKind.VARIABLE ||
kasperl 2012/01/05 12:52:19 Should we have element.isVariable() and element.is
floitsch 2012/01/05 13:59:20 Done.
+ element.kind === ElementKind.PARAMETER) {
+ return true;
+ }
+ return false;
+ }
}
« 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