fix error message for dcalls on null

Change-Id: I0f3ab303ce8844c9b147a21f3233ef04ec0acb66
Reviewed-on: https://dart-review.googlesource.com/45920
Commit-Queue: Jenny Messerly <jmesserly@google.com>
Reviewed-by: Vijay Menon <vsm@google.com>
This commit is contained in:
Jenny Messerly 2018-03-30 00:34:29 +00:00 committed by commit-bot@chromium.org
parent af22f6a591
commit d46dd1bd68
2 changed files with 9 additions and 3 deletions

View file

@ -323,10 +323,10 @@ _checkAndCall(f, ftype, obj, typeArgs, args, name) => JS('', '''(() => {
})()''');
dcall(f, @rest args) =>
_checkAndCall(f, _getRuntimeType(f), JS('', 'void 0'), null, args, 'call');
_checkAndCall(f, null, JS('', 'void 0'), null, args, 'call');
dgcall(f, typeArgs, @rest args) => _checkAndCall(
f, _getRuntimeType(f), JS('', 'void 0'), typeArgs, args, 'call');
dgcall(f, typeArgs, @rest args) =>
_checkAndCall(f, null, JS('', 'void 0'), typeArgs, args, 'call');
/// Helper for REPL dynamic invocation variants that make a best effort to
/// enable accessing private members across library boundaries.

View file

@ -40,4 +40,10 @@ void main() {
Expect.equals('Foo42', baz(42));
Expect.equals('Foo42', foo(42));
Expect.equals('Foo42', dyn(42));
var s = (FooType).toString();
var minified = s != 'FooType'; // dart2js --minify has minified names.
dynamic d = null;
Expect.throws(() => d(),
(e) => e is NoSuchMethodError && (minified || '$e'.contains('call')));
}