Files
sdk/tests/web/wasm/default_nullable_param_test.dart
Nate Biggs a484bb3973 [dart2wasm] Use constants to represent dummy values.
Today "dummy values" are generated per-module to stand in for things
like default parameter sentinels (where a given selector has multiple
default values for an optional parameter).

However, these values can end up crossing between modules. The logic is
set up to use ref_eq to check if an argument is one of these dummy
values. However, if one of these dummy values crosses between modules,
the passed value vs the ref_eq checked value will be different. Since
each module has its own canonical dummy value per type.

This new layout simplifies our handling of these dummy values by
treating them as Constants so that our normal module canonicalization
logic applies to them. We already have plenty of logic to canonicalize
constants across modules. This avoids the need for custom handling of
these dummy value globals.

Change-Id: Ia9c79923c788d7712b16705193ffbf3142141b5d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/480320
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
2026-02-19 12:48:49 -08:00

20 lines
664 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.
// dart2wasmOptions=--enable-deferred-loading
import 'default_nullable_param_helper.dart' deferred as helper;
import 'package:async_helper/async_helper.dart';
helper.Base getBase(int i, String s) => i < 10 ? helper.A() : helper.B(s);
Future<void> main() async {
asyncStart();
await helper.loadLibrary();
getBase(9, 'world').format('hello');
getBase(11, 'foo').format('hey', 'world');
getBase(11, 'foo').format('hey');
asyncEnd();
}