authorgravatar for me@tadeo.caTadeo Kondrak <me@tadeo.ca> 2020-05-05 05:11:19-06:00
committergravatar for me@tadeo.caTadeo Kondrak <me@tadeo.ca> 2020-05-05 05:17:34-06:00
logb957dc29a4e3f025e446e717b0ae8c69602545ca
tree848b3648266fccbf887d317217936fb051661810
parent8d5636ebe4b1d70db14e28c67f7986fb2a1ce3cf
signature Commit is signed but in an unrecognized format.

Rename noasync to nosuspend in C++ compiler


10 files changed, 96 insertions(+), 96 deletions(-)

src/all_types.hpp+11-11
...@@ -672,7 +672,7 @@ enum NodeType {...@@ -672,7 +672,7 @@ enum NodeType {
672 NodeTypeSwitchProng,672 NodeTypeSwitchProng,
673 NodeTypeSwitchRange,673 NodeTypeSwitchRange,
674 NodeTypeCompTime,674 NodeTypeCompTime,
675 NodeTypeNoAsync,675 NodeTypeNoSuspend,
676 NodeTypeBreak,676 NodeTypeBreak,
677 NodeTypeContinue,677 NodeTypeContinue,
678 NodeTypeAsmExpr,678 NodeTypeAsmExpr,
...@@ -862,7 +862,7 @@ enum CallModifier {...@@ -862,7 +862,7 @@ enum CallModifier {
862 CallModifierAsync,862 CallModifierAsync,
863 CallModifierNeverTail,863 CallModifierNeverTail,
864 CallModifierNeverInline,864 CallModifierNeverInline,
865 CallModifierNoAsync,865 CallModifierNoSuspend,
866 CallModifierAlwaysTail,866 CallModifierAlwaysTail,
867 CallModifierAlwaysInline,867 CallModifierAlwaysInline,
868 CallModifierCompileTime,868 CallModifierCompileTime,
...@@ -1014,7 +1014,7 @@ struct AstNodeCompTime {...@@ -1014,7 +1014,7 @@ struct AstNodeCompTime {
1014 AstNode *expr;1014 AstNode *expr;
1015};1015};
10161016
1017struct AstNodeNoAsync {1017struct AstNodeNoSuspend {
1018 AstNode *expr;1018 AstNode *expr;
1019};1019};
10201020
...@@ -1225,7 +1225,7 @@ struct AstNode {...@@ -1225,7 +1225,7 @@ struct AstNode {
1225 AstNodeSwitchProng switch_prong;1225 AstNodeSwitchProng switch_prong;
1226 AstNodeSwitchRange switch_range;1226 AstNodeSwitchRange switch_range;
1227 AstNodeCompTime comptime_expr;1227 AstNodeCompTime comptime_expr;
1228 AstNodeNoAsync noasync_expr;1228 AstNodeNoSuspend nosuspend_expr;
1229 AstNodeAsmExpr asm_expr;1229 AstNodeAsmExpr asm_expr;
1230 AstNodeFieldAccessExpr field_access_expr;1230 AstNodeFieldAccessExpr field_access_expr;
1231 AstNodePtrDerefExpr ptr_deref_expr;1231 AstNodePtrDerefExpr ptr_deref_expr;
...@@ -1858,7 +1858,7 @@ enum PanicMsgId {...@@ -1858,7 +1858,7 @@ enum PanicMsgId {
1858 PanicMsgIdResumedAnAwaitingFn,1858 PanicMsgIdResumedAnAwaitingFn,
1859 PanicMsgIdFrameTooSmall,1859 PanicMsgIdFrameTooSmall,
1860 PanicMsgIdResumedFnPendingAwait,1860 PanicMsgIdResumedFnPendingAwait,
1861 PanicMsgIdBadNoAsyncCall,1861 PanicMsgIdBadNoSuspendCall,
1862 PanicMsgIdResumeNotSuspendedFn,1862 PanicMsgIdResumeNotSuspendedFn,
1863 PanicMsgIdBadSentinel,1863 PanicMsgIdBadSentinel,
1864 PanicMsgIdShxTooBigRhs,1864 PanicMsgIdShxTooBigRhs,
...@@ -2376,7 +2376,7 @@ enum ScopeId {...@@ -2376,7 +2376,7 @@ enum ScopeId {
2376 ScopeIdRuntime,2376 ScopeIdRuntime,
2377 ScopeIdTypeOf,2377 ScopeIdTypeOf,
2378 ScopeIdExpr,2378 ScopeIdExpr,
2379 ScopeIdNoAsync,2379 ScopeIdNoSuspend,
2380};2380};
23812381
2382struct Scope {2382struct Scope {
...@@ -2510,9 +2510,9 @@ struct ScopeCompTime {...@@ -2510,9 +2510,9 @@ struct ScopeCompTime {
2510 Scope base;2510 Scope base;
2511};2511};
25122512
2513// This scope is created for a noasync expression.2513// This scope is created for a nosuspend expression.
2514// NodeTypeNoAsync2514// NodeTypeNoSuspend
2515struct ScopeNoAsync {2515struct ScopeNoSuspend {
2516 Scope base;2516 Scope base;
2517};2517};
25182518
...@@ -4488,7 +4488,7 @@ struct IrInstSrcAwait {...@@ -4488,7 +4488,7 @@ struct IrInstSrcAwait {
44884488
4489 IrInstSrc *frame;4489 IrInstSrc *frame;
4490 ResultLoc *result_loc;4490 ResultLoc *result_loc;
4491 bool is_noasync;4491 bool is_nosuspend;
4492};4492};
44934493
4494struct IrInstGenAwait {4494struct IrInstGenAwait {
...@@ -4497,7 +4497,7 @@ struct IrInstGenAwait {...@@ -4497,7 +4497,7 @@ struct IrInstGenAwait {
4497 IrInstGen *frame;4497 IrInstGen *frame;
4498 IrInstGen *result_loc;4498 IrInstGen *result_loc;
4499 ZigFn *target_fn;4499 ZigFn *target_fn;
4500 bool is_noasync;4500 bool is_nosuspend;
4501};4501};
45024502
4503struct IrInstSrcResume {4503struct IrInstSrcResume {
src/analyze.cpp+9-9
...@@ -106,7 +106,7 @@ static ScopeExpr *find_expr_scope(Scope *scope) {...@@ -106,7 +106,7 @@ static ScopeExpr *find_expr_scope(Scope *scope) {
106 case ScopeIdDecls:106 case ScopeIdDecls:
107 case ScopeIdFnDef:107 case ScopeIdFnDef:
108 case ScopeIdCompTime:108 case ScopeIdCompTime:
109 case ScopeIdNoAsync:109 case ScopeIdNoSuspend:
110 case ScopeIdVarDecl:110 case ScopeIdVarDecl:
111 case ScopeIdCImport:111 case ScopeIdCImport:
112 case ScopeIdSuspend:112 case ScopeIdSuspend:
...@@ -227,9 +227,9 @@ Scope *create_comptime_scope(CodeGen *g, AstNode *node, Scope *parent) {...@@ -227,9 +227,9 @@ Scope *create_comptime_scope(CodeGen *g, AstNode *node, Scope *parent) {
227 return &scope->base;227 return &scope->base;
228}228}
229229
230Scope *create_noasync_scope(CodeGen *g, AstNode *node, Scope *parent) {230Scope *create_nosuspend_scope(CodeGen *g, AstNode *node, Scope *parent) {
231 ScopeNoAsync *scope = heap::c_allocator.create<ScopeNoAsync>();231 ScopeNoSuspend *scope = heap::c_allocator.create<ScopeNoSuspend>();
232 init_scope(g, &scope->base, ScopeIdNoAsync, node, parent);232 init_scope(g, &scope->base, ScopeIdNoSuspend, node, parent);
233 return &scope->base;233 return &scope->base;
234}234}
235235
...@@ -3771,7 +3771,7 @@ void scan_decls(CodeGen *g, ScopeDecls *decls_scope, AstNode *node) {...@@ -3771,7 +3771,7 @@ void scan_decls(CodeGen *g, ScopeDecls *decls_scope, AstNode *node) {
3771 case NodeTypeCompTime:3771 case NodeTypeCompTime:
3772 preview_comptime_decl(g, node, decls_scope);3772 preview_comptime_decl(g, node, decls_scope);
3773 break;3773 break;
3774 case NodeTypeNoAsync:3774 case NodeTypeNoSuspend:
3775 case NodeTypeParamDecl:3775 case NodeTypeParamDecl:
3776 case NodeTypeReturnExpr:3776 case NodeTypeReturnExpr:
3777 case NodeTypeDefer:3777 case NodeTypeDefer:
...@@ -4689,7 +4689,7 @@ void add_async_error_notes(CodeGen *g, ErrorMsg *msg, ZigFn *fn) {...@@ -4689,7 +4689,7 @@ void add_async_error_notes(CodeGen *g, ErrorMsg *msg, ZigFn *fn) {
4689static Error analyze_callee_async(CodeGen *g, ZigFn *fn, ZigFn *callee, AstNode *call_node,4689static Error analyze_callee_async(CodeGen *g, ZigFn *fn, ZigFn *callee, AstNode *call_node,
4690 bool must_not_be_async, CallModifier modifier)4690 bool must_not_be_async, CallModifier modifier)
4691{4691{
4692 if (modifier == CallModifierNoAsync)4692 if (modifier == CallModifierNoSuspend)
4693 return ErrorNone;4693 return ErrorNone;
4694 bool callee_is_async = false;4694 bool callee_is_async = false;
4695 switch (callee->type_entry->data.fn.fn_type_id.cc) {4695 switch (callee->type_entry->data.fn.fn_type_id.cc) {
...@@ -4812,7 +4812,7 @@ static void analyze_fn_async(CodeGen *g, ZigFn *fn, bool resolve_frame) {...@@ -4812,7 +4812,7 @@ static void analyze_fn_async(CodeGen *g, ZigFn *fn, bool resolve_frame) {
4812 }4812 }
4813 for (size_t i = 0; i < fn->await_list.length; i += 1) {4813 for (size_t i = 0; i < fn->await_list.length; i += 1) {
4814 IrInstGenAwait *await = fn->await_list.at(i);4814 IrInstGenAwait *await = fn->await_list.at(i);
4815 if (await->is_noasync) continue;4815 if (await->is_nosuspend) continue;
4816 switch (analyze_callee_async(g, fn, await->target_fn, await->base.base.source_node, must_not_be_async,4816 switch (analyze_callee_async(g, fn, await->target_fn, await->base.base.source_node, must_not_be_async,
4817 CallModifierNone))4817 CallModifierNone))
4818 {4818 {
...@@ -6239,7 +6239,7 @@ static void mark_suspension_point(Scope *scope) {...@@ -6239,7 +6239,7 @@ static void mark_suspension_point(Scope *scope) {
6239 case ScopeIdDecls:6239 case ScopeIdDecls:
6240 case ScopeIdFnDef:6240 case ScopeIdFnDef:
6241 case ScopeIdCompTime:6241 case ScopeIdCompTime:
6242 case ScopeIdNoAsync:6242 case ScopeIdNoSuspend:
6243 case ScopeIdCImport:6243 case ScopeIdCImport:
6244 case ScopeIdSuspend:6244 case ScopeIdSuspend:
6245 case ScopeIdTypeOf:6245 case ScopeIdTypeOf:
...@@ -6472,7 +6472,7 @@ static Error resolve_async_frame(CodeGen *g, ZigType *frame_type) {...@@ -6472,7 +6472,7 @@ static Error resolve_async_frame(CodeGen *g, ZigType *frame_type) {
6472 // The funtion call result of foo() must be spilled.6472 // The funtion call result of foo() must be spilled.
6473 for (size_t i = 0; i < fn->await_list.length; i += 1) {6473 for (size_t i = 0; i < fn->await_list.length; i += 1) {
6474 IrInstGenAwait *await = fn->await_list.at(i);6474 IrInstGenAwait *await = fn->await_list.at(i);
6475 if (await->is_noasync) {6475 if (await->is_nosuspend) {
6476 continue;6476 continue;
6477 }6477 }
6478 if (await->base.value->special != ConstValSpecialRuntime) {6478 if (await->base.value->special != ConstValSpecialRuntime) {
src/analyze.hpp+1-1
...@@ -125,7 +125,7 @@ ScopeLoop *create_loop_scope(CodeGen *g, AstNode *node, Scope *parent);...@@ -125,7 +125,7 @@ ScopeLoop *create_loop_scope(CodeGen *g, AstNode *node, Scope *parent);
125ScopeSuspend *create_suspend_scope(CodeGen *g, AstNode *node, Scope *parent);125ScopeSuspend *create_suspend_scope(CodeGen *g, AstNode *node, Scope *parent);
126ScopeFnDef *create_fndef_scope(CodeGen *g, AstNode *node, Scope *parent, ZigFn *fn_entry);126ScopeFnDef *create_fndef_scope(CodeGen *g, AstNode *node, Scope *parent, ZigFn *fn_entry);
127Scope *create_comptime_scope(CodeGen *g, AstNode *node, Scope *parent);127Scope *create_comptime_scope(CodeGen *g, AstNode *node, Scope *parent);
128Scope *create_noasync_scope(CodeGen *g, AstNode *node, Scope *parent);128Scope *create_nosuspend_scope(CodeGen *g, AstNode *node, Scope *parent);
129Scope *create_runtime_scope(CodeGen *g, AstNode *node, Scope *parent, IrInstSrc *is_comptime);129Scope *create_runtime_scope(CodeGen *g, AstNode *node, Scope *parent, IrInstSrc *is_comptime);
130Scope *create_typeof_scope(CodeGen *g, AstNode *node, Scope *parent);130Scope *create_typeof_scope(CodeGen *g, AstNode *node, Scope *parent);
131ScopeExpr *create_expr_scope(CodeGen *g, AstNode *node, Scope *parent);131ScopeExpr *create_expr_scope(CodeGen *g, AstNode *node, Scope *parent);
src/ast_render.cpp+7-7
...@@ -220,8 +220,8 @@ static const char *node_type_str(NodeType node_type) {...@@ -220,8 +220,8 @@ static const char *node_type_str(NodeType node_type) {
220 return "SwitchRange";220 return "SwitchRange";
221 case NodeTypeCompTime:221 case NodeTypeCompTime:
222 return "CompTime";222 return "CompTime";
223 case NodeTypeNoAsync:223 case NodeTypeNoSuspend:
224 return "NoAsync";224 return "NoSuspend";
225 case NodeTypeBreak:225 case NodeTypeBreak:
226 return "Break";226 return "Break";
227 case NodeTypeContinue:227 case NodeTypeContinue:
...@@ -709,8 +709,8 @@ static void render_node_extra(AstRender *ar, AstNode *node, bool grouped) {...@@ -709,8 +709,8 @@ static void render_node_extra(AstRender *ar, AstNode *node, bool grouped) {
709 switch (node->data.fn_call_expr.modifier) {709 switch (node->data.fn_call_expr.modifier) {
710 case CallModifierNone:710 case CallModifierNone:
711 break;711 break;
712 case CallModifierNoAsync:712 case CallModifierNoSuspend:
713 fprintf(ar->f, "noasync ");713 fprintf(ar->f, "nosuspend ");
714 break;714 break;
715 case CallModifierAsync:715 case CallModifierAsync:
716 fprintf(ar->f, "async ");716 fprintf(ar->f, "async ");
...@@ -1093,10 +1093,10 @@ static void render_node_extra(AstRender *ar, AstNode *node, bool grouped) {...@@ -1093,10 +1093,10 @@ static void render_node_extra(AstRender *ar, AstNode *node, bool grouped) {
1093 render_node_grouped(ar, node->data.comptime_expr.expr);1093 render_node_grouped(ar, node->data.comptime_expr.expr);
1094 break;1094 break;
1095 }1095 }
1096 case NodeTypeNoAsync:1096 case NodeTypeNoSuspend:
1097 {1097 {
1098 fprintf(ar->f, "noasync ");1098 fprintf(ar->f, "nosuspend ");
1099 render_node_grouped(ar, node->data.noasync_expr.expr);1099 render_node_grouped(ar, node->data.nosuspend_expr.expr);
1100 break;1100 break;
1101 }1101 }
1102 case NodeTypeForExpr:1102 case NodeTypeForExpr:
src/codegen.cpp+15-15
...@@ -685,7 +685,7 @@ static ZigLLVMDIScope *get_di_scope(CodeGen *g, Scope *scope) {...@@ -685,7 +685,7 @@ static ZigLLVMDIScope *get_di_scope(CodeGen *g, Scope *scope) {
685 case ScopeIdLoop:685 case ScopeIdLoop:
686 case ScopeIdSuspend:686 case ScopeIdSuspend:
687 case ScopeIdCompTime:687 case ScopeIdCompTime:
688 case ScopeIdNoAsync:688 case ScopeIdNoSuspend:
689 case ScopeIdRuntime:689 case ScopeIdRuntime:
690 case ScopeIdTypeOf:690 case ScopeIdTypeOf:
691 case ScopeIdExpr:691 case ScopeIdExpr:
...@@ -966,8 +966,8 @@ static Buf *panic_msg_buf(PanicMsgId msg_id) {...@@ -966,8 +966,8 @@ static Buf *panic_msg_buf(PanicMsgId msg_id) {
966 return buf_create_from_str("frame too small");966 return buf_create_from_str("frame too small");
967 case PanicMsgIdResumedFnPendingAwait:967 case PanicMsgIdResumedFnPendingAwait:
968 return buf_create_from_str("resumed an async function which can only be awaited");968 return buf_create_from_str("resumed an async function which can only be awaited");
969 case PanicMsgIdBadNoAsyncCall:969 case PanicMsgIdBadNoSuspendCall:
970 return buf_create_from_str("async function called in noasync scope suspended");970 return buf_create_from_str("async function called in nosuspend scope suspended");
971 case PanicMsgIdResumeNotSuspendedFn:971 case PanicMsgIdResumeNotSuspendedFn:
972 return buf_create_from_str("resumed a non-suspended function");972 return buf_create_from_str("resumed a non-suspended function");
973 case PanicMsgIdBadSentinel:973 case PanicMsgIdBadSentinel:
...@@ -4061,7 +4061,7 @@ static void render_async_var_decls(CodeGen *g, Scope *scope) {...@@ -4061,7 +4061,7 @@ static void render_async_var_decls(CodeGen *g, Scope *scope) {
4061 case ScopeIdLoop:4061 case ScopeIdLoop:
4062 case ScopeIdSuspend:4062 case ScopeIdSuspend:
4063 case ScopeIdCompTime:4063 case ScopeIdCompTime:
4064 case ScopeIdNoAsync:4064 case ScopeIdNoSuspend:
4065 case ScopeIdRuntime:4065 case ScopeIdRuntime:
4066 case ScopeIdTypeOf:4066 case ScopeIdTypeOf:
4067 case ScopeIdExpr:4067 case ScopeIdExpr:
...@@ -4212,9 +4212,9 @@ static LLVMValueRef ir_render_call(CodeGen *g, IrExecutableGen *executable, IrIn...@@ -4212,9 +4212,9 @@ static LLVMValueRef ir_render_call(CodeGen *g, IrExecutableGen *executable, IrIn
4212 // even if prefix_arg_err_ret_stack is true, let the async function do its own4212 // even if prefix_arg_err_ret_stack is true, let the async function do its own
4213 // initialization.4213 // initialization.
4214 } else {4214 } else {
4215 if (instruction->modifier == CallModifierNoAsync && !fn_is_async(g->cur_fn)) {4215 if (instruction->modifier == CallModifierNoSuspend && !fn_is_async(g->cur_fn)) {
4216 // Async function called as a normal function, and calling function is not async.4216 // Async function called as a normal function, and calling function is not async.
4217 // This is allowed because it was called with `noasync` which asserts that it will4217 // This is allowed because it was called with `nosuspend` which asserts that it will
4218 // never suspend.4218 // never suspend.
4219 awaiter_init_val = zero;4219 awaiter_init_val = zero;
4220 } else {4220 } else {
...@@ -4325,7 +4325,7 @@ static LLVMValueRef ir_render_call(CodeGen *g, IrExecutableGen *executable, IrIn...@@ -4325,7 +4325,7 @@ static LLVMValueRef ir_render_call(CodeGen *g, IrExecutableGen *executable, IrIn
4325 case CallModifierCompileTime:4325 case CallModifierCompileTime:
4326 zig_unreachable();4326 zig_unreachable();
4327 case CallModifierNone:4327 case CallModifierNone:
4328 case CallModifierNoAsync:4328 case CallModifierNoSuspend:
4329 case CallModifierAsync:4329 case CallModifierAsync:
4330 call_attr = ZigLLVM_CallAttrAuto;4330 call_attr = ZigLLVM_CallAttrAuto;
4331 break;4331 break;
...@@ -4401,7 +4401,7 @@ static LLVMValueRef ir_render_call(CodeGen *g, IrExecutableGen *executable, IrIn...@@ -4401,7 +4401,7 @@ static LLVMValueRef ir_render_call(CodeGen *g, IrExecutableGen *executable, IrIn
4401 get_llvm_type(g, instruction->base.value->type), "");4401 get_llvm_type(g, instruction->base.value->type), "");
4402 }4402 }
4403 return nullptr;4403 return nullptr;
4404 } else if (instruction->modifier == CallModifierNoAsync && !fn_is_async(g->cur_fn)) {4404 } else if (instruction->modifier == CallModifierNoSuspend && !fn_is_async(g->cur_fn)) {
4405 gen_resume(g, fn_val, frame_result_loc, ResumeIdCall);4405 gen_resume(g, fn_val, frame_result_loc, ResumeIdCall);
44064406
4407 if (ir_want_runtime_safety(g, &instruction->base)) {4407 if (ir_want_runtime_safety(g, &instruction->base)) {
...@@ -4412,13 +4412,13 @@ static LLVMValueRef ir_render_call(CodeGen *g, IrExecutableGen *executable, IrIn...@@ -4412,13 +4412,13 @@ static LLVMValueRef ir_render_call(CodeGen *g, IrExecutableGen *executable, IrIn
4412 all_ones, LLVMAtomicOrderingRelease);4412 all_ones, LLVMAtomicOrderingRelease);
4413 LLVMValueRef ok_val = LLVMBuildICmp(g->builder, LLVMIntEQ, prev_val, all_ones, "");4413 LLVMValueRef ok_val = LLVMBuildICmp(g->builder, LLVMIntEQ, prev_val, all_ones, "");
44144414
4415 LLVMBasicBlockRef bad_block = LLVMAppendBasicBlock(g->cur_fn_val, "NoAsyncPanic");4415 LLVMBasicBlockRef bad_block = LLVMAppendBasicBlock(g->cur_fn_val, "NoSuspendPanic");
4416 LLVMBasicBlockRef ok_block = LLVMAppendBasicBlock(g->cur_fn_val, "NoAsyncOk");4416 LLVMBasicBlockRef ok_block = LLVMAppendBasicBlock(g->cur_fn_val, "NoSuspendOk");
4417 LLVMBuildCondBr(g->builder, ok_val, ok_block, bad_block);4417 LLVMBuildCondBr(g->builder, ok_val, ok_block, bad_block);
44184418
4419 // The async function suspended, but this noasync call asserted it wouldn't.4419 // The async function suspended, but this nosuspend call asserted it wouldn't.
4420 LLVMPositionBuilderAtEnd(g->builder, bad_block);4420 LLVMPositionBuilderAtEnd(g->builder, bad_block);
4421 gen_safety_crash(g, PanicMsgIdBadNoAsyncCall);4421 gen_safety_crash(g, PanicMsgIdBadNoSuspendCall);
44224422
4423 LLVMPositionBuilderAtEnd(g->builder, ok_block);4423 LLVMPositionBuilderAtEnd(g->builder, ok_block);
4424 }4424 }
...@@ -6391,7 +6391,7 @@ static LLVMValueRef ir_render_await(CodeGen *g, IrExecutableGen *executable, IrI...@@ -6391,7 +6391,7 @@ static LLVMValueRef ir_render_await(CodeGen *g, IrExecutableGen *executable, IrI
6391 LLVMValueRef result_loc = (instruction->result_loc == nullptr) ?6391 LLVMValueRef result_loc = (instruction->result_loc == nullptr) ?
6392 nullptr : ir_llvm_value(g, instruction->result_loc);6392 nullptr : ir_llvm_value(g, instruction->result_loc);
63936393
6394 if (instruction->is_noasync ||6394 if (instruction->is_nosuspend ||
6395 (instruction->target_fn != nullptr && !fn_is_async(instruction->target_fn)))6395 (instruction->target_fn != nullptr && !fn_is_async(instruction->target_fn)))
6396 {6396 {
6397 return gen_await_early_return(g, &instruction->base, target_frame_ptr, result_type,6397 return gen_await_early_return(g, &instruction->base, target_frame_ptr, result_type,
...@@ -7918,7 +7918,7 @@ static void do_code_gen(CodeGen *g) {...@@ -7918,7 +7918,7 @@ static void do_code_gen(CodeGen *g) {
7918 }7918 }
79197919
7920 if (!is_async) {7920 if (!is_async) {
7921 // allocate async frames for noasync calls & awaits to async functions7921 // allocate async frames for nosuspend calls & awaits to async functions
7922 ZigType *largest_call_frame_type = nullptr;7922 ZigType *largest_call_frame_type = nullptr;
7923 IrInstGen *all_calls_alloca = ir_create_alloca(g, &fn_table_entry->fndef_scope->base,7923 IrInstGen *all_calls_alloca = ir_create_alloca(g, &fn_table_entry->fndef_scope->base,
7924 fn_table_entry->body_node, fn_table_entry, g->builtin_types.entry_void, "@async_call_frame");7924 fn_table_entry->body_node, fn_table_entry, g->builtin_types.entry_void, "@async_call_frame");
...@@ -7928,7 +7928,7 @@ static void do_code_gen(CodeGen *g) {...@@ -7928,7 +7928,7 @@ static void do_code_gen(CodeGen *g) {
7928 continue;7928 continue;
7929 if (!fn_is_async(call->fn_entry))7929 if (!fn_is_async(call->fn_entry))
7930 continue;7930 continue;
7931 if (call->modifier != CallModifierNoAsync)7931 if (call->modifier != CallModifierNoSuspend)
7932 continue;7932 continue;
7933 if (call->frame_result_loc != nullptr)7933 if (call->frame_result_loc != nullptr)
7934 continue;7934 continue;
src/ir.cpp+30-30
...@@ -4846,12 +4846,12 @@ static IrInstGen *ir_build_suspend_finish_gen(IrAnalyze *ira, IrInst *source_ins...@@ -4846,12 +4846,12 @@ static IrInstGen *ir_build_suspend_finish_gen(IrAnalyze *ira, IrInst *source_ins
4846}4846}
48474847
4848static IrInstSrc *ir_build_await_src(IrBuilderSrc *irb, Scope *scope, AstNode *source_node,4848static IrInstSrc *ir_build_await_src(IrBuilderSrc *irb, Scope *scope, AstNode *source_node,
4849 IrInstSrc *frame, ResultLoc *result_loc, bool is_noasync)4849 IrInstSrc *frame, ResultLoc *result_loc, bool is_nosuspend)
4850{4850{
4851 IrInstSrcAwait *instruction = ir_build_instruction<IrInstSrcAwait>(irb, scope, source_node);4851 IrInstSrcAwait *instruction = ir_build_instruction<IrInstSrcAwait>(irb, scope, source_node);
4852 instruction->frame = frame;4852 instruction->frame = frame;
4853 instruction->result_loc = result_loc;4853 instruction->result_loc = result_loc;
4854 instruction->is_noasync = is_noasync;4854 instruction->is_nosuspend = is_nosuspend;
48554855
4856 ir_ref_instruction(frame, irb->current_basic_block);4856 ir_ref_instruction(frame, irb->current_basic_block);
48574857
...@@ -4859,14 +4859,14 @@ static IrInstSrc *ir_build_await_src(IrBuilderSrc *irb, Scope *scope, AstNode *s...@@ -4859,14 +4859,14 @@ static IrInstSrc *ir_build_await_src(IrBuilderSrc *irb, Scope *scope, AstNode *s
4859}4859}
48604860
4861static IrInstGenAwait *ir_build_await_gen(IrAnalyze *ira, IrInst *source_instruction,4861static IrInstGenAwait *ir_build_await_gen(IrAnalyze *ira, IrInst *source_instruction,
4862 IrInstGen *frame, ZigType *result_type, IrInstGen *result_loc, bool is_noasync)4862 IrInstGen *frame, ZigType *result_type, IrInstGen *result_loc, bool is_nosuspend)
4863{4863{
4864 IrInstGenAwait *instruction = ir_build_inst_gen<IrInstGenAwait>(&ira->new_irb,4864 IrInstGenAwait *instruction = ir_build_inst_gen<IrInstGenAwait>(&ira->new_irb,
4865 source_instruction->scope, source_instruction->source_node);4865 source_instruction->scope, source_instruction->source_node);
4866 instruction->base.value->type = result_type;4866 instruction->base.value->type = result_type;
4867 instruction->frame = frame;4867 instruction->frame = frame;
4868 instruction->result_loc = result_loc;4868 instruction->result_loc = result_loc;
4869 instruction->is_noasync = is_noasync;4869 instruction->is_nosuspend = is_nosuspend;
48704870
4871 ir_ref_inst_gen(frame);4871 ir_ref_inst_gen(frame);
4872 if (result_loc != nullptr) ir_ref_inst_gen(result_loc);4872 if (result_loc != nullptr) ir_ref_inst_gen(result_loc);
...@@ -4982,7 +4982,7 @@ static void ir_count_defers(IrBuilderSrc *irb, Scope *inner_scope, Scope *outer_...@@ -4982,7 +4982,7 @@ static void ir_count_defers(IrBuilderSrc *irb, Scope *inner_scope, Scope *outer_
4982 case ScopeIdLoop:4982 case ScopeIdLoop:
4983 case ScopeIdSuspend:4983 case ScopeIdSuspend:
4984 case ScopeIdCompTime:4984 case ScopeIdCompTime:
4985 case ScopeIdNoAsync:4985 case ScopeIdNoSuspend:
4986 case ScopeIdRuntime:4986 case ScopeIdRuntime:
4987 case ScopeIdTypeOf:4987 case ScopeIdTypeOf:
4988 case ScopeIdExpr:4988 case ScopeIdExpr:
...@@ -5072,7 +5072,7 @@ static bool ir_gen_defers_for_block(IrBuilderSrc *irb, Scope *inner_scope, Scope...@@ -5072,7 +5072,7 @@ static bool ir_gen_defers_for_block(IrBuilderSrc *irb, Scope *inner_scope, Scope
5072 case ScopeIdLoop:5072 case ScopeIdLoop:
5073 case ScopeIdSuspend:5073 case ScopeIdSuspend:
5074 case ScopeIdCompTime:5074 case ScopeIdCompTime:
5075 case ScopeIdNoAsync:5075 case ScopeIdNoSuspend:
5076 case ScopeIdRuntime:5076 case ScopeIdRuntime:
5077 case ScopeIdTypeOf:5077 case ScopeIdTypeOf:
5078 case ScopeIdExpr:5078 case ScopeIdExpr:
...@@ -7335,10 +7335,10 @@ static IrInstSrc *ir_gen_builtin_fn_call(IrBuilderSrc *irb, Scope *scope, AstNod...@@ -7335,10 +7335,10 @@ static IrInstSrc *ir_gen_builtin_fn_call(IrBuilderSrc *irb, Scope *scope, AstNod
7335 zig_unreachable();7335 zig_unreachable();
7336}7336}
73377337
7338static ScopeNoAsync *get_scope_noasync(Scope *scope) {7338static ScopeNoSuspend *get_scope_nosuspend(Scope *scope) {
7339 while (scope) {7339 while (scope) {
7340 if (scope->id == ScopeIdNoAsync)7340 if (scope->id == ScopeIdNoSuspend)
7341 return (ScopeNoAsync *)scope;7341 return (ScopeNoSuspend *)scope;
7342 if (scope->id == ScopeIdFnDef)7342 if (scope->id == ScopeIdFnDef)
7343 return nullptr;7343 return nullptr;
73447344
...@@ -7355,15 +7355,15 @@ static IrInstSrc *ir_gen_fn_call(IrBuilderSrc *irb, Scope *scope, AstNode *node,...@@ -7355,15 +7355,15 @@ static IrInstSrc *ir_gen_fn_call(IrBuilderSrc *irb, Scope *scope, AstNode *node,
7355 if (node->data.fn_call_expr.modifier == CallModifierBuiltin)7355 if (node->data.fn_call_expr.modifier == CallModifierBuiltin)
7356 return ir_gen_builtin_fn_call(irb, scope, node, lval, result_loc);7356 return ir_gen_builtin_fn_call(irb, scope, node, lval, result_loc);
73577357
7358 bool is_noasync = get_scope_noasync(scope) != nullptr;7358 bool is_nosuspend = get_scope_nosuspend(scope) != nullptr;
7359 CallModifier modifier = node->data.fn_call_expr.modifier;7359 CallModifier modifier = node->data.fn_call_expr.modifier;
7360 if (is_noasync) {7360 if (is_nosuspend) {
7361 if (modifier == CallModifierAsync) {7361 if (modifier == CallModifierAsync) {
7362 add_node_error(irb->codegen, node,7362 add_node_error(irb->codegen, node,
7363 buf_sprintf("async call in noasync scope"));7363 buf_sprintf("async call in nosuspend scope"));
7364 return irb->codegen->invalid_inst_src;7364 return irb->codegen->invalid_inst_src;
7365 }7365 }
7366 modifier = CallModifierNoAsync;7366 modifier = CallModifierNoSuspend;
7367 }7367 }
73687368
7369 AstNode *fn_ref_node = node->data.fn_call_expr.fn_ref_expr;7369 AstNode *fn_ref_node = node->data.fn_call_expr.fn_ref_expr;
...@@ -9222,10 +9222,10 @@ static IrInstSrc *ir_gen_comptime(IrBuilderSrc *irb, Scope *parent_scope, AstNod...@@ -9222,10 +9222,10 @@ static IrInstSrc *ir_gen_comptime(IrBuilderSrc *irb, Scope *parent_scope, AstNod
9222 return ir_gen_node_extra(irb, node->data.comptime_expr.expr, child_scope, lval, nullptr);9222 return ir_gen_node_extra(irb, node->data.comptime_expr.expr, child_scope, lval, nullptr);
9223}9223}
92249224
9225static IrInstSrc *ir_gen_noasync(IrBuilderSrc *irb, Scope *parent_scope, AstNode *node, LVal lval) {9225static IrInstSrc *ir_gen_nosuspend(IrBuilderSrc *irb, Scope *parent_scope, AstNode *node, LVal lval) {
9226 assert(node->type == NodeTypeNoAsync);9226 assert(node->type == NodeTypeNoSuspend);
92279227
9228 Scope *child_scope = create_noasync_scope(irb->codegen, node, parent_scope);9228 Scope *child_scope = create_nosuspend_scope(irb->codegen, node, parent_scope);
9229 // purposefully pass null for result_loc and let EndExpr handle it9229 // purposefully pass null for result_loc and let EndExpr handle it
9230 return ir_gen_node_extra(irb, node->data.comptime_expr.expr, child_scope, lval, nullptr);9230 return ir_gen_node_extra(irb, node->data.comptime_expr.expr, child_scope, lval, nullptr);
9231}9231}
...@@ -9813,8 +9813,8 @@ static IrInstSrc *ir_gen_fn_proto(IrBuilderSrc *irb, Scope *parent_scope, AstNod...@@ -9813,8 +9813,8 @@ static IrInstSrc *ir_gen_fn_proto(IrBuilderSrc *irb, Scope *parent_scope, AstNod
98139813
9814static IrInstSrc *ir_gen_resume(IrBuilderSrc *irb, Scope *scope, AstNode *node) {9814static IrInstSrc *ir_gen_resume(IrBuilderSrc *irb, Scope *scope, AstNode *node) {
9815 assert(node->type == NodeTypeResume);9815 assert(node->type == NodeTypeResume);
9816 if (get_scope_noasync(scope) != nullptr) {9816 if (get_scope_nosuspend(scope) != nullptr) {
9817 add_node_error(irb->codegen, node, buf_sprintf("resume in noasync scope"));9817 add_node_error(irb->codegen, node, buf_sprintf("resume in nosuspend scope"));
9818 return irb->codegen->invalid_inst_src;9818 return irb->codegen->invalid_inst_src;
9819 }9819 }
98209820
...@@ -9830,7 +9830,7 @@ static IrInstSrc *ir_gen_await_expr(IrBuilderSrc *irb, Scope *scope, AstNode *no...@@ -9830,7 +9830,7 @@ static IrInstSrc *ir_gen_await_expr(IrBuilderSrc *irb, Scope *scope, AstNode *no
9830{9830{
9831 assert(node->type == NodeTypeAwaitExpr);9831 assert(node->type == NodeTypeAwaitExpr);
98329832
9833 bool is_noasync = get_scope_noasync(scope) != nullptr;9833 bool is_nosuspend = get_scope_nosuspend(scope) != nullptr;
98349834
9835 AstNode *expr_node = node->data.await_expr.expr;9835 AstNode *expr_node = node->data.await_expr.expr;
9836 if (expr_node->type == NodeTypeFnCallExpr && expr_node->data.fn_call_expr.modifier == CallModifierBuiltin) {9836 if (expr_node->type == NodeTypeFnCallExpr && expr_node->data.fn_call_expr.modifier == CallModifierBuiltin) {
...@@ -9864,7 +9864,7 @@ static IrInstSrc *ir_gen_await_expr(IrBuilderSrc *irb, Scope *scope, AstNode *no...@@ -9864,7 +9864,7 @@ static IrInstSrc *ir_gen_await_expr(IrBuilderSrc *irb, Scope *scope, AstNode *no
9864 if (target_inst == irb->codegen->invalid_inst_src)9864 if (target_inst == irb->codegen->invalid_inst_src)
9865 return irb->codegen->invalid_inst_src;9865 return irb->codegen->invalid_inst_src;
98669866
9867 IrInstSrc *await_inst = ir_build_await_src(irb, scope, node, target_inst, result_loc, is_noasync);9867 IrInstSrc *await_inst = ir_build_await_src(irb, scope, node, target_inst, result_loc, is_nosuspend);
9868 return ir_lval_wrap(irb, scope, await_inst, lval, result_loc);9868 return ir_lval_wrap(irb, scope, await_inst, lval, result_loc);
9869}9869}
98709870
...@@ -9876,8 +9876,8 @@ static IrInstSrc *ir_gen_suspend(IrBuilderSrc *irb, Scope *parent_scope, AstNode...@@ -9876,8 +9876,8 @@ static IrInstSrc *ir_gen_suspend(IrBuilderSrc *irb, Scope *parent_scope, AstNode
9876 add_node_error(irb->codegen, node, buf_sprintf("suspend outside function definition"));9876 add_node_error(irb->codegen, node, buf_sprintf("suspend outside function definition"));
9877 return irb->codegen->invalid_inst_src;9877 return irb->codegen->invalid_inst_src;
9878 }9878 }
9879 if (get_scope_noasync(parent_scope) != nullptr) {9879 if (get_scope_nosuspend(parent_scope) != nullptr) {
9880 add_node_error(irb->codegen, node, buf_sprintf("suspend in noasync scope"));9880 add_node_error(irb->codegen, node, buf_sprintf("suspend in nosuspend scope"));
9881 return irb->codegen->invalid_inst_src;9881 return irb->codegen->invalid_inst_src;
9882 }9882 }
98839883
...@@ -10017,8 +10017,8 @@ static IrInstSrc *ir_gen_node_raw(IrBuilderSrc *irb, AstNode *node, Scope *scope...@@ -10017,8 +10017,8 @@ static IrInstSrc *ir_gen_node_raw(IrBuilderSrc *irb, AstNode *node, Scope *scope
10017 return ir_gen_switch_expr(irb, scope, node, lval, result_loc);10017 return ir_gen_switch_expr(irb, scope, node, lval, result_loc);
10018 case NodeTypeCompTime:10018 case NodeTypeCompTime:
10019 return ir_expr_wrap(irb, scope, ir_gen_comptime(irb, scope, node, lval), result_loc);10019 return ir_expr_wrap(irb, scope, ir_gen_comptime(irb, scope, node, lval), result_loc);
10020 case NodeTypeNoAsync:10020 case NodeTypeNoSuspend:
10021 return ir_expr_wrap(irb, scope, ir_gen_noasync(irb, scope, node, lval), result_loc);10021 return ir_expr_wrap(irb, scope, ir_gen_nosuspend(irb, scope, node, lval), result_loc);
10022 case NodeTypeErrorType:10022 case NodeTypeErrorType:
10023 return ir_lval_wrap(irb, scope, ir_gen_error_type(irb, scope, node), lval, result_loc);10023 return ir_lval_wrap(irb, scope, ir_gen_error_type(irb, scope, node), lval, result_loc);
10024 case NodeTypeBreak:10024 case NodeTypeBreak:
...@@ -10105,7 +10105,7 @@ static IrInstSrc *ir_gen_node_extra(IrBuilderSrc *irb, AstNode *node, Scope *sco...@@ -10105,7 +10105,7 @@ static IrInstSrc *ir_gen_node_extra(IrBuilderSrc *irb, AstNode *node, Scope *sco
10105 case NodeTypeIfOptional:10105 case NodeTypeIfOptional:
10106 case NodeTypeSwitchExpr:10106 case NodeTypeSwitchExpr:
10107 case NodeTypeCompTime:10107 case NodeTypeCompTime:
10108 case NodeTypeNoAsync:10108 case NodeTypeNoSuspend:
10109 case NodeTypeErrorType:10109 case NodeTypeErrorType:
10110 case NodeTypeBreak:10110 case NodeTypeBreak:
10111 case NodeTypeContinue:10111 case NodeTypeContinue:
...@@ -20025,7 +20025,7 @@ static IrInstGen *ir_analyze_fn_call(IrAnalyze *ira, IrInst* source_instr,...@@ -20025,7 +20025,7 @@ static IrInstGen *ir_analyze_fn_call(IrAnalyze *ira, IrInst* source_instr,
2002520025
20026 if (impl_fn_type_id->cc == CallingConventionAsync &&20026 if (impl_fn_type_id->cc == CallingConventionAsync &&
20027 parent_fn_entry->inferred_async_node == nullptr &&20027 parent_fn_entry->inferred_async_node == nullptr &&
20028 modifier != CallModifierNoAsync)20028 modifier != CallModifierNoSuspend)
20029 {20029 {
20030 parent_fn_entry->inferred_async_node = fn_ref->base.source_node;20030 parent_fn_entry->inferred_async_node = fn_ref->base.source_node;
20031 parent_fn_entry->inferred_async_fn = impl_fn;20031 parent_fn_entry->inferred_async_fn = impl_fn;
...@@ -20123,7 +20123,7 @@ static IrInstGen *ir_analyze_fn_call(IrAnalyze *ira, IrInst* source_instr,...@@ -20123,7 +20123,7 @@ static IrInstGen *ir_analyze_fn_call(IrAnalyze *ira, IrInst* source_instr,
2012320123
20124 if (fn_type_id->cc == CallingConventionAsync &&20124 if (fn_type_id->cc == CallingConventionAsync &&
20125 parent_fn_entry->inferred_async_node == nullptr &&20125 parent_fn_entry->inferred_async_node == nullptr &&
20126 modifier != CallModifierNoAsync)20126 modifier != CallModifierNoSuspend)
20127 {20127 {
20128 parent_fn_entry->inferred_async_node = fn_ref->base.source_node;20128 parent_fn_entry->inferred_async_node = fn_ref->base.source_node;
20129 parent_fn_entry->inferred_async_fn = fn_entry;20129 parent_fn_entry->inferred_async_fn = fn_entry;
...@@ -20233,7 +20233,7 @@ static IrInstGen *ir_analyze_call_extra(IrAnalyze *ira, IrInst* source_instr,...@@ -20233,7 +20233,7 @@ static IrInstGen *ir_analyze_call_extra(IrAnalyze *ira, IrInst* source_instr,
20233 case CallModifierNone:20233 case CallModifierNone:
20234 case CallModifierAlwaysInline:20234 case CallModifierAlwaysInline:
20235 case CallModifierAlwaysTail:20235 case CallModifierAlwaysTail:
20236 case CallModifierNoAsync:20236 case CallModifierNoSuspend:
20237 modifier = CallModifierCompileTime;20237 modifier = CallModifierCompileTime;
20238 break;20238 break;
20239 case CallModifierNeverInline:20239 case CallModifierNeverInline:
...@@ -30277,7 +30277,7 @@ static IrInstGen *ir_analyze_instruction_await(IrAnalyze *ira, IrInstSrcAwait *i...@@ -30277,7 +30277,7 @@ static IrInstGen *ir_analyze_instruction_await(IrAnalyze *ira, IrInstSrcAwait *i
30277 ir_assert(fn_entry != nullptr, &instruction->base.base);30277 ir_assert(fn_entry != nullptr, &instruction->base.base);
3027830278
30279 // If it's not @Frame(func) then it's definitely a suspend point30279 // If it's not @Frame(func) then it's definitely a suspend point
30280 if (target_fn == nullptr && !instruction->is_noasync) {30280 if (target_fn == nullptr && !instruction->is_nosuspend) {
30281 if (fn_entry->inferred_async_node == nullptr) {30281 if (fn_entry->inferred_async_node == nullptr) {
30282 fn_entry->inferred_async_node = instruction->base.base.source_node;30282 fn_entry->inferred_async_node = instruction->base.base.source_node;
30283 }30283 }
...@@ -30301,7 +30301,7 @@ static IrInstGen *ir_analyze_instruction_await(IrAnalyze *ira, IrInstSrcAwait *i...@@ -30301,7 +30301,7 @@ static IrInstGen *ir_analyze_instruction_await(IrAnalyze *ira, IrInstSrcAwait *i
30301 }30301 }
3030230302
30303 IrInstGenAwait *result = ir_build_await_gen(ira, &instruction->base.base, frame, result_type, result_loc,30303 IrInstGenAwait *result = ir_build_await_gen(ira, &instruction->base.base, frame, result_type, result_loc,
30304 instruction->is_noasync);30304 instruction->is_nosuspend);
30305 result->target_fn = target_fn;30305 result->target_fn = target_fn;
30306 fn_entry->await_list.append(result);30306 fn_entry->await_list.append(result);
30307 return ir_finish_anal(ira, &result->base);30307 return ir_finish_anal(ira, &result->base);
src/ir_print.cpp+4-4
...@@ -861,8 +861,8 @@ static void ir_print_call_src(IrPrintSrc *irp, IrInstSrcCall *call_instruction)...@@ -861,8 +861,8 @@ static void ir_print_call_src(IrPrintSrc *irp, IrInstSrcCall *call_instruction)
861 switch (call_instruction->modifier) {861 switch (call_instruction->modifier) {
862 case CallModifierNone:862 case CallModifierNone:
863 break;863 break;
864 case CallModifierNoAsync:864 case CallModifierNoSuspend:
865 fprintf(irp->f, "noasync ");865 fprintf(irp->f, "nosuspend ");
866 break;866 break;
867 case CallModifierAsync:867 case CallModifierAsync:
868 fprintf(irp->f, "async ");868 fprintf(irp->f, "async ");
...@@ -906,8 +906,8 @@ static void ir_print_call_gen(IrPrintGen *irp, IrInstGenCall *call_instruction)...@@ -906,8 +906,8 @@ static void ir_print_call_gen(IrPrintGen *irp, IrInstGenCall *call_instruction)
906 switch (call_instruction->modifier) {906 switch (call_instruction->modifier) {
907 case CallModifierNone:907 case CallModifierNone:
908 break;908 break;
909 case CallModifierNoAsync:909 case CallModifierNoSuspend:
910 fprintf(irp->f, "noasync ");910 fprintf(irp->f, "nosuspend ");
911 break;911 break;
912 case CallModifierAsync:912 case CallModifierAsync:
913 fprintf(irp->f, "async ");913 fprintf(irp->f, "async ");
src/parser.cpp+16-16
...@@ -913,7 +913,7 @@ static AstNode *ast_parse_container_field(ParseContext *pc) {...@@ -913,7 +913,7 @@ static AstNode *ast_parse_container_field(ParseContext *pc) {
913// Statement913// Statement
914// <- KEYWORD_comptime? VarDecl914// <- KEYWORD_comptime? VarDecl
915// / KEYWORD_comptime BlockExprStatement915// / KEYWORD_comptime BlockExprStatement
916// / KEYWORD_noasync BlockExprStatement916// / KEYWORD_nosuspend BlockExprStatement
917// / KEYWORD_suspend (SEMICOLON / BlockExprStatement)917// / KEYWORD_suspend (SEMICOLON / BlockExprStatement)
918// / KEYWORD_defer BlockExprStatement918// / KEYWORD_defer BlockExprStatement
919// / KEYWORD_errdefer Payload? BlockExprStatement919// / KEYWORD_errdefer Payload? BlockExprStatement
...@@ -937,11 +937,11 @@ static AstNode *ast_parse_statement(ParseContext *pc) {...@@ -937,11 +937,11 @@ static AstNode *ast_parse_statement(ParseContext *pc) {
937 return res;937 return res;
938 }938 }
939939
940 Token *noasync = eat_token_if(pc, TokenIdKeywordNoAsync);940 Token *nosuspend = eat_token_if(pc, TokenIdKeywordNoSuspend);
941 if (noasync != nullptr) {941 if (nosuspend != nullptr) {
942 AstNode *statement = ast_expect(pc, ast_parse_block_expr_statement);942 AstNode *statement = ast_expect(pc, ast_parse_block_expr_statement);
943 AstNode *res = ast_create_node(pc, NodeTypeNoAsync, noasync);943 AstNode *res = ast_create_node(pc, NodeTypeNoSuspend, nosuspend);
944 res->data.noasync_expr.expr = statement;944 res->data.nosuspend_expr.expr = statement;
945 return res;945 return res;
946 }946 }
947947
...@@ -1289,7 +1289,7 @@ static AstNode *ast_parse_prefix_expr(ParseContext *pc) {...@@ -1289,7 +1289,7 @@ static AstNode *ast_parse_prefix_expr(ParseContext *pc) {
1289// / IfExpr1289// / IfExpr
1290// / KEYWORD_break BreakLabel? Expr?1290// / KEYWORD_break BreakLabel? Expr?
1291// / KEYWORD_comptime Expr1291// / KEYWORD_comptime Expr
1292// / KEYWORD_noasync Expr1292// / KEYWORD_nosuspend Expr
1293// / KEYWORD_continue BreakLabel?1293// / KEYWORD_continue BreakLabel?
1294// / KEYWORD_resume Expr1294// / KEYWORD_resume Expr
1295// / KEYWORD_return Expr?1295// / KEYWORD_return Expr?
...@@ -1324,11 +1324,11 @@ static AstNode *ast_parse_primary_expr(ParseContext *pc) {...@@ -1324,11 +1324,11 @@ static AstNode *ast_parse_primary_expr(ParseContext *pc) {
1324 return res;1324 return res;
1325 }1325 }
13261326
1327 Token *noasync = eat_token_if(pc, TokenIdKeywordNoAsync);1327 Token *nosuspend = eat_token_if(pc, TokenIdKeywordNoSuspend);
1328 if (noasync != nullptr) {1328 if (nosuspend != nullptr) {
1329 AstNode *expr = ast_expect(pc, ast_parse_expr);1329 AstNode *expr = ast_expect(pc, ast_parse_expr);
1330 AstNode *res = ast_create_node(pc, NodeTypeNoAsync, noasync);1330 AstNode *res = ast_create_node(pc, NodeTypeNoSuspend, nosuspend);
1331 res->data.noasync_expr.expr = expr;1331 res->data.nosuspend_expr.expr = expr;
1332 return res;1332 return res;
1333 }1333 }
13341334
...@@ -1640,7 +1640,7 @@ static AstNode *ast_parse_suffix_expr(ParseContext *pc) {...@@ -1640,7 +1640,7 @@ static AstNode *ast_parse_suffix_expr(ParseContext *pc) {
1640// / IfTypeExpr1640// / IfTypeExpr
1641// / INTEGER1641// / INTEGER
1642// / KEYWORD_comptime TypeExpr1642// / KEYWORD_comptime TypeExpr
1643// / KEYWORD_noasync TypeExpr1643// / KEYWORD_nosuspend TypeExpr
1644// / KEYWORD_error DOT IDENTIFIER1644// / KEYWORD_error DOT IDENTIFIER
1645// / KEYWORD_false1645// / KEYWORD_false
1646// / KEYWORD_null1646// / KEYWORD_null
...@@ -1742,11 +1742,11 @@ static AstNode *ast_parse_primary_type_expr(ParseContext *pc) {...@@ -1742,11 +1742,11 @@ static AstNode *ast_parse_primary_type_expr(ParseContext *pc) {
1742 return res;1742 return res;
1743 }1743 }
17441744
1745 Token *noasync = eat_token_if(pc, TokenIdKeywordNoAsync);1745 Token *nosuspend = eat_token_if(pc, TokenIdKeywordNoSuspend);
1746 if (noasync != nullptr) {1746 if (nosuspend != nullptr) {
1747 AstNode *expr = ast_expect(pc, ast_parse_type_expr);1747 AstNode *expr = ast_expect(pc, ast_parse_type_expr);
1748 AstNode *res = ast_create_node(pc, NodeTypeNoAsync, noasync);1748 AstNode *res = ast_create_node(pc, NodeTypeNoSuspend, nosuspend);
1749 res->data.noasync_expr.expr = expr;1749 res->data.nosuspend_expr.expr = expr;
1750 return res;1750 return res;
1751 }1751 }
17521752
...@@ -3189,7 +3189,7 @@ void ast_visit_node_children(AstNode *node, void (*visit)(AstNode **, void *cont...@@ -3189,7 +3189,7 @@ void ast_visit_node_children(AstNode *node, void (*visit)(AstNode **, void *cont
3189 case NodeTypeCompTime:3189 case NodeTypeCompTime:
3190 visit_field(&node->data.comptime_expr.expr, visit, context);3190 visit_field(&node->data.comptime_expr.expr, visit, context);
3191 break;3191 break;
3192 case NodeTypeNoAsync:3192 case NodeTypeNoSuspend:
3193 visit_field(&node->data.comptime_expr.expr, visit, context);3193 visit_field(&node->data.comptime_expr.expr, visit, context);
3194 break;3194 break;
3195 case NodeTypeBreak:3195 case NodeTypeBreak:
src/tokenizer.cpp+2-2
...@@ -128,8 +128,8 @@ static const struct ZigKeyword zig_keywords[] = {...@@ -128,8 +128,8 @@ static const struct ZigKeyword zig_keywords[] = {
128 {"if", TokenIdKeywordIf},128 {"if", TokenIdKeywordIf},
129 {"inline", TokenIdKeywordInline},129 {"inline", TokenIdKeywordInline},
130 {"noalias", TokenIdKeywordNoAlias},130 {"noalias", TokenIdKeywordNoAlias},
131 {"noasync", TokenIdKeywordNoAsync},
132 {"noinline", TokenIdKeywordNoInline},131 {"noinline", TokenIdKeywordNoInline},
132 {"nosuspend", TokenIdKeywordNoSuspend},
133 {"null", TokenIdKeywordNull},133 {"null", TokenIdKeywordNull},
134 {"or", TokenIdKeywordOr},134 {"or", TokenIdKeywordOr},
135 {"orelse", TokenIdKeywordOrElse},135 {"orelse", TokenIdKeywordOrElse},
...@@ -1589,8 +1589,8 @@ const char * token_name(TokenId id) {...@@ -1589,8 +1589,8 @@ const char * token_name(TokenId id) {
1589 case TokenIdKeywordIf: return "if";1589 case TokenIdKeywordIf: return "if";
1590 case TokenIdKeywordInline: return "inline";1590 case TokenIdKeywordInline: return "inline";
1591 case TokenIdKeywordNoAlias: return "noalias";1591 case TokenIdKeywordNoAlias: return "noalias";
1592 case TokenIdKeywordNoAsync: return "noasync";
1593 case TokenIdKeywordNoInline: return "noinline";1592 case TokenIdKeywordNoInline: return "noinline";
1593 case TokenIdKeywordNoSuspend: return "nosuspend";
1594 case TokenIdKeywordNull: return "null";1594 case TokenIdKeywordNull: return "null";
1595 case TokenIdKeywordOr: return "or";1595 case TokenIdKeywordOr: return "or";
1596 case TokenIdKeywordOrElse: return "orelse";1596 case TokenIdKeywordOrElse: return "orelse";
src/tokenizer.hpp+1-1
...@@ -78,7 +78,7 @@ enum TokenId {...@@ -78,7 +78,7 @@ enum TokenId {
78 TokenIdKeywordNoInline,78 TokenIdKeywordNoInline,
79 TokenIdKeywordLinkSection,79 TokenIdKeywordLinkSection,
80 TokenIdKeywordNoAlias,80 TokenIdKeywordNoAlias,
81 TokenIdKeywordNoAsync,81 TokenIdKeywordNoSuspend,
82 TokenIdKeywordNull,82 TokenIdKeywordNull,
83 TokenIdKeywordOr,83 TokenIdKeywordOr,
84 TokenIdKeywordOrElse,84 TokenIdKeywordOrElse,