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

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

Issue 223403003: Use closure tracer to identify closures that are not passed to Function.apply (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix regression in emitted meta data Created 6 years, 9 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: sdk/lib/_internal/compiler/implementation/world.dart
diff --git a/sdk/lib/_internal/compiler/implementation/world.dart b/sdk/lib/_internal/compiler/implementation/world.dart
index 91a95d263d5a580e78d02fd9cb8c5db0f8a2f65a..f522cc8751c3b4d0c2384fbe4e5114874ffda3b4 100644
--- a/sdk/lib/_internal/compiler/implementation/world.dart
+++ b/sdk/lib/_internal/compiler/implementation/world.dart
@@ -29,6 +29,9 @@ class World {
final Set<Element> elementsThatCannotThrow = new Set<Element>();
+ final Set<Element> functionsThatMightBePassedToApply =
+ new Set<FunctionElement>();
+
Set<ClassElement> subclassesOf(ClassElement cls) {
return _subclasses[cls.declaration];
}
@@ -273,4 +276,21 @@ class World {
bool getCannotThrow(Element element) {
return elementsThatCannotThrow.contains(element);
}
+
+ void registerMightBePassedToApply(Element element) {
+ functionsThatMightBePassedToApply.add(element);
+ }
+
+ bool getMightBePassedToApply(Element element) {
+ // We have to check whether the element we look at was created after
+ // type inference ran. This is currently only the case for the call
+ // method of function classes that were generated for function
+ // expressions. In such a case, we have to look at the original
+ // function expressions's element.
+ // TODO(herhut): Generate classes for function expressions earlier.
+ if (element is SynthesizedCallMethodElementX) {
floitsch 2014/04/14 15:39:37 What if we have: === var f = () => 499; var f2 = f
herhut 2014/04/15 10:50:39 f2 would be a LocalElement, as would be f1. Only t
+ return getMightBePassedToApply(element.expression);
+ }
+ return functionsThatMightBePassedToApply.contains(element);
+ }
}

Powered by Google App Engine
This is Rietveld 408576698