| author | |
| committer | |
| log | ac319b27348f60e37f3f1b478fee00202280715f |
| tree | d249f3b1ab6d65ad0dadd177ce9a9dab2112431c |
| parent | c3b76d091337ba60d2ccb3632b525e5a42d1f2c5 |
| signature |
nosuspend cannot be used in a type expression and
all other use casesare covered by PrimaryExpr3 files changed, 3 insertions(+), 19 deletions(-)
doc/langref.html.in+3| ... | ... | @@ -10096,6 +10096,7 @@ ContainerField <- IDENTIFIER (COLON TypeExpr)? (EQUAL Expr)? |
| 10096 | 10096 | Statement |
| 10097 | 10097 | <- KEYWORD_comptime? VarDecl |
| 10098 | 10098 | / KEYWORD_comptime BlockExprStatement |
| 10099 | / KEYWORD_nosuspend BlockExprStatement | |
| 10099 | 10100 | / KEYWORD_suspend (SEMICOLON / BlockExprStatement) |
| 10100 | 10101 | / KEYWORD_defer BlockExprStatement |
| 10101 | 10102 | / KEYWORD_errdefer BlockExprStatement |
| ... | ... | @@ -10152,6 +10153,7 @@ PrimaryExpr |
| 10152 | 10153 | / IfExpr |
| 10153 | 10154 | / KEYWORD_break BreakLabel? Expr? |
| 10154 | 10155 | / KEYWORD_comptime Expr |
| 10156 | / KEYWORD_nosuspend Expr | |
| 10155 | 10157 | / KEYWORD_continue BreakLabel? |
| 10156 | 10158 | / KEYWORD_resume Expr |
| 10157 | 10159 | / KEYWORD_return Expr? |
| ... | ... | @@ -10514,6 +10516,7 @@ KEYWORD_for <- 'for' end_of_word |
| 10514 | 10516 | KEYWORD_if <- 'if' end_of_word |
| 10515 | 10517 | KEYWORD_inline <- 'inline' end_of_word |
| 10516 | 10518 | KEYWORD_noalias <- 'noalias' end_of_word |
| 10519 | KEYWORD_nosuspend <- 'nosuspend' end_of_word | |
| 10517 | 10520 | KEYWORD_null <- 'null' end_of_word |
| 10518 | 10521 | KEYWORD_or <- 'or' end_of_word |
| 10519 | 10522 | KEYWORD_orelse <- 'orelse' end_of_word |
lib/std/zig/parse.zig-10| ... | ... | @@ -1389,7 +1389,6 @@ fn parseSuffixExpr(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?*Node { |
| 1389 | 1389 | /// / IfTypeExpr |
| 1390 | 1390 | /// / INTEGER |
| 1391 | 1391 | /// / KEYWORD_comptime TypeExpr |
| 1392 | /// / KEYWORD_nosuspend TypeExpr | |
| 1393 | 1392 | /// / KEYWORD_error DOT IDENTIFIER |
| 1394 | 1393 | /// / KEYWORD_false |
| 1395 | 1394 | /// / KEYWORD_null |
| ... | ... | @@ -1428,15 +1427,6 @@ fn parsePrimaryTypeExpr(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?*N |
| 1428 | 1427 | }; |
| 1429 | 1428 | return &node.base; |
| 1430 | 1429 | } |
| 1431 | if (eatToken(it, .Keyword_nosuspend)) |token| { | |
| 1432 | const expr = (try parseTypeExpr(arena, it, tree)) orelse return null; | |
| 1433 | const node = try arena.create(Node.Nosuspend); | |
| 1434 | node.* = .{ | |
| 1435 | .nosuspend_token = token, | |
| 1436 | .expr = expr, | |
| 1437 | }; | |
| 1438 | return &node.base; | |
| 1439 | } | |
| 1440 | 1430 | if (eatToken(it, .Keyword_error)) |token| { |
| 1441 | 1431 | const period = try expectToken(it, tree, .Period); |
| 1442 | 1432 | const identifier = try expectNode(arena, it, tree, parseIdentifier, .{ |
src/parser.cpp-9| ... | ... | @@ -1609,7 +1609,6 @@ static AstNode *ast_parse_suffix_expr(ParseContext *pc) { |
| 1609 | 1609 | // / IfTypeExpr |
| 1610 | 1610 | // / INTEGER |
| 1611 | 1611 | // / KEYWORD_comptime TypeExpr |
| 1612 | // / KEYWORD_nosuspend TypeExpr | |
| 1613 | 1612 | // / KEYWORD_error DOT IDENTIFIER |
| 1614 | 1613 | // / KEYWORD_false |
| 1615 | 1614 | // / KEYWORD_null |
| ... | ... | @@ -1711,14 +1710,6 @@ static AstNode *ast_parse_primary_type_expr(ParseContext *pc) { |
| 1711 | 1710 | return res; |
| 1712 | 1711 | } |
| 1713 | 1712 | |
| 1714 | Token *nosuspend = eat_token_if(pc, TokenIdKeywordNoSuspend); | |
| 1715 | if (nosuspend != nullptr) { | |
| 1716 | AstNode *expr = ast_expect(pc, ast_parse_type_expr); | |
| 1717 | AstNode *res = ast_create_node(pc, NodeTypeNoSuspend, nosuspend); | |
| 1718 | res->data.nosuspend_expr.expr = expr; | |
| 1719 | return res; | |
| 1720 | } | |
| 1721 | ||
| 1722 | 1713 | Token *error = eat_token_if(pc, TokenIdKeywordError); |
| 1723 | 1714 | if (error != nullptr) { |
| 1724 | 1715 | Token *dot = expect_token(pc, TokenIdDot); |