Browse Source

Disallow `proc() do stmt` and only allow `proc() { stmt }`

gingerBill 3 years ago
parent
commit
22a0c3fce1
2 changed files with 2 additions and 6 deletions
  1. 1 1
      core/sys/windows/winerror.odin
  2. 1 5
      src/parser.cpp

+ 1 - 1
core/sys/windows/winerror.odin

@@ -45,4 +45,4 @@ ERROR_NOT_SAME_OBJECT        : DWORD : 1656
 
 
 E_NOTIMPL :: HRESULT(-0x7fff_bfff) // 0x8000_4001
 E_NOTIMPL :: HRESULT(-0x7fff_bfff) // 0x8000_4001
 
 
-SUCCEEDED :: #force_inline proc(#any_int result: int) -> bool do return result >= 0
+SUCCEEDED :: #force_inline proc(#any_int result: int) -> bool { return result >= 0 }

+ 1 - 5
src/parser.cpp

@@ -2324,11 +2324,7 @@ Ast *parse_operand(AstFile *f, bool lhs) {
 			body = convert_stmt_to_body(f, parse_stmt(f));
 			body = convert_stmt_to_body(f, parse_stmt(f));
 			f->curr_proc = curr_proc;
 			f->curr_proc = curr_proc;
 
 
-			if (build_context.disallow_do) {
-				syntax_error(body, "'do' has been disallowed");
-			} else if (!ast_on_same_line(type, body)) {
-				syntax_error(body, "The body of a 'do' must be on the same line as the signature");
-			}
+			syntax_error(body, "'do' for procedure bodies is not allowed, prefer {}");
 
 
 			return ast_proc_lit(f, type, body, tags, where_token, where_clauses);
 			return ast_proc_lit(f, type, body, tags, where_token, where_clauses);
 		}
 		}