diff options
| author | Daniel Gavin <danielgavin5@hotmail.com> | 2022-06-21 23:22:56 +0200 |
|---|---|---|
| committer | Daniel Gavin <danielgavin5@hotmail.com> | 2022-06-21 23:22:56 +0200 |
| commit | 0ff1e12ce89cf5d97625a73d1240b352e32400f2 (patch) | |
| tree | a5480ec46633af27340ccaad26779d23721ed903 /src | |
| parent | 6070844d69cab5b4a5bb50473bd6ccc2343ff7dd (diff) | |
| parent | f814d3e9791c9ef6dc3c002017f0d949224e6b44 (diff) | |
Merge branch 'master' of github.com:DanielGavin/ols
Diffstat (limited to 'src')
| -rw-r--r-- | src/odin/printer/visit.odin | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/src/odin/printer/visit.odin b/src/odin/printer/visit.odin index f0d718b..9a22c8b 100644 --- a/src/odin/printer/visit.odin +++ b/src/odin/printer/visit.odin @@ -1200,18 +1200,21 @@ visit_expr :: proc(p: ^Printer, expr: ^ast.Expr, called_from: Expr_Called_Type = if v.type != nil { document = cons_with_nopl(document, visit_expr(p, v.type)) - } - - if matrix_type, ok := v.type.derived.(^ast.Matrix_Type); ok && is_matrix_type_constant(matrix_type) { - document = cons_with_opl(document, visit_begin_brace(p, v.pos, .Generic)) - set_source_position(p, v.open) - document = cons(document, nest(p.indentation_count, cons(newline_position(p, 1, v.elems[0].pos), visit_matrix_comp_lit(p, v, matrix_type)))) - set_source_position(p, v.end) + if matrix_type, ok := v.type.derived.(^ast.Matrix_Type); ok && is_matrix_type_constant(matrix_type) { + document = cons_with_opl(document, visit_begin_brace(p, v.pos, .Generic)) + + set_source_position(p, v.open) + document = cons(document, nest(p.indentation_count, cons(newline_position(p, 1, v.elems[0].pos), visit_matrix_comp_lit(p, v, matrix_type)))) + set_source_position(p, v.end) - document = cons(document, cons(newline(1), text_position(p, "}", v.end))) + document = cons(document, cons(newline(1), text_position(p, "}", v.end))) + + break + } } - else if (should_align_comp_lit(p, v^) || contains_comments_in_range(p, v.pos, v.end)) && (called_from == .Value_Decl || called_from == .Assignment_Stmt) && len(v.elems) != 0 { + + if (should_align_comp_lit(p, v^) || contains_comments_in_range(p, v.pos, v.end)) && (called_from == .Value_Decl || called_from == .Assignment_Stmt) && len(v.elems) != 0 { document = cons_with_opl(document, visit_begin_brace(p, v.pos, .Generic)) set_source_position(p, v.open) |