mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
fmt: fix formatting of imported static methods (#18720)
This commit is contained in:
parent
ee429bb51d
commit
20c6d87fd4
@ -1828,7 +1828,12 @@ pub fn (mut f Fmt) call_expr(node ast.CallExpr) {
|
||||
name := f.short_module(node.name)
|
||||
f.mark_import_as_used(name)
|
||||
if node.name.contains('__static__') {
|
||||
f.write(name.replace('__static__', '.').capitalize())
|
||||
if name.contains('.') {
|
||||
indx := name.index('.') or { -1 } + 1
|
||||
f.write(name[0..indx] + name[indx..].replace('__static__', '.').capitalize())
|
||||
} else {
|
||||
f.write(name.replace('__static__', '.').capitalize())
|
||||
}
|
||||
} else {
|
||||
f.write(name)
|
||||
}
|
||||
|
7
vlib/v/fmt/tests/static_methods_keep.vv
Normal file
7
vlib/v/fmt/tests/static_methods_keep.vv
Normal file
@ -0,0 +1,7 @@
|
||||
module module_fmt
|
||||
|
||||
import mod
|
||||
|
||||
fn main() {
|
||||
mod.Foo.new()
|
||||
}
|
Loading…
Reference in New Issue
Block a user