Chromium Code Reviews| Index: frog/leg/compiler.dart |
| diff --git a/frog/leg/compiler.dart b/frog/leg/compiler.dart |
| index 35ff15a87e2a604df43fd462f12ccc874b5287bb..529243add221d089cf5ec4014460f57a06220ef4 100644 |
| --- a/frog/leg/compiler.dart |
| +++ b/frog/leg/compiler.dart |
| @@ -186,6 +186,7 @@ class Compiler implements DiagnosticListener { |
| void enqueueInvokedInstanceMethods() { |
| // TODO(floitsch): find a more efficient way of doing this. |
| + |
| // Run through the classes and see if we need to compile methods. |
| for (ClassElement classElement in universe.instantiatedClasses) { |
| for (ClassElement currentClass = classElement; |
| @@ -215,11 +216,33 @@ class Compiler implements DiagnosticListener { |
| if (universe.invokedGetters.contains(member.name)) { |
| addToWorklist(member); |
| } |
| + // A method invocation like in o.foo(x, y) might actually be an |
| + // invocation of the getter foo followed an invocation of the |
|
ngeoffray
2012/02/17 10:19:26
followed by
floitsch
2012/02/17 13:19:32
Done.
|
| + // returned closure. |
| + Set<Selector> invokedSelectors = universe.invokedNames[member.name]; |
| + if (invokedSelectors !== null && !invokedSelectors.isEmpty()) { |
|
ngeoffray
2012/02/17 10:19:26
Please add a comment that you cannot know if the s
floitsch
2012/02/17 13:19:32
Done.
|
| + addToWorklist(member); |
| + } |
| } else if (member.kind === ElementKind.SETTER) { |
| if (universe.invokedSetters.contains(member.name)) { |
| addToWorklist(member); |
| } |
| } |
| + |
| + // Make sure that the closure understands a call with the given |
| + // selector. For a method-invocation of the form o.foo(a: 499), we |
| + // need to make sure that closures can handle the optional argument if |
| + // there exists a field or getter 'foo'. |
| + if (member.kind === ElementKind.GETTER || |
| + member.kind === ElementKind.FIELD) { |
| + Set<Selector> invokedSelectors = universe.invokedNames[member.name]; |
| + if (invokedSelectors != null) { |
| + for (Selector selector in invokedSelectors) { |
| + registerDynamicInvocation(Namer.CLOSURE_INVOCATION_NAME, |
| + selector); |
| + } |
| + } |
| + } |
| } |
| } |
| } |