mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
fmt: fix pos of added imports (#8931)
This commit is contained in:
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) {
|
||||||
|
7
vlib/v/fmt/tests/import_auto_added_expected.vv
Normal file
7
vlib/v/fmt/tests/import_auto_added_expected.vv
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
module main
|
||||||
|
|
||||||
|
import time
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
curr_time := time.now()
|
||||||
|
}
|
5
vlib/v/fmt/tests/import_auto_added_input.vv
Normal file
5
vlib/v/fmt/tests/import_auto_added_input.vv
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
module main
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
curr_time := time.now()
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user