@@ -1885,6 +1885,16 @@ pub fn (mut f Fmt) at_expr(node ast.AtExpr) {
1885
1885
f.write (node.name)
1886
1886
}
1887
1887
1888
+ fn (mut f Fmt) write_static_method (name string , short_name string ) {
1889
+ f.mark_import_as_used (name.split ('__static__' )[0 ])
1890
+ if short_name.contains ('.' ) {
1891
+ indx := short_name.index ('.' ) or { - 1 } + 1
1892
+ f.write (short_name[0 ..indx] + short_name[indx..].replace ('__static__' , '.' ).capitalize ())
1893
+ } else {
1894
+ f.write (short_name.replace ('__static__' , '.' ).capitalize ())
1895
+ }
1896
+ }
1897
+
1888
1898
pub fn (mut f Fmt) call_expr (node ast.CallExpr) {
1889
1899
mut is_method_newline := false
1890
1900
if node.is_method {
@@ -1922,13 +1932,7 @@ pub fn (mut f Fmt) call_expr(node ast.CallExpr) {
1922
1932
} else {
1923
1933
name := f.short_module (node.name)
1924
1934
if node.name.contains ('__static__' ) {
1925
- f.mark_import_as_used (node.name.split ('__static__' )[0 ])
1926
- if name.contains ('.' ) {
1927
- indx := name.index ('.' ) or { - 1 } + 1
1928
- f.write (name[0 ..indx] + name[indx..].replace ('__static__' , '.' ).capitalize ())
1929
- } else {
1930
- f.write (name.replace ('__static__' , '.' ).capitalize ())
1931
- }
1935
+ f.write_static_method (node.name, name)
1932
1936
} else {
1933
1937
f.mark_import_as_used (name)
1934
1938
f.write (name)
@@ -2203,7 +2207,12 @@ pub fn (mut f Fmt) ident(node ast.Ident) {
2203
2207
}
2204
2208
}
2205
2209
name := f.short_module (node.name)
2206
- f.write (name)
2210
+ if node.name.contains ('__static__' ) {
2211
+ f.write_static_method (node.name, name)
2212
+ } else {
2213
+ f.mark_import_as_used (name)
2214
+ f.write (name)
2215
+ }
2207
2216
if node.concrete_types.len > 0 {
2208
2217
f.write ('[' )
2209
2218
for i, concrete_type in node.concrete_types {
0 commit comments