From 3a1bee19a9f599814f16d08278859165312aae18 Mon Sep 17 00:00:00 2001 From: zhibog Date: Sat, 18 Apr 2020 21:34:14 +0200 Subject: [PATCH] Added a bool flag to the Block_Stmt struct to have information whether or not 'do' was used vs brackets in the AST --- core/odin/ast/ast.odin | 1 + core/odin/parser/parser.odin | 1 + 2 files changed, 2 insertions(+) diff --git a/core/odin/ast/ast.odin b/core/odin/ast/ast.odin index 4bd50abd7..80974b0a9 100644 --- a/core/odin/ast/ast.odin +++ b/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 { diff --git a/core/odin/parser/parser.odin b/core/odin/parser/parser.odin index 29655766f..93ecddbda 100644 --- a/core/odin/parser/parser.odin +++ b/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; }