0
0
mirror of https://github.com/vim/vim.git synced 2025-10-03 05:14:07 -04:00

patch 9.0.1205: crash when handling class that extends another class

Problem:    Crash when handling class that extends another class with more
            than one object members.
Solution:   Correct pointer computations. (closes #11824)
This commit is contained in:
Bram Moolenaar
2023-01-15 20:49:00 +00:00
parent 912bfee710
commit ae3205aa55
3 changed files with 27 additions and 4 deletions

View File

@@ -1081,6 +1081,26 @@ def Test_class_extends()
var c = Child.new()
END
v9.CheckScriptFailure(lines, 'E1325: Method not found on class "Child": new(')
# base class with more than one object member
lines =<< trim END
vim9script
class Result
this.success: bool
this.value: any = null
endclass
class Success extends Result
def new(this.value = v:none)
this.success = true
enddef
endclass
var v = Success.new('asdf')
assert_equal("object of Success {success: true, value: 'asdf'}", string(v))
END
v9.CheckScriptSuccess(lines)
enddef
def Test_class_import()