mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 15:48:51 +00:00
fix out of bounds with empty struct
This commit is contained in:
@@ -493,7 +493,8 @@ align_var_decls :: proc(p: ^Printer) {
|
|||||||
line.format_tokens[i].kind == .Union ||
|
line.format_tokens[i].kind == .Union ||
|
||||||
line.format_tokens[i].kind == .Enum ||
|
line.format_tokens[i].kind == .Enum ||
|
||||||
line.format_tokens[i].kind == .Struct ||
|
line.format_tokens[i].kind == .Struct ||
|
||||||
line.format_tokens[i].kind == .For {
|
line.format_tokens[i].kind == .For ||
|
||||||
|
line.format_tokens[i].kind == .If {
|
||||||
continue_flag = true;
|
continue_flag = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -772,6 +773,10 @@ align_struct :: proc(p: ^Printer, index: int) {
|
|||||||
|
|
||||||
format_tokens := make([]TokenAndLength, brace_token.parameter_count, context.temp_allocator);
|
format_tokens := make([]TokenAndLength, brace_token.parameter_count, context.temp_allocator);
|
||||||
|
|
||||||
|
if brace_token.parameter_count == 0 {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
for line, line_index in p.lines[brace_line + 1:] {
|
for line, line_index in p.lines[brace_line + 1:] {
|
||||||
length := 0;
|
length := 0;
|
||||||
|
|
||||||
|
|||||||
@@ -487,9 +487,7 @@ visit_exprs :: proc(p: ^Printer, list: []^ast.Expr, add_comma := false, trailing
|
|||||||
//Don't move the first expression, it looks bad
|
//Don't move the first expression, it looks bad
|
||||||
if i != 0 && force_newline {
|
if i != 0 && force_newline {
|
||||||
newline_position(p, 1);
|
newline_position(p, 1);
|
||||||
}
|
} else if i != 0 {
|
||||||
|
|
||||||
else if i != 0 {
|
|
||||||
move_line_limit(p, expr.pos, 1);
|
move_line_limit(p, expr.pos, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user