patch 9.0.1140: cannot call an object method in a compiled function
Problem: Cannot call an object method in a compiled function.
Solution: Compile the instructins to invoke an object method.
diff --git a/src/testdir/test_vim9_class.vim b/src/testdir/test_vim9_class.vim
index 81076f8..60730c4 100644
--- a/src/testdir/test_vim9_class.vim
+++ b/src/testdir/test_vim9_class.vim
@@ -329,6 +329,7 @@
class MyCar
this.make: string
+ this.age = 5
def new(make_arg: string)
this.make = make_arg
@@ -337,6 +338,9 @@
def GetMake(): string
return $"make = {this.make}"
enddef
+ def GetAge(): number
+ return this.age
+ enddef
endclass
var c = MyCar.new("abc")
@@ -347,6 +351,12 @@
var c2 = MyCar.new("123")
assert_equal('make = 123', c2.GetMake())
+
+ def CheckCar()
+ assert_equal("make = def", c.GetMake())
+ assert_equal(5, c.GetAge())
+ enddef
+ CheckCar()
END
v9.CheckScriptSuccess(lines)