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

Unified Diff: lib/runtime/dart_sdk.js

Issue 2201973002: fix optional params to mock methods, allow all signatures (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: fix getters and setters Created 4 years, 5 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:
Download patch
Index: lib/runtime/dart_sdk.js
diff --git a/lib/runtime/dart_sdk.js b/lib/runtime/dart_sdk.js
index 69b551fb13e51ddc9c1bc6b6718d7203a67b9953..21f75dec979a199cc28ce880687af9c1b6acb3ce 100644
--- a/lib/runtime/dart_sdk.js
+++ b/lib/runtime/dart_sdk.js
@@ -1383,15 +1383,20 @@ dart_library.library('dart_sdk', null, /* Imports */[
dart._dartSymbol = function(name) {
return dart.const(core.Symbol.new(name.toString()));
};
+ dart.extractNamedArgs = function(args) {
+ if (args.length > 0) {
+ let last = args[args.length - 1];
+ if (last != null && last.__proto__ === Object.prototype) {
+ return args.pop();
+ }
+ }
+ return null;
+ };
dart._checkAndCall = function(f, ftype, obj, typeArgs, args, name) {
dart._trackCall(obj, name);
let originalTarget = obj === void 0 ? f : obj;
function callNSM() {
- let namedArgs = null;
- if (args.length > 0 && args[args.length - 1].__proto__ == Object.prototype) {
- namedArgs = args.pop();
- }
- return dart.noSuchMethod(originalTarget, new dart.InvocationImpl(name, args, {namedArguments: namedArgs, isMethod: true}));
+ return dart.noSuchMethod(originalTarget, new dart.InvocationImpl(name, args, {namedArguments: dart.extractNamedArgs(args), isMethod: true}));
}
if (!(f instanceof Function)) {
if (f != null) {
« no previous file with comments | « no previous file | lib/src/compiler/code_generator.dart » ('j') | test/codegen/language/no_such_method_mock_test.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698