| ... | ... | @@ -1089,7 +1089,7 @@ static AstNode *ast_parse_grouped_expr(ParseContext *pc, int *token_index, bool |
| 1089 | 1089 | } |
| 1090 | 1090 | |
| 1091 | 1091 | /* |
| 1092 | | ArrayType : token(LBracket) option(Expression) token(RBracket) option(token(Const)) Expression |
| 1092 | ArrayType : token(LBracket) option(Expression) token(RBracket) option(token(Const)) UnwrapMaybeExpression |
| 1093 | 1093 | */ |
| 1094 | 1094 | static AstNode *ast_parse_array_type_expr(ParseContext *pc, int *token_index, bool mandatory) { |
| 1095 | 1095 | Token *l_bracket = &pc->tokens->at(*token_index); |
| ... | ... | @@ -1114,7 +1114,7 @@ static AstNode *ast_parse_array_type_expr(ParseContext *pc, int *token_index, bo |
| 1114 | 1114 | node->data.array_type.is_const = true; |
| 1115 | 1115 | } |
| 1116 | 1116 | |
| 1117 | | node->data.array_type.child_type = ast_parse_expression(pc, token_index, true); |
| 1117 | node->data.array_type.child_type = ast_parse_unwrap_maybe_expr(pc, token_index, true); |
| 1118 | 1118 | |
| 1119 | 1119 | return node; |
| 1120 | 1120 | } |
| ... | ... | @@ -1141,7 +1141,7 @@ static void ast_parse_asm_input_item(ParseContext *pc, int *token_index, AstNode |
| 1141 | 1141 | } |
| 1142 | 1142 | |
| 1143 | 1143 | /* |
| 1144 | | AsmOutputItem : token(LBracket) token(Symbol) token(RBracket) token(String) token(LParen) (token(Symbol) | token(Arrow) Expression) token(RParen) |
| 1144 | AsmOutputItem : token(LBracket) token(Symbol) token(RBracket) token(String) token(LParen) (token(Symbol) | token(Arrow) UnwrapMaybeExpression token(RParen) |
| 1145 | 1145 | */ |
| 1146 | 1146 | static void ast_parse_asm_output_item(ParseContext *pc, int *token_index, AstNode *node) { |
| 1147 | 1147 | ast_eat_token(pc, token_index, TokenIdLBracket); |
| ... | ... | @@ -1159,7 +1159,7 @@ static void ast_parse_asm_output_item(ParseContext *pc, int *token_index, AstNod |
| 1159 | 1159 | if (token->id == TokenIdSymbol) { |
| 1160 | 1160 | ast_buf_from_token(pc, token, &asm_output->variable_name); |
| 1161 | 1161 | } else if (token->id == TokenIdArrow) { |
| 1162 | | asm_output->return_type = ast_parse_expression(pc, token_index, true); |
| 1162 | asm_output->return_type = ast_parse_unwrap_maybe_expr(pc, token_index, true); |
| 1163 | 1163 | } else { |
| 1164 | 1164 | ast_invalid_token_error(pc, token); |
| 1165 | 1165 | } |
| ... | ... | @@ -1948,7 +1948,7 @@ static AstNode *ast_parse_if_expr(ParseContext *pc, int *token_index, bool manda |
| 1948 | 1948 | node->data.if_var_expr.var_decl.expr = ast_parse_expression(pc, token_index, true); |
| 1949 | 1949 | } else if (eq_or_colon->id == TokenIdColon) { |
| 1950 | 1950 | *token_index += 1; |
| 1951 | | node->data.if_var_expr.var_decl.type = ast_parse_expression(pc, token_index, true); |
| 1951 | node->data.if_var_expr.var_decl.type = ast_parse_unwrap_maybe_expr(pc, token_index, true); |
| 1952 | 1952 | |
| 1953 | 1953 | ast_eat_token(pc, token_index, TokenIdMaybeAssign); |
| 1954 | 1954 | node->data.if_var_expr.var_decl.expr = ast_parse_expression(pc, token_index, true); |
| ... | ... | @@ -2342,7 +2342,7 @@ static AstNode *ast_parse_block(ParseContext *pc, int *token_index, bool mandato |
| 2342 | 2342 | } |
| 2343 | 2343 | |
| 2344 | 2344 | /* |
| 2345 | | FnProto : many(Directive) option(FnVisibleMod) token(Fn) token(Symbol) ParamDeclList option(Expression) |
| 2345 | FnProto : many(Directive) option(FnVisibleMod) token(Fn) token(Symbol) ParamDeclList option(UnwrapMaybeExpression) |
| 2346 | 2346 | */ |
| 2347 | 2347 | static AstNode *ast_parse_fn_proto(ParseContext *pc, int *token_index, bool mandatory) { |
| 2348 | 2348 | Token *first_token = &pc->tokens->at(*token_index); |
| ... | ... | @@ -2394,7 +2394,7 @@ static AstNode *ast_parse_fn_proto(ParseContext *pc, int *token_index, bool mand |
| 2394 | 2394 | ast_parse_param_decl_list(pc, token_index, &node->data.fn_proto.params, &node->data.fn_proto.is_var_args); |
| 2395 | 2395 | |
| 2396 | 2396 | Token *next_token = &pc->tokens->at(*token_index); |
| 2397 | | node->data.fn_proto.return_type = ast_parse_expression(pc, token_index, false); |
| 2397 | node->data.fn_proto.return_type = ast_parse_unwrap_maybe_expr(pc, token_index, false); |
| 2398 | 2398 | if (!node->data.fn_proto.return_type) { |
| 2399 | 2399 | node->data.fn_proto.return_type = ast_create_void_type_node(pc, next_token); |
| 2400 | 2400 | } |