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

Unified Diff: pkg/dev_compiler/tool/input_sdk/patch/core_patch.dart

Issue 2716583006: Fix Function.apply (Closed)
Patch Set: Created 3 years, 10 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 | « pkg/dev_compiler/test/browser/language_tests.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/dev_compiler/tool/input_sdk/patch/core_patch.dart
diff --git a/pkg/dev_compiler/tool/input_sdk/patch/core_patch.dart b/pkg/dev_compiler/tool/input_sdk/patch/core_patch.dart
index 6aafacda89e55a1c01dfb8293d0d17f53d156e66..910858fd7bd8f345404b8166749768ff6726fc10 100644
--- a/pkg/dev_compiler/tool/input_sdk/patch/core_patch.dart
+++ b/pkg/dev_compiler/tool/input_sdk/patch/core_patch.dart
@@ -56,8 +56,15 @@ class Function {
static apply(Function f,
List positionalArguments,
[Map<Symbol, dynamic> namedArguments]) {
- // TODO(vsm): Handle named args:
- // https://github.com/dart-lang/sdk/issues/27257
+ positionalArguments ??= [];
+ // dcall expects the namedArguments as a JS map in the last slot.
+ if (namedArguments != null && namedArguments.isNotEmpty) {
+ var map = JS('', '{}');
+ namedArguments.forEach((symbol, arg) {
+ JS('', '#[#] = #', map, _symbolToString(symbol), arg);
+ });
+ positionalArguments = new List.from(positionalArguments)..add(map);
+ }
return JS('', 'dart.dcall.apply(null, [#].concat(#))', f, positionalArguments);
}
« no previous file with comments | « pkg/dev_compiler/test/browser/language_tests.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698