Fix parsing bug with procedure types in return values

This commit is contained in:
Ginger Bill
2017-07-19 22:34:50 +01:00
parent d233706a2d
commit eab23cd5b7
+3 -1
View File
@@ -2295,7 +2295,8 @@ AstNode *parse_operand(AstFile *f, bool lhs) {
if (allow_token(f, Token_Undef)) { if (allow_token(f, Token_Undef)) {
return ast_proc_lit(f, type, nullptr, tags, link_name); return ast_proc_lit(f, type, nullptr, tags, link_name);
} else if (f->curr_token.kind == Token_OpenBrace) { } else if (!f->allow_type || f->expr_level >= 0) {
if (f->curr_token.kind == Token_OpenBrace) {
if ((tags & ProcTag_foreign) != 0) { if ((tags & ProcTag_foreign) != 0) {
syntax_error(token, "A procedure tagged as `#foreign` cannot have a body"); syntax_error(token, "A procedure tagged as `#foreign` cannot have a body");
} }
@@ -2318,6 +2319,7 @@ AstNode *parse_operand(AstFile *f, bool lhs) {
return ast_proc_lit(f, type, body, tags, link_name); return ast_proc_lit(f, type, body, tags, link_name);
} }
}
if ((tags & ProcTag_foreign) != 0) { if ((tags & ProcTag_foreign) != 0) {
return ast_proc_lit(f, type, nullptr, tags, link_name); return ast_proc_lit(f, type, nullptr, tags, link_name);