mirror of
https://github.com/dart-lang/sdk
synced 2024-10-14 11:03:19 +00:00
d06d627c79
No client of the VM uses this flag, only tests, and this flag was always set to false in AOT mode. Thus, remove uses of this flag and instead always lazily create dispatchers as needed when resolving method names in JIT mode. Remove the implicit value of `allow_add` for some Resolver static methods. For callers that previously depended on the implicit `true` value (which includes the AOT precompilier), pass `true` for uses in the compiler and pass `!FLAG_precompiled_mode` for uses in the runtime. Assert that `allow_add` is false when these methods are invoked from the precompiled runtime. Remove Resolver static methods that are no longer used. TEST=ci Change-Id: Ib6a7354f7a859e86743c381513a4129c14895753 Cq-Include-Trybots: luci.dart.try:vm-linux-debug-x64-try,vm-linux-release-x64-try,vm-aot-linux-debug-x64-try,vm-aot-linux-release-x64-try,vm-aot-mac-release-arm64-try,vm-mac-debug-arm64-try,vm-mac-release-arm64-try Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/366668 Reviewed-by: Ryan Macnak <rmacnak@google.com> Reviewed-by: Martin Kustermann <kustermann@google.com> Commit-Queue: Tess Strickland <sstrickl@google.com>
36 lines
1.1 KiB
Dart
36 lines
1.1 KiB
Dart
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
|
|
// for details. All rights reserved. Use of this source code is governed by a
|
|
// BSD-style license that can be found in the LICENSE file.
|
|
|
|
import "package:expect/expect.dart";
|
|
|
|
// Test that Null's noSuchMethod can be closurized and called directly.
|
|
|
|
class InvocationFactory {
|
|
static final dynamic instance = new InvocationFactory();
|
|
noSuchMethod(i) => i;
|
|
}
|
|
|
|
main() {
|
|
dynamic x;
|
|
// Non-existing method calls noSuchMethod.
|
|
Expect.throwsNoSuchMethodError(() => x.foo());
|
|
|
|
var invocation = InvocationFactory.instance.foo;
|
|
|
|
// Calling noSuchMethod directly.
|
|
Expect.throwsNoSuchMethodError(() => x.noSuchMethod(invocation, []));
|
|
|
|
// Closurizing noSuchMethod and calling it.
|
|
dynamic nsm = x.noSuchMethod;
|
|
Expect.notEquals(null, nsm);
|
|
Expect.throwsTypeError(() => nsm("foo"));
|
|
|
|
Expect.throwsNoSuchMethodError(() => nsm(invocation));
|
|
Expect.throwsNoSuchMethodError(
|
|
() => nsm(invocation, [])); // wrong number of args
|
|
|
|
// Wrong number and type of arguments.
|
|
Expect.throwsNoSuchMethodError(() => nsm("foo", [])); //# 01: ok
|
|
}
|