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

Unified Diff: frog/leg/native_handler.dart

Issue 9618053: Introduce the TYPEDEF element, and use it in order to catch passing closures to the DOM. I make the… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 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: frog/leg/native_handler.dart
===================================================================
--- frog/leg/native_handler.dart (revision 5070)
+++ frog/leg/native_handler.dart (working copy)
@@ -149,9 +149,20 @@
i++;
inputs.add(builder.localsHandler.readThis());
}
+ Compiler compiler = builder.compiler;
parameters.forEachParameter((Element parameter) {
+ Type type = parameter.computeType(compiler);
+ HInstruction input = builder.localsHandler.readLocal(parameter);
+ if (type is FunctionType) {
+ // TODO(ngeoffray): by better analyzing the function type and
+ // its formal parameters, we could just pass, eg closure.$call$0.
+ builder.push(new HStatic(builder.interceptors.getClosureConverter()));
+ List<HInstruction> callInputs = <HInstruction>[builder.pop(), input];
+ input = new HInvokeStatic(Selector.INVOCATION_1, callInputs);
+ builder.add(input);
+ }
+ inputs.add(input);
arguments.add('\$$i');
- inputs.add(builder.localsHandler.readLocal(parameter));
i++;
});
String foreignParameters = Strings.join(arguments, ',');

Powered by Google App Engine
This is Rietveld 408576698