| ... | ... | @@ -61,7 +61,8 @@ const Zir = @import("Zir.zig"); |
| 61 | 61 | const Module = @import("Module.zig"); |
| 62 | 62 | const trace = @import("tracy.zig").trace; |
| 63 | 63 | const Scope = Module.Scope; |
| 64 | | const InnerError = Module.InnerError; |
| 64 | const CompileError = Module.CompileError; |
| 65 | const SemaError = Module.SemaError; |
| 65 | 66 | const Decl = Module.Decl; |
| 66 | 67 | const LazySrcLoc = Module.LazySrcLoc; |
| 67 | 68 | const RangeSet = @import("RangeSet.zig"); |
| ... | ... | @@ -83,7 +84,7 @@ pub fn analyzeFnBody( |
| 83 | 84 | sema: *Sema, |
| 84 | 85 | block: *Scope.Block, |
| 85 | 86 | fn_body_inst: Zir.Inst.Index, |
| 86 | | ) InnerError!void { |
| 87 | ) SemaError!void { |
| 87 | 88 | const tags = sema.code.instructions.items(.tag); |
| 88 | 89 | const datas = sema.code.instructions.items(.data); |
| 89 | 90 | const body: []const Zir.Inst.Index = switch (tags[fn_body_inst]) { |
| ... | ... | @@ -109,13 +110,16 @@ pub fn analyzeFnBody( |
| 109 | 110 | }, |
| 110 | 111 | else => unreachable, |
| 111 | 112 | }; |
| 112 | | _ = try sema.analyzeBody(block, body); |
| 113 | _ = sema.analyzeBody(block, body) catch |err| switch (err) { |
| 114 | error.NeededSourceLocation => unreachable, |
| 115 | else => |e| return e, |
| 116 | }; |
| 113 | 117 | } |
| 114 | 118 | |
| 115 | 119 | /// Returns only the result from the body that is specified. |
| 116 | 120 | /// Only appropriate to call when it is determined at comptime that this body |
| 117 | 121 | /// has no peers. |
| 118 | | fn resolveBody(sema: *Sema, block: *Scope.Block, body: []const Zir.Inst.Index) InnerError!Air.Inst.Ref { |
| 122 | fn resolveBody(sema: *Sema, block: *Scope.Block, body: []const Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 119 | 123 | const break_inst = try sema.analyzeBody(block, body); |
| 120 | 124 | const operand_ref = sema.code.instructions.items(.data)[break_inst].@"break".operand; |
| 121 | 125 | return sema.resolveInst(operand_ref); |
| ... | ... | @@ -125,7 +129,7 @@ fn resolveBody(sema: *Sema, block: *Scope.Block, body: []const Zir.Inst.Index) I |
| 125 | 129 | /// return type of `analyzeBody` so that we can tail call them. |
| 126 | 130 | /// Only appropriate to return when the instruction is known to be NoReturn |
| 127 | 131 | /// solely based on the ZIR tag. |
| 128 | | const always_noreturn: InnerError!Zir.Inst.Index = @as(Zir.Inst.Index, undefined); |
| 132 | const always_noreturn: CompileError!Zir.Inst.Index = @as(Zir.Inst.Index, undefined); |
| 129 | 133 | |
| 130 | 134 | /// This function is the main loop of `Sema` and it can be used in two different ways: |
| 131 | 135 | /// * The traditional way where there are N breaks out of the block and peer type |
| ... | ... | @@ -140,7 +144,7 @@ pub fn analyzeBody( |
| 140 | 144 | sema: *Sema, |
| 141 | 145 | block: *Scope.Block, |
| 142 | 146 | body: []const Zir.Inst.Index, |
| 143 | | ) InnerError!Zir.Inst.Index { |
| 147 | ) CompileError!Zir.Inst.Index { |
| 144 | 148 | // No tracy calls here, to avoid interfering with the tail call mechanism. |
| 145 | 149 | |
| 146 | 150 | const map = &block.sema.inst_map; |
| ... | ... | @@ -541,7 +545,7 @@ pub fn analyzeBody( |
| 541 | 545 | } |
| 542 | 546 | } |
| 543 | 547 | |
| 544 | | fn zirExtended(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { |
| 548 | fn zirExtended(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 545 | 549 | const extended = sema.code.instructions.items(.data)[inst].extended; |
| 546 | 550 | switch (extended.opcode) { |
| 547 | 551 | // zig fmt: off |
| ... | ... | @@ -638,7 +642,7 @@ fn resolveConstValue( |
| 638 | 642 | block: *Scope.Block, |
| 639 | 643 | src: LazySrcLoc, |
| 640 | 644 | air_ref: Air.Inst.Ref, |
| 641 | | ) !Value { |
| 645 | ) CompileError!Value { |
| 642 | 646 | return (try sema.resolveDefinedValue(block, src, air_ref)) orelse |
| 643 | 647 | return sema.failWithNeededComptime(block, src); |
| 644 | 648 | } |
| ... | ... | @@ -648,7 +652,7 @@ fn resolveDefinedValue( |
| 648 | 652 | block: *Scope.Block, |
| 649 | 653 | src: LazySrcLoc, |
| 650 | 654 | air_ref: Air.Inst.Ref, |
| 651 | | ) !?Value { |
| 655 | ) CompileError!?Value { |
| 652 | 656 | if (try sema.resolvePossiblyUndefinedValue(block, src, air_ref)) |val| { |
| 653 | 657 | if (val.isUndef()) { |
| 654 | 658 | return sema.failWithUseOfUndef(block, src); |
| ... | ... | @@ -663,7 +667,7 @@ fn resolvePossiblyUndefinedValue( |
| 663 | 667 | block: *Scope.Block, |
| 664 | 668 | src: LazySrcLoc, |
| 665 | 669 | air_ref: Air.Inst.Ref, |
| 666 | | ) !?Value { |
| 670 | ) CompileError!?Value { |
| 667 | 671 | const ty = sema.getTypeOf(air_ref); |
| 668 | 672 | if (try sema.typeHasOnePossibleValue(block, src, ty)) |opv| { |
| 669 | 673 | return opv; |
| ... | ... | @@ -687,11 +691,11 @@ fn resolvePossiblyUndefinedValue( |
| 687 | 691 | } |
| 688 | 692 | } |
| 689 | 693 | |
| 690 | | fn failWithNeededComptime(sema: *Sema, block: *Scope.Block, src: LazySrcLoc) InnerError { |
| 694 | fn failWithNeededComptime(sema: *Sema, block: *Scope.Block, src: LazySrcLoc) CompileError { |
| 691 | 695 | return sema.mod.fail(&block.base, src, "unable to resolve comptime value", .{}); |
| 692 | 696 | } |
| 693 | 697 | |
| 694 | | fn failWithUseOfUndef(sema: *Sema, block: *Scope.Block, src: LazySrcLoc) InnerError { |
| 698 | fn failWithUseOfUndef(sema: *Sema, block: *Scope.Block, src: LazySrcLoc) CompileError { |
| 695 | 699 | return sema.mod.fail(&block.base, src, "use of undefined value here causes undefined behavior", .{}); |
| 696 | 700 | } |
| 697 | 701 | |
| ... | ... | @@ -733,7 +737,7 @@ pub fn resolveInstConst( |
| 733 | 737 | block: *Scope.Block, |
| 734 | 738 | src: LazySrcLoc, |
| 735 | 739 | zir_ref: Zir.Inst.Ref, |
| 736 | | ) InnerError!TypedValue { |
| 740 | ) CompileError!TypedValue { |
| 737 | 741 | const air_ref = sema.resolveInst(zir_ref); |
| 738 | 742 | const val = try sema.resolveConstValue(block, src, air_ref); |
| 739 | 743 | return TypedValue{ |
| ... | ... | @@ -742,13 +746,13 @@ pub fn resolveInstConst( |
| 742 | 746 | }; |
| 743 | 747 | } |
| 744 | 748 | |
| 745 | | fn zirBitcastResultPtr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { |
| 749 | fn zirBitcastResultPtr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 746 | 750 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; |
| 747 | 751 | const src = inst_data.src(); |
| 748 | 752 | return sema.mod.fail(&block.base, src, "TODO implement zir_sema.zirBitcastResultPtr", .{}); |
| 749 | 753 | } |
| 750 | 754 | |
| 751 | | fn zirCoerceResultPtr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { |
| 755 | fn zirCoerceResultPtr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 752 | 756 | _ = inst; |
| 753 | 757 | const tracy = trace(@src()); |
| 754 | 758 | defer tracy.end(); |
| ... | ... | @@ -760,7 +764,7 @@ pub fn analyzeStructDecl( |
| 760 | 764 | new_decl: *Decl, |
| 761 | 765 | inst: Zir.Inst.Index, |
| 762 | 766 | struct_obj: *Module.Struct, |
| 763 | | ) InnerError!void { |
| 767 | ) SemaError!void { |
| 764 | 768 | const extended = sema.code.instructions.items(.data)[inst].extended; |
| 765 | 769 | assert(extended.opcode == .struct_decl); |
| 766 | 770 | const small = @bitCast(Zir.Inst.StructDecl.Small, extended.small); |
| ... | ... | @@ -783,7 +787,7 @@ fn zirStructDecl( |
| 783 | 787 | block: *Scope.Block, |
| 784 | 788 | extended: Zir.Inst.Extended.InstData, |
| 785 | 789 | inst: Zir.Inst.Index, |
| 786 | | ) InnerError!Air.Inst.Ref { |
| 790 | ) CompileError!Air.Inst.Ref { |
| 787 | 791 | const small = @bitCast(Zir.Inst.StructDecl.Small, extended.small); |
| 788 | 792 | const src: LazySrcLoc = if (small.has_src_node) blk: { |
| 789 | 793 | const node_offset = @bitCast(i32, sema.code.extra[extended.operand]); |
| ... | ... | @@ -854,7 +858,7 @@ fn zirEnumDecl( |
| 854 | 858 | sema: *Sema, |
| 855 | 859 | block: *Scope.Block, |
| 856 | 860 | extended: Zir.Inst.Extended.InstData, |
| 857 | | ) InnerError!Air.Inst.Ref { |
| 861 | ) CompileError!Air.Inst.Ref { |
| 858 | 862 | const tracy = trace(@src()); |
| 859 | 863 | defer tracy.end(); |
| 860 | 864 | |
| ... | ... | @@ -1051,7 +1055,7 @@ fn zirUnionDecl( |
| 1051 | 1055 | block: *Scope.Block, |
| 1052 | 1056 | extended: Zir.Inst.Extended.InstData, |
| 1053 | 1057 | inst: Zir.Inst.Index, |
| 1054 | | ) InnerError!Air.Inst.Ref { |
| 1058 | ) CompileError!Air.Inst.Ref { |
| 1055 | 1059 | const tracy = trace(@src()); |
| 1056 | 1060 | defer tracy.end(); |
| 1057 | 1061 | |
| ... | ... | @@ -1115,7 +1119,7 @@ fn zirOpaqueDecl( |
| 1115 | 1119 | block: *Scope.Block, |
| 1116 | 1120 | inst: Zir.Inst.Index, |
| 1117 | 1121 | name_strategy: Zir.Inst.NameStrategy, |
| 1118 | | ) InnerError!Air.Inst.Ref { |
| 1122 | ) CompileError!Air.Inst.Ref { |
| 1119 | 1123 | const tracy = trace(@src()); |
| 1120 | 1124 | defer tracy.end(); |
| 1121 | 1125 | |
| ... | ... | @@ -1135,7 +1139,7 @@ fn zirErrorSetDecl( |
| 1135 | 1139 | block: *Scope.Block, |
| 1136 | 1140 | inst: Zir.Inst.Index, |
| 1137 | 1141 | name_strategy: Zir.Inst.NameStrategy, |
| 1138 | | ) InnerError!Air.Inst.Ref { |
| 1142 | ) CompileError!Air.Inst.Ref { |
| 1139 | 1143 | const tracy = trace(@src()); |
| 1140 | 1144 | defer tracy.end(); |
| 1141 | 1145 | |
| ... | ... | @@ -1175,7 +1179,7 @@ fn zirRetPtr( |
| 1175 | 1179 | sema: *Sema, |
| 1176 | 1180 | block: *Scope.Block, |
| 1177 | 1181 | extended: Zir.Inst.Extended.InstData, |
| 1178 | | ) InnerError!Air.Inst.Ref { |
| 1182 | ) CompileError!Air.Inst.Ref { |
| 1179 | 1183 | const tracy = trace(@src()); |
| 1180 | 1184 | defer tracy.end(); |
| 1181 | 1185 | |
| ... | ... | @@ -1187,7 +1191,7 @@ fn zirRetPtr( |
| 1187 | 1191 | return block.addNoOp(src, ptr_type, .alloc); |
| 1188 | 1192 | } |
| 1189 | 1193 | |
| 1190 | | fn zirRef(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { |
| 1194 | fn zirRef(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 1191 | 1195 | const tracy = trace(@src()); |
| 1192 | 1196 | defer tracy.end(); |
| 1193 | 1197 | |
| ... | ... | @@ -1200,7 +1204,7 @@ fn zirRetType( |
| 1200 | 1204 | sema: *Sema, |
| 1201 | 1205 | block: *Scope.Block, |
| 1202 | 1206 | extended: Zir.Inst.Extended.InstData, |
| 1203 | | ) InnerError!Air.Inst.Ref { |
| 1207 | ) CompileError!Air.Inst.Ref { |
| 1204 | 1208 | const tracy = trace(@src()); |
| 1205 | 1209 | defer tracy.end(); |
| 1206 | 1210 | |
| ... | ... | @@ -1211,7 +1215,7 @@ fn zirRetType( |
| 1211 | 1215 | return sema.addType(ret_type); |
| 1212 | 1216 | } |
| 1213 | 1217 | |
| 1214 | | fn zirEnsureResultUsed(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!void { |
| 1218 | fn zirEnsureResultUsed(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!void { |
| 1215 | 1219 | const tracy = trace(@src()); |
| 1216 | 1220 | defer tracy.end(); |
| 1217 | 1221 | |
| ... | ... | @@ -1227,14 +1231,14 @@ fn ensureResultUsed( |
| 1227 | 1231 | block: *Scope.Block, |
| 1228 | 1232 | operand: Air.Inst.Ref, |
| 1229 | 1233 | src: LazySrcLoc, |
| 1230 | | ) InnerError!void { |
| 1234 | ) CompileError!void { |
| 1231 | 1235 | switch (operand.ty.zigTypeTag()) { |
| 1232 | 1236 | .Void, .NoReturn => return, |
| 1233 | 1237 | else => return sema.mod.fail(&block.base, src, "expression value is ignored", .{}), |
| 1234 | 1238 | } |
| 1235 | 1239 | } |
| 1236 | 1240 | |
| 1237 | | fn zirEnsureResultNonError(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!void { |
| 1241 | fn zirEnsureResultNonError(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!void { |
| 1238 | 1242 | const tracy = trace(@src()); |
| 1239 | 1243 | defer tracy.end(); |
| 1240 | 1244 | |
| ... | ... | @@ -1247,7 +1251,7 @@ fn zirEnsureResultNonError(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Inde |
| 1247 | 1251 | } |
| 1248 | 1252 | } |
| 1249 | 1253 | |
| 1250 | | fn zirIndexablePtrLen(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { |
| 1254 | fn zirIndexablePtrLen(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 1251 | 1255 | const tracy = trace(@src()); |
| 1252 | 1256 | defer tracy.end(); |
| 1253 | 1257 | |
| ... | ... | @@ -1281,7 +1285,7 @@ fn zirIndexablePtrLen(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) In |
| 1281 | 1285 | return sema.analyzeLoad(block, src, result_ptr, result_ptr.src); |
| 1282 | 1286 | } |
| 1283 | 1287 | |
| 1284 | | fn zirArg(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { |
| 1288 | fn zirArg(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 1285 | 1289 | const inst_data = sema.code.instructions.items(.data)[inst].str_tok; |
| 1286 | 1290 | const arg_name = inst_data.get(sema.code); |
| 1287 | 1291 | const arg_index = sema.next_arg_index; |
| ... | ... | @@ -1304,13 +1308,13 @@ fn zirAllocExtended( |
| 1304 | 1308 | sema: *Sema, |
| 1305 | 1309 | block: *Scope.Block, |
| 1306 | 1310 | extended: Zir.Inst.Extended.InstData, |
| 1307 | | ) InnerError!Air.Inst.Ref { |
| 1311 | ) CompileError!Air.Inst.Ref { |
| 1308 | 1312 | const extra = sema.code.extraData(Zir.Inst.AllocExtended, extended.operand); |
| 1309 | 1313 | const src: LazySrcLoc = .{ .node_offset = extra.data.src_node }; |
| 1310 | 1314 | return sema.mod.fail(&block.base, src, "TODO implement Sema.zirAllocExtended", .{}); |
| 1311 | 1315 | } |
| 1312 | 1316 | |
| 1313 | | fn zirAllocComptime(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { |
| 1317 | fn zirAllocComptime(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 1314 | 1318 | const tracy = trace(@src()); |
| 1315 | 1319 | defer tracy.end(); |
| 1316 | 1320 | |
| ... | ... | @@ -1333,13 +1337,13 @@ fn zirAllocComptime(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) Inne |
| 1333 | 1337 | }); |
| 1334 | 1338 | } |
| 1335 | 1339 | |
| 1336 | | fn zirAllocInferredComptime(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { |
| 1340 | fn zirAllocInferredComptime(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 1337 | 1341 | const src_node = sema.code.instructions.items(.data)[inst].node; |
| 1338 | 1342 | const src: LazySrcLoc = .{ .node_offset = src_node }; |
| 1339 | 1343 | return sema.mod.fail(&block.base, src, "TODO implement Sema.zirAllocInferredComptime", .{}); |
| 1340 | 1344 | } |
| 1341 | 1345 | |
| 1342 | | fn zirAlloc(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { |
| 1346 | fn zirAlloc(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 1343 | 1347 | const tracy = trace(@src()); |
| 1344 | 1348 | defer tracy.end(); |
| 1345 | 1349 | |
| ... | ... | @@ -1352,7 +1356,7 @@ fn zirAlloc(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!A |
| 1352 | 1356 | return block.addNoOp(var_decl_src, ptr_type, .alloc); |
| 1353 | 1357 | } |
| 1354 | 1358 | |
| 1355 | | fn zirAllocMut(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { |
| 1359 | fn zirAllocMut(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 1356 | 1360 | const tracy = trace(@src()); |
| 1357 | 1361 | defer tracy.end(); |
| 1358 | 1362 | |
| ... | ... | @@ -1371,7 +1375,7 @@ fn zirAllocInferred( |
| 1371 | 1375 | block: *Scope.Block, |
| 1372 | 1376 | inst: Zir.Inst.Index, |
| 1373 | 1377 | inferred_alloc_ty: Type, |
| 1374 | | ) InnerError!Air.Inst.Ref { |
| 1378 | ) CompileError!Air.Inst.Ref { |
| 1375 | 1379 | const tracy = trace(@src()); |
| 1376 | 1380 | defer tracy.end(); |
| 1377 | 1381 | |
| ... | ... | @@ -1395,7 +1399,7 @@ fn zirAllocInferred( |
| 1395 | 1399 | return result; |
| 1396 | 1400 | } |
| 1397 | 1401 | |
| 1398 | | fn zirResolveInferredAlloc(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!void { |
| 1402 | fn zirResolveInferredAlloc(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!void { |
| 1399 | 1403 | const tracy = trace(@src()); |
| 1400 | 1404 | defer tracy.end(); |
| 1401 | 1405 | |
| ... | ... | @@ -1421,7 +1425,7 @@ fn zirResolveInferredAlloc(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Inde |
| 1421 | 1425 | ptr.tag = .alloc; |
| 1422 | 1426 | } |
| 1423 | 1427 | |
| 1424 | | fn zirValidateStructInitPtr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!void { |
| 1428 | fn zirValidateStructInitPtr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!void { |
| 1425 | 1429 | const tracy = trace(@src()); |
| 1426 | 1430 | defer tracy.end(); |
| 1427 | 1431 | |
| ... | ... | @@ -1494,7 +1498,7 @@ fn zirValidateStructInitPtr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Ind |
| 1494 | 1498 | } |
| 1495 | 1499 | } |
| 1496 | 1500 | |
| 1497 | | fn zirValidateArrayInitPtr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!void { |
| 1501 | fn zirValidateArrayInitPtr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!void { |
| 1498 | 1502 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; |
| 1499 | 1503 | const src = inst_data.src(); |
| 1500 | 1504 | return sema.mod.fail(&block.base, src, "TODO implement Sema.zirValidateArrayInitPtr", .{}); |
| ... | ... | @@ -1506,7 +1510,7 @@ fn failWithBadFieldAccess( |
| 1506 | 1510 | struct_obj: *Module.Struct, |
| 1507 | 1511 | field_src: LazySrcLoc, |
| 1508 | 1512 | field_name: []const u8, |
| 1509 | | ) InnerError { |
| 1513 | ) CompileError { |
| 1510 | 1514 | const mod = sema.mod; |
| 1511 | 1515 | const gpa = sema.gpa; |
| 1512 | 1516 | |
| ... | ... | @@ -1533,7 +1537,7 @@ fn failWithBadUnionFieldAccess( |
| 1533 | 1537 | union_obj: *Module.Union, |
| 1534 | 1538 | field_src: LazySrcLoc, |
| 1535 | 1539 | field_name: []const u8, |
| 1536 | | ) InnerError { |
| 1540 | ) CompileError { |
| 1537 | 1541 | const mod = sema.mod; |
| 1538 | 1542 | const gpa = sema.gpa; |
| 1539 | 1543 | |
| ... | ... | @@ -1554,7 +1558,7 @@ fn failWithBadUnionFieldAccess( |
| 1554 | 1558 | return mod.failWithOwnedErrorMsg(&block.base, msg); |
| 1555 | 1559 | } |
| 1556 | 1560 | |
| 1557 | | fn zirStoreToBlockPtr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!void { |
| 1561 | fn zirStoreToBlockPtr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!void { |
| 1558 | 1562 | const tracy = trace(@src()); |
| 1559 | 1563 | defer tracy.end(); |
| 1560 | 1564 | |
| ... | ... | @@ -1575,7 +1579,7 @@ fn zirStoreToBlockPtr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) In |
| 1575 | 1579 | return sema.storePtr(block, src, bitcasted_ptr, value); |
| 1576 | 1580 | } |
| 1577 | 1581 | |
| 1578 | | fn zirStoreToInferredPtr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!void { |
| 1582 | fn zirStoreToInferredPtr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!void { |
| 1579 | 1583 | const tracy = trace(@src()); |
| 1580 | 1584 | defer tracy.end(); |
| 1581 | 1585 | |
| ... | ... | @@ -1594,7 +1598,7 @@ fn zirStoreToInferredPtr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) |
| 1594 | 1598 | return sema.storePtr(block, src, bitcasted_ptr, value); |
| 1595 | 1599 | } |
| 1596 | 1600 | |
| 1597 | | fn zirSetEvalBranchQuota(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!void { |
| 1601 | fn zirSetEvalBranchQuota(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!void { |
| 1598 | 1602 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; |
| 1599 | 1603 | const src = inst_data.src(); |
| 1600 | 1604 | const quota = try sema.resolveAlreadyCoercedInt(block, src, inst_data.operand, u32); |
| ... | ... | @@ -1602,7 +1606,7 @@ fn zirSetEvalBranchQuota(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) |
| 1602 | 1606 | sema.branch_quota = quota; |
| 1603 | 1607 | } |
| 1604 | 1608 | |
| 1605 | | fn zirStore(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!void { |
| 1609 | fn zirStore(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!void { |
| 1606 | 1610 | const tracy = trace(@src()); |
| 1607 | 1611 | defer tracy.end(); |
| 1608 | 1612 | |
| ... | ... | @@ -1612,7 +1616,7 @@ fn zirStore(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!v |
| 1612 | 1616 | return sema.storePtr(block, sema.src, ptr, value); |
| 1613 | 1617 | } |
| 1614 | 1618 | |
| 1615 | | fn zirStoreNode(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!void { |
| 1619 | fn zirStoreNode(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!void { |
| 1616 | 1620 | const tracy = trace(@src()); |
| 1617 | 1621 | defer tracy.end(); |
| 1618 | 1622 | |
| ... | ... | @@ -1624,7 +1628,7 @@ fn zirStoreNode(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerErr |
| 1624 | 1628 | return sema.storePtr(block, src, ptr, value); |
| 1625 | 1629 | } |
| 1626 | 1630 | |
| 1627 | | fn zirParamType(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { |
| 1631 | fn zirParamType(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 1628 | 1632 | const tracy = trace(@src()); |
| 1629 | 1633 | defer tracy.end(); |
| 1630 | 1634 | |
| ... | ... | @@ -1660,7 +1664,7 @@ fn zirParamType(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerErr |
| 1660 | 1664 | return sema.addType(param_type); |
| 1661 | 1665 | } |
| 1662 | 1666 | |
| 1663 | | fn zirStr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { |
| 1667 | fn zirStr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 1664 | 1668 | const tracy = trace(@src()); |
| 1665 | 1669 | defer tracy.end(); |
| 1666 | 1670 | |
| ... | ... | @@ -1688,7 +1692,7 @@ fn zirStr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air |
| 1688 | 1692 | return sema.analyzeDeclRef(block, .unneeded, new_decl); |
| 1689 | 1693 | } |
| 1690 | 1694 | |
| 1691 | | fn zirInt(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { |
| 1695 | fn zirInt(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 1692 | 1696 | _ = block; |
| 1693 | 1697 | const tracy = trace(@src()); |
| 1694 | 1698 | defer tracy.end(); |
| ... | ... | @@ -1697,7 +1701,7 @@ fn zirInt(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air |
| 1697 | 1701 | return sema.addIntUnsigned(Type.initTag(.comptime_int), int); |
| 1698 | 1702 | } |
| 1699 | 1703 | |
| 1700 | | fn zirIntBig(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { |
| 1704 | fn zirIntBig(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 1701 | 1705 | _ = block; |
| 1702 | 1706 | const tracy = trace(@src()); |
| 1703 | 1707 | defer tracy.end(); |
| ... | ... | @@ -1715,7 +1719,7 @@ fn zirIntBig(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError! |
| 1715 | 1719 | }); |
| 1716 | 1720 | } |
| 1717 | 1721 | |
| 1718 | | fn zirFloat(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { |
| 1722 | fn zirFloat(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 1719 | 1723 | _ = block; |
| 1720 | 1724 | const arena = sema.arena; |
| 1721 | 1725 | const inst_data = sema.code.instructions.items(.data)[inst].float; |
| ... | ... | @@ -1728,7 +1732,7 @@ fn zirFloat(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!A |
| 1728 | 1732 | }); |
| 1729 | 1733 | } |
| 1730 | 1734 | |
| 1731 | | fn zirFloat128(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { |
| 1735 | fn zirFloat128(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 1732 | 1736 | _ = block; |
| 1733 | 1737 | const arena = sema.arena; |
| 1734 | 1738 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; |
| ... | ... | @@ -1742,7 +1746,7 @@ fn zirFloat128(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerErro |
| 1742 | 1746 | }); |
| 1743 | 1747 | } |
| 1744 | 1748 | |
| 1745 | | fn zirCompileError(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Zir.Inst.Index { |
| 1749 | fn zirCompileError(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Zir.Inst.Index { |
| 1746 | 1750 | const tracy = trace(@src()); |
| 1747 | 1751 | defer tracy.end(); |
| 1748 | 1752 | |
| ... | ... | @@ -1757,7 +1761,7 @@ fn zirCompileLog( |
| 1757 | 1761 | sema: *Sema, |
| 1758 | 1762 | block: *Scope.Block, |
| 1759 | 1763 | extended: Zir.Inst.Extended.InstData, |
| 1760 | | ) InnerError!Air.Inst.Ref { |
| 1764 | ) CompileError!Air.Inst.Ref { |
| 1761 | 1765 | var managed = sema.mod.compile_log_text.toManaged(sema.gpa); |
| 1762 | 1766 | defer sema.mod.compile_log_text = managed.moveToUnmanaged(); |
| 1763 | 1767 | const writer = managed.writer(); |
| ... | ... | @@ -1789,7 +1793,7 @@ fn zirCompileLog( |
| 1789 | 1793 | }); |
| 1790 | 1794 | } |
| 1791 | 1795 | |
| 1792 | | fn zirRepeat(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Zir.Inst.Index { |
| 1796 | fn zirRepeat(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Zir.Inst.Index { |
| 1793 | 1797 | const tracy = trace(@src()); |
| 1794 | 1798 | defer tracy.end(); |
| 1795 | 1799 | |
| ... | ... | @@ -1799,7 +1803,7 @@ fn zirRepeat(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError! |
| 1799 | 1803 | return always_noreturn; |
| 1800 | 1804 | } |
| 1801 | 1805 | |
| 1802 | | fn zirPanic(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Zir.Inst.Index { |
| 1806 | fn zirPanic(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Zir.Inst.Index { |
| 1803 | 1807 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; |
| 1804 | 1808 | const src: LazySrcLoc = inst_data.src(); |
| 1805 | 1809 | const msg_inst = sema.resolveInst(inst_data.operand); |
| ... | ... | @@ -1807,7 +1811,7 @@ fn zirPanic(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Z |
| 1807 | 1811 | return sema.panicWithMsg(block, src, msg_inst); |
| 1808 | 1812 | } |
| 1809 | 1813 | |
| 1810 | | fn zirLoop(sema: *Sema, parent_block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { |
| 1814 | fn zirLoop(sema: *Sema, parent_block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 1811 | 1815 | const tracy = trace(@src()); |
| 1812 | 1816 | defer tracy.end(); |
| 1813 | 1817 | |
| ... | ... | @@ -1872,7 +1876,7 @@ fn zirLoop(sema: *Sema, parent_block: *Scope.Block, inst: Zir.Inst.Index) InnerE |
| 1872 | 1876 | return sema.analyzeBlockBody(parent_block, src, &child_block, merges); |
| 1873 | 1877 | } |
| 1874 | 1878 | |
| 1875 | | fn zirCImport(sema: *Sema, parent_block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { |
| 1879 | fn zirCImport(sema: *Sema, parent_block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 1876 | 1880 | const tracy = trace(@src()); |
| 1877 | 1881 | defer tracy.end(); |
| 1878 | 1882 | |
| ... | ... | @@ -1882,13 +1886,13 @@ fn zirCImport(sema: *Sema, parent_block: *Scope.Block, inst: Zir.Inst.Index) Inn |
| 1882 | 1886 | return sema.mod.fail(&parent_block.base, src, "TODO: implement Sema.zirCImport", .{}); |
| 1883 | 1887 | } |
| 1884 | 1888 | |
| 1885 | | fn zirSuspendBlock(sema: *Sema, parent_block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { |
| 1889 | fn zirSuspendBlock(sema: *Sema, parent_block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 1886 | 1890 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; |
| 1887 | 1891 | const src = inst_data.src(); |
| 1888 | 1892 | return sema.mod.fail(&parent_block.base, src, "TODO: implement Sema.zirSuspendBlock", .{}); |
| 1889 | 1893 | } |
| 1890 | 1894 | |
| 1891 | | fn zirBlock(sema: *Sema, parent_block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { |
| 1895 | fn zirBlock(sema: *Sema, parent_block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 1892 | 1896 | const tracy = trace(@src()); |
| 1893 | 1897 | defer tracy.end(); |
| 1894 | 1898 | |
| ... | ... | @@ -1946,7 +1950,7 @@ fn resolveBlockBody( |
| 1946 | 1950 | child_block: *Scope.Block, |
| 1947 | 1951 | body: []const Zir.Inst.Index, |
| 1948 | 1952 | merges: *Scope.Block.Merges, |
| 1949 | | ) InnerError!Air.Inst.Ref { |
| 1953 | ) CompileError!Air.Inst.Ref { |
| 1950 | 1954 | _ = try sema.analyzeBody(child_block, body); |
| 1951 | 1955 | return sema.analyzeBlockBody(parent_block, src, child_block, merges); |
| 1952 | 1956 | } |
| ... | ... | @@ -1957,7 +1961,7 @@ fn analyzeBlockBody( |
| 1957 | 1961 | src: LazySrcLoc, |
| 1958 | 1962 | child_block: *Scope.Block, |
| 1959 | 1963 | merges: *Scope.Block.Merges, |
| 1960 | | ) InnerError!Air.Inst.Ref { |
| 1964 | ) CompileError!Air.Inst.Ref { |
| 1961 | 1965 | const tracy = trace(@src()); |
| 1962 | 1966 | defer tracy.end(); |
| 1963 | 1967 | |
| ... | ... | @@ -2033,7 +2037,7 @@ fn analyzeBlockBody( |
| 2033 | 2037 | return &merges.block_inst.base; |
| 2034 | 2038 | } |
| 2035 | 2039 | |
| 2036 | | fn zirExport(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!void { |
| 2040 | fn zirExport(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!void { |
| 2037 | 2041 | const tracy = trace(@src()); |
| 2038 | 2042 | defer tracy.end(); |
| 2039 | 2043 | |
| ... | ... | @@ -2069,13 +2073,13 @@ fn zirExport(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError! |
| 2069 | 2073 | try sema.mod.analyzeExport(&block.base, src, export_name, decl); |
| 2070 | 2074 | } |
| 2071 | 2075 | |
| 2072 | | fn zirSetAlignStack(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!void { |
| 2076 | fn zirSetAlignStack(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!void { |
| 2073 | 2077 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; |
| 2074 | 2078 | const src: LazySrcLoc = inst_data.src(); |
| 2075 | 2079 | return sema.mod.fail(&block.base, src, "TODO: implement Sema.zirSetAlignStack", .{}); |
| 2076 | 2080 | } |
| 2077 | 2081 | |
| 2078 | | fn zirSetCold(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!void { |
| 2082 | fn zirSetCold(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!void { |
| 2079 | 2083 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; |
| 2080 | 2084 | const operand_src: LazySrcLoc = .{ .node_offset_builtin_call_arg0 = inst_data.src_node }; |
| 2081 | 2085 | const is_cold = try sema.resolveConstBool(block, operand_src, inst_data.operand); |
| ... | ... | @@ -2083,19 +2087,19 @@ fn zirSetCold(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError |
| 2083 | 2087 | func.is_cold = is_cold; |
| 2084 | 2088 | } |
| 2085 | 2089 | |
| 2086 | | fn zirSetFloatMode(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!void { |
| 2090 | fn zirSetFloatMode(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!void { |
| 2087 | 2091 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; |
| 2088 | 2092 | const src: LazySrcLoc = inst_data.src(); |
| 2089 | 2093 | return sema.mod.fail(&block.base, src, "TODO: implement Sema.zirSetFloatMode", .{}); |
| 2090 | 2094 | } |
| 2091 | 2095 | |
| 2092 | | fn zirSetRuntimeSafety(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!void { |
| 2096 | fn zirSetRuntimeSafety(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!void { |
| 2093 | 2097 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; |
| 2094 | 2098 | const operand_src: LazySrcLoc = .{ .node_offset_builtin_call_arg0 = inst_data.src_node }; |
| 2095 | 2099 | block.want_safety = try sema.resolveConstBool(block, operand_src, inst_data.operand); |
| 2096 | 2100 | } |
| 2097 | 2101 | |
| 2098 | | fn zirBreakpoint(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!void { |
| 2102 | fn zirBreakpoint(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!void { |
| 2099 | 2103 | const tracy = trace(@src()); |
| 2100 | 2104 | defer tracy.end(); |
| 2101 | 2105 | |
| ... | ... | @@ -2105,13 +2109,13 @@ fn zirBreakpoint(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerEr |
| 2105 | 2109 | _ = try block.addNoOp(src, Type.initTag(.void), .breakpoint); |
| 2106 | 2110 | } |
| 2107 | 2111 | |
| 2108 | | fn zirFence(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!void { |
| 2112 | fn zirFence(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!void { |
| 2109 | 2113 | const src_node = sema.code.instructions.items(.data)[inst].node; |
| 2110 | 2114 | const src: LazySrcLoc = .{ .node_offset = src_node }; |
| 2111 | 2115 | return sema.mod.fail(&block.base, src, "TODO: implement Sema.zirFence", .{}); |
| 2112 | 2116 | } |
| 2113 | 2117 | |
| 2114 | | fn zirBreak(sema: *Sema, start_block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Zir.Inst.Index { |
| 2118 | fn zirBreak(sema: *Sema, start_block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Zir.Inst.Index { |
| 2115 | 2119 | const tracy = trace(@src()); |
| 2116 | 2120 | defer tracy.end(); |
| 2117 | 2121 | |
| ... | ... | @@ -2151,7 +2155,7 @@ fn zirBreak(sema: *Sema, start_block: *Scope.Block, inst: Zir.Inst.Index) InnerE |
| 2151 | 2155 | } |
| 2152 | 2156 | } |
| 2153 | 2157 | |
| 2154 | | fn zirDbgStmt(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!void { |
| 2158 | fn zirDbgStmt(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!void { |
| 2155 | 2159 | const tracy = trace(@src()); |
| 2156 | 2160 | defer tracy.end(); |
| 2157 | 2161 | |
| ... | ... | @@ -2165,7 +2169,7 @@ fn zirDbgStmt(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError |
| 2165 | 2169 | _ = try block.addDbgStmt(.unneeded, inst_data.line, inst_data.column); |
| 2166 | 2170 | } |
| 2167 | 2171 | |
| 2168 | | fn zirDeclRef(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { |
| 2172 | fn zirDeclRef(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 2169 | 2173 | const inst_data = sema.code.instructions.items(.data)[inst].str_tok; |
| 2170 | 2174 | const src = inst_data.src(); |
| 2171 | 2175 | const decl_name = inst_data.get(sema.code); |
| ... | ... | @@ -2173,7 +2177,7 @@ fn zirDeclRef(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError |
| 2173 | 2177 | return sema.analyzeDeclRef(block, src, decl); |
| 2174 | 2178 | } |
| 2175 | 2179 | |
| 2176 | | fn zirDeclVal(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { |
| 2180 | fn zirDeclVal(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 2177 | 2181 | const inst_data = sema.code.instructions.items(.data)[inst].str_tok; |
| 2178 | 2182 | const src = inst_data.src(); |
| 2179 | 2183 | const decl_name = inst_data.get(sema.code); |
| ... | ... | @@ -2199,7 +2203,7 @@ fn lookupInNamespace( |
| 2199 | 2203 | sema: *Sema, |
| 2200 | 2204 | namespace: *Scope.Namespace, |
| 2201 | 2205 | ident_name: []const u8, |
| 2202 | | ) InnerError!?*Decl { |
| 2206 | ) CompileError!?*Decl { |
| 2203 | 2207 | const namespace_decl = namespace.getDecl(); |
| 2204 | 2208 | if (namespace_decl.analysis == .file_failure) { |
| 2205 | 2209 | try sema.mod.declareDeclDependency(sema.owner_decl, namespace_decl); |
| ... | ... | @@ -2227,7 +2231,7 @@ fn zirCall( |
| 2227 | 2231 | inst: Zir.Inst.Index, |
| 2228 | 2232 | modifier: std.builtin.CallOptions.Modifier, |
| 2229 | 2233 | ensure_result_used: bool, |
| 2230 | | ) InnerError!Air.Inst.Ref { |
| 2234 | ) CompileError!Air.Inst.Ref { |
| 2231 | 2235 | const tracy = trace(@src()); |
| 2232 | 2236 | defer tracy.end(); |
| 2233 | 2237 | |
| ... | ... | @@ -2257,7 +2261,7 @@ fn analyzeCall( |
| 2257 | 2261 | modifier: std.builtin.CallOptions.Modifier, |
| 2258 | 2262 | ensure_result_used: bool, |
| 2259 | 2263 | args: []const Air.Inst.Ref, |
| 2260 | | ) InnerError!Air.Inst.Ref { |
| 2264 | ) CompileError!Air.Inst.Ref { |
| 2261 | 2265 | if (func.ty.zigTypeTag() != .Fn) |
| 2262 | 2266 | return sema.mod.fail(&block.base, func_src, "type '{}' not a function", .{func.ty}); |
| 2263 | 2267 | |
| ... | ... | @@ -2412,7 +2416,7 @@ fn analyzeCall( |
| 2412 | 2416 | return result; |
| 2413 | 2417 | } |
| 2414 | 2418 | |
| 2415 | | fn zirIntType(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { |
| 2419 | fn zirIntType(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 2416 | 2420 | _ = block; |
| 2417 | 2421 | const tracy = trace(@src()); |
| 2418 | 2422 | defer tracy.end(); |
| ... | ... | @@ -2423,7 +2427,7 @@ fn zirIntType(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError |
| 2423 | 2427 | return sema.addType(ty); |
| 2424 | 2428 | } |
| 2425 | 2429 | |
| 2426 | | fn zirOptionalType(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { |
| 2430 | fn zirOptionalType(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 2427 | 2431 | const tracy = trace(@src()); |
| 2428 | 2432 | defer tracy.end(); |
| 2429 | 2433 | |
| ... | ... | @@ -2435,7 +2439,7 @@ fn zirOptionalType(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) Inner |
| 2435 | 2439 | return sema.addType(opt_type); |
| 2436 | 2440 | } |
| 2437 | 2441 | |
| 2438 | | fn zirElemType(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { |
| 2442 | fn zirElemType(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 2439 | 2443 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; |
| 2440 | 2444 | const src = inst_data.src(); |
| 2441 | 2445 | const array_type = try sema.resolveType(block, src, inst_data.operand); |
| ... | ... | @@ -2443,7 +2447,7 @@ fn zirElemType(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerErro |
| 2443 | 2447 | return sema.addType(elem_type); |
| 2444 | 2448 | } |
| 2445 | 2449 | |
| 2446 | | fn zirVectorType(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { |
| 2450 | fn zirVectorType(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 2447 | 2451 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; |
| 2448 | 2452 | const elem_type_src: LazySrcLoc = .{ .node_offset_builtin_call_arg0 = inst_data.src_node }; |
| 2449 | 2453 | const len_src: LazySrcLoc = .{ .node_offset_builtin_call_arg1 = inst_data.src_node }; |
| ... | ... | @@ -2457,7 +2461,7 @@ fn zirVectorType(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerEr |
| 2457 | 2461 | return sema.addType(vector_type); |
| 2458 | 2462 | } |
| 2459 | 2463 | |
| 2460 | | fn zirArrayType(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { |
| 2464 | fn zirArrayType(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 2461 | 2465 | const tracy = trace(@src()); |
| 2462 | 2466 | defer tracy.end(); |
| 2463 | 2467 | |
| ... | ... | @@ -2470,7 +2474,7 @@ fn zirArrayType(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerErr |
| 2470 | 2474 | return sema.addType(array_ty); |
| 2471 | 2475 | } |
| 2472 | 2476 | |
| 2473 | | fn zirArrayTypeSentinel(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { |
| 2477 | fn zirArrayTypeSentinel(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 2474 | 2478 | const tracy = trace(@src()); |
| 2475 | 2479 | defer tracy.end(); |
| 2476 | 2480 | |
| ... | ... | @@ -2485,7 +2489,7 @@ fn zirArrayTypeSentinel(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) |
| 2485 | 2489 | return sema.addType(array_ty); |
| 2486 | 2490 | } |
| 2487 | 2491 | |
| 2488 | | fn zirAnyframeType(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { |
| 2492 | fn zirAnyframeType(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 2489 | 2493 | const tracy = trace(@src()); |
| 2490 | 2494 | defer tracy.end(); |
| 2491 | 2495 | |
| ... | ... | @@ -2497,7 +2501,7 @@ fn zirAnyframeType(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) Inner |
| 2497 | 2501 | return sema.addType(anyframe_type); |
| 2498 | 2502 | } |
| 2499 | 2503 | |
| 2500 | | fn zirErrorUnionType(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { |
| 2504 | fn zirErrorUnionType(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 2501 | 2505 | const tracy = trace(@src()); |
| 2502 | 2506 | defer tracy.end(); |
| 2503 | 2507 | |
| ... | ... | @@ -2517,7 +2521,7 @@ fn zirErrorUnionType(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) Inn |
| 2517 | 2521 | return sema.addType(err_union_ty); |
| 2518 | 2522 | } |
| 2519 | 2523 | |
| 2520 | | fn zirErrorValue(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { |
| 2524 | fn zirErrorValue(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 2521 | 2525 | _ = block; |
| 2522 | 2526 | const tracy = trace(@src()); |
| 2523 | 2527 | defer tracy.end(); |
| ... | ... | @@ -2536,7 +2540,7 @@ fn zirErrorValue(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerEr |
| 2536 | 2540 | }); |
| 2537 | 2541 | } |
| 2538 | 2542 | |
| 2539 | | fn zirErrorToInt(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { |
| 2543 | fn zirErrorToInt(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 2540 | 2544 | const tracy = trace(@src()); |
| 2541 | 2545 | defer tracy.end(); |
| 2542 | 2546 | |
| ... | ... | @@ -2566,7 +2570,7 @@ fn zirErrorToInt(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerEr |
| 2566 | 2570 | return block.addTyOp(.bitcast, result_ty, op_coerced); |
| 2567 | 2571 | } |
| 2568 | 2572 | |
| 2569 | | fn zirIntToError(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { |
| 2573 | fn zirIntToError(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 2570 | 2574 | const tracy = trace(@src()); |
| 2571 | 2575 | defer tracy.end(); |
| 2572 | 2576 | |
| ... | ... | @@ -2599,7 +2603,7 @@ fn zirIntToError(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerEr |
| 2599 | 2603 | return block.addTyOp(.bitcast, Type.initTag(.anyerror), op); |
| 2600 | 2604 | } |
| 2601 | 2605 | |
| 2602 | | fn zirMergeErrorSets(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { |
| 2606 | fn zirMergeErrorSets(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 2603 | 2607 | const tracy = trace(@src()); |
| 2604 | 2608 | defer tracy.end(); |
| 2605 | 2609 | |
| ... | ... | @@ -2689,7 +2693,7 @@ fn zirMergeErrorSets(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) Inn |
| 2689 | 2693 | }); |
| 2690 | 2694 | } |
| 2691 | 2695 | |
| 2692 | | fn zirEnumLiteral(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { |
| 2696 | fn zirEnumLiteral(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 2693 | 2697 | _ = block; |
| 2694 | 2698 | const tracy = trace(@src()); |
| 2695 | 2699 | defer tracy.end(); |
| ... | ... | @@ -2703,7 +2707,7 @@ fn zirEnumLiteral(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerE |
| 2703 | 2707 | }); |
| 2704 | 2708 | } |
| 2705 | 2709 | |
| 2706 | | fn zirEnumToInt(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { |
| 2710 | fn zirEnumToInt(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 2707 | 2711 | const mod = sema.mod; |
| 2708 | 2712 | const arena = sema.arena; |
| 2709 | 2713 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; |
| ... | ... | @@ -2741,7 +2745,7 @@ fn zirEnumToInt(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerErr |
| 2741 | 2745 | }); |
| 2742 | 2746 | } |
| 2743 | 2747 | |
| 2744 | | if (enum_tag.value()) |enum_tag_val| { |
| 2748 | if (try sema.resolvePossiblyUndefinedValue(block, operand_src, enum_tag)) |enum_tag_val| { |
| 2745 | 2749 | if (enum_tag_val.castTag(.enum_field_index)) |enum_field_payload| { |
| 2746 | 2750 | const field_index = enum_field_payload.data; |
| 2747 | 2751 | switch (enum_tag.ty.tag()) { |
| ... | ... | @@ -2785,7 +2789,7 @@ fn zirEnumToInt(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerErr |
| 2785 | 2789 | return block.addTyOp(.bitcast, int_tag_ty, enum_tag); |
| 2786 | 2790 | } |
| 2787 | 2791 | |
| 2788 | | fn zirIntToEnum(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { |
| 2792 | fn zirIntToEnum(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 2789 | 2793 | const mod = sema.mod; |
| 2790 | 2794 | const target = mod.getTarget(); |
| 2791 | 2795 | const arena = sema.arena; |
| ... | ... | @@ -2801,16 +2805,16 @@ fn zirIntToEnum(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerErr |
| 2801 | 2805 | return mod.fail(&block.base, dest_ty_src, "expected enum, found {}", .{dest_ty}); |
| 2802 | 2806 | } |
| 2803 | 2807 | |
| 2804 | | if (dest_ty.isNonexhaustiveEnum()) { |
| 2805 | | if (operand.value()) |int_val| { |
| 2808 | if (try sema.resolvePossiblyUndefinedValue(block, operand_src, operand)) |int_val| { |
| 2809 | if (dest_ty.isNonexhaustiveEnum()) { |
| 2806 | 2810 | return mod.constInst(arena, src, .{ |
| 2807 | 2811 | .ty = dest_ty, |
| 2808 | 2812 | .val = int_val, |
| 2809 | 2813 | }); |
| 2810 | 2814 | } |
| 2811 | | } |
| 2812 | | |
| 2813 | | if (try sema.resolveDefinedValue(block, operand_src, operand)) |int_val| { |
| 2815 | if (int_val.isUndef()) { |
| 2816 | return sema.failWithUseOfUndef(block, operand_src); |
| 2817 | } |
| 2814 | 2818 | if (!dest_ty.enumHasInt(int_val, target)) { |
| 2815 | 2819 | const msg = msg: { |
| 2816 | 2820 | const msg = try mod.errMsg( |
| ... | ... | @@ -2846,7 +2850,7 @@ fn zirOptionalPayloadPtr( |
| 2846 | 2850 | block: *Scope.Block, |
| 2847 | 2851 | inst: Zir.Inst.Index, |
| 2848 | 2852 | safety_check: bool, |
| 2849 | | ) InnerError!Air.Inst.Ref { |
| 2853 | ) CompileError!Air.Inst.Ref { |
| 2850 | 2854 | const tracy = trace(@src()); |
| 2851 | 2855 | defer tracy.end(); |
| 2852 | 2856 | |
| ... | ... | @@ -2863,7 +2867,7 @@ fn zirOptionalPayloadPtr( |
| 2863 | 2867 | const child_type = try opt_type.optionalChildAlloc(sema.arena); |
| 2864 | 2868 | const child_pointer = try Module.simplePtrType(sema.arena, child_type, !optional_ptr.ty.isConstPtr(), .One); |
| 2865 | 2869 | |
| 2866 | | if (optional_ptr.value()) |pointer_val| { |
| 2870 | if (try sema.resolveDefinedValue(block, src, optional_ptr)) |pointer_val| { |
| 2867 | 2871 | const val = try pointer_val.pointerDeref(sema.arena); |
| 2868 | 2872 | if (val.isNull()) { |
| 2869 | 2873 | return sema.mod.fail(&block.base, src, "unable to unwrap null", .{}); |
| ... | ... | @@ -2889,7 +2893,7 @@ fn zirOptionalPayload( |
| 2889 | 2893 | block: *Scope.Block, |
| 2890 | 2894 | inst: Zir.Inst.Index, |
| 2891 | 2895 | safety_check: bool, |
| 2892 | | ) InnerError!Air.Inst.Ref { |
| 2896 | ) CompileError!Air.Inst.Ref { |
| 2893 | 2897 | const tracy = trace(@src()); |
| 2894 | 2898 | defer tracy.end(); |
| 2895 | 2899 | |
| ... | ... | @@ -2903,7 +2907,7 @@ fn zirOptionalPayload( |
| 2903 | 2907 | |
| 2904 | 2908 | const child_type = try opt_type.optionalChildAlloc(sema.arena); |
| 2905 | 2909 | |
| 2906 | | if (operand.value()) |val| { |
| 2910 | if (try sema.resolveDefinedValue(block, src, operand)) |val| { |
| 2907 | 2911 | if (val.isNull()) { |
| 2908 | 2912 | return sema.mod.fail(&block.base, src, "unable to unwrap null", .{}); |
| 2909 | 2913 | } |
| ... | ... | @@ -2927,7 +2931,7 @@ fn zirErrUnionPayload( |
| 2927 | 2931 | block: *Scope.Block, |
| 2928 | 2932 | inst: Zir.Inst.Index, |
| 2929 | 2933 | safety_check: bool, |
| 2930 | | ) InnerError!Air.Inst.Ref { |
| 2934 | ) CompileError!Air.Inst.Ref { |
| 2931 | 2935 | const tracy = trace(@src()); |
| 2932 | 2936 | defer tracy.end(); |
| 2933 | 2937 | |
| ... | ... | @@ -2937,7 +2941,7 @@ fn zirErrUnionPayload( |
| 2937 | 2941 | if (operand.ty.zigTypeTag() != .ErrorUnion) |
| 2938 | 2942 | return sema.mod.fail(&block.base, operand.src, "expected error union type, found '{}'", .{operand.ty}); |
| 2939 | 2943 | |
| 2940 | | if (operand.value()) |val| { |
| 2944 | if (try sema.resolveDefinedValue(block, src, operand)) |val| { |
| 2941 | 2945 | if (val.getError()) |name| { |
| 2942 | 2946 | return sema.mod.fail(&block.base, src, "caught unexpected error '{s}'", .{name}); |
| 2943 | 2947 | } |
| ... | ... | @@ -2962,7 +2966,7 @@ fn zirErrUnionPayloadPtr( |
| 2962 | 2966 | block: *Scope.Block, |
| 2963 | 2967 | inst: Zir.Inst.Index, |
| 2964 | 2968 | safety_check: bool, |
| 2965 | | ) InnerError!Air.Inst.Ref { |
| 2969 | ) CompileError!Air.Inst.Ref { |
| 2966 | 2970 | const tracy = trace(@src()); |
| 2967 | 2971 | defer tracy.end(); |
| 2968 | 2972 | |
| ... | ... | @@ -2976,7 +2980,7 @@ fn zirErrUnionPayloadPtr( |
| 2976 | 2980 | |
| 2977 | 2981 | const operand_pointer_ty = try Module.simplePtrType(sema.arena, operand.ty.elemType().castTag(.error_union).?.data.payload, !operand.ty.isConstPtr(), .One); |
| 2978 | 2982 | |
| 2979 | | if (operand.value()) |pointer_val| { |
| 2983 | if (try sema.resolveDefinedValue(block, src, operand)) |pointer_val| { |
| 2980 | 2984 | const val = try pointer_val.pointerDeref(sema.arena); |
| 2981 | 2985 | if (val.getError()) |name| { |
| 2982 | 2986 | return sema.mod.fail(&block.base, src, "caught unexpected error '{s}'", .{name}); |
| ... | ... | @@ -3001,7 +3005,7 @@ fn zirErrUnionPayloadPtr( |
| 3001 | 3005 | } |
| 3002 | 3006 | |
| 3003 | 3007 | /// Value in, value out |
| 3004 | | fn zirErrUnionCode(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { |
| 3008 | fn zirErrUnionCode(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 3005 | 3009 | const tracy = trace(@src()); |
| 3006 | 3010 | defer tracy.end(); |
| 3007 | 3011 | |
| ... | ... | @@ -3013,7 +3017,7 @@ fn zirErrUnionCode(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) Inner |
| 3013 | 3017 | |
| 3014 | 3018 | const result_ty = operand.ty.castTag(.error_union).?.data.error_set; |
| 3015 | 3019 | |
| 3016 | | if (operand.value()) |val| { |
| 3020 | if (try sema.resolveDefinedValue(block, src, operand)) |val| { |
| 3017 | 3021 | assert(val.getError() != null); |
| 3018 | 3022 | const data = val.castTag(.error_union).?.data; |
| 3019 | 3023 | return sema.mod.constInst(sema.arena, src, .{ |
| ... | ... | @@ -3027,7 +3031,7 @@ fn zirErrUnionCode(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) Inner |
| 3027 | 3031 | } |
| 3028 | 3032 | |
| 3029 | 3033 | /// Pointer in, value out |
| 3030 | | fn zirErrUnionCodePtr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { |
| 3034 | fn zirErrUnionCodePtr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 3031 | 3035 | const tracy = trace(@src()); |
| 3032 | 3036 | defer tracy.end(); |
| 3033 | 3037 | |
| ... | ... | @@ -3041,7 +3045,7 @@ fn zirErrUnionCodePtr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) In |
| 3041 | 3045 | |
| 3042 | 3046 | const result_ty = operand.ty.elemType().castTag(.error_union).?.data.error_set; |
| 3043 | 3047 | |
| 3044 | | if (operand.value()) |pointer_val| { |
| 3048 | if (try sema.resolveDefinedValue(block, src, operand)) |pointer_val| { |
| 3045 | 3049 | const val = try pointer_val.pointerDeref(sema.arena); |
| 3046 | 3050 | assert(val.getError() != null); |
| 3047 | 3051 | const data = val.castTag(.error_union).?.data; |
| ... | ... | @@ -3055,7 +3059,7 @@ fn zirErrUnionCodePtr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) In |
| 3055 | 3059 | return block.addTyOp(.unwrap_errunion_err_ptr, result_ty, operand); |
| 3056 | 3060 | } |
| 3057 | 3061 | |
| 3058 | | fn zirEnsureErrPayloadVoid(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!void { |
| 3062 | fn zirEnsureErrPayloadVoid(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!void { |
| 3059 | 3063 | const tracy = trace(@src()); |
| 3060 | 3064 | defer tracy.end(); |
| 3061 | 3065 | |
| ... | ... | @@ -3074,7 +3078,7 @@ fn zirFunc( |
| 3074 | 3078 | block: *Scope.Block, |
| 3075 | 3079 | inst: Zir.Inst.Index, |
| 3076 | 3080 | inferred_error_set: bool, |
| 3077 | | ) InnerError!Air.Inst.Ref { |
| 3081 | ) CompileError!Air.Inst.Ref { |
| 3078 | 3082 | const tracy = trace(@src()); |
| 3079 | 3083 | defer tracy.end(); |
| 3080 | 3084 | |
| ... | ... | @@ -3125,7 +3129,7 @@ fn funcCommon( |
| 3125 | 3129 | is_extern: bool, |
| 3126 | 3130 | src_locs: Zir.Inst.Func.SrcLocs, |
| 3127 | 3131 | opt_lib_name: ?[]const u8, |
| 3128 | | ) InnerError!Air.Inst.Ref { |
| 3132 | ) CompileError!Air.Inst.Ref { |
| 3129 | 3133 | const src: LazySrcLoc = .{ .node_offset = src_node_offset }; |
| 3130 | 3134 | const ret_ty_src: LazySrcLoc = .{ .node_offset_fn_type_ret_ty = src_node_offset }; |
| 3131 | 3135 | const bare_return_type = try sema.resolveType(block, ret_ty_src, zir_return_type); |
| ... | ... | @@ -3266,7 +3270,7 @@ fn funcCommon( |
| 3266 | 3270 | return result; |
| 3267 | 3271 | } |
| 3268 | 3272 | |
| 3269 | | fn zirAs(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { |
| 3273 | fn zirAs(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 3270 | 3274 | const tracy = trace(@src()); |
| 3271 | 3275 | defer tracy.end(); |
| 3272 | 3276 | |
| ... | ... | @@ -3274,7 +3278,7 @@ fn zirAs(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air. |
| 3274 | 3278 | return sema.analyzeAs(block, .unneeded, bin_inst.lhs, bin_inst.rhs); |
| 3275 | 3279 | } |
| 3276 | 3280 | |
| 3277 | | fn zirAsNode(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { |
| 3281 | fn zirAsNode(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 3278 | 3282 | const tracy = trace(@src()); |
| 3279 | 3283 | defer tracy.end(); |
| 3280 | 3284 | |
| ... | ... | @@ -3290,13 +3294,13 @@ fn analyzeAs( |
| 3290 | 3294 | src: LazySrcLoc, |
| 3291 | 3295 | zir_dest_type: Zir.Inst.Ref, |
| 3292 | 3296 | zir_operand: Zir.Inst.Ref, |
| 3293 | | ) InnerError!Air.Inst.Ref { |
| 3297 | ) CompileError!Air.Inst.Ref { |
| 3294 | 3298 | const dest_type = try sema.resolveType(block, src, zir_dest_type); |
| 3295 | 3299 | const operand = sema.resolveInst(zir_operand); |
| 3296 | 3300 | return sema.coerce(block, dest_type, operand, src); |
| 3297 | 3301 | } |
| 3298 | 3302 | |
| 3299 | | fn zirPtrToInt(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { |
| 3303 | fn zirPtrToInt(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 3300 | 3304 | const tracy = trace(@src()); |
| 3301 | 3305 | defer tracy.end(); |
| 3302 | 3306 | |
| ... | ... | @@ -3312,7 +3316,7 @@ fn zirPtrToInt(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerErro |
| 3312 | 3316 | return block.addUnOp(.ptrtoint, ptr); |
| 3313 | 3317 | } |
| 3314 | 3318 | |
| 3315 | | fn zirFieldVal(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { |
| 3319 | fn zirFieldVal(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 3316 | 3320 | const tracy = trace(@src()); |
| 3317 | 3321 | defer tracy.end(); |
| 3318 | 3322 | |
| ... | ... | @@ -3330,7 +3334,7 @@ fn zirFieldVal(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerErro |
| 3330 | 3334 | return sema.analyzeLoad(block, src, result_ptr, result_ptr.src); |
| 3331 | 3335 | } |
| 3332 | 3336 | |
| 3333 | | fn zirFieldPtr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { |
| 3337 | fn zirFieldPtr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 3334 | 3338 | const tracy = trace(@src()); |
| 3335 | 3339 | defer tracy.end(); |
| 3336 | 3340 | |
| ... | ... | @@ -3343,7 +3347,7 @@ fn zirFieldPtr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerErro |
| 3343 | 3347 | return sema.namedFieldPtr(block, src, object_ptr, field_name, field_name_src); |
| 3344 | 3348 | } |
| 3345 | 3349 | |
| 3346 | | fn zirFieldValNamed(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { |
| 3350 | fn zirFieldValNamed(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 3347 | 3351 | const tracy = trace(@src()); |
| 3348 | 3352 | defer tracy.end(); |
| 3349 | 3353 | |
| ... | ... | @@ -3358,7 +3362,7 @@ fn zirFieldValNamed(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) Inne |
| 3358 | 3362 | return sema.analyzeLoad(block, src, result_ptr, src); |
| 3359 | 3363 | } |
| 3360 | 3364 | |
| 3361 | | fn zirFieldPtrNamed(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { |
| 3365 | fn zirFieldPtrNamed(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 3362 | 3366 | const tracy = trace(@src()); |
| 3363 | 3367 | defer tracy.end(); |
| 3364 | 3368 | |
| ... | ... | @@ -3371,7 +3375,7 @@ fn zirFieldPtrNamed(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) Inne |
| 3371 | 3375 | return sema.namedFieldPtr(block, src, object_ptr, field_name, field_name_src); |
| 3372 | 3376 | } |
| 3373 | 3377 | |
| 3374 | | fn zirIntCast(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { |
| 3378 | fn zirIntCast(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 3375 | 3379 | const tracy = trace(@src()); |
| 3376 | 3380 | defer tracy.end(); |
| 3377 | 3381 | |
| ... | ... | @@ -3414,7 +3418,7 @@ fn zirIntCast(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError |
| 3414 | 3418 | return sema.mod.fail(&block.base, src, "TODO implement analyze widen or shorten int", .{}); |
| 3415 | 3419 | } |
| 3416 | 3420 | |
| 3417 | | fn zirBitcast(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { |
| 3421 | fn zirBitcast(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 3418 | 3422 | const tracy = trace(@src()); |
| 3419 | 3423 | defer tracy.end(); |
| 3420 | 3424 | |
| ... | ... | @@ -3428,7 +3432,7 @@ fn zirBitcast(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError |
| 3428 | 3432 | return sema.bitcast(block, dest_type, operand, operand_src); |
| 3429 | 3433 | } |
| 3430 | 3434 | |
| 3431 | | fn zirFloatCast(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { |
| 3435 | fn zirFloatCast(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 3432 | 3436 | const tracy = trace(@src()); |
| 3433 | 3437 | defer tracy.end(); |
| 3434 | 3438 | |
| ... | ... | @@ -3471,7 +3475,7 @@ fn zirFloatCast(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerErr |
| 3471 | 3475 | return sema.mod.fail(&block.base, src, "TODO implement analyze widen or shorten float", .{}); |
| 3472 | 3476 | } |
| 3473 | 3477 | |
| 3474 | | fn zirElemVal(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { |
| 3478 | fn zirElemVal(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 3475 | 3479 | const tracy = trace(@src()); |
| 3476 | 3480 | defer tracy.end(); |
| 3477 | 3481 | |
| ... | ... | @@ -3486,7 +3490,7 @@ fn zirElemVal(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError |
| 3486 | 3490 | return sema.analyzeLoad(block, sema.src, result_ptr, sema.src); |
| 3487 | 3491 | } |
| 3488 | 3492 | |
| 3489 | | fn zirElemValNode(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { |
| 3493 | fn zirElemValNode(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 3490 | 3494 | const tracy = trace(@src()); |
| 3491 | 3495 | defer tracy.end(); |
| 3492 | 3496 | |
| ... | ... | @@ -3504,7 +3508,7 @@ fn zirElemValNode(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerE |
| 3504 | 3508 | return sema.analyzeLoad(block, src, result_ptr, src); |
| 3505 | 3509 | } |
| 3506 | 3510 | |
| 3507 | | fn zirElemPtr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { |
| 3511 | fn zirElemPtr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 3508 | 3512 | const tracy = trace(@src()); |
| 3509 | 3513 | defer tracy.end(); |
| 3510 | 3514 | |
| ... | ... | @@ -3514,7 +3518,7 @@ fn zirElemPtr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError |
| 3514 | 3518 | return sema.elemPtr(block, sema.src, array_ptr, elem_index, sema.src); |
| 3515 | 3519 | } |
| 3516 | 3520 | |
| 3517 | | fn zirElemPtrNode(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { |
| 3521 | fn zirElemPtrNode(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 3518 | 3522 | const tracy = trace(@src()); |
| 3519 | 3523 | defer tracy.end(); |
| 3520 | 3524 | |
| ... | ... | @@ -3527,7 +3531,7 @@ fn zirElemPtrNode(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerE |
| 3527 | 3531 | return sema.elemPtr(block, src, array_ptr, elem_index, elem_index_src); |
| 3528 | 3532 | } |
| 3529 | 3533 | |
| 3530 | | fn zirSliceStart(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { |
| 3534 | fn zirSliceStart(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 3531 | 3535 | const tracy = trace(@src()); |
| 3532 | 3536 | defer tracy.end(); |
| 3533 | 3537 | |
| ... | ... | @@ -3540,7 +3544,7 @@ fn zirSliceStart(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerEr |
| 3540 | 3544 | return sema.analyzeSlice(block, src, array_ptr, start, null, null, .unneeded); |
| 3541 | 3545 | } |
| 3542 | 3546 | |
| 3543 | | fn zirSliceEnd(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { |
| 3547 | fn zirSliceEnd(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 3544 | 3548 | const tracy = trace(@src()); |
| 3545 | 3549 | defer tracy.end(); |
| 3546 | 3550 | |
| ... | ... | @@ -3554,7 +3558,7 @@ fn zirSliceEnd(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerErro |
| 3554 | 3558 | return sema.analyzeSlice(block, src, array_ptr, start, end, null, .unneeded); |
| 3555 | 3559 | } |
| 3556 | 3560 | |
| 3557 | | fn zirSliceSentinel(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { |
| 3561 | fn zirSliceSentinel(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 3558 | 3562 | const tracy = trace(@src()); |
| 3559 | 3563 | defer tracy.end(); |
| 3560 | 3564 | |
| ... | ... | @@ -3576,7 +3580,7 @@ fn zirSwitchCapture( |
| 3576 | 3580 | inst: Zir.Inst.Index, |
| 3577 | 3581 | is_multi: bool, |
| 3578 | 3582 | is_ref: bool, |
| 3579 | | ) InnerError!Air.Inst.Ref { |
| 3583 | ) CompileError!Air.Inst.Ref { |
| 3580 | 3584 | const tracy = trace(@src()); |
| 3581 | 3585 | defer tracy.end(); |
| 3582 | 3586 | |
| ... | ... | @@ -3595,7 +3599,7 @@ fn zirSwitchCaptureElse( |
| 3595 | 3599 | block: *Scope.Block, |
| 3596 | 3600 | inst: Zir.Inst.Index, |
| 3597 | 3601 | is_ref: bool, |
| 3598 | | ) InnerError!Air.Inst.Ref { |
| 3602 | ) CompileError!Air.Inst.Ref { |
| 3599 | 3603 | const tracy = trace(@src()); |
| 3600 | 3604 | defer tracy.end(); |
| 3601 | 3605 | |
| ... | ... | @@ -3614,7 +3618,7 @@ fn zirSwitchBlock( |
| 3614 | 3618 | inst: Zir.Inst.Index, |
| 3615 | 3619 | is_ref: bool, |
| 3616 | 3620 | special_prong: Zir.SpecialProng, |
| 3617 | | ) InnerError!Air.Inst.Ref { |
| 3621 | ) CompileError!Air.Inst.Ref { |
| 3618 | 3622 | const tracy = trace(@src()); |
| 3619 | 3623 | defer tracy.end(); |
| 3620 | 3624 | |
| ... | ... | @@ -3647,7 +3651,7 @@ fn zirSwitchBlockMulti( |
| 3647 | 3651 | inst: Zir.Inst.Index, |
| 3648 | 3652 | is_ref: bool, |
| 3649 | 3653 | special_prong: Zir.SpecialProng, |
| 3650 | | ) InnerError!Air.Inst.Ref { |
| 3654 | ) CompileError!Air.Inst.Ref { |
| 3651 | 3655 | const tracy = trace(@src()); |
| 3652 | 3656 | defer tracy.end(); |
| 3653 | 3657 | |
| ... | ... | @@ -3684,7 +3688,7 @@ fn analyzeSwitch( |
| 3684 | 3688 | multi_cases_len: usize, |
| 3685 | 3689 | switch_inst: Zir.Inst.Index, |
| 3686 | 3690 | src_node_offset: i32, |
| 3687 | | ) InnerError!Air.Inst.Ref { |
| 3691 | ) CompileError!Air.Inst.Ref { |
| 3688 | 3692 | const gpa = sema.gpa; |
| 3689 | 3693 | const mod = sema.mod; |
| 3690 | 3694 | |
| ... | ... | @@ -4350,20 +4354,23 @@ fn resolveSwitchItemVal( |
| 4350 | 4354 | switch_node_offset: i32, |
| 4351 | 4355 | switch_prong_src: Module.SwitchProngSrc, |
| 4352 | 4356 | range_expand: Module.SwitchProngSrc.RangeExpand, |
| 4353 | | ) InnerError!TypedValue { |
| 4357 | ) CompileError!TypedValue { |
| 4354 | 4358 | const item = sema.resolveInst(item_ref); |
| 4355 | | // We have to avoid the other helper functions here because we cannot construct a LazySrcLoc |
| 4356 | | // because we only have the switch AST node. Only if we know for sure we need to report |
| 4357 | | // a compile error do we resolve the full source locations. |
| 4358 | | if (item.value()) |val| { |
| 4359 | | if (val.isUndef()) { |
| 4360 | | const src = switch_prong_src.resolve(sema.gpa, block.src_decl, switch_node_offset, range_expand); |
| 4361 | | return sema.failWithUseOfUndef(block, src); |
| 4362 | | } |
| 4359 | // Constructing a LazySrcLoc is costly because we only have the switch AST node. |
| 4360 | // Only if we know for sure we need to report a compile error do we resolve the |
| 4361 | // full source locations. |
| 4362 | if (sema.resolveConstValue(block, .unneeded, item)) |val| { |
| 4363 | 4363 | return TypedValue{ .ty = item.ty, .val = val }; |
| 4364 | } else |err| switch (err) { |
| 4365 | error.NeededSourceLocation => { |
| 4366 | const src = switch_prong_src.resolve(sema.gpa, block.src_decl, switch_node_offset, range_expand); |
| 4367 | return TypedValue{ |
| 4368 | .ty = item.ty, |
| 4369 | .val = try sema.resolveConstValue(block, src, item), |
| 4370 | }; |
| 4371 | }, |
| 4372 | else => |e| return e, |
| 4364 | 4373 | } |
| 4365 | | const src = switch_prong_src.resolve(sema.gpa, block.src_decl, switch_node_offset, range_expand); |
| 4366 | | return sema.failWithNeededComptime(block, src); |
| 4367 | 4374 | } |
| 4368 | 4375 | |
| 4369 | 4376 | fn validateSwitchRange( |
| ... | ... | @@ -4374,7 +4381,7 @@ fn validateSwitchRange( |
| 4374 | 4381 | last_ref: Zir.Inst.Ref, |
| 4375 | 4382 | src_node_offset: i32, |
| 4376 | 4383 | switch_prong_src: Module.SwitchProngSrc, |
| 4377 | | ) InnerError!void { |
| 4384 | ) CompileError!void { |
| 4378 | 4385 | const first_val = (try sema.resolveSwitchItemVal(block, first_ref, src_node_offset, switch_prong_src, .first)).val; |
| 4379 | 4386 | const last_val = (try sema.resolveSwitchItemVal(block, last_ref, src_node_offset, switch_prong_src, .last)).val; |
| 4380 | 4387 | const maybe_prev_src = try range_set.add(first_val, last_val, switch_prong_src); |
| ... | ... | @@ -4388,7 +4395,7 @@ fn validateSwitchItem( |
| 4388 | 4395 | item_ref: Zir.Inst.Ref, |
| 4389 | 4396 | src_node_offset: i32, |
| 4390 | 4397 | switch_prong_src: Module.SwitchProngSrc, |
| 4391 | | ) InnerError!void { |
| 4398 | ) CompileError!void { |
| 4392 | 4399 | const item_val = (try sema.resolveSwitchItemVal(block, item_ref, src_node_offset, switch_prong_src, .none)).val; |
| 4393 | 4400 | const maybe_prev_src = try range_set.add(item_val, item_val, switch_prong_src); |
| 4394 | 4401 | return sema.validateSwitchDupe(block, maybe_prev_src, switch_prong_src, src_node_offset); |
| ... | ... | @@ -4401,7 +4408,7 @@ fn validateSwitchItemEnum( |
| 4401 | 4408 | item_ref: Zir.Inst.Ref, |
| 4402 | 4409 | src_node_offset: i32, |
| 4403 | 4410 | switch_prong_src: Module.SwitchProngSrc, |
| 4404 | | ) InnerError!void { |
| 4411 | ) CompileError!void { |
| 4405 | 4412 | const mod = sema.mod; |
| 4406 | 4413 | const item_tv = try sema.resolveSwitchItemVal(block, item_ref, src_node_offset, switch_prong_src, .none); |
| 4407 | 4414 | const field_index = item_tv.ty.enumTagFieldIndex(item_tv.val) orelse { |
| ... | ... | @@ -4435,7 +4442,7 @@ fn validateSwitchDupe( |
| 4435 | 4442 | maybe_prev_src: ?Module.SwitchProngSrc, |
| 4436 | 4443 | switch_prong_src: Module.SwitchProngSrc, |
| 4437 | 4444 | src_node_offset: i32, |
| 4438 | | ) InnerError!void { |
| 4445 | ) CompileError!void { |
| 4439 | 4446 | const prev_prong_src = maybe_prev_src orelse return; |
| 4440 | 4447 | const mod = sema.mod; |
| 4441 | 4448 | const gpa = sema.gpa; |
| ... | ... | @@ -4469,7 +4476,7 @@ fn validateSwitchItemBool( |
| 4469 | 4476 | item_ref: Zir.Inst.Ref, |
| 4470 | 4477 | src_node_offset: i32, |
| 4471 | 4478 | switch_prong_src: Module.SwitchProngSrc, |
| 4472 | | ) InnerError!void { |
| 4479 | ) CompileError!void { |
| 4473 | 4480 | const item_val = (try sema.resolveSwitchItemVal(block, item_ref, src_node_offset, switch_prong_src, .none)).val; |
| 4474 | 4481 | if (item_val.toBool()) { |
| 4475 | 4482 | true_count.* += 1; |
| ... | ... | @@ -4491,7 +4498,7 @@ fn validateSwitchItemSparse( |
| 4491 | 4498 | item_ref: Zir.Inst.Ref, |
| 4492 | 4499 | src_node_offset: i32, |
| 4493 | 4500 | switch_prong_src: Module.SwitchProngSrc, |
| 4494 | | ) InnerError!void { |
| 4501 | ) CompileError!void { |
| 4495 | 4502 | const item_val = (try sema.resolveSwitchItemVal(block, item_ref, src_node_offset, switch_prong_src, .none)).val; |
| 4496 | 4503 | const kv = (try seen_values.fetchPut(item_val, switch_prong_src)) orelse return; |
| 4497 | 4504 | return sema.validateSwitchDupe(block, kv.value, switch_prong_src, src_node_offset); |
| ... | ... | @@ -4503,7 +4510,7 @@ fn validateSwitchNoRange( |
| 4503 | 4510 | ranges_len: u32, |
| 4504 | 4511 | operand_ty: Type, |
| 4505 | 4512 | src_node_offset: i32, |
| 4506 | | ) InnerError!void { |
| 4513 | ) CompileError!void { |
| 4507 | 4514 | if (ranges_len == 0) |
| 4508 | 4515 | return; |
| 4509 | 4516 | |
| ... | ... | @@ -4530,7 +4537,7 @@ fn validateSwitchNoRange( |
| 4530 | 4537 | return sema.mod.failWithOwnedErrorMsg(&block.base, msg); |
| 4531 | 4538 | } |
| 4532 | 4539 | |
| 4533 | | fn zirHasField(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { |
| 4540 | fn zirHasField(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 4534 | 4541 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; |
| 4535 | 4542 | const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data; |
| 4536 | 4543 | _ = extra; |
| ... | ... | @@ -4539,7 +4546,7 @@ fn zirHasField(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerErro |
| 4539 | 4546 | return sema.mod.fail(&block.base, src, "TODO implement zirHasField", .{}); |
| 4540 | 4547 | } |
| 4541 | 4548 | |
| 4542 | | fn zirHasDecl(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { |
| 4549 | fn zirHasDecl(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 4543 | 4550 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; |
| 4544 | 4551 | const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data; |
| 4545 | 4552 | const lhs_src: LazySrcLoc = .{ .node_offset_builtin_call_arg0 = inst_data.src_node }; |
| ... | ... | @@ -4562,7 +4569,7 @@ fn zirHasDecl(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError |
| 4562 | 4569 | return Air.Inst.Ref.bool_false; |
| 4563 | 4570 | } |
| 4564 | 4571 | |
| 4565 | | fn zirImport(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { |
| 4572 | fn zirImport(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 4566 | 4573 | const tracy = trace(@src()); |
| 4567 | 4574 | defer tracy.end(); |
| 4568 | 4575 | |
| ... | ... | @@ -4587,13 +4594,13 @@ fn zirImport(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError! |
| 4587 | 4594 | return sema.addType(file_root_decl.ty); |
| 4588 | 4595 | } |
| 4589 | 4596 | |
| 4590 | | fn zirRetErrValueCode(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { |
| 4597 | fn zirRetErrValueCode(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 4591 | 4598 | _ = block; |
| 4592 | 4599 | _ = inst; |
| 4593 | 4600 | return sema.mod.fail(&block.base, sema.src, "TODO implement zirRetErrValueCode", .{}); |
| 4594 | 4601 | } |
| 4595 | 4602 | |
| 4596 | | fn zirShl(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { |
| 4603 | fn zirShl(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 4597 | 4604 | const tracy = trace(@src()); |
| 4598 | 4605 | defer tracy.end(); |
| 4599 | 4606 | |
| ... | ... | @@ -4602,7 +4609,7 @@ fn zirShl(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air |
| 4602 | 4609 | return sema.mod.fail(&block.base, sema.src, "TODO implement zirShl", .{}); |
| 4603 | 4610 | } |
| 4604 | 4611 | |
| 4605 | | fn zirShr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { |
| 4612 | fn zirShr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 4606 | 4613 | const tracy = trace(@src()); |
| 4607 | 4614 | defer tracy.end(); |
| 4608 | 4615 | |
| ... | ... | @@ -4615,7 +4622,7 @@ fn zirBitwise( |
| 4615 | 4622 | block: *Scope.Block, |
| 4616 | 4623 | inst: Zir.Inst.Index, |
| 4617 | 4624 | air_tag: Air.Inst.Tag, |
| 4618 | | ) InnerError!Air.Inst.Ref { |
| 4625 | ) CompileError!Air.Inst.Ref { |
| 4619 | 4626 | const tracy = trace(@src()); |
| 4620 | 4627 | defer tracy.end(); |
| 4621 | 4628 | |
| ... | ... | @@ -4675,7 +4682,7 @@ fn zirBitwise( |
| 4675 | 4682 | return block.addBinOp(air_tag, casted_lhs, casted_rhs); |
| 4676 | 4683 | } |
| 4677 | 4684 | |
| 4678 | | fn zirBitNot(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { |
| 4685 | fn zirBitNot(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 4679 | 4686 | const tracy = trace(@src()); |
| 4680 | 4687 | defer tracy.end(); |
| 4681 | 4688 | |
| ... | ... | @@ -4683,7 +4690,7 @@ fn zirBitNot(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError! |
| 4683 | 4690 | return sema.mod.fail(&block.base, sema.src, "TODO implement zirBitNot", .{}); |
| 4684 | 4691 | } |
| 4685 | 4692 | |
| 4686 | | fn zirArrayCat(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { |
| 4693 | fn zirArrayCat(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 4687 | 4694 | const tracy = trace(@src()); |
| 4688 | 4695 | defer tracy.end(); |
| 4689 | 4696 | |
| ... | ... | @@ -4691,7 +4698,7 @@ fn zirArrayCat(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerErro |
| 4691 | 4698 | return sema.mod.fail(&block.base, sema.src, "TODO implement zirArrayCat", .{}); |
| 4692 | 4699 | } |
| 4693 | 4700 | |
| 4694 | | fn zirArrayMul(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { |
| 4701 | fn zirArrayMul(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 4695 | 4702 | const tracy = trace(@src()); |
| 4696 | 4703 | defer tracy.end(); |
| 4697 | 4704 | |
| ... | ... | @@ -4704,7 +4711,7 @@ fn zirNegate( |
| 4704 | 4711 | block: *Scope.Block, |
| 4705 | 4712 | inst: Zir.Inst.Index, |
| 4706 | 4713 | tag_override: Zir.Inst.Tag, |
| 4707 | | ) InnerError!Air.Inst.Ref { |
| 4714 | ) CompileError!Air.Inst.Ref { |
| 4708 | 4715 | const tracy = trace(@src()); |
| 4709 | 4716 | defer tracy.end(); |
| 4710 | 4717 | |
| ... | ... | @@ -4718,7 +4725,7 @@ fn zirNegate( |
| 4718 | 4725 | return sema.analyzeArithmetic(block, tag_override, lhs, rhs, src, lhs_src, rhs_src); |
| 4719 | 4726 | } |
| 4720 | 4727 | |
| 4721 | | fn zirArithmetic(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { |
| 4728 | fn zirArithmetic(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 4722 | 4729 | const tracy = trace(@src()); |
| 4723 | 4730 | defer tracy.end(); |
| 4724 | 4731 | |
| ... | ... | @@ -4738,7 +4745,7 @@ fn zirOverflowArithmetic( |
| 4738 | 4745 | sema: *Sema, |
| 4739 | 4746 | block: *Scope.Block, |
| 4740 | 4747 | extended: Zir.Inst.Extended.InstData, |
| 4741 | | ) InnerError!Air.Inst.Ref { |
| 4748 | ) CompileError!Air.Inst.Ref { |
| 4742 | 4749 | const tracy = trace(@src()); |
| 4743 | 4750 | defer tracy.end(); |
| 4744 | 4751 | |
| ... | ... | @@ -4757,7 +4764,7 @@ fn analyzeArithmetic( |
| 4757 | 4764 | src: LazySrcLoc, |
| 4758 | 4765 | lhs_src: LazySrcLoc, |
| 4759 | 4766 | rhs_src: LazySrcLoc, |
| 4760 | | ) InnerError!Air.Inst.Ref { |
| 4767 | ) CompileError!Air.Inst.Ref { |
| 4761 | 4768 | const instructions = &[_]Air.Inst.Index{ lhs, rhs }; |
| 4762 | 4769 | const resolved_type = try sema.resolvePeerTypes(block, src, instructions); |
| 4763 | 4770 | const casted_lhs = try sema.coerce(block, resolved_type, lhs, lhs_src); |
| ... | ... | @@ -4867,7 +4874,7 @@ fn analyzeArithmetic( |
| 4867 | 4874 | return block.addBinOp(air_tag, casted_lhs, casted_rhs); |
| 4868 | 4875 | } |
| 4869 | 4876 | |
| 4870 | | fn zirLoad(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { |
| 4877 | fn zirLoad(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 4871 | 4878 | const tracy = trace(@src()); |
| 4872 | 4879 | defer tracy.end(); |
| 4873 | 4880 | |
| ... | ... | @@ -4882,7 +4889,7 @@ fn zirAsm( |
| 4882 | 4889 | sema: *Sema, |
| 4883 | 4890 | block: *Scope.Block, |
| 4884 | 4891 | extended: Zir.Inst.Extended.InstData, |
| 4885 | | ) InnerError!Air.Inst.Ref { |
| 4892 | ) CompileError!Air.Inst.Ref { |
| 4886 | 4893 | const tracy = trace(@src()); |
| 4887 | 4894 | defer tracy.end(); |
| 4888 | 4895 | |
| ... | ... | @@ -4966,7 +4973,7 @@ fn zirCmp( |
| 4966 | 4973 | block: *Scope.Block, |
| 4967 | 4974 | inst: Zir.Inst.Index, |
| 4968 | 4975 | op: std.math.CompareOperator, |
| 4969 | | ) InnerError!Air.Inst.Ref { |
| 4976 | ) CompileError!Air.Inst.Ref { |
| 4970 | 4977 | const tracy = trace(@src()); |
| 4971 | 4978 | defer tracy.end(); |
| 4972 | 4979 | |
| ... | ... | @@ -5091,7 +5098,7 @@ fn zirCmp( |
| 5091 | 5098 | return block.addBinOp(tag, casted_lhs, casted_rhs); |
| 5092 | 5099 | } |
| 5093 | 5100 | |
| 5094 | | fn zirSizeOf(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { |
| 5101 | fn zirSizeOf(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 5095 | 5102 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; |
| 5096 | 5103 | const operand_src: LazySrcLoc = .{ .node_offset_builtin_call_arg0 = inst_data.src_node }; |
| 5097 | 5104 | const operand_ty = try sema.resolveType(block, operand_src, inst_data.operand); |
| ... | ... | @@ -5100,7 +5107,7 @@ fn zirSizeOf(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError! |
| 5100 | 5107 | return sema.addIntUnsigned(Type.initTag(.comptime_int), abi_size); |
| 5101 | 5108 | } |
| 5102 | 5109 | |
| 5103 | | fn zirBitSizeOf(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { |
| 5110 | fn zirBitSizeOf(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 5104 | 5111 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; |
| 5105 | 5112 | const operand_src: LazySrcLoc = .{ .node_offset_builtin_call_arg0 = inst_data.src_node }; |
| 5106 | 5113 | const operand_ty = try sema.resolveType(block, operand_src, inst_data.operand); |
| ... | ... | @@ -5113,7 +5120,7 @@ fn zirThis( |
| 5113 | 5120 | sema: *Sema, |
| 5114 | 5121 | block: *Scope.Block, |
| 5115 | 5122 | extended: Zir.Inst.Extended.InstData, |
| 5116 | | ) InnerError!Air.Inst.Ref { |
| 5123 | ) CompileError!Air.Inst.Ref { |
| 5117 | 5124 | const src: LazySrcLoc = .{ .node_offset = @bitCast(i32, extended.operand) }; |
| 5118 | 5125 | return sema.mod.fail(&block.base, src, "TODO: implement Sema.zirThis", .{}); |
| 5119 | 5126 | } |
| ... | ... | @@ -5122,7 +5129,7 @@ fn zirRetAddr( |
| 5122 | 5129 | sema: *Sema, |
| 5123 | 5130 | block: *Scope.Block, |
| 5124 | 5131 | extended: Zir.Inst.Extended.InstData, |
| 5125 | | ) InnerError!Air.Inst.Ref { |
| 5132 | ) CompileError!Air.Inst.Ref { |
| 5126 | 5133 | const src: LazySrcLoc = .{ .node_offset = @bitCast(i32, extended.operand) }; |
| 5127 | 5134 | return sema.mod.fail(&block.base, src, "TODO: implement Sema.zirRetAddr", .{}); |
| 5128 | 5135 | } |
| ... | ... | @@ -5131,12 +5138,12 @@ fn zirBuiltinSrc( |
| 5131 | 5138 | sema: *Sema, |
| 5132 | 5139 | block: *Scope.Block, |
| 5133 | 5140 | extended: Zir.Inst.Extended.InstData, |
| 5134 | | ) InnerError!Air.Inst.Ref { |
| 5141 | ) CompileError!Air.Inst.Ref { |
| 5135 | 5142 | const src: LazySrcLoc = .{ .node_offset = @bitCast(i32, extended.operand) }; |
| 5136 | 5143 | return sema.mod.fail(&block.base, src, "TODO: implement Sema.zirBuiltinSrc", .{}); |
| 5137 | 5144 | } |
| 5138 | 5145 | |
| 5139 | | fn zirTypeInfo(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { |
| 5146 | fn zirTypeInfo(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 5140 | 5147 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; |
| 5141 | 5148 | const src = inst_data.src(); |
| 5142 | 5149 | const ty = try sema.resolveType(block, src, inst_data.operand); |
| ... | ... | @@ -5179,7 +5186,7 @@ fn zirTypeInfo(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerErro |
| 5179 | 5186 | } |
| 5180 | 5187 | } |
| 5181 | 5188 | |
| 5182 | | fn zirTypeof(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { |
| 5189 | fn zirTypeof(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 5183 | 5190 | _ = block; |
| 5184 | 5191 | const zir_datas = sema.code.instructions.items(.data); |
| 5185 | 5192 | const inst_data = zir_datas[inst].un_node; |
| ... | ... | @@ -5187,7 +5194,7 @@ fn zirTypeof(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError! |
| 5187 | 5194 | return sema.addType(operand.ty); |
| 5188 | 5195 | } |
| 5189 | 5196 | |
| 5190 | | fn zirTypeofElem(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { |
| 5197 | fn zirTypeofElem(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 5191 | 5198 | _ = block; |
| 5192 | 5199 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; |
| 5193 | 5200 | const operand_ptr = sema.resolveInst(inst_data.operand); |
| ... | ... | @@ -5195,13 +5202,13 @@ fn zirTypeofElem(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerEr |
| 5195 | 5202 | return sema.addType(elem_ty); |
| 5196 | 5203 | } |
| 5197 | 5204 | |
| 5198 | | fn zirTypeofLog2IntType(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { |
| 5205 | fn zirTypeofLog2IntType(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 5199 | 5206 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; |
| 5200 | 5207 | const src = inst_data.src(); |
| 5201 | 5208 | return sema.mod.fail(&block.base, src, "TODO: implement Sema.zirTypeofLog2IntType", .{}); |
| 5202 | 5209 | } |
| 5203 | 5210 | |
| 5204 | | fn zirLog2IntType(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { |
| 5211 | fn zirLog2IntType(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 5205 | 5212 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; |
| 5206 | 5213 | const src = inst_data.src(); |
| 5207 | 5214 | return sema.mod.fail(&block.base, src, "TODO: implement Sema.zirLog2IntType", .{}); |
| ... | ... | @@ -5211,7 +5218,7 @@ fn zirTypeofPeer( |
| 5211 | 5218 | sema: *Sema, |
| 5212 | 5219 | block: *Scope.Block, |
| 5213 | 5220 | extended: Zir.Inst.Extended.InstData, |
| 5214 | | ) InnerError!Air.Inst.Ref { |
| 5221 | ) CompileError!Air.Inst.Ref { |
| 5215 | 5222 | const tracy = trace(@src()); |
| 5216 | 5223 | defer tracy.end(); |
| 5217 | 5224 | |
| ... | ... | @@ -5230,7 +5237,7 @@ fn zirTypeofPeer( |
| 5230 | 5237 | return sema.addType(result_type); |
| 5231 | 5238 | } |
| 5232 | 5239 | |
| 5233 | | fn zirBoolNot(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { |
| 5240 | fn zirBoolNot(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 5234 | 5241 | const tracy = trace(@src()); |
| 5235 | 5242 | defer tracy.end(); |
| 5236 | 5243 | |
| ... | ... | @@ -5256,7 +5263,7 @@ fn zirBoolOp( |
| 5256 | 5263 | block: *Scope.Block, |
| 5257 | 5264 | inst: Zir.Inst.Index, |
| 5258 | 5265 | is_bool_or: bool, |
| 5259 | | ) InnerError!Air.Inst.Ref { |
| 5266 | ) CompileError!Air.Inst.Ref { |
| 5260 | 5267 | const tracy = trace(@src()); |
| 5261 | 5268 | defer tracy.end(); |
| 5262 | 5269 | |
| ... | ... | @@ -5295,7 +5302,7 @@ fn zirBoolBr( |
| 5295 | 5302 | parent_block: *Scope.Block, |
| 5296 | 5303 | inst: Zir.Inst.Index, |
| 5297 | 5304 | is_bool_or: bool, |
| 5298 | | ) InnerError!Air.Inst.Ref { |
| 5305 | ) CompileError!Air.Inst.Ref { |
| 5299 | 5306 | const tracy = trace(@src()); |
| 5300 | 5307 | defer tracy.end(); |
| 5301 | 5308 | |
| ... | ... | @@ -5369,7 +5376,7 @@ fn zirIsNonNull( |
| 5369 | 5376 | sema: *Sema, |
| 5370 | 5377 | block: *Scope.Block, |
| 5371 | 5378 | inst: Zir.Inst.Index, |
| 5372 | | ) InnerError!Air.Inst.Ref { |
| 5379 | ) CompileError!Air.Inst.Ref { |
| 5373 | 5380 | const tracy = trace(@src()); |
| 5374 | 5381 | defer tracy.end(); |
| 5375 | 5382 | |
| ... | ... | @@ -5383,7 +5390,7 @@ fn zirIsNonNullPtr( |
| 5383 | 5390 | sema: *Sema, |
| 5384 | 5391 | block: *Scope.Block, |
| 5385 | 5392 | inst: Zir.Inst.Index, |
| 5386 | | ) InnerError!Air.Inst.Ref { |
| 5393 | ) CompileError!Air.Inst.Ref { |
| 5387 | 5394 | const tracy = trace(@src()); |
| 5388 | 5395 | defer tracy.end(); |
| 5389 | 5396 | |
| ... | ... | @@ -5394,7 +5401,7 @@ fn zirIsNonNullPtr( |
| 5394 | 5401 | return sema.analyzeIsNull(block, src, loaded, true); |
| 5395 | 5402 | } |
| 5396 | 5403 | |
| 5397 | | fn zirIsNonErr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { |
| 5404 | fn zirIsNonErr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 5398 | 5405 | const tracy = trace(@src()); |
| 5399 | 5406 | defer tracy.end(); |
| 5400 | 5407 | |
| ... | ... | @@ -5403,7 +5410,7 @@ fn zirIsNonErr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerErro |
| 5403 | 5410 | return sema.analyzeIsNonErr(block, inst_data.src(), operand); |
| 5404 | 5411 | } |
| 5405 | 5412 | |
| 5406 | | fn zirIsNonErrPtr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { |
| 5413 | fn zirIsNonErrPtr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 5407 | 5414 | const tracy = trace(@src()); |
| 5408 | 5415 | defer tracy.end(); |
| 5409 | 5416 | |
| ... | ... | @@ -5418,7 +5425,7 @@ fn zirCondbr( |
| 5418 | 5425 | sema: *Sema, |
| 5419 | 5426 | parent_block: *Scope.Block, |
| 5420 | 5427 | inst: Zir.Inst.Index, |
| 5421 | | ) InnerError!Zir.Inst.Index { |
| 5428 | ) CompileError!Zir.Inst.Index { |
| 5422 | 5429 | const tracy = trace(@src()); |
| 5423 | 5430 | defer tracy.end(); |
| 5424 | 5431 | |
| ... | ... | @@ -5461,7 +5468,7 @@ fn zirCondbr( |
| 5461 | 5468 | return always_noreturn; |
| 5462 | 5469 | } |
| 5463 | 5470 | |
| 5464 | | fn zirUnreachable(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Zir.Inst.Index { |
| 5471 | fn zirUnreachable(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Zir.Inst.Index { |
| 5465 | 5472 | const tracy = trace(@src()); |
| 5466 | 5473 | defer tracy.end(); |
| 5467 | 5474 | |
| ... | ... | @@ -5482,7 +5489,7 @@ fn zirRetErrValue( |
| 5482 | 5489 | sema: *Sema, |
| 5483 | 5490 | block: *Scope.Block, |
| 5484 | 5491 | inst: Zir.Inst.Index, |
| 5485 | | ) InnerError!Zir.Inst.Index { |
| 5492 | ) CompileError!Zir.Inst.Index { |
| 5486 | 5493 | const inst_data = sema.code.instructions.items(.data)[inst].str_tok; |
| 5487 | 5494 | const err_name = inst_data.get(sema.code); |
| 5488 | 5495 | const src = inst_data.src(); |
| ... | ... | @@ -5507,7 +5514,7 @@ fn zirRetCoerce( |
| 5507 | 5514 | block: *Scope.Block, |
| 5508 | 5515 | inst: Zir.Inst.Index, |
| 5509 | 5516 | need_coercion: bool, |
| 5510 | | ) InnerError!Zir.Inst.Index { |
| 5517 | ) CompileError!Zir.Inst.Index { |
| 5511 | 5518 | const tracy = trace(@src()); |
| 5512 | 5519 | defer tracy.end(); |
| 5513 | 5520 | |
| ... | ... | @@ -5518,7 +5525,7 @@ fn zirRetCoerce( |
| 5518 | 5525 | return sema.analyzeRet(block, operand, src, need_coercion); |
| 5519 | 5526 | } |
| 5520 | 5527 | |
| 5521 | | fn zirRetNode(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Zir.Inst.Index { |
| 5528 | fn zirRetNode(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Zir.Inst.Index { |
| 5522 | 5529 | const tracy = trace(@src()); |
| 5523 | 5530 | defer tracy.end(); |
| 5524 | 5531 | |
| ... | ... | @@ -5535,7 +5542,7 @@ fn analyzeRet( |
| 5535 | 5542 | operand: Air.Inst.Ref, |
| 5536 | 5543 | src: LazySrcLoc, |
| 5537 | 5544 | need_coercion: bool, |
| 5538 | | ) InnerError!Zir.Inst.Index { |
| 5545 | ) CompileError!Zir.Inst.Index { |
| 5539 | 5546 | if (block.inlining) |inlining| { |
| 5540 | 5547 | // We are inlining a function call; rewrite the `ret` as a `break`. |
| 5541 | 5548 | try inlining.merges.results.append(sema.gpa, operand); |
| ... | ... | @@ -5564,7 +5571,7 @@ fn floatOpAllowed(tag: Zir.Inst.Tag) bool { |
| 5564 | 5571 | }; |
| 5565 | 5572 | } |
| 5566 | 5573 | |
| 5567 | | fn zirPtrTypeSimple(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { |
| 5574 | fn zirPtrTypeSimple(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 5568 | 5575 | const tracy = trace(@src()); |
| 5569 | 5576 | defer tracy.end(); |
| 5570 | 5577 | |
| ... | ... | @@ -5585,7 +5592,7 @@ fn zirPtrTypeSimple(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) Inne |
| 5585 | 5592 | return sema.addType(ty); |
| 5586 | 5593 | } |
| 5587 | 5594 | |
| 5588 | | fn zirPtrType(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { |
| 5595 | fn zirPtrType(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 5589 | 5596 | const tracy = trace(@src()); |
| 5590 | 5597 | defer tracy.end(); |
| 5591 | 5598 | |
| ... | ... | @@ -5639,7 +5646,7 @@ fn zirPtrType(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError |
| 5639 | 5646 | return sema.addType(ty); |
| 5640 | 5647 | } |
| 5641 | 5648 | |
| 5642 | | fn zirStructInitEmpty(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { |
| 5649 | fn zirStructInitEmpty(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 5643 | 5650 | const tracy = trace(@src()); |
| 5644 | 5651 | defer tracy.end(); |
| 5645 | 5652 | |
| ... | ... | @@ -5653,13 +5660,13 @@ fn zirStructInitEmpty(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) In |
| 5653 | 5660 | }); |
| 5654 | 5661 | } |
| 5655 | 5662 | |
| 5656 | | fn zirUnionInitPtr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { |
| 5663 | fn zirUnionInitPtr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 5657 | 5664 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; |
| 5658 | 5665 | const src = inst_data.src(); |
| 5659 | 5666 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirUnionInitPtr", .{}); |
| 5660 | 5667 | } |
| 5661 | 5668 | |
| 5662 | | fn zirStructInit(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index, is_ref: bool) InnerError!Air.Inst.Ref { |
| 5669 | fn zirStructInit(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index, is_ref: bool) CompileError!Air.Inst.Ref { |
| 5663 | 5670 | const mod = sema.mod; |
| 5664 | 5671 | const gpa = sema.gpa; |
| 5665 | 5672 | const zir_datas = sema.code.instructions.items(.data); |
| ... | ... | @@ -5772,7 +5779,7 @@ fn zirStructInit(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index, is_ref: |
| 5772 | 5779 | return mod.fail(&block.base, src, "TODO: Sema.zirStructInit for runtime-known struct values", .{}); |
| 5773 | 5780 | } |
| 5774 | 5781 | |
| 5775 | | fn zirStructInitAnon(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index, is_ref: bool) InnerError!Air.Inst.Ref { |
| 5782 | fn zirStructInitAnon(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index, is_ref: bool) CompileError!Air.Inst.Ref { |
| 5776 | 5783 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; |
| 5777 | 5784 | const src = inst_data.src(); |
| 5778 | 5785 | |
| ... | ... | @@ -5780,7 +5787,7 @@ fn zirStructInitAnon(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index, is_ |
| 5780 | 5787 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirStructInitAnon", .{}); |
| 5781 | 5788 | } |
| 5782 | 5789 | |
| 5783 | | fn zirArrayInit(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index, is_ref: bool) InnerError!Air.Inst.Ref { |
| 5790 | fn zirArrayInit(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index, is_ref: bool) CompileError!Air.Inst.Ref { |
| 5784 | 5791 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; |
| 5785 | 5792 | const src = inst_data.src(); |
| 5786 | 5793 | |
| ... | ... | @@ -5788,7 +5795,7 @@ fn zirArrayInit(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index, is_ref: |
| 5788 | 5795 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirArrayInit", .{}); |
| 5789 | 5796 | } |
| 5790 | 5797 | |
| 5791 | | fn zirArrayInitAnon(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index, is_ref: bool) InnerError!Air.Inst.Ref { |
| 5798 | fn zirArrayInitAnon(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index, is_ref: bool) CompileError!Air.Inst.Ref { |
| 5792 | 5799 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; |
| 5793 | 5800 | const src = inst_data.src(); |
| 5794 | 5801 | |
| ... | ... | @@ -5796,13 +5803,13 @@ fn zirArrayInitAnon(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index, is_r |
| 5796 | 5803 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirArrayInitAnon", .{}); |
| 5797 | 5804 | } |
| 5798 | 5805 | |
| 5799 | | fn zirFieldTypeRef(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { |
| 5806 | fn zirFieldTypeRef(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 5800 | 5807 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; |
| 5801 | 5808 | const src = inst_data.src(); |
| 5802 | 5809 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirFieldTypeRef", .{}); |
| 5803 | 5810 | } |
| 5804 | 5811 | |
| 5805 | | fn zirFieldType(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { |
| 5812 | fn zirFieldType(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 5806 | 5813 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; |
| 5807 | 5814 | const extra = sema.code.extraData(Zir.Inst.FieldType, inst_data.payload_index).data; |
| 5808 | 5815 | const src = inst_data.src(); |
| ... | ... | @@ -5824,7 +5831,7 @@ fn zirErrorReturnTrace( |
| 5824 | 5831 | sema: *Sema, |
| 5825 | 5832 | block: *Scope.Block, |
| 5826 | 5833 | extended: Zir.Inst.Extended.InstData, |
| 5827 | | ) InnerError!Air.Inst.Ref { |
| 5834 | ) CompileError!Air.Inst.Ref { |
| 5828 | 5835 | const src: LazySrcLoc = .{ .node_offset = @bitCast(i32, extended.operand) }; |
| 5829 | 5836 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirErrorReturnTrace", .{}); |
| 5830 | 5837 | } |
| ... | ... | @@ -5833,7 +5840,7 @@ fn zirFrame( |
| 5833 | 5840 | sema: *Sema, |
| 5834 | 5841 | block: *Scope.Block, |
| 5835 | 5842 | extended: Zir.Inst.Extended.InstData, |
| 5836 | | ) InnerError!Air.Inst.Ref { |
| 5843 | ) CompileError!Air.Inst.Ref { |
| 5837 | 5844 | const src: LazySrcLoc = .{ .node_offset = @bitCast(i32, extended.operand) }; |
| 5838 | 5845 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirFrame", .{}); |
| 5839 | 5846 | } |
| ... | ... | @@ -5842,84 +5849,84 @@ fn zirFrameAddress( |
| 5842 | 5849 | sema: *Sema, |
| 5843 | 5850 | block: *Scope.Block, |
| 5844 | 5851 | extended: Zir.Inst.Extended.InstData, |
| 5845 | | ) InnerError!Air.Inst.Ref { |
| 5852 | ) CompileError!Air.Inst.Ref { |
| 5846 | 5853 | const src: LazySrcLoc = .{ .node_offset = @bitCast(i32, extended.operand) }; |
| 5847 | 5854 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirFrameAddress", .{}); |
| 5848 | 5855 | } |
| 5849 | 5856 | |
| 5850 | | fn zirAlignOf(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { |
| 5857 | fn zirAlignOf(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 5851 | 5858 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; |
| 5852 | 5859 | const src = inst_data.src(); |
| 5853 | 5860 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirAlignOf", .{}); |
| 5854 | 5861 | } |
| 5855 | 5862 | |
| 5856 | | fn zirBoolToInt(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { |
| 5863 | fn zirBoolToInt(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 5857 | 5864 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; |
| 5858 | 5865 | const src = inst_data.src(); |
| 5859 | 5866 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirBoolToInt", .{}); |
| 5860 | 5867 | } |
| 5861 | 5868 | |
| 5862 | | fn zirEmbedFile(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { |
| 5869 | fn zirEmbedFile(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 5863 | 5870 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; |
| 5864 | 5871 | const src = inst_data.src(); |
| 5865 | 5872 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirEmbedFile", .{}); |
| 5866 | 5873 | } |
| 5867 | 5874 | |
| 5868 | | fn zirErrorName(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { |
| 5875 | fn zirErrorName(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 5869 | 5876 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; |
| 5870 | 5877 | const src = inst_data.src(); |
| 5871 | 5878 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirErrorName", .{}); |
| 5872 | 5879 | } |
| 5873 | 5880 | |
| 5874 | | fn zirUnaryMath(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { |
| 5881 | fn zirUnaryMath(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 5875 | 5882 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; |
| 5876 | 5883 | const src = inst_data.src(); |
| 5877 | 5884 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirUnaryMath", .{}); |
| 5878 | 5885 | } |
| 5879 | 5886 | |
| 5880 | | fn zirTagName(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { |
| 5887 | fn zirTagName(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 5881 | 5888 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; |
| 5882 | 5889 | const src = inst_data.src(); |
| 5883 | 5890 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirTagName", .{}); |
| 5884 | 5891 | } |
| 5885 | 5892 | |
| 5886 | | fn zirReify(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { |
| 5893 | fn zirReify(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 5887 | 5894 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; |
| 5888 | 5895 | const src = inst_data.src(); |
| 5889 | 5896 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirReify", .{}); |
| 5890 | 5897 | } |
| 5891 | 5898 | |
| 5892 | | fn zirTypeName(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { |
| 5899 | fn zirTypeName(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 5893 | 5900 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; |
| 5894 | 5901 | const src = inst_data.src(); |
| 5895 | 5902 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirTypeName", .{}); |
| 5896 | 5903 | } |
| 5897 | 5904 | |
| 5898 | | fn zirFrameType(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { |
| 5905 | fn zirFrameType(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 5899 | 5906 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; |
| 5900 | 5907 | const src = inst_data.src(); |
| 5901 | 5908 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirFrameType", .{}); |
| 5902 | 5909 | } |
| 5903 | 5910 | |
| 5904 | | fn zirFrameSize(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { |
| 5911 | fn zirFrameSize(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 5905 | 5912 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; |
| 5906 | 5913 | const src = inst_data.src(); |
| 5907 | 5914 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirFrameSize", .{}); |
| 5908 | 5915 | } |
| 5909 | 5916 | |
| 5910 | | fn zirFloatToInt(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { |
| 5917 | fn zirFloatToInt(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 5911 | 5918 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; |
| 5912 | 5919 | const src = inst_data.src(); |
| 5913 | 5920 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirFloatToInt", .{}); |
| 5914 | 5921 | } |
| 5915 | 5922 | |
| 5916 | | fn zirIntToFloat(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { |
| 5923 | fn zirIntToFloat(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 5917 | 5924 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; |
| 5918 | 5925 | const src = inst_data.src(); |
| 5919 | 5926 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirIntToFloat", .{}); |
| 5920 | 5927 | } |
| 5921 | 5928 | |
| 5922 | | fn zirIntToPtr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { |
| 5929 | fn zirIntToPtr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 5923 | 5930 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; |
| 5924 | 5931 | const src = inst_data.src(); |
| 5925 | 5932 | |
| ... | ... | @@ -5982,199 +5989,199 @@ fn zirIntToPtr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerErro |
| 5982 | 5989 | return block.addTyOp(.bitcast, type_res, operand_coerced); |
| 5983 | 5990 | } |
| 5984 | 5991 | |
| 5985 | | fn zirErrSetCast(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { |
| 5992 | fn zirErrSetCast(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 5986 | 5993 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; |
| 5987 | 5994 | const src = inst_data.src(); |
| 5988 | 5995 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirErrSetCast", .{}); |
| 5989 | 5996 | } |
| 5990 | 5997 | |
| 5991 | | fn zirPtrCast(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { |
| 5998 | fn zirPtrCast(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 5992 | 5999 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; |
| 5993 | 6000 | const src = inst_data.src(); |
| 5994 | 6001 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirPtrCast", .{}); |
| 5995 | 6002 | } |
| 5996 | 6003 | |
| 5997 | | fn zirTruncate(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { |
| 6004 | fn zirTruncate(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 5998 | 6005 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; |
| 5999 | 6006 | const src = inst_data.src(); |
| 6000 | 6007 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirTruncate", .{}); |
| 6001 | 6008 | } |
| 6002 | 6009 | |
| 6003 | | fn zirAlignCast(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { |
| 6010 | fn zirAlignCast(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 6004 | 6011 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; |
| 6005 | 6012 | const src = inst_data.src(); |
| 6006 | 6013 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirAlignCast", .{}); |
| 6007 | 6014 | } |
| 6008 | 6015 | |
| 6009 | | fn zirClz(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { |
| 6016 | fn zirClz(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 6010 | 6017 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; |
| 6011 | 6018 | const src = inst_data.src(); |
| 6012 | 6019 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirClz", .{}); |
| 6013 | 6020 | } |
| 6014 | 6021 | |
| 6015 | | fn zirCtz(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { |
| 6022 | fn zirCtz(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 6016 | 6023 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; |
| 6017 | 6024 | const src = inst_data.src(); |
| 6018 | 6025 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirCtz", .{}); |
| 6019 | 6026 | } |
| 6020 | 6027 | |
| 6021 | | fn zirPopCount(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { |
| 6028 | fn zirPopCount(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 6022 | 6029 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; |
| 6023 | 6030 | const src = inst_data.src(); |
| 6024 | 6031 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirPopCount", .{}); |
| 6025 | 6032 | } |
| 6026 | 6033 | |
| 6027 | | fn zirByteSwap(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { |
| 6034 | fn zirByteSwap(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 6028 | 6035 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; |
| 6029 | 6036 | const src = inst_data.src(); |
| 6030 | 6037 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirByteSwap", .{}); |
| 6031 | 6038 | } |
| 6032 | 6039 | |
| 6033 | | fn zirBitReverse(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { |
| 6040 | fn zirBitReverse(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 6034 | 6041 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; |
| 6035 | 6042 | const src = inst_data.src(); |
| 6036 | 6043 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirBitReverse", .{}); |
| 6037 | 6044 | } |
| 6038 | 6045 | |
| 6039 | | fn zirDivExact(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { |
| 6046 | fn zirDivExact(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 6040 | 6047 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; |
| 6041 | 6048 | const src = inst_data.src(); |
| 6042 | 6049 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirDivExact", .{}); |
| 6043 | 6050 | } |
| 6044 | 6051 | |
| 6045 | | fn zirDivFloor(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { |
| 6052 | fn zirDivFloor(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 6046 | 6053 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; |
| 6047 | 6054 | const src = inst_data.src(); |
| 6048 | 6055 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirDivFloor", .{}); |
| 6049 | 6056 | } |
| 6050 | 6057 | |
| 6051 | | fn zirDivTrunc(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { |
| 6058 | fn zirDivTrunc(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 6052 | 6059 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; |
| 6053 | 6060 | const src = inst_data.src(); |
| 6054 | 6061 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirDivTrunc", .{}); |
| 6055 | 6062 | } |
| 6056 | 6063 | |
| 6057 | | fn zirMod(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { |
| 6064 | fn zirMod(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 6058 | 6065 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; |
| 6059 | 6066 | const src = inst_data.src(); |
| 6060 | 6067 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirMod", .{}); |
| 6061 | 6068 | } |
| 6062 | 6069 | |
| 6063 | | fn zirRem(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { |
| 6070 | fn zirRem(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 6064 | 6071 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; |
| 6065 | 6072 | const src = inst_data.src(); |
| 6066 | 6073 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirRem", .{}); |
| 6067 | 6074 | } |
| 6068 | 6075 | |
| 6069 | | fn zirShlExact(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { |
| 6076 | fn zirShlExact(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 6070 | 6077 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; |
| 6071 | 6078 | const src = inst_data.src(); |
| 6072 | 6079 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirShlExact", .{}); |
| 6073 | 6080 | } |
| 6074 | 6081 | |
| 6075 | | fn zirShrExact(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { |
| 6082 | fn zirShrExact(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 6076 | 6083 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; |
| 6077 | 6084 | const src = inst_data.src(); |
| 6078 | 6085 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirShrExact", .{}); |
| 6079 | 6086 | } |
| 6080 | 6087 | |
| 6081 | | fn zirBitOffsetOf(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { |
| 6088 | fn zirBitOffsetOf(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 6082 | 6089 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; |
| 6083 | 6090 | const src = inst_data.src(); |
| 6084 | 6091 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirBitOffsetOf", .{}); |
| 6085 | 6092 | } |
| 6086 | 6093 | |
| 6087 | | fn zirOffsetOf(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { |
| 6094 | fn zirOffsetOf(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 6088 | 6095 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; |
| 6089 | 6096 | const src = inst_data.src(); |
| 6090 | 6097 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirOffsetOf", .{}); |
| 6091 | 6098 | } |
| 6092 | 6099 | |
| 6093 | | fn zirCmpxchg(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { |
| 6100 | fn zirCmpxchg(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 6094 | 6101 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; |
| 6095 | 6102 | const src = inst_data.src(); |
| 6096 | 6103 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirCmpxchg", .{}); |
| 6097 | 6104 | } |
| 6098 | 6105 | |
| 6099 | | fn zirSplat(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { |
| 6106 | fn zirSplat(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 6100 | 6107 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; |
| 6101 | 6108 | const src = inst_data.src(); |
| 6102 | 6109 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirSplat", .{}); |
| 6103 | 6110 | } |
| 6104 | 6111 | |
| 6105 | | fn zirReduce(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { |
| 6112 | fn zirReduce(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 6106 | 6113 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; |
| 6107 | 6114 | const src = inst_data.src(); |
| 6108 | 6115 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirReduce", .{}); |
| 6109 | 6116 | } |
| 6110 | 6117 | |
| 6111 | | fn zirShuffle(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { |
| 6118 | fn zirShuffle(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 6112 | 6119 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; |
| 6113 | 6120 | const src = inst_data.src(); |
| 6114 | 6121 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirShuffle", .{}); |
| 6115 | 6122 | } |
| 6116 | 6123 | |
| 6117 | | fn zirAtomicLoad(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { |
| 6124 | fn zirAtomicLoad(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 6118 | 6125 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; |
| 6119 | 6126 | const src = inst_data.src(); |
| 6120 | 6127 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirAtomicLoad", .{}); |
| 6121 | 6128 | } |
| 6122 | 6129 | |
| 6123 | | fn zirAtomicRmw(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { |
| 6130 | fn zirAtomicRmw(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 6124 | 6131 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; |
| 6125 | 6132 | const src = inst_data.src(); |
| 6126 | 6133 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirAtomicRmw", .{}); |
| 6127 | 6134 | } |
| 6128 | 6135 | |
| 6129 | | fn zirAtomicStore(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { |
| 6136 | fn zirAtomicStore(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 6130 | 6137 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; |
| 6131 | 6138 | const src = inst_data.src(); |
| 6132 | 6139 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirAtomicStore", .{}); |
| 6133 | 6140 | } |
| 6134 | 6141 | |
| 6135 | | fn zirMulAdd(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { |
| 6142 | fn zirMulAdd(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 6136 | 6143 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; |
| 6137 | 6144 | const src = inst_data.src(); |
| 6138 | 6145 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirMulAdd", .{}); |
| 6139 | 6146 | } |
| 6140 | 6147 | |
| 6141 | | fn zirBuiltinCall(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { |
| 6148 | fn zirBuiltinCall(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 6142 | 6149 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; |
| 6143 | 6150 | const src = inst_data.src(); |
| 6144 | 6151 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirBuiltinCall", .{}); |
| 6145 | 6152 | } |
| 6146 | 6153 | |
| 6147 | | fn zirFieldPtrType(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { |
| 6154 | fn zirFieldPtrType(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 6148 | 6155 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; |
| 6149 | 6156 | const src = inst_data.src(); |
| 6150 | 6157 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirFieldPtrType", .{}); |
| 6151 | 6158 | } |
| 6152 | 6159 | |
| 6153 | | fn zirFieldParentPtr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { |
| 6160 | fn zirFieldParentPtr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 6154 | 6161 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; |
| 6155 | 6162 | const src = inst_data.src(); |
| 6156 | 6163 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirFieldParentPtr", .{}); |
| 6157 | 6164 | } |
| 6158 | 6165 | |
| 6159 | | fn zirMemcpy(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { |
| 6166 | fn zirMemcpy(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 6160 | 6167 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; |
| 6161 | 6168 | const src = inst_data.src(); |
| 6162 | 6169 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirMemcpy", .{}); |
| 6163 | 6170 | } |
| 6164 | 6171 | |
| 6165 | | fn zirMemset(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { |
| 6172 | fn zirMemset(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 6166 | 6173 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; |
| 6167 | 6174 | const src = inst_data.src(); |
| 6168 | 6175 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirMemset", .{}); |
| 6169 | 6176 | } |
| 6170 | 6177 | |
| 6171 | | fn zirBuiltinAsyncCall(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { |
| 6178 | fn zirBuiltinAsyncCall(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 6172 | 6179 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; |
| 6173 | 6180 | const src = inst_data.src(); |
| 6174 | 6181 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirBuiltinAsyncCall", .{}); |
| 6175 | 6182 | } |
| 6176 | 6183 | |
| 6177 | | fn zirResume(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!Air.Inst.Ref { |
| 6184 | fn zirResume(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 6178 | 6185 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; |
| 6179 | 6186 | const src = inst_data.src(); |
| 6180 | 6187 | return sema.mod.fail(&block.base, src, "TODO: Sema.zirResume", .{}); |
| ... | ... | @@ -6185,7 +6192,7 @@ fn zirAwait( |
| 6185 | 6192 | block: *Scope.Block, |
| 6186 | 6193 | inst: Zir.Inst.Index, |
| 6187 | 6194 | is_nosuspend: bool, |
| 6188 | | ) InnerError!Air.Inst.Ref { |
| 6195 | ) CompileError!Air.Inst.Ref { |
| 6189 | 6196 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; |
| 6190 | 6197 | const src = inst_data.src(); |
| 6191 | 6198 | |
| ... | ... | @@ -6197,7 +6204,7 @@ fn zirVarExtended( |
| 6197 | 6204 | sema: *Sema, |
| 6198 | 6205 | block: *Scope.Block, |
| 6199 | 6206 | extended: Zir.Inst.Extended.InstData, |
| 6200 | | ) InnerError!Air.Inst.Ref { |
| 6207 | ) CompileError!Air.Inst.Ref { |
| 6201 | 6208 | const extra = sema.code.extraData(Zir.Inst.ExtendedVar, extended.operand); |
| 6202 | 6209 | const src = sema.src; |
| 6203 | 6210 | const ty_src: LazySrcLoc = src; // TODO add a LazySrcLoc that points at type |
| ... | ... | @@ -6263,7 +6270,7 @@ fn zirFuncExtended( |
| 6263 | 6270 | block: *Scope.Block, |
| 6264 | 6271 | extended: Zir.Inst.Extended.InstData, |
| 6265 | 6272 | inst: Zir.Inst.Index, |
| 6266 | | ) InnerError!Air.Inst.Ref { |
| 6273 | ) CompileError!Air.Inst.Ref { |
| 6267 | 6274 | const tracy = trace(@src()); |
| 6268 | 6275 | defer tracy.end(); |
| 6269 | 6276 | |
| ... | ... | @@ -6330,7 +6337,7 @@ fn zirCUndef( |
| 6330 | 6337 | sema: *Sema, |
| 6331 | 6338 | block: *Scope.Block, |
| 6332 | 6339 | extended: Zir.Inst.Extended.InstData, |
| 6333 | | ) InnerError!Air.Inst.Ref { |
| 6340 | ) CompileError!Air.Inst.Ref { |
| 6334 | 6341 | const extra = sema.code.extraData(Zir.Inst.UnNode, extended.operand).data; |
| 6335 | 6342 | const src: LazySrcLoc = .{ .node_offset = extra.node }; |
| 6336 | 6343 | return sema.mod.fail(&block.base, src, "TODO: implement Sema.zirCUndef", .{}); |
| ... | ... | @@ -6340,7 +6347,7 @@ fn zirCInclude( |
| 6340 | 6347 | sema: *Sema, |
| 6341 | 6348 | block: *Scope.Block, |
| 6342 | 6349 | extended: Zir.Inst.Extended.InstData, |
| 6343 | | ) InnerError!Air.Inst.Ref { |
| 6350 | ) CompileError!Air.Inst.Ref { |
| 6344 | 6351 | const extra = sema.code.extraData(Zir.Inst.UnNode, extended.operand).data; |
| 6345 | 6352 | const src: LazySrcLoc = .{ .node_offset = extra.node }; |
| 6346 | 6353 | return sema.mod.fail(&block.base, src, "TODO: implement Sema.zirCInclude", .{}); |
| ... | ... | @@ -6350,7 +6357,7 @@ fn zirCDefine( |
| 6350 | 6357 | sema: *Sema, |
| 6351 | 6358 | block: *Scope.Block, |
| 6352 | 6359 | extended: Zir.Inst.Extended.InstData, |
| 6353 | | ) InnerError!Air.Inst.Ref { |
| 6360 | ) CompileError!Air.Inst.Ref { |
| 6354 | 6361 | const extra = sema.code.extraData(Zir.Inst.BinNode, extended.operand).data; |
| 6355 | 6362 | const src: LazySrcLoc = .{ .node_offset = extra.node }; |
| 6356 | 6363 | return sema.mod.fail(&block.base, src, "TODO: implement Sema.zirCDefine", .{}); |
| ... | ... | @@ -6360,7 +6367,7 @@ fn zirWasmMemorySize( |
| 6360 | 6367 | sema: *Sema, |
| 6361 | 6368 | block: *Scope.Block, |
| 6362 | 6369 | extended: Zir.Inst.Extended.InstData, |
| 6363 | | ) InnerError!Air.Inst.Ref { |
| 6370 | ) CompileError!Air.Inst.Ref { |
| 6364 | 6371 | const extra = sema.code.extraData(Zir.Inst.UnNode, extended.operand).data; |
| 6365 | 6372 | const src: LazySrcLoc = .{ .node_offset = extra.node }; |
| 6366 | 6373 | return sema.mod.fail(&block.base, src, "TODO: implement Sema.zirWasmMemorySize", .{}); |
| ... | ... | @@ -6370,7 +6377,7 @@ fn zirWasmMemoryGrow( |
| 6370 | 6377 | sema: *Sema, |
| 6371 | 6378 | block: *Scope.Block, |
| 6372 | 6379 | extended: Zir.Inst.Extended.InstData, |
| 6373 | | ) InnerError!Air.Inst.Ref { |
| 6380 | ) CompileError!Air.Inst.Ref { |
| 6374 | 6381 | const extra = sema.code.extraData(Zir.Inst.BinNode, extended.operand).data; |
| 6375 | 6382 | const src: LazySrcLoc = .{ .node_offset = extra.node }; |
| 6376 | 6383 | return sema.mod.fail(&block.base, src, "TODO: implement Sema.zirWasmMemoryGrow", .{}); |
| ... | ... | @@ -6380,7 +6387,7 @@ fn zirBuiltinExtern( |
| 6380 | 6387 | sema: *Sema, |
| 6381 | 6388 | block: *Scope.Block, |
| 6382 | 6389 | extended: Zir.Inst.Extended.InstData, |
| 6383 | | ) InnerError!Air.Inst.Ref { |
| 6390 | ) CompileError!Air.Inst.Ref { |
| 6384 | 6391 | const extra = sema.code.extraData(Zir.Inst.BinNode, extended.operand).data; |
| 6385 | 6392 | const src: LazySrcLoc = .{ .node_offset = extra.node }; |
| 6386 | 6393 | return sema.mod.fail(&block.base, src, "TODO: implement Sema.zirBuiltinExtern", .{}); |
| ... | ... | @@ -6556,7 +6563,7 @@ fn namedFieldPtr( |
| 6556 | 6563 | object_ptr: Air.Inst.Ref, |
| 6557 | 6564 | field_name: []const u8, |
| 6558 | 6565 | field_name_src: LazySrcLoc, |
| 6559 | | ) InnerError!Air.Inst.Ref { |
| 6566 | ) CompileError!Air.Inst.Ref { |
| 6560 | 6567 | const mod = sema.mod; |
| 6561 | 6568 | const arena = sema.arena; |
| 6562 | 6569 | |
| ... | ... | @@ -6706,7 +6713,7 @@ fn analyzeNamespaceLookup( |
| 6706 | 6713 | src: LazySrcLoc, |
| 6707 | 6714 | namespace: *Scope.Namespace, |
| 6708 | 6715 | decl_name: []const u8, |
| 6709 | | ) InnerError!?Air.Inst.Ref { |
| 6716 | ) CompileError!?Air.Inst.Ref { |
| 6710 | 6717 | const mod = sema.mod; |
| 6711 | 6718 | const gpa = sema.gpa; |
| 6712 | 6719 | if (try sema.lookupInNamespace(namespace, decl_name)) |decl| { |
| ... | ... | @@ -6734,7 +6741,7 @@ fn analyzeStructFieldPtr( |
| 6734 | 6741 | field_name: []const u8, |
| 6735 | 6742 | field_name_src: LazySrcLoc, |
| 6736 | 6743 | unresolved_struct_ty: Type, |
| 6737 | | ) InnerError!Air.Inst.Ref { |
| 6744 | ) CompileError!Air.Inst.Ref { |
| 6738 | 6745 | const mod = sema.mod; |
| 6739 | 6746 | const arena = sema.arena; |
| 6740 | 6747 | assert(unresolved_struct_ty.zigTypeTag() == .Struct); |
| ... | ... | @@ -6769,7 +6776,7 @@ fn analyzeUnionFieldPtr( |
| 6769 | 6776 | field_name: []const u8, |
| 6770 | 6777 | field_name_src: LazySrcLoc, |
| 6771 | 6778 | unresolved_union_ty: Type, |
| 6772 | | ) InnerError!Air.Inst.Ref { |
| 6779 | ) CompileError!Air.Inst.Ref { |
| 6773 | 6780 | const mod = sema.mod; |
| 6774 | 6781 | const arena = sema.arena; |
| 6775 | 6782 | assert(unresolved_union_ty.zigTypeTag() == .Union); |
| ... | ... | @@ -6805,7 +6812,7 @@ fn elemPtr( |
| 6805 | 6812 | array_ptr: Air.Inst.Ref, |
| 6806 | 6813 | elem_index: Air.Inst.Ref, |
| 6807 | 6814 | elem_index_src: LazySrcLoc, |
| 6808 | | ) InnerError!Air.Inst.Ref { |
| 6815 | ) CompileError!Air.Inst.Ref { |
| 6809 | 6816 | const array_ty = switch (array_ptr.ty.zigTypeTag()) { |
| 6810 | 6817 | .Pointer => array_ptr.ty.elemType(), |
| 6811 | 6818 | else => return sema.mod.fail(&block.base, array_ptr.src, "expected pointer, found '{}'", .{array_ptr.ty}), |
| ... | ... | @@ -6832,7 +6839,7 @@ fn elemPtrArray( |
| 6832 | 6839 | array_ptr: Air.Inst.Ref, |
| 6833 | 6840 | elem_index: Air.Inst.Ref, |
| 6834 | 6841 | elem_index_src: LazySrcLoc, |
| 6835 | | ) InnerError!Air.Inst.Ref { |
| 6842 | ) CompileError!Air.Inst.Ref { |
| 6836 | 6843 | if (array_ptr.value()) |array_ptr_val| { |
| 6837 | 6844 | if (elem_index.value()) |index_val| { |
| 6838 | 6845 | // Both array pointer and index are compile-time known. |
| ... | ... | @@ -6859,7 +6866,7 @@ fn coerce( |
| 6859 | 6866 | dest_type: Type, |
| 6860 | 6867 | inst: Air.Inst.Ref, |
| 6861 | 6868 | inst_src: LazySrcLoc, |
| 6862 | | ) InnerError!Air.Inst.Ref { |
| 6869 | ) CompileError!Air.Inst.Ref { |
| 6863 | 6870 | if (dest_type.tag() == .var_args_param) { |
| 6864 | 6871 | return sema.coerceVarArgParam(block, inst, inst_src); |
| 6865 | 6872 | } |
| ... | ... | @@ -7041,7 +7048,7 @@ fn coerceInMemoryAllowed(dest_type: Type, src_type: Type) InMemoryCoercionResult |
| 7041 | 7048 | return .no_match; |
| 7042 | 7049 | } |
| 7043 | 7050 | |
| 7044 | | fn coerceNum(sema: *Sema, block: *Scope.Block, dest_type: Type, inst: Air.Inst.Ref) InnerError!?Air.Inst.Index { |
| 7051 | fn coerceNum(sema: *Sema, block: *Scope.Block, dest_type: Type, inst: Air.Inst.Ref) CompileError!?Air.Inst.Index { |
| 7045 | 7052 | const val = inst.value() orelse return null; |
| 7046 | 7053 | const src_zig_tag = inst.ty.zigTypeTag(); |
| 7047 | 7054 | const dst_zig_tag = dest_type.zigTypeTag(); |
| ... | ... | @@ -7153,7 +7160,7 @@ fn bitcast( |
| 7153 | 7160 | dest_type: Type, |
| 7154 | 7161 | inst: Air.Inst.Ref, |
| 7155 | 7162 | inst_src: LazySrcLoc, |
| 7156 | | ) InnerError!Air.Inst.Ref { |
| 7163 | ) CompileError!Air.Inst.Ref { |
| 7157 | 7164 | if (try sema.resolvePossiblyUndefinedValue(block, inst_src, inst)) |val| { |
| 7158 | 7165 | // Keep the comptime Value representation; take the new type. |
| 7159 | 7166 | return sema.addConstant(dest_type, val); |
| ... | ... | @@ -7163,7 +7170,7 @@ fn bitcast( |
| 7163 | 7170 | return block.addTyOp(.bitcast, dest_type, inst); |
| 7164 | 7171 | } |
| 7165 | 7172 | |
| 7166 | | fn coerceArrayPtrToSlice(sema: *Sema, block: *Scope.Block, dest_type: Type, inst: Air.Inst.Ref) InnerError!Air.Inst.Ref { |
| 7173 | fn coerceArrayPtrToSlice(sema: *Sema, block: *Scope.Block, dest_type: Type, inst: Air.Inst.Ref) CompileError!Air.Inst.Ref { |
| 7167 | 7174 | if (inst.value()) |val| { |
| 7168 | 7175 | // The comptime Value representation is compatible with both types. |
| 7169 | 7176 | return sema.mod.constInst(sema.arena, inst.src, .{ .ty = dest_type, .val = val }); |
| ... | ... | @@ -7179,12 +7186,12 @@ fn coerceArrayPtrToMany(sema: *Sema, block: *Scope.Block, dest_type: Type, inst: |
| 7179 | 7186 | return sema.mod.fail(&block.base, inst.src, "TODO implement coerceArrayPtrToMany runtime instruction", .{}); |
| 7180 | 7187 | } |
| 7181 | 7188 | |
| 7182 | | fn analyzeDeclVal(sema: *Sema, block: *Scope.Block, src: LazySrcLoc, decl: *Decl) InnerError!Air.Inst.Ref { |
| 7189 | fn analyzeDeclVal(sema: *Sema, block: *Scope.Block, src: LazySrcLoc, decl: *Decl) CompileError!Air.Inst.Ref { |
| 7183 | 7190 | const decl_ref = try sema.analyzeDeclRef(block, src, decl); |
| 7184 | 7191 | return sema.analyzeLoad(block, src, decl_ref, src); |
| 7185 | 7192 | } |
| 7186 | 7193 | |
| 7187 | | fn analyzeDeclRef(sema: *Sema, block: *Scope.Block, src: LazySrcLoc, decl: *Decl) InnerError!Air.Inst.Ref { |
| 7194 | fn analyzeDeclRef(sema: *Sema, block: *Scope.Block, src: LazySrcLoc, decl: *Decl) CompileError!Air.Inst.Ref { |
| 7188 | 7195 | try sema.mod.declareDeclDependency(sema.owner_decl, decl); |
| 7189 | 7196 | sema.mod.ensureDeclAnalyzed(decl) catch |err| { |
| 7190 | 7197 | if (sema.func) |func| { |
| ... | ... | @@ -7205,7 +7212,7 @@ fn analyzeDeclRef(sema: *Sema, block: *Scope.Block, src: LazySrcLoc, decl: *Decl |
| 7205 | 7212 | ); |
| 7206 | 7213 | } |
| 7207 | 7214 | |
| 7208 | | fn analyzeVarRef(sema: *Sema, block: *Scope.Block, src: LazySrcLoc, tv: TypedValue) InnerError!Air.Inst.Ref { |
| 7215 | fn analyzeVarRef(sema: *Sema, block: *Scope.Block, src: LazySrcLoc, tv: TypedValue) CompileError!Air.Inst.Ref { |
| 7209 | 7216 | const variable = tv.val.castTag(.variable).?.data; |
| 7210 | 7217 | |
| 7211 | 7218 | const ty = try Module.simplePtrType(sema.arena, tv.ty, variable.is_mutable, .One); |
| ... | ... | @@ -7233,7 +7240,7 @@ fn analyzeRef( |
| 7233 | 7240 | block: *Scope.Block, |
| 7234 | 7241 | src: LazySrcLoc, |
| 7235 | 7242 | operand: Air.Inst.Ref, |
| 7236 | | ) InnerError!Air.Inst.Ref { |
| 7243 | ) CompileError!Air.Inst.Ref { |
| 7237 | 7244 | const ptr_type = try sema.mod.simplePtrType(sema.arena, operand.ty, false, .One); |
| 7238 | 7245 | |
| 7239 | 7246 | if (try sema.resolvePossiblyUndefinedValue(block, src, operand)) |val| { |
| ... | ... | @@ -7253,7 +7260,7 @@ fn analyzeLoad( |
| 7253 | 7260 | src: LazySrcLoc, |
| 7254 | 7261 | ptr: Air.Inst.Ref, |
| 7255 | 7262 | ptr_src: LazySrcLoc, |
| 7256 | | ) InnerError!Air.Inst.Ref { |
| 7263 | ) CompileError!Air.Inst.Ref { |
| 7257 | 7264 | const ptr_ty = sema.getTypeOf(ptr); |
| 7258 | 7265 | const elem_ty = switch (ptr_ty.zigTypeTag()) { |
| 7259 | 7266 | .Pointer => ptr_ty.elemType(), |
| ... | ... | @@ -7276,7 +7283,7 @@ fn analyzeIsNull( |
| 7276 | 7283 | src: LazySrcLoc, |
| 7277 | 7284 | operand: Air.Inst.Ref, |
| 7278 | 7285 | invert_logic: bool, |
| 7279 | | ) InnerError!Air.Inst.Ref { |
| 7286 | ) CompileError!Air.Inst.Ref { |
| 7280 | 7287 | const result_ty = Type.initTag(.bool); |
| 7281 | 7288 | if (try sema.resolvePossiblyUndefinedValue(block, src, operand)) |opt_val| { |
| 7282 | 7289 | if (opt_val.isUndef()) { |
| ... | ... | @@ -7300,7 +7307,7 @@ fn analyzeIsNonErr( |
| 7300 | 7307 | block: *Scope.Block, |
| 7301 | 7308 | src: LazySrcLoc, |
| 7302 | 7309 | operand: Air.Inst.Ref, |
| 7303 | | ) InnerError!Air.Inst.Ref { |
| 7310 | ) CompileError!Air.Inst.Ref { |
| 7304 | 7311 | const ot = operand.ty.zigTypeTag(); |
| 7305 | 7312 | if (ot != .ErrorSet and ot != .ErrorUnion) return Air.Inst.Ref.bool_true; |
| 7306 | 7313 | if (ot == .ErrorSet) return Air.Inst.Ref.bool_false; |
| ... | ... | @@ -7329,7 +7336,7 @@ fn analyzeSlice( |
| 7329 | 7336 | end_opt: ?Air.Inst.Index, |
| 7330 | 7337 | sentinel_opt: ?Air.Inst.Index, |
| 7331 | 7338 | sentinel_src: LazySrcLoc, |
| 7332 | | ) InnerError!Air.Inst.Ref { |
| 7339 | ) CompileError!Air.Inst.Ref { |
| 7333 | 7340 | const ptr_child = switch (array_ptr.ty.zigTypeTag()) { |
| 7334 | 7341 | .Pointer => array_ptr.ty.elemType(), |
| 7335 | 7342 | else => return sema.mod.fail(&block.base, src, "expected pointer, found '{}'", .{array_ptr.ty}), |
| ... | ... | @@ -7405,7 +7412,7 @@ fn cmpNumeric( |
| 7405 | 7412 | op: std.math.CompareOperator, |
| 7406 | 7413 | lhs_src: LazySrcLoc, |
| 7407 | 7414 | rhs_src: LazySrcLoc, |
| 7408 | | ) InnerError!Air.Inst.Ref { |
| 7415 | ) CompileError!Air.Inst.Ref { |
| 7409 | 7416 | const lhs_ty = sema.getTypeOf(lhs); |
| 7410 | 7417 | const rhs_ty = sema.getTypeOf(rhs); |
| 7411 | 7418 | |
| ... | ... | @@ -7746,7 +7753,7 @@ fn resolvePeerTypes( |
| 7746 | 7753 | return chosen.ty; |
| 7747 | 7754 | } |
| 7748 | 7755 | |
| 7749 | | fn resolveTypeFields(sema: *Sema, block: *Scope.Block, src: LazySrcLoc, ty: Type) InnerError!Type { |
| 7756 | fn resolveTypeFields(sema: *Sema, block: *Scope.Block, src: LazySrcLoc, ty: Type) CompileError!Type { |
| 7750 | 7757 | switch (ty.tag()) { |
| 7751 | 7758 | .@"struct" => { |
| 7752 | 7759 | const struct_obj = ty.castTag(.@"struct").?.data; |
| ... | ... | @@ -7798,7 +7805,7 @@ fn resolveBuiltinTypeFields( |
| 7798 | 7805 | block: *Scope.Block, |
| 7799 | 7806 | src: LazySrcLoc, |
| 7800 | 7807 | name: []const u8, |
| 7801 | | ) InnerError!Type { |
| 7808 | ) CompileError!Type { |
| 7802 | 7809 | const resolved_ty = try sema.getBuiltinType(block, src, name); |
| 7803 | 7810 | return sema.resolveTypeFields(block, src, resolved_ty); |
| 7804 | 7811 | } |
| ... | ... | @@ -7808,7 +7815,7 @@ fn getBuiltin( |
| 7808 | 7815 | block: *Scope.Block, |
| 7809 | 7816 | src: LazySrcLoc, |
| 7810 | 7817 | name: []const u8, |
| 7811 | | ) InnerError!Air.Inst.Ref { |
| 7818 | ) CompileError!Air.Inst.Ref { |
| 7812 | 7819 | const mod = sema.mod; |
| 7813 | 7820 | const std_pkg = mod.root_pkg.table.get("std").?; |
| 7814 | 7821 | const std_file = (mod.importPkg(std_pkg) catch unreachable).file; |
| ... | ... | @@ -7834,7 +7841,7 @@ fn getBuiltinType( |
| 7834 | 7841 | block: *Scope.Block, |
| 7835 | 7842 | src: LazySrcLoc, |
| 7836 | 7843 | name: []const u8, |
| 7837 | | ) InnerError!Type { |
| 7844 | ) CompileError!Type { |
| 7838 | 7845 | const ty_inst = try sema.getBuiltin(block, src, name); |
| 7839 | 7846 | return sema.resolveAirAsType(block, src, ty_inst); |
| 7840 | 7847 | } |
| ... | ... | @@ -7848,7 +7855,7 @@ fn typeHasOnePossibleValue( |
| 7848 | 7855 | block: *Scope.Block, |
| 7849 | 7856 | src: LazySrcLoc, |
| 7850 | 7857 | starting_type: Type, |
| 7851 | | ) InnerError!?Value { |
| 7858 | ) CompileError!?Value { |
| 7852 | 7859 | var ty = starting_type; |
| 7853 | 7860 | while (true) switch (ty.tag()) { |
| 7854 | 7861 | .f16, |
| ... | ... | @@ -7986,7 +7993,7 @@ fn typeHasOnePossibleValue( |
| 7986 | 7993 | }; |
| 7987 | 7994 | } |
| 7988 | 7995 | |
| 7989 | | fn getAstTree(sema: *Sema, block: *Scope.Block) InnerError!*const std.zig.ast.Tree { |
| 7996 | fn getAstTree(sema: *Sema, block: *Scope.Block) CompileError!*const std.zig.ast.Tree { |
| 7990 | 7997 | return block.src_decl.namespace.file_scope.getTree(sema.gpa) catch |err| { |
| 7991 | 7998 | log.err("unable to load AST to report compile error: {s}", .{@errorName(err)}); |
| 7992 | 7999 | return error.AnalysisFail; |
| ... | ... | @@ -8166,15 +8173,15 @@ pub fn addType(sema: *Sema, ty: Type) !Air.Inst.Ref { |
| 8166 | 8173 | return indexToRef(@intCast(u32, sema.air_instructions.len - 1)); |
| 8167 | 8174 | } |
| 8168 | 8175 | |
| 8169 | | fn addIntUnsigned(sema: *Sema, ty: Type, int: u64) InnerError!Air.Inst.Ref { |
| 8176 | fn addIntUnsigned(sema: *Sema, ty: Type, int: u64) CompileError!Air.Inst.Ref { |
| 8170 | 8177 | return sema.addConstant(ty, try Value.Tag.int_u64.create(sema.arena, int)); |
| 8171 | 8178 | } |
| 8172 | 8179 | |
| 8173 | | fn addConstUndef(sema: *Sema, ty: Type) InnerError!Air.Inst.Ref { |
| 8180 | fn addConstUndef(sema: *Sema, ty: Type) CompileError!Air.Inst.Ref { |
| 8174 | 8181 | return sema.addConstant(ty, Value.initTag(.undef)); |
| 8175 | 8182 | } |
| 8176 | 8183 | |
| 8177 | | fn addConstant(sema: *Sema, ty: Type, val: Value) InnerError!Air.Inst.Ref { |
| 8184 | fn addConstant(sema: *Sema, ty: Type, val: Value) CompileError!Air.Inst.Ref { |
| 8178 | 8185 | const gpa = sema.gpa; |
| 8179 | 8186 | const ty_inst = try sema.addType(ty); |
| 8180 | 8187 | try sema.air_values.append(gpa, val); |