mirror of
https://github.com/ziglang/zig.git
synced 2026-02-13 12:59:04 +00:00
parent
317cb629fb
commit
9f6f460124
10
src/Sema.zig
10
src/Sema.zig
@ -10729,6 +10729,7 @@ fn zirShl(
|
||||
|
||||
const inst_data = sema.code.instructions.items(.data)[inst].pl_node;
|
||||
const src = inst_data.src();
|
||||
sema.src = src;
|
||||
const lhs_src: LazySrcLoc = .{ .node_offset_bin_lhs = inst_data.src_node };
|
||||
const rhs_src: LazySrcLoc = .{ .node_offset_bin_rhs = inst_data.src_node };
|
||||
const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data;
|
||||
@ -10902,6 +10903,7 @@ fn zirShr(
|
||||
|
||||
const inst_data = sema.code.instructions.items(.data)[inst].pl_node;
|
||||
const src = inst_data.src();
|
||||
sema.src = src;
|
||||
const lhs_src: LazySrcLoc = .{ .node_offset_bin_lhs = inst_data.src_node };
|
||||
const rhs_src: LazySrcLoc = .{ .node_offset_bin_rhs = inst_data.src_node };
|
||||
const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data;
|
||||
@ -11024,6 +11026,7 @@ fn zirBitwise(
|
||||
|
||||
const inst_data = sema.code.instructions.items(.data)[inst].pl_node;
|
||||
const src: LazySrcLoc = .{ .node_offset_bin_op = inst_data.src_node };
|
||||
sema.src = src;
|
||||
const lhs_src: LazySrcLoc = .{ .node_offset_bin_lhs = inst_data.src_node };
|
||||
const rhs_src: LazySrcLoc = .{ .node_offset_bin_rhs = inst_data.src_node };
|
||||
const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data;
|
||||
@ -11657,6 +11660,7 @@ fn zirArithmetic(
|
||||
fn zirDiv(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref {
|
||||
const inst_data = sema.code.instructions.items(.data)[inst].pl_node;
|
||||
const src: LazySrcLoc = .{ .node_offset_bin_op = inst_data.src_node };
|
||||
sema.src = src;
|
||||
const lhs_src: LazySrcLoc = .{ .node_offset_bin_lhs = inst_data.src_node };
|
||||
const rhs_src: LazySrcLoc = .{ .node_offset_bin_rhs = inst_data.src_node };
|
||||
const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data;
|
||||
@ -11810,6 +11814,7 @@ fn zirDiv(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Ins
|
||||
fn zirDivExact(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref {
|
||||
const inst_data = sema.code.instructions.items(.data)[inst].pl_node;
|
||||
const src: LazySrcLoc = .{ .node_offset_bin_op = inst_data.src_node };
|
||||
sema.src = src;
|
||||
const lhs_src: LazySrcLoc = .{ .node_offset_bin_lhs = inst_data.src_node };
|
||||
const rhs_src: LazySrcLoc = .{ .node_offset_bin_rhs = inst_data.src_node };
|
||||
const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data;
|
||||
@ -11966,6 +11971,7 @@ fn zirDivExact(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai
|
||||
fn zirDivFloor(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref {
|
||||
const inst_data = sema.code.instructions.items(.data)[inst].pl_node;
|
||||
const src: LazySrcLoc = .{ .node_offset_bin_op = inst_data.src_node };
|
||||
sema.src = src;
|
||||
const lhs_src: LazySrcLoc = .{ .node_offset_bin_lhs = inst_data.src_node };
|
||||
const rhs_src: LazySrcLoc = .{ .node_offset_bin_rhs = inst_data.src_node };
|
||||
const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data;
|
||||
@ -12077,6 +12083,7 @@ fn zirDivFloor(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai
|
||||
fn zirDivTrunc(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref {
|
||||
const inst_data = sema.code.instructions.items(.data)[inst].pl_node;
|
||||
const src: LazySrcLoc = .{ .node_offset_bin_op = inst_data.src_node };
|
||||
sema.src = src;
|
||||
const lhs_src: LazySrcLoc = .{ .node_offset_bin_lhs = inst_data.src_node };
|
||||
const rhs_src: LazySrcLoc = .{ .node_offset_bin_rhs = inst_data.src_node };
|
||||
const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data;
|
||||
@ -12313,6 +12320,7 @@ fn airTag(block: *Block, is_int: bool, normal: Air.Inst.Tag, optimized: Air.Inst
|
||||
fn zirModRem(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref {
|
||||
const inst_data = sema.code.instructions.items(.data)[inst].pl_node;
|
||||
const src: LazySrcLoc = .{ .node_offset_bin_op = inst_data.src_node };
|
||||
sema.src = src;
|
||||
const lhs_src: LazySrcLoc = .{ .node_offset_bin_lhs = inst_data.src_node };
|
||||
const rhs_src: LazySrcLoc = .{ .node_offset_bin_rhs = inst_data.src_node };
|
||||
const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data;
|
||||
@ -12498,6 +12506,7 @@ fn intRemScalar(
|
||||
fn zirMod(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref {
|
||||
const inst_data = sema.code.instructions.items(.data)[inst].pl_node;
|
||||
const src: LazySrcLoc = .{ .node_offset_bin_op = inst_data.src_node };
|
||||
sema.src = src;
|
||||
const lhs_src: LazySrcLoc = .{ .node_offset_bin_lhs = inst_data.src_node };
|
||||
const rhs_src: LazySrcLoc = .{ .node_offset_bin_rhs = inst_data.src_node };
|
||||
const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data;
|
||||
@ -12600,6 +12609,7 @@ fn zirMod(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Ins
|
||||
fn zirRem(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref {
|
||||
const inst_data = sema.code.instructions.items(.data)[inst].pl_node;
|
||||
const src: LazySrcLoc = .{ .node_offset_bin_op = inst_data.src_node };
|
||||
sema.src = src;
|
||||
const lhs_src: LazySrcLoc = .{ .node_offset_bin_lhs = inst_data.src_node };
|
||||
const rhs_src: LazySrcLoc = .{ .node_offset_bin_rhs = inst_data.src_node };
|
||||
const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data;
|
||||
|
||||
@ -1,6 +1,74 @@
|
||||
export fn f() void {
|
||||
const a = 3;
|
||||
a = 4;
|
||||
export fn entry1() void {
|
||||
const a = 1;
|
||||
a = 1;
|
||||
}
|
||||
export fn entry2() void {
|
||||
const a = 1;
|
||||
a |= 1;
|
||||
}
|
||||
export fn entry3() void {
|
||||
const a = 1;
|
||||
a %= 1;
|
||||
}
|
||||
export fn entry4() void {
|
||||
const a = 1;
|
||||
a ^= 1;
|
||||
}
|
||||
export fn entry5() void {
|
||||
const a = 1;
|
||||
a += 1;
|
||||
}
|
||||
export fn entry6() void {
|
||||
const a = 1;
|
||||
a +%= 1;
|
||||
}
|
||||
export fn entry7() void {
|
||||
const a = 1;
|
||||
a +|= 1;
|
||||
}
|
||||
export fn entry8() void {
|
||||
const a = 1;
|
||||
a -= 1;
|
||||
}
|
||||
export fn entry9() void {
|
||||
const a = 1;
|
||||
a -%= 1;
|
||||
}
|
||||
export fn entry10() void {
|
||||
const a = 1;
|
||||
a -|= 1;
|
||||
}
|
||||
export fn entry11() void {
|
||||
const a = 1;
|
||||
a *= 1;
|
||||
}
|
||||
export fn entry12() void {
|
||||
const a = 1;
|
||||
a *%= 1;
|
||||
}
|
||||
export fn entry13() void {
|
||||
const a = 1;
|
||||
a *|= 1;
|
||||
}
|
||||
export fn entry14() void {
|
||||
const a = 1;
|
||||
a /= 1;
|
||||
}
|
||||
export fn entry15() void {
|
||||
const a = 1;
|
||||
a &= 1;
|
||||
}
|
||||
export fn entry16() void {
|
||||
const a = 1;
|
||||
a <<= 1;
|
||||
}
|
||||
export fn entry17() void {
|
||||
const a = 1;
|
||||
a <<|= 1;
|
||||
}
|
||||
export fn entry18() void {
|
||||
const a = 1;
|
||||
a >>= 1;
|
||||
}
|
||||
|
||||
// error
|
||||
@ -8,3 +76,20 @@ export fn f() void {
|
||||
// target=native
|
||||
//
|
||||
// :3:9: error: cannot assign to constant
|
||||
// :7:7: error: cannot assign to constant
|
||||
// :11:7: error: cannot assign to constant
|
||||
// :15:7: error: cannot assign to constant
|
||||
// :19:7: error: cannot assign to constant
|
||||
// :23:7: error: cannot assign to constant
|
||||
// :27:7: error: cannot assign to constant
|
||||
// :31:7: error: cannot assign to constant
|
||||
// :35:7: error: cannot assign to constant
|
||||
// :39:7: error: cannot assign to constant
|
||||
// :43:7: error: cannot assign to constant
|
||||
// :47:7: error: cannot assign to constant
|
||||
// :51:7: error: cannot assign to constant
|
||||
// :55:7: error: cannot assign to constant
|
||||
// :59:7: error: cannot assign to constant
|
||||
// :63:7: error: cannot assign to constant
|
||||
// :67:7: error: cannot assign to constant
|
||||
// :71:7: error: cannot assign to constant
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user