From 0f9ce46c6ddd879bcd378f4fabc8e967280da6ec Mon Sep 17 00:00:00 2001 From: Martin Kustermann Date: Thu, 7 May 2026 04:05:45 -0700 Subject: [PATCH] [dart2wasm] Ensure the field in BoxedBool is non mutable Change-Id: Idfa251e647f9d0205086d17334103a511366df7a Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/501460 Commit-Queue: Martin Kustermann Reviewed-by: Slava Egorov --- pkg/dart2wasm/test/ir_tests/dynamic_call.wat | 2 +- sdk/lib/_internal/wasm/lib/boxed_bool.dart | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/pkg/dart2wasm/test/ir_tests/dynamic_call.wat b/pkg/dart2wasm/test/ir_tests/dynamic_call.wat index e8627fbad3c..705d67b1b5b 100644 --- a/pkg/dart2wasm/test/ir_tests/dynamic_call.wat +++ b/pkg/dart2wasm/test/ir_tests/dynamic_call.wat @@ -4,7 +4,7 @@ (type $Array (array (field (mut (ref null $#Top))))) (type $BoxedBool (sub final $#Top (struct (field $field0 i32) - (field $value (mut i32))))) + (field $value i32)))) (type $BoxedInt (sub final $#Top (struct (field $field0 i32) (field $value i64)))) diff --git a/sdk/lib/_internal/wasm/lib/boxed_bool.dart b/sdk/lib/_internal/wasm/lib/boxed_bool.dart index cb9ba59cad2..6723eda729e 100644 --- a/sdk/lib/_internal/wasm/lib/boxed_bool.dart +++ b/sdk/lib/_internal/wasm/lib/boxed_bool.dart @@ -2,14 +2,15 @@ // 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 'dart:_wasm'; + @pragma("wasm:entry-point") final class BoxedBool extends bool { - // A boxed bool contains an unboxed bool. @pragma("wasm:entry-point") - bool value = false; + final WasmI32 value; - /// Dummy factory to silence error about missing superclass constructor. - external factory BoxedBool(); + @pragma("wasm:entry-point") + external BoxedBool(); @override bool operator ==(Object other) {