fmt: fix pos of added imports (#8931)
parent
8e9e9b2f89
commit
b18d091e18
|
@ -236,6 +236,9 @@ pub fn (mut f Fmt) mod(mod ast.Module) {
|
||||||
}
|
}
|
||||||
f.attrs(mod.attrs)
|
f.attrs(mod.attrs)
|
||||||
f.writeln('module $mod.short_name\n')
|
f.writeln('module $mod.short_name\n')
|
||||||
|
if f.import_pos == 0 {
|
||||||
|
f.import_pos = f.out.len
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn (mut f Fmt) mark_types_import_as_used(typ table.Type) {
|
pub fn (mut f Fmt) mark_types_import_as_used(typ table.Type) {
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
module main
|
||||||
|
|
||||||
|
import time
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
curr_time := time.now()
|
||||||
|
}
|
|
@ -0,0 +1,5 @@
|
||||||
|
module main
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
curr_time := time.now()
|
||||||
|
}
|
Loading…
Reference in New Issue