From e7cb3d369ff63acac1ba6a4e3ee17194df96ecd0 Mon Sep 17 00:00:00 2001 From: DanielGavin Date: Sun, 13 Aug 2023 11:51:12 +0200 Subject: Add support for tag stmts. --- src/odin/printer/visit.odin | 11 +++++++++++ src/server/analysis.odin | 4 ++-- 2 files changed, 13 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/odin/printer/visit.odin b/src/odin/printer/visit.odin index 53ee19c..da17bc5 100644 --- a/src/odin/printer/visit.odin +++ b/src/odin/printer/visit.odin @@ -937,6 +937,17 @@ visit_stmt :: proc( comments := move_line(p, stmt.pos) #partial switch v in stmt.derived { + case ^ast.Tag_Stmt: + //Hack to fix a bug in the odin parser + v.end = v.stmt.end + + document = cons( + document, + text(v.op.text), + text(v.name), + break_with_no_newline(), + visit_stmt(p, v.stmt), + ) case ^Using_Stmt: document = cons( document, diff --git a/src/server/analysis.odin b/src/server/analysis.odin index 630110f..c9ec923 100644 --- a/src/server/analysis.odin +++ b/src/server/analysis.odin @@ -3555,7 +3555,7 @@ get_locals_if_stmt :: proc( return } - get_locals_stmt(file, stmt.init, ast_context, document_position, true) + get_locals_stmt(file, stmt.init, ast_context, document_position, false) get_locals_stmt(file, stmt.body, ast_context, document_position) get_locals_stmt(file, stmt.else_stmt, ast_context, document_position) } @@ -3752,7 +3752,7 @@ get_locals_for_stmt :: proc( return } - get_locals_stmt(file, stmt.init, ast_context, document_position, true) + get_locals_stmt(file, stmt.init, ast_context, document_position, false) get_locals_stmt(file, stmt.body, ast_context, document_position) } -- cgit v1.2.3