From a38a0f4fb78fb79bc88a356f14715848d28a9e23 Mon Sep 17 00:00:00 2001 From: BigBlack <840206@qq.com> Date: Fri, 20 Dec 2019 02:23:29 +0800 Subject: [PATCH] parser: fix x.function_pointer() --- vlib/compiler/parser.v | 2 +- vlib/compiler/tests/fn_test.v | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/vlib/compiler/parser.v b/vlib/compiler/parser.v index 092b3ed370..38be51c975 100644 --- a/vlib/compiler/parser.v +++ b/vlib/compiler/parser.v @@ -2009,7 +2009,7 @@ pub: if base.starts_with('fn ') && p.peek() == .lpar { tmp_typ := p.table.find_type(base) mut f := tmp_typ.func - p.gen('.$field.name') + p.gen('$dot$field.name') p.gen('(') p.check(.name) p.fn_call_args(mut f) diff --git a/vlib/compiler/tests/fn_test.v b/vlib/compiler/tests/fn_test.v index f4498b9cea..5fe4d35580 100644 --- a/vlib/compiler/tests/fn_test.v +++ b/vlib/compiler/tests/fn_test.v @@ -157,6 +157,9 @@ fn test_fn_type_call() { st := MySt{f:test} assert st.f(10) == 1010 + + st1 := &MySt{f:test} + assert st1.f(10) == 1010 }