File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -3546,7 +3546,11 @@ fn (mut c Checker) at_expr(mut node ast.AtExpr) ast.Type {
35463546 if c.table.cur_fn == unsafe { nil } {
35473547 return ast.void_type
35483548 }
3549- node.val = c.table.cur_fn.name.all_after_last ('.' )
3549+ if _ := c.table.cur_fn.name.index ('__static__' ) {
3550+ node.val = c.table.cur_fn.name.all_after_last ('__static__' )
3551+ } else {
3552+ node.val = c.table.cur_fn.name.all_after_last ('.' )
3553+ }
35503554 }
35513555 .method_name {
35523556 if c.table.cur_fn == unsafe { nil } {
@@ -3556,6 +3560,8 @@ fn (mut c Checker) at_expr(mut node ast.AtExpr) ast.Type {
35563560 if c.table.cur_fn.is_method {
35573561 node.val = c.table.type_to_str (c.table.cur_fn.receiver.typ).all_after_last ('.' ) +
35583562 '.' + fname
3563+ } else if _ := fname.index ('__static__' ) {
3564+ node.val = fname.all_before ('__static__' ) + '.' + fname.all_after ('__static__' )
35593565 } else {
35603566 node.val = fname
35613567 }
Original file line number Diff line number Diff line change @@ -60,6 +60,12 @@ fn (mut t TestFn) tst_2(cb fn (int)) {
6060 cb (1 )
6161}
6262
63+ fn TestFn .static_fn () {
64+ assert @FN == 'static_fn'
65+ assert @METHOD == 'TestFn.static_fn'
66+ assert @STRUCT == 'TestFn'
67+ }
68+
6369fn fn_name_mod_level () {
6470 assert @FN == 'fn_name_mod_level'
6571 assert @METHOD == 'fn_name_mod_level'
@@ -96,6 +102,7 @@ fn test_at_fn() {
96102 t := i + 1
97103 assert t == 2
98104 })
105+ TestFn.static_fn ()
99106}
100107
101108fn test_at_mod () {
You can’t perform that action at this time.
0 commit comments