mirror of
https://github.com/vim/vim.git
synced 2025-10-06 05:44:14 -04:00
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.
This commit is contained in:
@@ -329,6 +329,7 @@ def Test_class_object_member_access()
|
||||
|
||||
class MyCar
|
||||
this.make: string
|
||||
this.age = 5
|
||||
|
||||
def new(make_arg: string)
|
||||
this.make = make_arg
|
||||
@@ -337,6 +338,9 @@ def Test_class_object_member_access()
|
||||
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 @@ def Test_class_object_member_access()
|
||||
|
||||
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)
|
||||
|
||||
|
Reference in New Issue
Block a user