File tree Expand file tree Collapse file tree 2 files changed +30
-1
lines changed Expand file tree Collapse file tree 2 files changed +30
-1
lines changed Original file line number Diff line number Diff line change @@ -1777,7 +1777,11 @@ fn (mut g Gen) fn_call(node ast.CallExpr) {
17771777 cast_sym := g.table.sym (g.unwrap_generic (typ))
17781778 mut is_ptr := false
17791779 if i == 0 {
1780- g.write (node.name)
1780+ if obj.is_inherited {
1781+ g.write (c.closure_ctx + '->' + node.name)
1782+ } else {
1783+ g.write (node.name)
1784+ }
17811785 if obj.orig_type.is_ptr () {
17821786 is_ptr = true
17831787 }
Original file line number Diff line number Diff line change 1+ pub type MyCallback = fn () | fn (ctx voidptr )
2+
3+ fn my_lower_level_func (func fn (ctx voidptr ), ctx voidptr ) {
4+ println ('Bar' )
5+ }
6+
7+ fn my_func (cb MyCallback, ctx voidptr ) {
8+ my_lower_level_func (fn [cb] (ctx voidptr ) {
9+ match cb {
10+ fn () {
11+ cb ()
12+ }
13+ fn (ctx voidptr ) {
14+ cb (ctx)
15+ }
16+ }
17+ }, ctx)
18+ }
19+
20+ fn test_closure_variable_in_smartcast () {
21+ my_func (fn () {
22+ println ('Foo' )
23+ }, unsafe { nil })
24+ assert true
25+ }
You can’t perform that action at this time.
0 commit comments