Chromium Code Reviews| 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); |
| + } |
| } |