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

Unified Diff: lib/compiler/implementation/native_emitter.dart

Issue 10539109: Do not convert a Dart closure parameter to a JS closure if the parameter was not provided. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 6 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
« no previous file with comments | « frog/tests/frog_native/native_wrapping_function2_frog_test.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/compiler/implementation/native_emitter.dart
===================================================================
--- lib/compiler/implementation/native_emitter.dart (revision 8546)
+++ lib/compiler/implementation/native_emitter.dart (working copy)
@@ -168,15 +168,19 @@
}
void potentiallyConvertDartClosuresToJs(StringBuffer code,
- FunctionElement member) {
+ FunctionElement member,
+ List<String> argumentsBuffer) {
FunctionSignature parameters = member.computeSignature(compiler);
Element converter =
compiler.findHelper(const SourceString('convertDartClosureToJS'));
String closureConverter = compiler.namer.isolateAccess(converter);
parameters.forEachParameter((Element parameter) {
+ String name = parameter.name.slowToString();
+ // If [name] is not in [argumentsBuffer], then the parameter is
+ // an optional parameter that was not provided for that stub.
+ if (argumentsBuffer.indexOf(name) == -1) return;
Type type = parameter.computeType(compiler);
if (type is FunctionType) {
- String name = parameter.name.slowToString();
int arity = type.computeArity();
code.add(' $name = $closureConverter($name, $arity);\n');
}
@@ -206,7 +210,7 @@
String nativeArguments = Strings.join(nativeArgumentsBuffer, ",");
StringBuffer code = new StringBuffer();
- potentiallyConvertDartClosuresToJs(code, member);
+ potentiallyConvertDartClosuresToJs(code, member, argumentsBuffer);
if (!nativeMethods.contains(member)) {
// When calling a method that has a native body, we call it
« no previous file with comments | « frog/tests/frog_native/native_wrapping_function2_frog_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698