| ... | @@ -1096,16 +1096,19 @@ fn parseErrorUnionExpr(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?*No | ... | @@ -1096,16 +1096,19 @@ fn parseErrorUnionExpr(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?*No |
| 1096 | | 1096 | |
| 1097 | /// SuffixExpr | 1097 | /// SuffixExpr |
| 1098 | /// <- KEYWORD_async PrimaryTypeExpr SuffixOp* FnCallArguments | 1098 | /// <- KEYWORD_async PrimaryTypeExpr SuffixOp* FnCallArguments |
| | 1099 | /// / KEYWORD_noasync PrimaryTypeExpr SuffixOp* FnCallArguments |
| 1099 | /// / PrimaryTypeExpr (SuffixOp / FnCallArguments)* | 1100 | /// / PrimaryTypeExpr (SuffixOp / FnCallArguments)* |
| 1100 | fn parseSuffixExpr(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?*Node { | 1101 | fn parseSuffixExpr(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?*Node { |
| 1101 | if (eatToken(it, .Keyword_async)) |async_token| { | 1102 | var maybe_async = eatAnnotatedToken(it, .Keyword_async) orelse eatAnnotatedToken(it, .Keyword_noasync); |
| 1102 | if (eatToken(it, .Keyword_fn)) |token_fn| { | 1103 | if (maybe_async) |async_token| { |
| | 1104 | const token_fn = eatToken(it, .Keyword_fn); |
| | 1105 | if (async_token.ptr.id == .Keyword_async and token_fn != null) { |
| 1103 | // HACK: If we see the keyword `fn`, then we assume that | 1106 | // HACK: If we see the keyword `fn`, then we assume that |
| 1104 | // we are parsing an async fn proto, and not a call. | 1107 | // we are parsing an async fn proto, and not a call. |
| 1105 | // We therefore put back all tokens consumed by the async | 1108 | // We therefore put back all tokens consumed by the async |
| 1106 | // prefix... | 1109 | // prefix... |
| 1107 | putBackToken(it, token_fn); | 1110 | putBackToken(it, token_fn.?); |
| 1108 | putBackToken(it, async_token); | 1111 | putBackToken(it, async_token.index); |
| 1109 | return parsePrimaryTypeExpr(arena, it, tree); | 1112 | return parsePrimaryTypeExpr(arena, it, tree); |
| 1110 | } | 1113 | } |
| 1111 | // TODO: Implement hack for parsing `async fn ...` in ast_parse_suffix_expr | 1114 | // TODO: Implement hack for parsing `async fn ...` in ast_parse_suffix_expr |
| ... | @@ -1135,7 +1138,7 @@ fn parseSuffixExpr(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?*Node { | ... | @@ -1135,7 +1138,7 @@ fn parseSuffixExpr(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?*Node { |
| 1135 | .op = Node.SuffixOp.Op{ | 1138 | .op = Node.SuffixOp.Op{ |
| 1136 | .Call = Node.SuffixOp.Op.Call{ | 1139 | .Call = Node.SuffixOp.Op.Call{ |
| 1137 | .params = params.list, | 1140 | .params = params.list, |
| 1138 | .async_token = async_token, | 1141 | .async_token = async_token.index, |
| 1139 | }, | 1142 | }, |
| 1140 | }, | 1143 | }, |
| 1141 | .rtoken = params.rparen, | 1144 | .rtoken = params.rparen, |