[dart2wasm] Fix param info lookup to match signature lookup logic.
Change-Id: Id20eb822d9505dda83d09626227e43dd57366ff4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/431324
Reviewed-by: Ömer Ağacan <omersa@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
diff --git a/pkg/dart2wasm/lib/translator.dart b/pkg/dart2wasm/lib/translator.dart
index 995366e..40895bb 100644
--- a/pkg/dart2wasm/lib/translator.dart
+++ b/pkg/dart2wasm/lib/translator.dart
@@ -1417,7 +1417,8 @@
if (target.asMember.isInstanceMember) {
final table = dispatchTableForTarget(target);
final selector = table.selectorForTarget(target);
- if (selector.containsTarget(target)) {
+ if (selector.containsTarget(target) ||
+ selector.isDynamicSubmoduleOverridable) {
return selector.paramInfo;
}
}
diff --git a/pkg/dynamic_modules/test/data/overrideable_super/dynamic_interface.yaml b/pkg/dynamic_modules/test/data/overrideable_super/dynamic_interface.yaml
new file mode 100644
index 0000000..c761a11
--- /dev/null
+++ b/pkg/dynamic_modules/test/data/overrideable_super/dynamic_interface.yaml
@@ -0,0 +1,16 @@
+# Copyright (c) 2025, 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.
+extendable:
+ - library: 'shared/shared.dart'
+ class: 'Base'
+
+can-be-overridden:
+ - library: 'shared/shared.dart'
+ class: 'Base'
+ member: 'toString'
+
+callable:
+ - library: 'dart:core'
+ - library: 'shared/shared.dart'
+ class: 'Other'
diff --git a/pkg/dynamic_modules/test/data/overrideable_super/main.dart b/pkg/dynamic_modules/test/data/overrideable_super/main.dart
new file mode 100644
index 0000000..8e981a8
--- /dev/null
+++ b/pkg/dynamic_modules/test/data/overrideable_super/main.dart
@@ -0,0 +1,16 @@
+// Copyright (c) 2025, 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 '../../common/testing.dart' as helper;
+import 'package:expect/expect.dart';
+
+import 'shared/shared.dart' show Child, Other;
+
+void main() async {
+ final o1 = Other();
+ Child();
+ Expect.equals('Instance of \'Other\'', o1.toString());
+ Expect.equals(3, await helper.load('entry1.dart'));
+ helper.done();
+}
diff --git a/pkg/dynamic_modules/test/data/overrideable_super/modules/entry1.dart b/pkg/dynamic_modules/test/data/overrideable_super/modules/entry1.dart
new file mode 100644
index 0000000..5517b7f
--- /dev/null
+++ b/pkg/dynamic_modules/test/data/overrideable_super/modules/entry1.dart
@@ -0,0 +1,8 @@
+// Copyright (c) 2025, 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.
+
+@pragma('dyn-module:entry-point')
+Object? dynamicModuleEntrypoint() {
+ return 3;
+}
diff --git a/pkg/dynamic_modules/test/data/overrideable_super/shared/shared.dart b/pkg/dynamic_modules/test/data/overrideable_super/shared/shared.dart
new file mode 100644
index 0000000..649d670
--- /dev/null
+++ b/pkg/dynamic_modules/test/data/overrideable_super/shared/shared.dart
@@ -0,0 +1,22 @@
+// Copyright (c) 2025, 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.
+
+abstract class Base {
+ const Base();
+
+ @override
+ // ignore: unnecessary_overrides
+ String toString() => super.toString();
+}
+
+class Child extends Base {
+ @override
+ // ignore: unnecessary_overrides
+ String toString() => super.toString();
+}
+
+class Other {
+ @override
+ String toString({bool? someArg1, bool? someArg2}) => super.toString();
+}