1
0
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:
Isaiah 2023-07-01 05:04:52 -04:00 committed by GitHub
parent ee429bb51d
commit 20c6d87fd4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 1 deletions

View File

@ -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)
}

View File

@ -0,0 +1,7 @@
module module_fmt
import mod
fn main() {
mod.Foo.new()
}