authorgravatar for mail@isaacfreund.comIsaac Freund <mail@isaacfreund.com> 2021-03-23 00:19:29+01:00
committergravatar for mail@isaacfreund.comIsaac Freund <mail@isaacfreund.com> 2021-03-23 00:23:41+01:00
log9f0b9b8da1a111d16eb8d1254212ff98a8b4be08
tree2d1b8a5c3355de2a2f116bd3d23ee69716c3c877
parent240b15381dd560cac004c5e84783fb93f03c0697
signature Commit is signed but in an unrecognized format.

stage2: remove all async related code

The current plan is to avoid using async and related features in the stage2 compiler so that we can bootstrap before implementing them. Having this untested and incomplete code in the codebase increases friction while working on stage2, in particular when preforming larger refactors such as the current zir memory layout rework. Therefore remove all async related code, leaving only error messages in astgen.

6 files changed, 19 insertions(+), 377 deletions(-)

src/Module.zig+2-89
...@@ -410,8 +410,6 @@ pub const Scope = struct {...@@ -410,8 +410,6 @@ pub const Scope = struct {
410 .gen_zir => return scope.cast(GenZir).?.zir_code.arena,410 .gen_zir => return scope.cast(GenZir).?.zir_code.arena,
411 .local_val => return scope.cast(LocalVal).?.gen_zir.zir_code.arena,411 .local_val => return scope.cast(LocalVal).?.gen_zir.zir_code.arena,
412 .local_ptr => return scope.cast(LocalPtr).?.gen_zir.zir_code.arena,412 .local_ptr => return scope.cast(LocalPtr).?.gen_zir.zir_code.arena,
413 .gen_suspend => return scope.cast(GenZir).?.zir_code.arena,
414 .gen_nosuspend => return scope.cast(Nosuspend).?.gen_zir.zir_code.arena,
415 .file => unreachable,413 .file => unreachable,
416 .container => unreachable,414 .container => unreachable,
417 .decl_ref => unreachable,415 .decl_ref => unreachable,
...@@ -428,8 +426,6 @@ pub const Scope = struct {...@@ -428,8 +426,6 @@ pub const Scope = struct {
428 .gen_zir => scope.cast(GenZir).?.zir_code.decl,426 .gen_zir => scope.cast(GenZir).?.zir_code.decl,
429 .local_val => scope.cast(LocalVal).?.gen_zir.zir_code.decl,427 .local_val => scope.cast(LocalVal).?.gen_zir.zir_code.decl,
430 .local_ptr => scope.cast(LocalPtr).?.gen_zir.zir_code.decl,428 .local_ptr => scope.cast(LocalPtr).?.gen_zir.zir_code.decl,
431 .gen_suspend => return scope.cast(GenZir).?.zir_code.decl,
432 .gen_nosuspend => return scope.cast(Nosuspend).?.gen_zir.zir_code.decl,
433 .file => null,429 .file => null,
434 .container => null,430 .container => null,
435 .decl_ref => scope.cast(DeclRef).?.decl,431 .decl_ref => scope.cast(DeclRef).?.decl,
...@@ -442,8 +438,6 @@ pub const Scope = struct {...@@ -442,8 +438,6 @@ pub const Scope = struct {
442 .gen_zir => scope.cast(GenZir).?.zir_code.decl,438 .gen_zir => scope.cast(GenZir).?.zir_code.decl,
443 .local_val => scope.cast(LocalVal).?.gen_zir.zir_code.decl,439 .local_val => scope.cast(LocalVal).?.gen_zir.zir_code.decl,
444 .local_ptr => scope.cast(LocalPtr).?.gen_zir.zir_code.decl,440 .local_ptr => scope.cast(LocalPtr).?.gen_zir.zir_code.decl,
445 .gen_suspend => return scope.cast(GenZir).?.zir_code.decl,
446 .gen_nosuspend => return scope.cast(Nosuspend).?.gen_zir.zir_code.decl,
447 .file => null,441 .file => null,
448 .container => null,442 .container => null,
449 .decl_ref => scope.cast(DeclRef).?.decl,443 .decl_ref => scope.cast(DeclRef).?.decl,
...@@ -459,8 +453,6 @@ pub const Scope = struct {...@@ -459,8 +453,6 @@ pub const Scope = struct {
459 .local_ptr => return scope.cast(LocalPtr).?.gen_zir.zir_code.decl.container,453 .local_ptr => return scope.cast(LocalPtr).?.gen_zir.zir_code.decl.container,
460 .file => return &scope.cast(File).?.root_container,454 .file => return &scope.cast(File).?.root_container,
461 .container => return scope.cast(Container).?,455 .container => return scope.cast(Container).?,
462 .gen_suspend => return scope.cast(GenZir).?.zir_code.decl.container,
463 .gen_nosuspend => return scope.cast(Nosuspend).?.gen_zir.zir_code.decl.container,
464 .decl_ref => return scope.cast(DeclRef).?.decl.container,456 .decl_ref => return scope.cast(DeclRef).?.decl.container,
465 }457 }
466 }458 }
...@@ -474,8 +466,6 @@ pub const Scope = struct {...@@ -474,8 +466,6 @@ pub const Scope = struct {
474 .gen_zir => unreachable,466 .gen_zir => unreachable,
475 .local_val => unreachable,467 .local_val => unreachable,
476 .local_ptr => unreachable,468 .local_ptr => unreachable,
477 .gen_suspend => unreachable,
478 .gen_nosuspend => unreachable,
479 .file => unreachable,469 .file => unreachable,
480 .container => return scope.cast(Container).?.fullyQualifiedNameHash(name),470 .container => return scope.cast(Container).?.fullyQualifiedNameHash(name),
481 .decl_ref => unreachable,471 .decl_ref => unreachable,
...@@ -491,8 +481,6 @@ pub const Scope = struct {...@@ -491,8 +481,6 @@ pub const Scope = struct {
491 .local_val => return &scope.cast(LocalVal).?.gen_zir.zir_code.decl.container.file_scope.tree,481 .local_val => return &scope.cast(LocalVal).?.gen_zir.zir_code.decl.container.file_scope.tree,
492 .local_ptr => return &scope.cast(LocalPtr).?.gen_zir.zir_code.decl.container.file_scope.tree,482 .local_ptr => return &scope.cast(LocalPtr).?.gen_zir.zir_code.decl.container.file_scope.tree,
493 .container => return &scope.cast(Container).?.file_scope.tree,483 .container => return &scope.cast(Container).?.file_scope.tree,
494 .gen_suspend => return &scope.cast(GenZir).?.zir_code.decl.container.file_scope.tree,
495 .gen_nosuspend => return &scope.cast(Nosuspend).?.gen_zir.zir_code.decl.container.file_scope.tree,
496 .decl_ref => return &scope.cast(DeclRef).?.decl.container.file_scope.tree,484 .decl_ref => return &scope.cast(DeclRef).?.decl.container.file_scope.tree,
497 }485 }
498 }486 }
...@@ -501,10 +489,9 @@ pub const Scope = struct {...@@ -501,10 +489,9 @@ pub const Scope = struct {
501 pub fn getGenZir(scope: *Scope) *GenZir {489 pub fn getGenZir(scope: *Scope) *GenZir {
502 return switch (scope.tag) {490 return switch (scope.tag) {
503 .block => unreachable,491 .block => unreachable,
504 .gen_zir, .gen_suspend => scope.cast(GenZir).?,492 .gen_zir => scope.cast(GenZir).?,
505 .local_val => return scope.cast(LocalVal).?.gen_zir,493 .local_val => return scope.cast(LocalVal).?.gen_zir,
506 .local_ptr => return scope.cast(LocalPtr).?.gen_zir,494 .local_ptr => return scope.cast(LocalPtr).?.gen_zir,
507 .gen_nosuspend => return scope.cast(Nosuspend).?.gen_zir,
508 .file => unreachable,495 .file => unreachable,
509 .container => unreachable,496 .container => unreachable,
510 .decl_ref => unreachable,497 .decl_ref => unreachable,
...@@ -521,8 +508,6 @@ pub const Scope = struct {...@@ -521,8 +508,6 @@ pub const Scope = struct {
521 .gen_zir => unreachable,508 .gen_zir => unreachable,
522 .local_val => unreachable,509 .local_val => unreachable,
523 .local_ptr => unreachable,510 .local_ptr => unreachable,
524 .gen_suspend => unreachable,
525 .gen_nosuspend => unreachable,
526 .decl_ref => unreachable,511 .decl_ref => unreachable,
527 }512 }
528 }513 }
...@@ -535,8 +520,6 @@ pub const Scope = struct {...@@ -535,8 +520,6 @@ pub const Scope = struct {
535 .local_val => unreachable,520 .local_val => unreachable,
536 .local_ptr => unreachable,521 .local_ptr => unreachable,
537 .block => unreachable,522 .block => unreachable,
538 .gen_suspend => unreachable,
539 .gen_nosuspend => unreachable,
540 .decl_ref => unreachable,523 .decl_ref => unreachable,
541 }524 }
542 }525 }
...@@ -552,41 +535,11 @@ pub const Scope = struct {...@@ -552,41 +535,11 @@ pub const Scope = struct {
552 .local_val => @fieldParentPtr(LocalVal, "base", cur).parent,535 .local_val => @fieldParentPtr(LocalVal, "base", cur).parent,
553 .local_ptr => @fieldParentPtr(LocalPtr, "base", cur).parent,536 .local_ptr => @fieldParentPtr(LocalPtr, "base", cur).parent,
554 .block => return @fieldParentPtr(Block, "base", cur).src_decl.container.file_scope,537 .block => return @fieldParentPtr(Block, "base", cur).src_decl.container.file_scope,
555 .gen_suspend => @fieldParentPtr(GenZir, "base", cur).parent,
556 .gen_nosuspend => @fieldParentPtr(Nosuspend, "base", cur).parent,
557 .decl_ref => return @fieldParentPtr(DeclRef, "base", cur).decl.container.file_scope,538 .decl_ref => return @fieldParentPtr(DeclRef, "base", cur).decl.container.file_scope,
558 };539 };
559 }540 }
560 }541 }
561542
562 pub fn getSuspend(base: *Scope) ?*Scope.GenZir {
563 var cur = base;
564 while (true) {
565 cur = switch (cur.tag) {
566 .gen_zir => @fieldParentPtr(GenZir, "base", cur).parent,
567 .local_val => @fieldParentPtr(LocalVal, "base", cur).parent,
568 .local_ptr => @fieldParentPtr(LocalPtr, "base", cur).parent,
569 .gen_nosuspend => @fieldParentPtr(Nosuspend, "base", cur).parent,
570 .gen_suspend => return @fieldParentPtr(GenZir, "base", cur),
571 else => return null,
572 };
573 }
574 }
575
576 pub fn getNosuspend(base: *Scope) ?*Scope.Nosuspend {
577 var cur = base;
578 while (true) {
579 cur = switch (cur.tag) {
580 .gen_zir => @fieldParentPtr(GenZir, "base", cur).parent,
581 .local_val => @fieldParentPtr(LocalVal, "base", cur).parent,
582 .local_ptr => @fieldParentPtr(LocalPtr, "base", cur).parent,
583 .gen_suspend => @fieldParentPtr(GenZir, "base", cur).parent,
584 .gen_nosuspend => return @fieldParentPtr(Nosuspend, "base", cur),
585 else => return null,
586 };
587 }
588 }
589
590 fn name_hash_hash(x: NameHash) u32 {543 fn name_hash_hash(x: NameHash) u32 {
591 return @truncate(u32, @bitCast(u128, x));544 return @truncate(u32, @bitCast(u128, x));
592 }545 }
...@@ -604,8 +557,6 @@ pub const Scope = struct {...@@ -604,8 +557,6 @@ pub const Scope = struct {
604 gen_zir,557 gen_zir,
605 local_val,558 local_val,
606 local_ptr,559 local_ptr,
607 gen_suspend,
608 gen_nosuspend,
609 /// Used for simple error reporting. Only contains a reference to a560 /// Used for simple error reporting. Only contains a reference to a
610 /// `Decl` for use with `srcDecl` and `ownerDecl`.561 /// `Decl` for use with `srcDecl` and `ownerDecl`.
611 /// Has no parents or children.562 /// Has no parents or children.
...@@ -1382,16 +1333,6 @@ pub const Scope = struct {...@@ -1382,16 +1333,6 @@ pub const Scope = struct {
1382 src: LazySrcLoc,1333 src: LazySrcLoc,
1383 };1334 };
13841335
1385 pub const Nosuspend = struct {
1386 pub const base_tag: Tag = .gen_nosuspend;
1387
1388 base: Scope = Scope{ .tag = base_tag },
1389 /// Parents can be: `LocalVal`, `LocalPtr`, `GenZir`.
1390 parent: *Scope,
1391 gen_zir: *GenZir,
1392 src: LazySrcLoc,
1393 };
1394
1395 pub const DeclRef = struct {1336 pub const DeclRef = struct {
1396 pub const base_tag: Tag = .decl_ref;1337 pub const base_tag: Tag = .decl_ref;
1397 base: Scope = Scope{ .tag = base_tag },1338 base: Scope = Scope{ .tag = base_tag },
...@@ -1475,8 +1416,6 @@ pub const WipZirCode = struct {...@@ -1475,8 +1416,6 @@ pub const WipZirCode = struct {
1475 .bool_and,1416 .bool_and,
1476 .bool_or,1417 .bool_or,
1477 .call,1418 .call,
1478 .call_async_kw,
1479 .call_no_async,
1480 .call_compile_time,1419 .call_compile_time,
1481 .call_none,1420 .call_none,
1482 .cmp_lt,1421 .cmp_lt,
...@@ -1549,7 +1488,6 @@ pub const WipZirCode = struct {...@@ -1549,7 +1488,6 @@ pub const WipZirCode = struct {
1549 .enum_literal,1488 .enum_literal,
1550 .enum_literal_small,1489 .enum_literal_small,
1551 .merge_error_sets,1490 .merge_error_sets,
1552 .anyframe_type,
1553 .error_union_type,1491 .error_union_type,
1554 .bit_not,1492 .bit_not,
1555 .error_set,1493 .error_set,
...@@ -1560,9 +1498,6 @@ pub const WipZirCode = struct {...@@ -1560,9 +1498,6 @@ pub const WipZirCode = struct {
1560 .import,1498 .import,
1561 .typeof_peer,1499 .typeof_peer,
1562 .resolve_inferred_alloc,1500 .resolve_inferred_alloc,
1563 .@"resume",
1564 .@"await",
1565 .nosuspend_await,
1566 => return false,1501 => return false,
15671502
1568 .breakpoint,1503 .breakpoint,
...@@ -1581,8 +1516,6 @@ pub const WipZirCode = struct {...@@ -1581,8 +1516,6 @@ pub const WipZirCode = struct {
1581 .ret_coerce,1516 .ret_coerce,
1582 .@"unreachable",1517 .@"unreachable",
1583 .loop,1518 .loop,
1584 .suspend_block,
1585 .suspend_block_one,
1586 .elided,1519 .elided,
1587 => return true,1520 => return true,
1588 }1521 }
...@@ -1692,7 +1625,6 @@ pub const SrcLoc = struct {...@@ -1692,7 +1625,6 @@ pub const SrcLoc = struct {
1692 .node_offset_asm_source,1625 .node_offset_asm_source,
1693 .node_offset_asm_ret_ty,1626 .node_offset_asm_ret_ty,
1694 .node_offset_if_cond,1627 .node_offset_if_cond,
1695 .node_offset_anyframe_type,
1696 .node_offset_bin_op,1628 .node_offset_bin_op,
1697 .node_offset_bin_lhs,1629 .node_offset_bin_lhs,
1698 .node_offset_bin_rhs,1630 .node_offset_bin_rhs,
...@@ -1750,7 +1682,6 @@ pub const SrcLoc = struct {...@@ -1750,7 +1682,6 @@ pub const SrcLoc = struct {
1750 .node_offset_asm_source => @panic("TODO"),1682 .node_offset_asm_source => @panic("TODO"),
1751 .node_offset_asm_ret_ty => @panic("TODO"),1683 .node_offset_asm_ret_ty => @panic("TODO"),
1752 .node_offset_if_cond => @panic("TODO"),1684 .node_offset_if_cond => @panic("TODO"),
1753 .node_offset_anyframe_type => @panic("TODO"),
1754 .node_offset_bin_op => @panic("TODO"),1685 .node_offset_bin_op => @panic("TODO"),
1755 .node_offset_bin_lhs => @panic("TODO"),1686 .node_offset_bin_lhs => @panic("TODO"),
1756 .node_offset_bin_rhs => @panic("TODO"),1687 .node_offset_bin_rhs => @panic("TODO"),
...@@ -1872,12 +1803,6 @@ pub const LazySrcLoc = union(enum) {...@@ -1872,12 +1803,6 @@ pub const LazySrcLoc = union(enum) {
1872 /// to the condition expression.1803 /// to the condition expression.
1873 /// The Decl is determined contextually.1804 /// The Decl is determined contextually.
1874 node_offset_if_cond: i32,1805 node_offset_if_cond: i32,
1875 /// The source location points to the type expression of an `anyframe->T`
1876 /// expression, found by taking this AST node index offset from the containing
1877 /// Decl AST node, which points to a `anyframe->T` expression AST node. Next, navigate
1878 /// to the type expression.
1879 /// The Decl is determined contextually.
1880 node_offset_anyframe_type: i32,
1881 /// The source location points to a binary expression, such as `a + b`, found1806 /// The source location points to a binary expression, such as `a + b`, found
1882 /// by taking this AST node index offset from the containing Decl AST node.1807 /// by taking this AST node index offset from the containing Decl AST node.
1883 /// The Decl is determined contextually.1808 /// The Decl is determined contextually.
...@@ -1922,7 +1847,6 @@ pub const LazySrcLoc = union(enum) {...@@ -1922,7 +1847,6 @@ pub const LazySrcLoc = union(enum) {
1922 .node_offset_asm_source,1847 .node_offset_asm_source,
1923 .node_offset_asm_ret_ty,1848 .node_offset_asm_ret_ty,
1924 .node_offset_if_cond,1849 .node_offset_if_cond,
1925 .node_offset_anyframe_type,
1926 .node_offset_bin_op,1850 .node_offset_bin_op,
1927 .node_offset_bin_lhs,1851 .node_offset_bin_lhs,
1928 .node_offset_bin_rhs,1852 .node_offset_bin_rhs,
...@@ -1962,7 +1886,6 @@ pub const LazySrcLoc = union(enum) {...@@ -1962,7 +1886,6 @@ pub const LazySrcLoc = union(enum) {
1962 .node_offset_asm_source,1886 .node_offset_asm_source,
1963 .node_offset_asm_ret_ty,1887 .node_offset_asm_ret_ty,
1964 .node_offset_if_cond,1888 .node_offset_if_cond,
1965 .node_offset_anyframe_type,
1966 .node_offset_bin_op,1889 .node_offset_bin_op,
1967 .node_offset_bin_lhs,1890 .node_offset_bin_lhs,
1968 .node_offset_bin_rhs,1891 .node_offset_bin_rhs,
...@@ -3888,7 +3811,7 @@ pub fn failWithOwnedErrorMsg(mod: *Module, scope: *Scope, err_msg: *ErrorMsg) In...@@ -3888,7 +3811,7 @@ pub fn failWithOwnedErrorMsg(mod: *Module, scope: *Scope, err_msg: *ErrorMsg) In
3888 }3811 }
3889 mod.failed_decls.putAssumeCapacityNoClobber(block.sema.owner_decl, err_msg);3812 mod.failed_decls.putAssumeCapacityNoClobber(block.sema.owner_decl, err_msg);
3890 },3813 },
3891 .gen_zir, .gen_suspend => {3814 .gen_zir => {
3892 const gen_zir = scope.cast(Scope.GenZir).?;3815 const gen_zir = scope.cast(Scope.GenZir).?;
3893 gen_zir.zir_code.decl.analysis = .sema_failure;3816 gen_zir.zir_code.decl.analysis = .sema_failure;
3894 gen_zir.zir_code.decl.generation = mod.generation;3817 gen_zir.zir_code.decl.generation = mod.generation;
...@@ -3906,12 +3829,6 @@ pub fn failWithOwnedErrorMsg(mod: *Module, scope: *Scope, err_msg: *ErrorMsg) In...@@ -3906,12 +3829,6 @@ pub fn failWithOwnedErrorMsg(mod: *Module, scope: *Scope, err_msg: *ErrorMsg) In
3906 gen_zir.zir_code.decl.generation = mod.generation;3829 gen_zir.zir_code.decl.generation = mod.generation;
3907 mod.failed_decls.putAssumeCapacityNoClobber(gen_zir.zir_code.decl, err_msg);3830 mod.failed_decls.putAssumeCapacityNoClobber(gen_zir.zir_code.decl, err_msg);
3908 },3831 },
3909 .gen_nosuspend => {
3910 const gen_zir = scope.cast(Scope.Nosuspend).?.gen_zir;
3911 gen_zir.zir_code.decl.analysis = .sema_failure;
3912 gen_zir.zir_code.decl.generation = mod.generation;
3913 mod.failed_decls.putAssumeCapacityNoClobber(gen_zir.zir_code.decl, err_msg);
3914 },
3915 .file => unreachable,3832 .file => unreachable,
3916 .container => unreachable,3833 .container => unreachable,
3917 .decl_ref => {3834 .decl_ref => {
...@@ -4157,10 +4074,6 @@ pub fn errorUnionType(...@@ -4157,10 +4074,6 @@ pub fn errorUnionType(
4157 });4074 });
4158}4075}
41594076
4160pub fn anyframeType(mod: *Module, arena: *Allocator, return_type: Type) Allocator.Error!Type {
4161 return Type.Tag.anyframe_T.create(arena, return_type);
4162}
4163
4164pub fn dumpInst(mod: *Module, scope: *Scope, inst: *ir.Inst) void {4077pub fn dumpInst(mod: *Module, scope: *Scope, inst: *ir.Inst) void {
4165 const zir_module = scope.namespace();4078 const zir_module = scope.namespace();
4166 const source = zir_module.getSource(mod) catch @panic("dumpInst failed to get source");4079 const source = zir_module.getSource(mod) catch @panic("dumpInst failed to get source");
src/Sema.zig-31
...@@ -97,8 +97,6 @@ pub fn analyzeBody(sema: *Sema, block: *Scope.Block, body: []const zir.Inst.Inde...@@ -97,8 +97,6 @@ pub fn analyzeBody(sema: *Sema, block: *Scope.Block, body: []const zir.Inst.Inde
97 .break_void_tok => try sema.zirBreakVoidTok(block, zir_inst),97 .break_void_tok => try sema.zirBreakVoidTok(block, zir_inst),
98 .breakpoint => try sema.zirBreakpoint(block, zir_inst),98 .breakpoint => try sema.zirBreakpoint(block, zir_inst),
99 .call => try sema.zirCall(block, zir_inst, .auto),99 .call => try sema.zirCall(block, zir_inst, .auto),
100 .call_async_kw => try sema.zirCall(block, zir_inst, .async_kw),
101 .call_no_async => try sema.zirCall(block, zir_inst, .no_async),
102 .call_compile_time => try sema.zirCall(block, zir_inst, .compile_time),100 .call_compile_time => try sema.zirCall(block, zir_inst, .compile_time),
103 .call_none => try sema.zirCallNone(block, zir_inst),101 .call_none => try sema.zirCallNone(block, zir_inst),
104 .coerce_result_ptr => try sema.zirCoerceResultPtr(block, zir_inst),102 .coerce_result_ptr => try sema.zirCoerceResultPtr(block, zir_inst),
...@@ -205,7 +203,6 @@ pub fn analyzeBody(sema: *Sema, block: *Scope.Block, body: []const zir.Inst.Inde...@@ -205,7 +203,6 @@ pub fn analyzeBody(sema: *Sema, block: *Scope.Block, body: []const zir.Inst.Inde
205 .enum_literal_small => try sema.zirEnumLiteralSmall(block, zir_inst),203 .enum_literal_small => try sema.zirEnumLiteralSmall(block, zir_inst),
206 .merge_error_sets => try sema.zirMergeErrorSets(block, zir_inst),204 .merge_error_sets => try sema.zirMergeErrorSets(block, zir_inst),
207 .error_union_type => try sema.zirErrorUnionType(block, zir_inst),205 .error_union_type => try sema.zirErrorUnionType(block, zir_inst),
208 .anyframe_type => try sema.zirAnyframeType(block, zir_inst),
209 .error_set => try sema.zirErrorSet(block, zir_inst),206 .error_set => try sema.zirErrorSet(block, zir_inst),
210 .error_value => try sema.zirErrorValue(block, zir_inst),207 .error_value => try sema.zirErrorValue(block, zir_inst),
211 .slice_start => try sema.zirSliceStart(block, zir_inst),208 .slice_start => try sema.zirSliceStart(block, zir_inst),
...@@ -214,11 +211,6 @@ pub fn analyzeBody(sema: *Sema, block: *Scope.Block, body: []const zir.Inst.Inde...@@ -214,11 +211,6 @@ pub fn analyzeBody(sema: *Sema, block: *Scope.Block, body: []const zir.Inst.Inde
214 .import => try sema.zirImport(block, zir_inst),211 .import => try sema.zirImport(block, zir_inst),
215 .bool_and => try sema.zirBoolOp(block, zir_inst, false),212 .bool_and => try sema.zirBoolOp(block, zir_inst, false),
216 .bool_or => try sema.zirBoolOp(block, zir_inst, true),213 .bool_or => try sema.zirBoolOp(block, zir_inst, true),
217 .@"await" => try sema.zirAwait(block, zir_inst),
218 .nosuspend_await => try sema.zirNosuspendAwait(block, zir_inst),
219 .suspend_block_one => @panic("TODO"),
220 .suspend_block => @panic("TODO"),
221 .@"resume" => @panic("TODO"),
222 // TODO214 // TODO
223 //.switchbr => try sema.zirSwitchBr(block, zir_inst, false),215 //.switchbr => try sema.zirSwitchBr(block, zir_inst, false),
224 //.switchbr_ref => try sema.zirSwitchBr(block, zir_inst, true),216 //.switchbr_ref => try sema.zirSwitchBr(block, zir_inst, true),
...@@ -1276,19 +1268,6 @@ fn zirErrorUnionType(sema: *Sema, block: *Scope.Block, inst: zir.Inst.Index) Inn...@@ -1276,19 +1268,6 @@ fn zirErrorUnionType(sema: *Sema, block: *Scope.Block, inst: zir.Inst.Index) Inn
1276 return sema.mod.constType(sema.arena, .unneeded, err_union_ty);1268 return sema.mod.constType(sema.arena, .unneeded, err_union_ty);
1277}1269}
12781270
1279fn zirAnyframeType(sema: *Sema, block: *Scope.Block, inst: zir.Inst.Index) InnerError!*Inst {
1280 const tracy = trace(@src());
1281 defer tracy.end();
1282
1283 const inst_data = sema.code.instructions.items(.data)[inst].un_node;
1284 const src = inst_data.src();
1285 const operand_src: LazySrcLoc = .{ .node_offset_anyframe_type = inst_data.src_node };
1286 const return_type = try sema.resolveType(block, operand_src, inst_data.operand);
1287 const anyframe_type = try sema.mod.anyframeType(sema.arena, return_type);
1288
1289 return sema.mod.constType(sema.arena, src, anyframe_type);
1290}
1291
1292fn zirErrorSet(sema: *Sema, block: *Scope.Block, inst: zir.Inst.Index) InnerError!*Inst {1271fn zirErrorSet(sema: *Sema, block: *Scope.Block, inst: zir.Inst.Index) InnerError!*Inst {
1293 const tracy = trace(@src());1272 const tracy = trace(@src());
1294 defer tracy.end();1273 defer tracy.end();
...@@ -2989,16 +2968,6 @@ fn zirPtrType(sema: *Sema, block: *Scope.Block, inst: zir.Inst.Index) InnerError...@@ -2989,16 +2968,6 @@ fn zirPtrType(sema: *Sema, block: *Scope.Block, inst: zir.Inst.Index) InnerError
2989 return sema.mod.constType(sema.arena, src, ty);2968 return sema.mod.constType(sema.arena, src, ty);
2990}2969}
29912970
2992fn zirAwait(sema: *Sema, block: *Scope.Block, inst: zir.Inst.Index) InnerError!*Inst {
2993 const inst_data = sema.code.instructions.items(.data)[inst].un_node;
2994 return sema.mod.fail(&block.base, inst_data.src(), "TODO implement Sema await", .{});
2995}
2996
2997fn zirNosuspendAwait(sema: *Sema, block: *Scope.Block, inst: zir.Inst.Index) InnerError!*Inst {
2998 const inst_data = sema.code.instructions.items(.data)[inst].un_node;
2999 return sema.mod.fail(&block.base, inst_data.src(), "TODO implement Sema nosuspend_await", .{});
3000}
3001
3002fn requireFunctionBlock(sema: *Sema, block: *Scope.Block, src: LazySrcLoc) !void {2971fn requireFunctionBlock(sema: *Sema, block: *Scope.Block, src: LazySrcLoc) !void {
3003 if (sema.func == null) {2972 if (sema.func == null) {
3004 return sema.mod.fail(&block.base, src, "instruction illegal outside function body", .{});2973 return sema.mod.fail(&block.base, src, "instruction illegal outside function body", .{});
src/astgen.zig+16-133
...@@ -527,21 +527,8 @@ pub fn expr(mod: *Module, scope: *Scope, rl: ResultLoc, node: ast.Node.Index) In...@@ -527,21 +527,8 @@ pub fn expr(mod: *Module, scope: *Scope, rl: ResultLoc, node: ast.Node.Index) In
527 const result = try addZIRBinOp(mod, scope, src, .merge_error_sets, lhs, rhs);527 const result = try addZIRBinOp(mod, scope, src, .merge_error_sets, lhs, rhs);
528 return rvalue(mod, scope, rl, result);528 return rvalue(mod, scope, rl, result);
529 },529 },
530 .anyframe_literal => {530 .anyframe_literal => return mod.failNode(scope, node, "async and related features are not yet supported", .{}),
531 if (true) @panic("TODO update for zir-memory-layout");531 .anyframe_type => return mod.failNode(scope, node, "async and related features are not yet supported", .{}),
532 const main_token = main_tokens[node];
533 const result = try addZIRInstConst(mod, scope, src, .{
534 .ty = Type.initTag(.type),
535 .val = Value.initTag(.anyframe_type),
536 });
537 return rvalue(mod, scope, rl, result);
538 },
539 .anyframe_type => {
540 if (true) @panic("TODO update for zir-memory-layout");
541 const return_type = try typeExpr(mod, scope, node_datas[node].rhs);
542 const result = try addZIRUnOp(mod, scope, src, .anyframe_type, return_type);
543 return rvalue(mod, scope, rl, result);
544 },
545 .@"catch" => {532 .@"catch" => {
546 if (true) @panic("TODO update for zir-memory-layout");533 if (true) @panic("TODO update for zir-memory-layout");
547 const catch_token = main_tokens[node];534 const catch_token = main_tokens[node];
...@@ -641,12 +628,10 @@ pub fn expr(mod: *Module, scope: *Scope, rl: ResultLoc, node: ast.Node.Index) In...@@ -641,12 +628,10 @@ pub fn expr(mod: *Module, scope: *Scope, rl: ResultLoc, node: ast.Node.Index) In
641 .@"comptime" => return comptimeExpr(mod, scope, rl, node_datas[node].lhs),628 .@"comptime" => return comptimeExpr(mod, scope, rl, node_datas[node].lhs),
642 .@"switch", .switch_comma => return switchExpr(mod, scope, rl, node),629 .@"switch", .switch_comma => return switchExpr(mod, scope, rl, node),
643630
644 .@"nosuspend" => return nosuspendExpr(mod, scope, rl, node),631 .@"nosuspend" => return mod.failNode(scope, node, "async and related features are not yet supported", .{}),
645 .@"suspend" => @panic("TODO"),632 .@"suspend" => return mod.failNode(scope, node, "async and related features are not yet supported", .{}),
646 //.@"suspend" => return rvalue(mod, scope, rl, try suspendExpr(mod, scope, node)),633 .@"await" => return mod.failNode(scope, node, "async and related features are not yet supported", .{}),
647 .@"await" => return awaitExpr(mod, scope, rl, node),634 .@"resume" => return mod.failNode(scope, node, "async and related features are not yet supported", .{}),
648 .@"resume" => @panic("TODO"),
649 //.@"resume" => return rvalue(mod, scope, rl, try resumeExpr(mod, scope, node)),
650635
651 .@"defer" => return mod.failNode(scope, node, "TODO implement astgen.expr for .defer", .{}),636 .@"defer" => return mod.failNode(scope, node, "TODO implement astgen.expr for .defer", .{}),
652 .@"errdefer" => return mod.failNode(scope, node, "TODO implement astgen.expr for .errdefer", .{}),637 .@"errdefer" => return mod.failNode(scope, node, "TODO implement astgen.expr for .errdefer", .{}),
...@@ -782,8 +767,6 @@ fn breakExpr(...@@ -782,8 +767,6 @@ fn breakExpr(
782 },767 },
783 .local_val => scope = scope.cast(Scope.LocalVal).?.parent,768 .local_val => scope = scope.cast(Scope.LocalVal).?.parent,
784 .local_ptr => scope = scope.cast(Scope.LocalPtr).?.parent,769 .local_ptr => scope = scope.cast(Scope.LocalPtr).?.parent,
785 .gen_suspend => scope = scope.cast(Scope.GenZir).?.parent,
786 .gen_nosuspend => scope = scope.cast(Scope.Nosuspend).?.parent,
787 else => if (break_label != 0) {770 else => if (break_label != 0) {
788 const label_name = try mod.identifierTokenString(parent_scope, break_label);771 const label_name = try mod.identifierTokenString(parent_scope, break_label);
789 return mod.failTok(parent_scope, break_label, "label not found: '{s}'", .{label_name});772 return mod.failTok(parent_scope, break_label, "label not found: '{s}'", .{label_name});
...@@ -836,8 +819,6 @@ fn continueExpr(...@@ -836,8 +819,6 @@ fn continueExpr(
836 },819 },
837 .local_val => scope = scope.cast(Scope.LocalVal).?.parent,820 .local_val => scope = scope.cast(Scope.LocalVal).?.parent,
838 .local_ptr => scope = scope.cast(Scope.LocalPtr).?.parent,821 .local_ptr => scope = scope.cast(Scope.LocalPtr).?.parent,
839 .gen_suspend => scope = scope.cast(Scope.GenZir).?.parent,
840 .gen_nosuspend => scope = scope.cast(Scope.Nosuspend).?.parent,
841 else => if (break_label != 0) {822 else => if (break_label != 0) {
842 const label_name = try mod.identifierTokenString(parent_scope, break_label);823 const label_name = try mod.identifierTokenString(parent_scope, break_label);
843 return mod.failTok(parent_scope, break_label, "label not found: '{s}'", .{label_name});824 return mod.failTok(parent_scope, break_label, "label not found: '{s}'", .{label_name});
...@@ -910,8 +891,6 @@ fn checkLabelRedefinition(mod: *Module, parent_scope: *Scope, label: ast.TokenIn...@@ -910,8 +891,6 @@ fn checkLabelRedefinition(mod: *Module, parent_scope: *Scope, label: ast.TokenIn
910 },891 },
911 .local_val => scope = scope.cast(Scope.LocalVal).?.parent,892 .local_val => scope = scope.cast(Scope.LocalVal).?.parent,
912 .local_ptr => scope = scope.cast(Scope.LocalPtr).?.parent,893 .local_ptr => scope = scope.cast(Scope.LocalPtr).?.parent,
913 .gen_suspend => scope = scope.cast(Scope.GenZir).?.parent,
914 .gen_nosuspend => scope = scope.cast(Scope.Nosuspend).?.parent,
915 else => return,894 else => return,
916 }895 }
917 }896 }
...@@ -1111,8 +1090,6 @@ fn varDecl(...@@ -1111,8 +1090,6 @@ fn varDecl(
1111 s = local_ptr.parent;1090 s = local_ptr.parent;
1112 },1091 },
1113 .gen_zir => s = s.cast(Scope.GenZir).?.parent,1092 .gen_zir => s = s.cast(Scope.GenZir).?.parent,
1114 .gen_suspend => s = s.cast(Scope.GenZir).?.parent,
1115 .gen_nosuspend => s = s.cast(Scope.Nosuspend).?.parent,
1116 else => break,1093 else => break,
1117 };1094 };
1118 }1095 }
...@@ -2797,8 +2774,6 @@ fn identifier(...@@ -2797,8 +2774,6 @@ fn identifier(
2797 s = local_ptr.parent;2774 s = local_ptr.parent;
2798 },2775 },
2799 .gen_zir => s = s.cast(Scope.GenZir).?.parent,2776 .gen_zir => s = s.cast(Scope.GenZir).?.parent,
2800 .gen_suspend => s = s.cast(Scope.GenZir).?.parent,
2801 .gen_nosuspend => s = s.cast(Scope.Nosuspend).?.parent,
2802 else => break,2777 else => break,
2803 };2778 };
2804 }2779 }
...@@ -3272,7 +3247,6 @@ fn builtinCall(...@@ -3272,7 +3247,6 @@ fn builtinCall(
3272 .add_with_overflow,3247 .add_with_overflow,
3273 .align_cast,3248 .align_cast,
3274 .align_of,3249 .align_of,
3275 .async_call,
3276 .atomic_load,3250 .atomic_load,
3277 .atomic_rmw,3251 .atomic_rmw,
3278 .atomic_store,3252 .atomic_store,
...@@ -3305,10 +3279,6 @@ fn builtinCall(...@@ -3305,10 +3279,6 @@ fn builtinCall(
3305 .fence,3279 .fence,
3306 .field_parent_ptr,3280 .field_parent_ptr,
3307 .float_to_int,3281 .float_to_int,
3308 .frame,
3309 .Frame,
3310 .frame_address,
3311 .frame_size,
3312 .has_decl,3282 .has_decl,
3313 .has_field,3283 .has_field,
3314 .int_to_enum,3284 .int_to_enum,
...@@ -3362,6 +3332,13 @@ fn builtinCall(...@@ -3362,6 +3332,13 @@ fn builtinCall(
3362 => return mod.failTok(scope, builtin_token, "TODO: implement builtin function {s}", .{3332 => return mod.failTok(scope, builtin_token, "TODO: implement builtin function {s}", .{
3363 builtin_name,3333 builtin_name,
3364 }),3334 }),
3335
3336 .async_call,
3337 .frame,
3338 .Frame,
3339 .frame_address,
3340 .frame_size,
3341 => return mod.failTok(scope, builtin_token, "async and related features are not yet supported", .{}),
3365 }3342 }
3366}3343}
33673344
...@@ -3373,7 +3350,7 @@ fn callExpr(...@@ -3373,7 +3350,7 @@ fn callExpr(
3373 call: ast.full.Call,3350 call: ast.full.Call,
3374) InnerError!zir.Inst.Ref {3351) InnerError!zir.Inst.Ref {
3375 if (call.async_token) |async_token| {3352 if (call.async_token) |async_token| {
3376 return mod.failTok(scope, async_token, "TODO implement async fn call", .{});3353 return mod.failTok(scope, async_token, "async and related features are not yet supported", .{});
3377 }3354 }
3378 const lhs = try expr(mod, scope, .none, call.ast.fn_expr);3355 const lhs = try expr(mod, scope, .none, call.ast.fn_expr);
33793356
...@@ -3402,10 +3379,10 @@ fn callExpr(...@@ -3402,10 +3379,10 @@ fn callExpr(
3402 true => break :res try gz.addUnNode(.call_none, lhs, node),3379 true => break :res try gz.addUnNode(.call_none, lhs, node),
3403 false => .call,3380 false => .call,
3404 },3381 },
3405 .async_kw => .call_async_kw,3382 .async_kw => return mod.failNode(scope, node, "async and related features are not yet supported", .{}),
3406 .never_tail => unreachable,3383 .never_tail => unreachable,
3407 .never_inline => unreachable,3384 .never_inline => unreachable,
3408 .no_async => .call_no_async,3385 .no_async => return mod.failNode(scope, node, "async and related features are not yet supported", .{}),
3409 .always_tail => unreachable,3386 .always_tail => unreachable,
3410 .always_inline => unreachable,3387 .always_inline => unreachable,
3411 .compile_time => .call_compile_time,3388 .compile_time => .call_compile_time,
...@@ -3415,99 +3392,6 @@ fn callExpr(...@@ -3415,99 +3392,6 @@ fn callExpr(
3415 return rvalue(mod, scope, rl, result, node); // TODO function call with result location3392 return rvalue(mod, scope, rl, result, node); // TODO function call with result location
3416}3393}
34173394
3418fn suspendExpr(mod: *Module, scope: *Scope, node: ast.Node.Index) InnerError!zir.Inst.Ref {
3419 const tree = scope.tree();
3420 const src = tree.tokens.items(.start)[tree.nodes.items(.main_token)[node]];
3421
3422 if (scope.getNosuspend()) |some| {
3423 const msg = msg: {
3424 const msg = try mod.errMsg(scope, src, "suspend in nosuspend block", .{});
3425 errdefer msg.destroy(mod.gpa);
3426 try mod.errNote(scope, some.src, msg, "nosuspend block here", .{});
3427 break :msg msg;
3428 };
3429 return mod.failWithOwnedErrorMsg(scope, msg);
3430 }
3431
3432 if (scope.getSuspend()) |some| {
3433 const msg = msg: {
3434 const msg = try mod.errMsg(scope, src, "cannot suspend inside suspend block", .{});
3435 errdefer msg.destroy(mod.gpa);
3436 try mod.errNote(scope, some.src, msg, "other suspend block here", .{});
3437 break :msg msg;
3438 };
3439 return mod.failWithOwnedErrorMsg(scope, msg);
3440 }
3441
3442 var suspend_scope: Scope.GenZir = .{
3443 .base = .{ .tag = .gen_suspend },
3444 .parent = scope,
3445 .decl = scope.ownerDecl().?,
3446 .arena = scope.arena(),
3447 .force_comptime = scope.isComptime(),
3448 .instructions = .{},
3449 };
3450 defer suspend_scope.instructions.deinit(mod.gpa);
3451
3452 const operand = tree.nodes.items(.data)[node].lhs;
3453 if (operand != 0) {
3454 const possibly_unused_result = try expr(mod, &suspend_scope.base, .none, operand);
3455 if (!possibly_unused_result.tag.isNoReturn()) {
3456 _ = try addZIRUnOp(mod, &suspend_scope.base, src, .ensure_result_used, possibly_unused_result);
3457 }
3458 } else {
3459 return addZIRNoOp(mod, scope, src, .@"suspend");
3460 }
3461
3462 const block = try addZIRInstBlock(mod, scope, src, .suspend_block, .{
3463 .instructions = try scope.arena().dupe(zir.Inst.Ref, suspend_scope.instructions.items),
3464 });
3465 return &block.base;
3466}
3467
3468fn nosuspendExpr(mod: *Module, scope: *Scope, rl: ResultLoc, node: ast.Node.Index) InnerError!zir.Inst.Ref {
3469 if (true) @panic("TODO update for zir-memory-layout");
3470 const tree = scope.tree();
3471 var child_scope = Scope.Nosuspend{
3472 .parent = scope,
3473 .gen_zir = scope.getGenZir(),
3474 .src = tree.tokens.items(.start)[tree.nodes.items(.main_token)[node]],
3475 };
3476
3477 return expr(mod, &child_scope.base, rl, tree.nodes.items(.data)[node].lhs);
3478}
3479
3480fn awaitExpr(mod: *Module, scope: *Scope, rl: ResultLoc, node: ast.Node.Index) InnerError!zir.Inst.Ref {
3481 if (true) @panic("TODO update for zir-memory-layout");
3482 const tree = scope.tree();
3483 const src = tree.tokens.items(.start)[tree.nodes.items(.main_token)[node]];
3484 const is_nosuspend = scope.getNosuspend() != null;
3485
3486 // TODO some @asyncCall stuff
3487
3488 if (scope.getSuspend()) |some| {
3489 const msg = msg: {
3490 const msg = try mod.errMsg(scope, src, "cannot await inside suspend block", .{});
3491 errdefer msg.destroy(mod.gpa);
3492 try mod.errNote(scope, some.src, msg, "suspend block here", .{});
3493 break :msg msg;
3494 };
3495 return mod.failWithOwnedErrorMsg(scope, msg);
3496 }
3497
3498 const operand = try expr(mod, scope, .ref, tree.nodes.items(.data)[node].lhs);
3499 // TODO pass result location
3500 return addZIRUnOp(mod, scope, src, if (is_nosuspend) .nosuspend_await else .@"await", operand);
3501}
3502
3503fn resumeExpr(mod: *Module, scope: *Scope, node: ast.Node.Index) InnerError!zir.Inst.Ref {
3504 const tree = scope.tree();
3505 const src = tree.tokens.items(.start)[tree.nodes.items(.main_token)[node]];
3506
3507 const operand = try expr(mod, scope, .ref, tree.nodes.items(.data)[node].lhs);
3508 return addZIRUnOp(mod, scope, src, .@"resume", operand);
3509}
3510
3511pub const simple_types = std.ComptimeStringMap(zir.Const, .{3395pub const simple_types = std.ComptimeStringMap(zir.Const, .{
3512 .{ "u8", .u8_type },3396 .{ "u8", .u8_type },
3513 .{ "i8", .i8_type },3397 .{ "i8", .i8_type },
...@@ -3542,7 +3426,6 @@ pub const simple_types = std.ComptimeStringMap(zir.Const, .{...@@ -3542,7 +3426,6 @@ pub const simple_types = std.ComptimeStringMap(zir.Const, .{
3542 .{ "noreturn", .noreturn_type },3426 .{ "noreturn", .noreturn_type },
3543 .{ "null", .null_type },3427 .{ "null", .null_type },
3544 .{ "undefined", .undefined_type },3428 .{ "undefined", .undefined_type },
3545 .{ "anyframe", .anyframe_type },
3546 .{ "undefined", .undef },3429 .{ "undefined", .undef },
3547 .{ "null", .null_value },3430 .{ "null", .null_value },
3548 .{ "true", .bool_true },3431 .{ "true", .bool_true },
src/type.zig+1-66
...@@ -92,8 +92,6 @@ pub const Type = extern union {...@@ -92,8 +92,6 @@ pub const Type = extern union {
9292
93 .anyerror_void_error_union, .error_union => return .ErrorUnion,93 .anyerror_void_error_union, .error_union => return .ErrorUnion,
9494
95 .anyframe_T, .@"anyframe" => return .AnyFrame,
96
97 .empty_struct => return .Struct,95 .empty_struct => return .Struct,
9896
99 .var_args_param => unreachable, // can be any type97 .var_args_param => unreachable, // can be any type
...@@ -397,7 +395,6 @@ pub const Type = extern union {...@@ -397,7 +395,6 @@ pub const Type = extern union {
397 .const_slice_u8,395 .const_slice_u8,
398 .enum_literal,396 .enum_literal,
399 .anyerror_void_error_union,397 .anyerror_void_error_union,
400 .@"anyframe",
401 .inferred_alloc_const,398 .inferred_alloc_const,
402 .inferred_alloc_mut,399 .inferred_alloc_mut,
403 .var_args_param,400 .var_args_param,
...@@ -418,7 +415,6 @@ pub const Type = extern union {...@@ -418,7 +415,6 @@ pub const Type = extern union {
418 .optional,415 .optional,
419 .optional_single_mut_pointer,416 .optional_single_mut_pointer,
420 .optional_single_const_pointer,417 .optional_single_const_pointer,
421 .anyframe_T,
422 => return self.copyPayloadShallow(allocator, Payload.ElemType),418 => return self.copyPayloadShallow(allocator, Payload.ElemType),
423419
424 .int_signed,420 .int_signed,
...@@ -546,7 +542,6 @@ pub const Type = extern union {...@@ -546,7 +542,6 @@ pub const Type = extern union {
546542
547 // TODO this should print the structs name543 // TODO this should print the structs name
548 .empty_struct => return out_stream.writeAll("struct {}"),544 .empty_struct => return out_stream.writeAll("struct {}"),
549 .@"anyframe" => return out_stream.writeAll("anyframe"),
550 .anyerror_void_error_union => return out_stream.writeAll("anyerror!void"),545 .anyerror_void_error_union => return out_stream.writeAll("anyerror!void"),
551 .const_slice_u8 => return out_stream.writeAll("[]const u8"),546 .const_slice_u8 => return out_stream.writeAll("[]const u8"),
552 .fn_noreturn_no_args => return out_stream.writeAll("fn() noreturn"),547 .fn_noreturn_no_args => return out_stream.writeAll("fn() noreturn"),
...@@ -574,12 +569,6 @@ pub const Type = extern union {...@@ -574,12 +569,6 @@ pub const Type = extern union {
574 continue;569 continue;
575 },570 },
576571
577 .anyframe_T => {
578 const return_type = ty.castTag(.anyframe_T).?.data;
579 try out_stream.print("anyframe->", .{});
580 ty = return_type;
581 continue;
582 },
583 .array_u8 => {572 .array_u8 => {
584 const len = ty.castTag(.array_u8).?.data;573 const len = ty.castTag(.array_u8).?.data;
585 return out_stream.print("[{d}]u8", .{len});574 return out_stream.print("[{d}]u8", .{len});
...@@ -814,8 +803,6 @@ pub const Type = extern union {...@@ -814,8 +803,6 @@ pub const Type = extern union {
814 .optional,803 .optional,
815 .optional_single_mut_pointer,804 .optional_single_mut_pointer,
816 .optional_single_const_pointer,805 .optional_single_const_pointer,
817 .@"anyframe",
818 .anyframe_T,
819 .anyerror_void_error_union,806 .anyerror_void_error_union,
820 .error_set,807 .error_set,
821 .error_set_single,808 .error_set_single,
...@@ -898,8 +885,6 @@ pub const Type = extern union {...@@ -898,8 +885,6 @@ pub const Type = extern union {
898 .mut_slice,885 .mut_slice,
899 .optional_single_const_pointer,886 .optional_single_const_pointer,
900 .optional_single_mut_pointer,887 .optional_single_mut_pointer,
901 .@"anyframe",
902 .anyframe_T,
903 => return @divExact(target.cpu.arch.ptrBitWidth(), 8),888 => return @divExact(target.cpu.arch.ptrBitWidth(), 8),
904889
905 .pointer => {890 .pointer => {
...@@ -1025,7 +1010,7 @@ pub const Type = extern union {...@@ -1025,7 +1010,7 @@ pub const Type = extern union {
1025 .i64, .u64 => return 8,1010 .i64, .u64 => return 8,
1026 .u128, .i128 => return 16,1011 .u128, .i128 => return 16,
10271012
1028 .@"anyframe", .anyframe_T, .isize, .usize => return @divExact(target.cpu.arch.ptrBitWidth(), 8),1013 .isize, .usize => return @divExact(target.cpu.arch.ptrBitWidth(), 8),
10291014
1030 .const_slice,1015 .const_slice,
1031 .mut_slice,1016 .mut_slice,
...@@ -1169,8 +1154,6 @@ pub const Type = extern union {...@@ -1169,8 +1154,6 @@ pub const Type = extern union {
1169 .const_slice,1154 .const_slice,
1170 .mut_slice,1155 .mut_slice,
1171 .error_union,1156 .error_union,
1172 .@"anyframe",
1173 .anyframe_T,
1174 .anyerror_void_error_union,1157 .anyerror_void_error_union,
1175 .error_set,1158 .error_set,
1176 .error_set_single,1159 .error_set_single,
...@@ -1244,8 +1227,6 @@ pub const Type = extern union {...@@ -1244,8 +1227,6 @@ pub const Type = extern union {
1244 .optional_single_const_pointer,1227 .optional_single_const_pointer,
1245 .enum_literal,1228 .enum_literal,
1246 .error_union,1229 .error_union,
1247 .@"anyframe",
1248 .anyframe_T,
1249 .anyerror_void_error_union,1230 .anyerror_void_error_union,
1250 .error_set,1231 .error_set,
1251 .error_set_single,1232 .error_set_single,
...@@ -1338,8 +1319,6 @@ pub const Type = extern union {...@@ -1338,8 +1319,6 @@ pub const Type = extern union {
1338 .optional_single_const_pointer,1319 .optional_single_const_pointer,
1339 .enum_literal,1320 .enum_literal,
1340 .error_union,1321 .error_union,
1341 .@"anyframe",
1342 .anyframe_T,
1343 .anyerror_void_error_union,1322 .anyerror_void_error_union,
1344 .error_set,1323 .error_set,
1345 .error_set_single,1324 .error_set_single,
...@@ -1416,8 +1395,6 @@ pub const Type = extern union {...@@ -1416,8 +1395,6 @@ pub const Type = extern union {
1416 .enum_literal,1395 .enum_literal,
1417 .mut_slice,1396 .mut_slice,
1418 .error_union,1397 .error_union,
1419 .@"anyframe",
1420 .anyframe_T,
1421 .anyerror_void_error_union,1398 .anyerror_void_error_union,
1422 .error_set,1399 .error_set,
1423 .error_set_single,1400 .error_set_single,
...@@ -1503,8 +1480,6 @@ pub const Type = extern union {...@@ -1503,8 +1480,6 @@ pub const Type = extern union {
1503 .optional_single_const_pointer,1480 .optional_single_const_pointer,
1504 .enum_literal,1481 .enum_literal,
1505 .error_union,1482 .error_union,
1506 .@"anyframe",
1507 .anyframe_T,
1508 .anyerror_void_error_union,1483 .anyerror_void_error_union,
1509 .error_set,1484 .error_set,
1510 .error_set_single,1485 .error_set_single,
...@@ -1585,8 +1560,6 @@ pub const Type = extern union {...@@ -1585,8 +1560,6 @@ pub const Type = extern union {
1585 .optional_single_const_pointer,1560 .optional_single_const_pointer,
1586 .enum_literal,1561 .enum_literal,
1587 .error_union,1562 .error_union,
1588 .@"anyframe",
1589 .anyframe_T,
1590 .anyerror_void_error_union,1563 .anyerror_void_error_union,
1591 .error_set,1564 .error_set,
1592 .error_set_single,1565 .error_set_single,
...@@ -1709,8 +1682,6 @@ pub const Type = extern union {...@@ -1709,8 +1682,6 @@ pub const Type = extern union {
1709 .optional_single_mut_pointer => unreachable,1682 .optional_single_mut_pointer => unreachable,
1710 .enum_literal => unreachable,1683 .enum_literal => unreachable,
1711 .error_union => unreachable,1684 .error_union => unreachable,
1712 .@"anyframe" => unreachable,
1713 .anyframe_T => unreachable,
1714 .anyerror_void_error_union => unreachable,1685 .anyerror_void_error_union => unreachable,
1715 .error_set => unreachable,1686 .error_set => unreachable,
1716 .error_set_single => unreachable,1687 .error_set_single => unreachable,
...@@ -1859,8 +1830,6 @@ pub const Type = extern union {...@@ -1859,8 +1830,6 @@ pub const Type = extern union {
1859 .optional_single_const_pointer,1830 .optional_single_const_pointer,
1860 .enum_literal,1831 .enum_literal,
1861 .error_union,1832 .error_union,
1862 .@"anyframe",
1863 .anyframe_T,
1864 .anyerror_void_error_union,1833 .anyerror_void_error_union,
1865 .error_set,1834 .error_set,
1866 .error_set_single,1835 .error_set_single,
...@@ -1931,8 +1900,6 @@ pub const Type = extern union {...@@ -1931,8 +1900,6 @@ pub const Type = extern union {
1931 .optional_single_const_pointer,1900 .optional_single_const_pointer,
1932 .enum_literal,1901 .enum_literal,
1933 .error_union,1902 .error_union,
1934 .@"anyframe",
1935 .anyframe_T,
1936 .anyerror_void_error_union,1903 .anyerror_void_error_union,
1937 .error_set,1904 .error_set,
1938 .error_set_single,1905 .error_set_single,
...@@ -2018,8 +1985,6 @@ pub const Type = extern union {...@@ -2018,8 +1985,6 @@ pub const Type = extern union {
2018 .optional_single_const_pointer,1985 .optional_single_const_pointer,
2019 .enum_literal,1986 .enum_literal,
2020 .error_union,1987 .error_union,
2021 .@"anyframe",
2022 .anyframe_T,
2023 .anyerror_void_error_union,1988 .anyerror_void_error_union,
2024 .error_set,1989 .error_set,
2025 .error_set_single,1990 .error_set_single,
...@@ -2101,8 +2066,6 @@ pub const Type = extern union {...@@ -2101,8 +2066,6 @@ pub const Type = extern union {
2101 .optional_single_const_pointer,2066 .optional_single_const_pointer,
2102 .enum_literal,2067 .enum_literal,
2103 .error_union,2068 .error_union,
2104 .@"anyframe",
2105 .anyframe_T,
2106 .anyerror_void_error_union,2069 .anyerror_void_error_union,
2107 .error_set,2070 .error_set,
2108 .error_set_single,2071 .error_set_single,
...@@ -2170,8 +2133,6 @@ pub const Type = extern union {...@@ -2170,8 +2133,6 @@ pub const Type = extern union {
2170 .optional_single_const_pointer,2133 .optional_single_const_pointer,
2171 .enum_literal,2134 .enum_literal,
2172 .error_union,2135 .error_union,
2173 .@"anyframe",
2174 .anyframe_T,
2175 .anyerror_void_error_union,2136 .anyerror_void_error_union,
2176 .error_set,2137 .error_set,
2177 .error_set_single,2138 .error_set_single,
...@@ -2267,8 +2228,6 @@ pub const Type = extern union {...@@ -2267,8 +2228,6 @@ pub const Type = extern union {
2267 .optional_single_const_pointer,2228 .optional_single_const_pointer,
2268 .enum_literal,2229 .enum_literal,
2269 .error_union,2230 .error_union,
2270 .@"anyframe",
2271 .anyframe_T,
2272 .anyerror_void_error_union,2231 .anyerror_void_error_union,
2273 .error_set,2232 .error_set,
2274 .error_set_single,2233 .error_set_single,
...@@ -2385,8 +2344,6 @@ pub const Type = extern union {...@@ -2385,8 +2344,6 @@ pub const Type = extern union {
2385 .optional_single_const_pointer,2344 .optional_single_const_pointer,
2386 .enum_literal,2345 .enum_literal,
2387 .error_union,2346 .error_union,
2388 .@"anyframe",
2389 .anyframe_T,
2390 .anyerror_void_error_union,2347 .anyerror_void_error_union,
2391 .error_set,2348 .error_set,
2392 .error_set_single,2349 .error_set_single,
...@@ -2469,8 +2426,6 @@ pub const Type = extern union {...@@ -2469,8 +2426,6 @@ pub const Type = extern union {
2469 .optional_single_const_pointer,2426 .optional_single_const_pointer,
2470 .enum_literal,2427 .enum_literal,
2471 .error_union,2428 .error_union,
2472 .@"anyframe",
2473 .anyframe_T,
2474 .anyerror_void_error_union,2429 .anyerror_void_error_union,
2475 .error_set,2430 .error_set,
2476 .error_set_single,2431 .error_set_single,
...@@ -2552,8 +2507,6 @@ pub const Type = extern union {...@@ -2552,8 +2507,6 @@ pub const Type = extern union {
2552 .optional_single_const_pointer,2507 .optional_single_const_pointer,
2553 .enum_literal,2508 .enum_literal,
2554 .error_union,2509 .error_union,
2555 .@"anyframe",
2556 .anyframe_T,
2557 .anyerror_void_error_union,2510 .anyerror_void_error_union,
2558 .error_set,2511 .error_set,
2559 .error_set_single,2512 .error_set_single,
...@@ -2635,8 +2588,6 @@ pub const Type = extern union {...@@ -2635,8 +2588,6 @@ pub const Type = extern union {
2635 .optional_single_const_pointer,2588 .optional_single_const_pointer,
2636 .enum_literal,2589 .enum_literal,
2637 .error_union,2590 .error_union,
2638 .@"anyframe",
2639 .anyframe_T,
2640 .anyerror_void_error_union,2591 .anyerror_void_error_union,
2641 .error_set,2592 .error_set,
2642 .error_set_single,2593 .error_set_single,
...@@ -2715,8 +2666,6 @@ pub const Type = extern union {...@@ -2715,8 +2666,6 @@ pub const Type = extern union {
2715 .optional_single_const_pointer,2666 .optional_single_const_pointer,
2716 .enum_literal,2667 .enum_literal,
2717 .error_union,2668 .error_union,
2718 .@"anyframe",
2719 .anyframe_T,
2720 .anyerror_void_error_union,2669 .anyerror_void_error_union,
2721 .error_set,2670 .error_set,
2722 .error_set_single,2671 .error_set_single,
...@@ -2795,8 +2744,6 @@ pub const Type = extern union {...@@ -2795,8 +2744,6 @@ pub const Type = extern union {
2795 .optional_single_const_pointer,2744 .optional_single_const_pointer,
2796 .enum_literal,2745 .enum_literal,
2797 .error_union,2746 .error_union,
2798 .@"anyframe",
2799 .anyframe_T,
2800 .anyerror_void_error_union,2747 .anyerror_void_error_union,
2801 .error_set,2748 .error_set,
2802 .error_set_single,2749 .error_set_single,
...@@ -2875,8 +2822,6 @@ pub const Type = extern union {...@@ -2875,8 +2822,6 @@ pub const Type = extern union {
2875 .optional_single_const_pointer,2822 .optional_single_const_pointer,
2876 .enum_literal,2823 .enum_literal,
2877 .error_union,2824 .error_union,
2878 .@"anyframe",
2879 .anyframe_T,
2880 .anyerror_void_error_union,2825 .anyerror_void_error_union,
2881 .error_set,2826 .error_set,
2882 .error_set_single,2827 .error_set_single,
...@@ -2939,8 +2884,6 @@ pub const Type = extern union {...@@ -2939,8 +2884,6 @@ pub const Type = extern union {
2939 .optional_single_const_pointer,2884 .optional_single_const_pointer,
2940 .enum_literal,2885 .enum_literal,
2941 .anyerror_void_error_union,2886 .anyerror_void_error_union,
2942 .anyframe_T,
2943 .@"anyframe",
2944 .error_union,2887 .error_union,
2945 .error_set,2888 .error_set,
2946 .error_set_single,2889 .error_set_single,
...@@ -3047,8 +2990,6 @@ pub const Type = extern union {...@@ -3047,8 +2990,6 @@ pub const Type = extern union {
3047 .optional_single_const_pointer,2990 .optional_single_const_pointer,
3048 .enum_literal,2991 .enum_literal,
3049 .error_union,2992 .error_union,
3050 .@"anyframe",
3051 .anyframe_T,
3052 .anyerror_void_error_union,2993 .anyerror_void_error_union,
3053 .error_set,2994 .error_set,
3054 .error_set_single,2995 .error_set_single,
...@@ -3136,8 +3077,6 @@ pub const Type = extern union {...@@ -3136,8 +3077,6 @@ pub const Type = extern union {
3136 .optional_single_const_pointer,3077 .optional_single_const_pointer,
3137 .enum_literal,3078 .enum_literal,
3138 .error_union,3079 .error_union,
3139 .@"anyframe",
3140 .anyframe_T,
3141 .anyerror_void_error_union,3080 .anyerror_void_error_union,
3142 .error_set,3081 .error_set,
3143 .error_set_single,3082 .error_set_single,
...@@ -3259,7 +3198,6 @@ pub const Type = extern union {...@@ -3259,7 +3198,6 @@ pub const Type = extern union {
3259 fn_ccc_void_no_args,3198 fn_ccc_void_no_args,
3260 single_const_pointer_to_comptime_int,3199 single_const_pointer_to_comptime_int,
3261 anyerror_void_error_union,3200 anyerror_void_error_union,
3262 @"anyframe",
3263 const_slice_u8,3201 const_slice_u8,
3264 /// This is a special type for variadic parameters of a function call.3202 /// This is a special type for variadic parameters of a function call.
3265 /// Casts to it will validate that the type can be passed to a c calling convetion function.3203 /// Casts to it will validate that the type can be passed to a c calling convetion function.
...@@ -3292,7 +3230,6 @@ pub const Type = extern union {...@@ -3292,7 +3230,6 @@ pub const Type = extern union {
3292 optional_single_mut_pointer,3230 optional_single_mut_pointer,
3293 optional_single_const_pointer,3231 optional_single_const_pointer,
3294 error_union,3232 error_union,
3295 anyframe_T,
3296 error_set,3233 error_set,
3297 error_set_single,3234 error_set_single,
3298 empty_struct,3235 empty_struct,
...@@ -3345,7 +3282,6 @@ pub const Type = extern union {...@@ -3345,7 +3282,6 @@ pub const Type = extern union {
3345 .fn_ccc_void_no_args,3282 .fn_ccc_void_no_args,
3346 .single_const_pointer_to_comptime_int,3283 .single_const_pointer_to_comptime_int,
3347 .anyerror_void_error_union,3284 .anyerror_void_error_union,
3348 .@"anyframe",
3349 .const_slice_u8,3285 .const_slice_u8,
3350 .inferred_alloc_const,3286 .inferred_alloc_const,
3351 .inferred_alloc_mut,3287 .inferred_alloc_mut,
...@@ -3367,7 +3303,6 @@ pub const Type = extern union {...@@ -3367,7 +3303,6 @@ pub const Type = extern union {
3367 .optional,3303 .optional,
3368 .optional_single_mut_pointer,3304 .optional_single_mut_pointer,
3369 .optional_single_const_pointer,3305 .optional_single_const_pointer,
3370 .anyframe_T,
3371 => Payload.ElemType,3306 => Payload.ElemType,
33723307
3373 .int_signed,3308 .int_signed,
src/value.zig-18
...@@ -62,7 +62,6 @@ pub const Value = extern union {...@@ -62,7 +62,6 @@ pub const Value = extern union {
62 single_const_pointer_to_comptime_int_type,62 single_const_pointer_to_comptime_int_type,
63 const_slice_u8_type,63 const_slice_u8_type,
64 enum_literal_type,64 enum_literal_type,
65 anyframe_type,
6665
67 undef,66 undef,
68 zero,67 zero,
...@@ -153,7 +152,6 @@ pub const Value = extern union {...@@ -153,7 +152,6 @@ pub const Value = extern union {
153 .single_const_pointer_to_comptime_int_type,152 .single_const_pointer_to_comptime_int_type,
154 .const_slice_u8_type,153 .const_slice_u8_type,
155 .enum_literal_type,154 .enum_literal_type,
156 .anyframe_type,
157 .undef,155 .undef,
158 .zero,156 .zero,
159 .one,157 .one,
...@@ -308,7 +306,6 @@ pub const Value = extern union {...@@ -308,7 +306,6 @@ pub const Value = extern union {
308 .single_const_pointer_to_comptime_int_type,306 .single_const_pointer_to_comptime_int_type,
309 .const_slice_u8_type,307 .const_slice_u8_type,
310 .enum_literal_type,308 .enum_literal_type,
311 .anyframe_type,
312 .undef,309 .undef,
313 .zero,310 .zero,
314 .one,311 .one,
...@@ -462,7 +459,6 @@ pub const Value = extern union {...@@ -462,7 +459,6 @@ pub const Value = extern union {
462 .single_const_pointer_to_comptime_int_type => return out_stream.writeAll("*const comptime_int"),459 .single_const_pointer_to_comptime_int_type => return out_stream.writeAll("*const comptime_int"),
463 .const_slice_u8_type => return out_stream.writeAll("[]const u8"),460 .const_slice_u8_type => return out_stream.writeAll("[]const u8"),
464 .enum_literal_type => return out_stream.writeAll("@Type(.EnumLiteral)"),461 .enum_literal_type => return out_stream.writeAll("@Type(.EnumLiteral)"),
465 .anyframe_type => return out_stream.writeAll("anyframe"),
466462
467 // TODO this should print `NAME{}`463 // TODO this should print `NAME{}`
468 .empty_struct_value => return out_stream.writeAll("struct {}{}"),464 .empty_struct_value => return out_stream.writeAll("struct {}{}"),
...@@ -590,7 +586,6 @@ pub const Value = extern union {...@@ -590,7 +586,6 @@ pub const Value = extern union {
590 .single_const_pointer_to_comptime_int_type => Type.initTag(.single_const_pointer_to_comptime_int),586 .single_const_pointer_to_comptime_int_type => Type.initTag(.single_const_pointer_to_comptime_int),
591 .const_slice_u8_type => Type.initTag(.const_slice_u8),587 .const_slice_u8_type => Type.initTag(.const_slice_u8),
592 .enum_literal_type => Type.initTag(.enum_literal),588 .enum_literal_type => Type.initTag(.enum_literal),
593 .anyframe_type => Type.initTag(.@"anyframe"),
594589
595 .int_type => {590 .int_type => {
596 const payload = self.castTag(.int_type).?.data;591 const payload = self.castTag(.int_type).?.data;
...@@ -687,7 +682,6 @@ pub const Value = extern union {...@@ -687,7 +682,6 @@ pub const Value = extern union {
687 .single_const_pointer_to_comptime_int_type,682 .single_const_pointer_to_comptime_int_type,
688 .const_slice_u8_type,683 .const_slice_u8_type,
689 .enum_literal_type,684 .enum_literal_type,
690 .anyframe_type,
691 .null_value,685 .null_value,
692 .function,686 .function,
693 .extern_fn,687 .extern_fn,
...@@ -774,7 +768,6 @@ pub const Value = extern union {...@@ -774,7 +768,6 @@ pub const Value = extern union {
774 .single_const_pointer_to_comptime_int_type,768 .single_const_pointer_to_comptime_int_type,
775 .const_slice_u8_type,769 .const_slice_u8_type,
776 .enum_literal_type,770 .enum_literal_type,
777 .anyframe_type,
778 .null_value,771 .null_value,
779 .function,772 .function,
780 .extern_fn,773 .extern_fn,
...@@ -861,7 +854,6 @@ pub const Value = extern union {...@@ -861,7 +854,6 @@ pub const Value = extern union {
861 .single_const_pointer_to_comptime_int_type,854 .single_const_pointer_to_comptime_int_type,
862 .const_slice_u8_type,855 .const_slice_u8_type,
863 .enum_literal_type,856 .enum_literal_type,
864 .anyframe_type,
865 .null_value,857 .null_value,
866 .function,858 .function,
867 .extern_fn,859 .extern_fn,
...@@ -975,7 +967,6 @@ pub const Value = extern union {...@@ -975,7 +967,6 @@ pub const Value = extern union {
975 .single_const_pointer_to_comptime_int_type,967 .single_const_pointer_to_comptime_int_type,
976 .const_slice_u8_type,968 .const_slice_u8_type,
977 .enum_literal_type,969 .enum_literal_type,
978 .anyframe_type,
979 .null_value,970 .null_value,
980 .function,971 .function,
981 .extern_fn,972 .extern_fn,
...@@ -1067,7 +1058,6 @@ pub const Value = extern union {...@@ -1067,7 +1058,6 @@ pub const Value = extern union {
1067 .single_const_pointer_to_comptime_int_type,1058 .single_const_pointer_to_comptime_int_type,
1068 .const_slice_u8_type,1059 .const_slice_u8_type,
1069 .enum_literal_type,1060 .enum_literal_type,
1070 .anyframe_type,
1071 .null_value,1061 .null_value,
1072 .function,1062 .function,
1073 .extern_fn,1063 .extern_fn,
...@@ -1224,7 +1214,6 @@ pub const Value = extern union {...@@ -1224,7 +1214,6 @@ pub const Value = extern union {
1224 .single_const_pointer_to_comptime_int_type,1214 .single_const_pointer_to_comptime_int_type,
1225 .const_slice_u8_type,1215 .const_slice_u8_type,
1226 .enum_literal_type,1216 .enum_literal_type,
1227 .anyframe_type,
1228 .bool_true,1217 .bool_true,
1229 .bool_false,1218 .bool_false,
1230 .null_value,1219 .null_value,
...@@ -1308,7 +1297,6 @@ pub const Value = extern union {...@@ -1308,7 +1297,6 @@ pub const Value = extern union {
1308 .single_const_pointer_to_comptime_int_type,1297 .single_const_pointer_to_comptime_int_type,
1309 .const_slice_u8_type,1298 .const_slice_u8_type,
1310 .enum_literal_type,1299 .enum_literal_type,
1311 .anyframe_type,
1312 .null_value,1300 .null_value,
1313 .function,1301 .function,
1314 .extern_fn,1302 .extern_fn,
...@@ -1460,7 +1448,6 @@ pub const Value = extern union {...@@ -1460,7 +1448,6 @@ pub const Value = extern union {
1460 .single_const_pointer_to_comptime_int_type,1448 .single_const_pointer_to_comptime_int_type,
1461 .const_slice_u8_type,1449 .const_slice_u8_type,
1462 .enum_literal_type,1450 .enum_literal_type,
1463 .anyframe_type,
1464 .ty,1451 .ty,
1465 => {1452 => {
1466 // Directly return Type.hash, toType can only fail for .int_type and .error_set.1453 // Directly return Type.hash, toType can only fail for .int_type and .error_set.
...@@ -1618,7 +1605,6 @@ pub const Value = extern union {...@@ -1618,7 +1605,6 @@ pub const Value = extern union {
1618 .single_const_pointer_to_comptime_int_type,1605 .single_const_pointer_to_comptime_int_type,
1619 .const_slice_u8_type,1606 .const_slice_u8_type,
1620 .enum_literal_type,1607 .enum_literal_type,
1621 .anyframe_type,
1622 .zero,1608 .zero,
1623 .one,1609 .one,
1624 .bool_true,1610 .bool_true,
...@@ -1705,7 +1691,6 @@ pub const Value = extern union {...@@ -1705,7 +1691,6 @@ pub const Value = extern union {
1705 .single_const_pointer_to_comptime_int_type,1691 .single_const_pointer_to_comptime_int_type,
1706 .const_slice_u8_type,1692 .const_slice_u8_type,
1707 .enum_literal_type,1693 .enum_literal_type,
1708 .anyframe_type,
1709 .zero,1694 .zero,
1710 .one,1695 .one,
1711 .bool_true,1696 .bool_true,
...@@ -1809,7 +1794,6 @@ pub const Value = extern union {...@@ -1809,7 +1794,6 @@ pub const Value = extern union {
1809 .single_const_pointer_to_comptime_int_type,1794 .single_const_pointer_to_comptime_int_type,
1810 .const_slice_u8_type,1795 .const_slice_u8_type,
1811 .enum_literal_type,1796 .enum_literal_type,
1812 .anyframe_type,
1813 .zero,1797 .zero,
1814 .one,1798 .one,
1815 .empty_array,1799 .empty_array,
...@@ -1891,7 +1875,6 @@ pub const Value = extern union {...@@ -1891,7 +1875,6 @@ pub const Value = extern union {
1891 .single_const_pointer_to_comptime_int_type,1875 .single_const_pointer_to_comptime_int_type,
1892 .const_slice_u8_type,1876 .const_slice_u8_type,
1893 .enum_literal_type,1877 .enum_literal_type,
1894 .anyframe_type,
1895 .zero,1878 .zero,
1896 .one,1879 .one,
1897 .null_value,1880 .null_value,
...@@ -1993,7 +1976,6 @@ pub const Value = extern union {...@@ -1993,7 +1976,6 @@ pub const Value = extern union {
1993 .single_const_pointer_to_comptime_int_type,1976 .single_const_pointer_to_comptime_int_type,
1994 .const_slice_u8_type,1977 .const_slice_u8_type,
1995 .enum_literal_type,1978 .enum_literal_type,
1996 .anyframe_type,
1997 .error_set,1979 .error_set,
1998 => true,1980 => true,
19991981
src/zir.zig-40
...@@ -161,7 +161,6 @@ pub const Const = enum {...@@ -161,7 +161,6 @@ pub const Const = enum {
161 single_const_pointer_to_comptime_int_type,161 single_const_pointer_to_comptime_int_type,
162 const_slice_u8_type,162 const_slice_u8_type,
163 enum_literal_type,163 enum_literal_type,
164 anyframe_type,
165164
166 /// `undefined` (untyped)165 /// `undefined` (untyped)
167 undef,166 undef,
...@@ -343,10 +342,6 @@ pub const const_inst_list = std.enums.directEnumArray(Const, TypedValue, 0, .{...@@ -343,10 +342,6 @@ pub const const_inst_list = std.enums.directEnumArray(Const, TypedValue, 0, .{
343 .ty = Type.initTag(.type),342 .ty = Type.initTag(.type),
344 .val = Value.initTag(.enum_literal_type),343 .val = Value.initTag(.enum_literal_type),
345 },344 },
346 .anyframe_type = .{
347 .ty = Type.initTag(.type),
348 .val = Value.initTag(.anyframe_type),
349 },
350345
351 .undef = .{346 .undef = .{
352 .ty = Type.initTag(.@"undefined"),347 .ty = Type.initTag(.@"undefined"),
...@@ -409,9 +404,6 @@ pub const Inst = struct {...@@ -409,9 +404,6 @@ pub const Inst = struct {
409 alloc_inferred,404 alloc_inferred,
410 /// Same as `alloc_inferred` except mutable.405 /// Same as `alloc_inferred` except mutable.
411 alloc_inferred_mut,406 alloc_inferred_mut,
412 /// Create an `anyframe->T`.
413 /// Uses the `un_node` field. AST node is the `anyframe->T` syntax. Operand is the type.
414 anyframe_type,
415 /// Array concatenation. `a ++ b`407 /// Array concatenation. `a ++ b`
416 /// Uses the `pl_node` union field. Payload is `Bin`.408 /// Uses the `pl_node` union field. Payload is `Bin`.
417 array_cat,409 array_cat,
...@@ -441,8 +433,6 @@ pub const Inst = struct {...@@ -441,8 +433,6 @@ pub const Inst = struct {
441 /// Inline assembly with the volatile attribute.433 /// Inline assembly with the volatile attribute.
442 /// Uses the `pl_node` union field. Payload is `Asm`. AST node is the assembly node.434 /// Uses the `pl_node` union field. Payload is `Asm`. AST node is the assembly node.
443 asm_volatile,435 asm_volatile,
444 /// `await x` syntax. Uses the `un_node` union field.
445 @"await",
446 /// Bitwise AND. `&`436 /// Bitwise AND. `&`
447 bit_and,437 bit_and,
448 /// TODO delete this instruction, it has no purpose.438 /// TODO delete this instruction, it has no purpose.
...@@ -495,10 +485,6 @@ pub const Inst = struct {...@@ -495,10 +485,6 @@ pub const Inst = struct {
495 /// Function call with modifier `.auto`.485 /// Function call with modifier `.auto`.
496 /// Uses `pl_node`. AST node is the function call. Payload is `Call`.486 /// Uses `pl_node`. AST node is the function call. Payload is `Call`.
497 call,487 call,
498 /// Same as `call` but with modifier `.async_kw`.
499 call_async_kw,
500 /// Same as `call` but with modifier `.no_async`.
501 call_no_async,
502 /// Same as `call` but with modifier `.compile_time`.488 /// Same as `call` but with modifier `.compile_time`.
503 call_compile_time,489 call_compile_time,
504 /// Function call with modifier `.auto`, empty parameter list.490 /// Function call with modifier `.auto`, empty parameter list.
...@@ -666,8 +652,6 @@ pub const Inst = struct {...@@ -666,8 +652,6 @@ pub const Inst = struct {
666 /// Twos complement wrapping integer multiplication.652 /// Twos complement wrapping integer multiplication.
667 /// Uses the `pl_node` union field. Payload is `Bin`.653 /// Uses the `pl_node` union field. Payload is `Bin`.
668 mulwrap,654 mulwrap,
669 /// An await inside a nosuspend scope.
670 nosuspend_await,
671 /// Given a reference to a function and a parameter index, returns the655 /// Given a reference to a function and a parameter index, returns the
672 /// type of the parameter. The only usage of this instruction is for the656 /// type of the parameter. The only usage of this instruction is for the
673 /// result location of parameters of function calls. In the case of a function's657 /// result location of parameters of function calls. In the case of a function's
...@@ -686,8 +670,6 @@ pub const Inst = struct {...@@ -686,8 +670,6 @@ pub const Inst = struct {
686 /// instruction.670 /// instruction.
687 /// Uses the `un_tok` union field.671 /// Uses the `un_tok` union field.
688 ref,672 ref,
689 /// Resume an async function.
690 @"resume",
691 /// Obtains a pointer to the return value.673 /// Obtains a pointer to the return value.
692 /// Uses the `node` union field.674 /// Uses the `node` union field.
693 ret_ptr,675 ret_ptr,
...@@ -841,12 +823,6 @@ pub const Inst = struct {...@@ -841,12 +823,6 @@ pub const Inst = struct {
841 /// An enum literal 8 or fewer bytes. No source location.823 /// An enum literal 8 or fewer bytes. No source location.
842 /// Uses the `small_str` field.824 /// Uses the `small_str` field.
843 enum_literal_small,825 enum_literal_small,
844 /// Suspend an async function. The suspend block has 0 or 1 statements in it.
845 /// Uses the `un_node` union field.
846 suspend_block_one,
847 /// Suspend an async function. The suspend block has any number of statements in it.
848 /// Uses the `pl_node` union field. Payload is `MultiOp`.
849 suspend_block,
850 // /// A switch expression.826 // /// A switch expression.
851 // /// lhs is target, SwitchBr[rhs]827 // /// lhs is target, SwitchBr[rhs]
852 // /// All prongs of target handled.828 // /// All prongs of target handled.
...@@ -918,8 +894,6 @@ pub const Inst = struct {...@@ -918,8 +894,6 @@ pub const Inst = struct {
918 .bool_or,894 .bool_or,
919 .breakpoint,895 .breakpoint,
920 .call,896 .call,
921 .call_async_kw,
922 .call_no_async,
923 .call_compile_time,897 .call_compile_time,
924 .call_none,898 .call_none,
925 .cmp_lt,899 .cmp_lt,
...@@ -997,7 +971,6 @@ pub const Inst = struct {...@@ -997,7 +971,6 @@ pub const Inst = struct {
997 .enum_literal,971 .enum_literal,
998 .enum_literal_small,972 .enum_literal_small,
999 .merge_error_sets,973 .merge_error_sets,
1000 .anyframe_type,
1001 .error_union_type,974 .error_union_type,
1002 .bit_not,975 .bit_not,
1003 .error_set,976 .error_set,
...@@ -1010,9 +983,6 @@ pub const Inst = struct {...@@ -1010,9 +983,6 @@ pub const Inst = struct {
1010 .resolve_inferred_alloc,983 .resolve_inferred_alloc,
1011 .set_eval_branch_quota,984 .set_eval_branch_quota,
1012 .compile_log,985 .compile_log,
1013 .@"resume",
1014 .@"await",
1015 .nosuspend_await,
1016 .elided,986 .elided,
1017 => false,987 => false,
1018988
...@@ -1025,8 +995,6 @@ pub const Inst = struct {...@@ -1025,8 +995,6 @@ pub const Inst = struct {
1025 .ret_coerce,995 .ret_coerce,
1026 .@"unreachable",996 .@"unreachable",
1027 .loop,997 .loop,
1028 .suspend_block,
1029 .suspend_block_one,
1030 => true,998 => true,
1031 };999 };
1032 }1000 }
...@@ -1347,9 +1315,7 @@ const Writer = struct {...@@ -1347,9 +1315,7 @@ const Writer = struct {
1347 .alloc_mut,1315 .alloc_mut,
1348 .alloc_inferred,1316 .alloc_inferred,
1349 .alloc_inferred_mut,1317 .alloc_inferred_mut,
1350 .anyframe_type,
1351 .indexable_ptr_len,1318 .indexable_ptr_len,
1352 .@"await",
1353 .bit_not,1319 .bit_not,
1354 .bool_not,1320 .bool_not,
1355 .negate,1321 .negate,
...@@ -1364,7 +1330,6 @@ const Writer = struct {...@@ -1364,7 +1330,6 @@ const Writer = struct {
1364 .ret_node,1330 .ret_node,
1365 .set_eval_branch_quota,1331 .set_eval_branch_quota,
1366 .resolve_inferred_alloc,1332 .resolve_inferred_alloc,
1367 .suspend_block_one,
1368 .optional_type,1333 .optional_type,
1369 .optional_type_from_ptr_elem,1334 .optional_type_from_ptr_elem,
1370 .optional_payload_safe,1335 .optional_payload_safe,
...@@ -1409,8 +1374,6 @@ const Writer = struct {...@@ -1409,8 +1374,6 @@ const Writer = struct {
1409 .block_comptime,1374 .block_comptime,
1410 .block_comptime_flat,1375 .block_comptime_flat,
1411 .call,1376 .call,
1412 .call_async_kw,
1413 .call_no_async,
1414 .call_compile_time,1377 .call_compile_time,
1415 .compile_log,1378 .compile_log,
1416 .condbr,1379 .condbr,
...@@ -1426,7 +1389,6 @@ const Writer = struct {...@@ -1426,7 +1389,6 @@ const Writer = struct {
1426 .slice_end,1389 .slice_end,
1427 .slice_sentinel,1390 .slice_sentinel,
1428 .typeof_peer,1391 .typeof_peer,
1429 .suspend_block,
1430 => try self.writePlNode(stream, inst),1392 => try self.writePlNode(stream, inst),
14311393
1432 .add,1394 .add,
...@@ -1481,8 +1443,6 @@ const Writer = struct {...@@ -1481,8 +1443,6 @@ const Writer = struct {
1481 .bitcast_result_ptr,1443 .bitcast_result_ptr,
1482 .error_union_type,1444 .error_union_type,
1483 .error_set,1445 .error_set,
1484 .nosuspend_await,
1485 .@"resume",
1486 .store,1446 .store,
1487 .store_to_block_ptr,1447 .store_to_block_ptr,
1488 .store_to_inferred_ptr,1448 .store_to_inferred_ptr,