diff options
| author | DanielGavin <danielgavin5@hotmail.com> | 2024-04-28 16:34:57 +0200 |
|---|---|---|
| committer | DanielGavin <danielgavin5@hotmail.com> | 2024-04-28 16:34:57 +0200 |
| commit | 0cb994a3b520b8800fa2dbe7e3b279f9496b6f59 (patch) | |
| tree | 802232fad8a9af1db45fb2be8cf342cae940ffa6 | |
| parent | 95aae62645f893302eb465a35c369f884378063d (diff) | |
Fix issues with comp literal returns
| -rw-r--r-- | src/odin/printer/visit.odin | 6 |
1 files changed, 5 insertions, 1 deletions
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 } |