diff options
| author | Matthew Lugg <mlugg@mlugg.co.uk> | 2023-11-19 16:19:06 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-11-19 16:19:06 +0000 |
| commit | 6b1a823b2b30d9318c9877dbdbd3d02fa939fba0 (patch) | |
| tree | 6e5afdad2397ac7224119811583d19107b6e517a /src/arch/wasm/CodeGen.zig | |
| parent | 325e0f5f0e8a9ce2540ec3ec5b7cbbecac15257a (diff) | |
| parent | 9cf6c1ad11bb5f0247ff3458cba5f3bd156d1fb9 (diff) | |
| download | zig-6b1a823b2b30d9318c9877dbdbd3d02fa939fba0.tar.gz zig-6b1a823b2b30d9318c9877dbdbd3d02fa939fba0.zip | |
Merge pull request #18017 from mlugg/var-never-mutated
compiler: add error for unnecessary use of 'var'
Diffstat (limited to 'src/arch/wasm/CodeGen.zig')
| -rw-r--r-- | src/arch/wasm/CodeGen.zig | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/arch/wasm/CodeGen.zig b/src/arch/wasm/CodeGen.zig index 7c752490c6..da0226b54c 100644 --- a/src/arch/wasm/CodeGen.zig +++ b/src/arch/wasm/CodeGen.zig @@ -2139,7 +2139,7 @@ fn airRetPtr(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { const mod = func.bin_file.base.options.module.?; const child_type = func.typeOfIndex(inst).childType(mod); - var result = result: { + const result = result: { if (!child_type.isFnOrHasRuntimeBitsIgnoreComptime(mod)) { break :result try func.allocStack(Type.usize); // create pointer to void } @@ -5001,7 +5001,7 @@ fn airArrayElemVal(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { return func.finishAir(inst, try WValue.toLocal(.stack, func, elem_ty), &.{ bin_op.lhs, bin_op.rhs }); }, else => { - var stack_vec = try func.allocStack(array_ty); + const stack_vec = try func.allocStack(array_ty); try func.store(stack_vec, array, array_ty, 0); // Is a non-unrolled vector (v128) @@ -5944,7 +5944,7 @@ fn airAddSubWithOverflow(func: *CodeGen, inst: Air.Inst.Index, op: Op) InnerErro rhs.free(func); }; - var bin_op = try (try func.binOp(lhs, rhs, lhs_ty, op)).toLocal(func, lhs_ty); + const bin_op = try (try func.binOp(lhs, rhs, lhs_ty, op)).toLocal(func, lhs_ty); var result = if (wasm_bits != int_info.bits) blk: { break :blk try (try func.wrapOperand(bin_op, lhs_ty)).toLocal(func, lhs_ty); } else bin_op; @@ -6335,7 +6335,7 @@ fn airMulAdd(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { const lhs_ext = try func.fpext(lhs, ty, Type.f32); const addend_ext = try func.fpext(addend, ty, Type.f32); // call to compiler-rt `fn fmaf(f32, f32, f32) f32` - var result = try func.callIntrinsic( + const result = try func.callIntrinsic( "fmaf", &.{ .f32_type, .f32_type, .f32_type }, Type.f32, |
