From 0cb994a3b520b8800fa2dbe7e3b279f9496b6f59 Mon Sep 17 00:00:00 2001 From: DanielGavin Date: Sun, 28 Apr 2024 16:34:57 +0200 Subject: Fix issues with comp literal returns --- src/odin/printer/visit.odin | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/odin/printer/visit.odin b/src/odin/printer/visit.odin index f21eeaa..0568026 100644 --- a/src/odin/printer/visit.odin +++ b/src/odin/printer/visit.odin @@ -557,7 +557,7 @@ is_values_return_stmt_callable :: proc(list: []^ast.Expr) -> bool { } #partial switch v in result.derived { - case ^ast.Call_Expr: + case ^ast.Call_Expr, ^ast.Comp_Lit: return false } } @@ -574,6 +574,10 @@ is_return_stmt_ending_with_call_expr :: proc(list: []^ast.Expr) -> bool { return true } + if _, is_cmp := list[len(list) - 1].derived.(^ast.Comp_Lit); is_cmp { + return true + } + return false } -- cgit v1.2.3