Browse Source

Added a bool flag to the Block_Stmt struct to have information whether or not 'do' was used vs brackets in the AST

zhibog 5 years ago
parent
commit
3a1bee19a9
2 changed files with 2 additions and 0 deletions
  1. 1 0
      core/odin/ast/ast.odin
  2. 1 0
      core/odin/parser/parser.odin

+ 1 - 0
core/odin/ast/ast.odin

@@ -282,6 +282,7 @@ Block_Stmt :: struct {
 	open:  tokenizer.Pos,
 	stmts: []^Stmt,
 	close: tokenizer.Pos,
+	uses_do: bool,
 }
 
 If_Stmt :: struct {

+ 1 - 0
core/odin/parser/parser.odin

@@ -1217,6 +1217,7 @@ convert_stmt_to_body :: proc(p: ^Parser, stmt: ^ast.Stmt) -> ^ast.Stmt {
 	bs.stmts = make([]^ast.Stmt, 1);
 	bs.stmts[0] = stmt;
 	bs.close = stmt.end;
+	bs.uses_do = true;
 	return bs;
 }