b5cc7e17f2
The CL does a few things:
* Rename "forwarder" to "dispatcher" to disambiguate them from actual
dynamic forwarders:
- "dynamic dispatcher": A function that takes all arguments of a
dynamic call & dispatches them to the right target (which is a
dynamic forwarder).
- "dynamic forwarder": A function that takes arguments, type checks
them, unboxes them (if applicable), calls the real function, boxes
the result (if applicable).
* Make dynamic setter dispatchers & forwarders have `void` return type.
Setters in Dart don't produce values, the call sites turn `a.b = c`
into something like this: `let tmp = c in (let a.b=(tmp) in tmp)`
* Make `CallShape` remember not just the argument shape but also whether
it was a getter, setter or method.
Issue https://github.com/dart-lang/sdk/issues/62639
Change-Id: Ia616f504a3ed3e9fa86a93d274af794b9437e5ed
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/488081
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Srujan Gaddam <srujzs@google.com>
22 lines
538 B
Dart
22 lines
538 B
Dart
// Copyright (c) 2026, 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.
|
|
|
|
// functionFilter=Dynamic dispatcher|\$main
|
|
// compilerOption=-O0
|
|
|
|
dynamic confuse(dynamic a) => a;
|
|
|
|
class Foo {
|
|
String toString({bool a = false}) => 'foo$a';
|
|
}
|
|
|
|
class Bar {
|
|
String toString({int a = 0}) => 'bar$a';
|
|
}
|
|
|
|
void main() {
|
|
print(confuse(Foo()).toString(a: true));
|
|
print(confuse(Bar()).toString(a: 1));
|
|
}
|