aboutsummaryrefslogtreecommitdiff
path: root/src/arch/wasm/CodeGen.zig
diff options
context:
space:
mode:
authorVeikka Tuominen <git@vexu.eu>2022-10-26 00:30:17 +0300
committerAndrew Kelley <andrew@ziglang.org>2022-10-27 21:08:25 -0400
commitd03c47bf85b17f7727d2f1fe5bd497b311c9eba7 (patch)
treefc2008e0adbee552fd72215614eefe7e111dbf5d /src/arch/wasm/CodeGen.zig
parent398a3aae40bc03f6b7c6cd86d78a4cde125f2811 (diff)
downloadzig-d03c47bf85b17f7727d2f1fe5bd497b311c9eba7.tar.gz
zig-d03c47bf85b17f7727d2f1fe5bd497b311c9eba7.zip
Sema: use `runtime_value` instead of creating allocs
Diffstat (limited to 'src/arch/wasm/CodeGen.zig')
-rw-r--r--src/arch/wasm/CodeGen.zig6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/arch/wasm/CodeGen.zig b/src/arch/wasm/CodeGen.zig
index 538fcb13c1..69d5e38f65 100644
--- a/src/arch/wasm/CodeGen.zig
+++ b/src/arch/wasm/CodeGen.zig
@@ -2582,7 +2582,11 @@ fn toTwosComplement(value: anytype, bits: u7) std.meta.Int(.unsigned, @typeInfo(
return @intCast(WantedT, result);
}
-fn lowerConstant(func: *CodeGen, val: Value, ty: Type) InnerError!WValue {
+fn lowerConstant(func: *CodeGen, arg_val: Value, ty: Type) InnerError!WValue {
+ var val = arg_val;
+ if (val.castTag(.runtime_value)) |rt| {
+ val = rt.data;
+ }
if (val.isUndefDeep()) return func.emitUndefined(ty);
if (val.castTag(.decl_ref)) |decl_ref| {
const decl_index = decl_ref.data;