mirror of
https://github.com/odin-lang/Odin.git
synced 2026-01-07 05:23:12 +00:00
more work
This commit is contained in:
@@ -124,6 +124,8 @@ print :: proc(p: ^Printer, file: ^ast.File) -> string {
|
||||
}
|
||||
|
||||
set_source_position(p, file.pkg_token.pos);
|
||||
|
||||
p.last_source_position.line = 1;
|
||||
|
||||
set_line(p, 0);
|
||||
|
||||
@@ -187,6 +189,8 @@ print :: proc(p: ^Printer, file: ^ast.File) -> string {
|
||||
last_line = line_index;
|
||||
}
|
||||
|
||||
strings.write_string(&builder, newline);
|
||||
|
||||
return strings.to_string(builder);
|
||||
}
|
||||
|
||||
|
||||
@@ -106,10 +106,8 @@ push_comment :: proc(p: ^Printer, comment: tokenizer.Token) -> int {
|
||||
} else if c == '/' && comment.text[min(c_len - 1, i + 1)] == '*' {
|
||||
strings.write_string(&builder, "/*");
|
||||
trim_space = true;
|
||||
p.depth += 1;
|
||||
i += 1;
|
||||
} else if c == '*' && comment.text[min(c_len - 1, i + 1)] == '/' {
|
||||
p.depth -= 1;
|
||||
trim_space = true;
|
||||
strings.write_string(&builder, "*/");
|
||||
i += 1;
|
||||
@@ -453,7 +451,11 @@ visit_decl :: proc(p: ^Printer, decl: ^ast.Decl, called_in_stmt := false) {
|
||||
push_generic_token(p, .Colon, 0);
|
||||
}
|
||||
|
||||
visit_exprs(p, v.values, true);
|
||||
if len(v.values) == 1 {
|
||||
visit_expr(p, v.values[0]); //this is too ensure that one value are never newlined(procs, structs, etc.)
|
||||
} else {
|
||||
visit_exprs(p, v.values, true);
|
||||
}
|
||||
|
||||
add_semicolon := true;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user