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

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: fixed issue with failing test Created 6 years, 8 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 033c95ba404981cbe512c2a03a31ccb36240b2d5..2d5accdb4e2a3725ff9c143d4600e998a3fef19f 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];
}
@@ -278,4 +281,21 @@ class World {
FunctionElement superConstructor) {
elements.otherDependencies.add(superConstructor);
}
+
+ 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) {
+ return getMightBePassedToApply(element.expression);
+ }
+ return functionsThatMightBePassedToApply.contains(element);
+ }
}

Powered by Google App Engine
This is Rietveld 408576698