mirror of
https://github.com/vim/vim.git
synced 2025-07-26 11:04:33 -04:00
patch 9.1.0252: Vim9: segfault with static in super class
Problem: Vim9: segfault with static in super class (Ernie Rael) Solution: When initializing lhs, use the correct class where a class variable is defined (Yegappan Lakshmanan) fixes: #14352 closes: #14372 Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
parent
8eb7523802
commit
2ed5a11b1a
@ -10463,4 +10463,32 @@ def Test_current_class_object_class_member()
|
|||||||
v9.CheckScriptSuccess(lines)
|
v9.CheckScriptSuccess(lines)
|
||||||
enddef
|
enddef
|
||||||
|
|
||||||
|
" Test for updating a base class variable from a base class method without the
|
||||||
|
" class name. This used to crash Vim (Github issue #14352).
|
||||||
|
def Test_use_base_class_variable_from_base_class_method()
|
||||||
|
var lines =<< trim END
|
||||||
|
vim9script
|
||||||
|
|
||||||
|
class DictKeyClass
|
||||||
|
static var _obj_id_count = 1
|
||||||
|
def _GenerateKey()
|
||||||
|
_obj_id_count += 1
|
||||||
|
enddef
|
||||||
|
static def GetIdCount(): number
|
||||||
|
return _obj_id_count
|
||||||
|
enddef
|
||||||
|
endclass
|
||||||
|
|
||||||
|
class C extends DictKeyClass
|
||||||
|
def F()
|
||||||
|
this._GenerateKey()
|
||||||
|
enddef
|
||||||
|
endclass
|
||||||
|
|
||||||
|
C.new().F()
|
||||||
|
assert_equal(2, DictKeyClass.GetIdCount())
|
||||||
|
END
|
||||||
|
v9.CheckScriptSuccess(lines)
|
||||||
|
enddef
|
||||||
|
|
||||||
" vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker
|
" vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker
|
||||||
|
@ -704,6 +704,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
252,
|
||||||
/**/
|
/**/
|
||||||
251,
|
251,
|
||||||
/**/
|
/**/
|
||||||
|
@ -1790,10 +1790,11 @@ compile_lhs(
|
|||||||
return FAIL;
|
return FAIL;
|
||||||
|
|
||||||
lhs->lhs_dest = dest_class_member;
|
lhs->lhs_dest = dest_class_member;
|
||||||
lhs->lhs_class = cctx->ctx_ufunc->uf_class;
|
// The class variable is defined either in the current class or
|
||||||
lhs->lhs_type =
|
// in one of the parent class in the hierarchy.
|
||||||
oc_member_type_by_idx(cctx->ctx_ufunc->uf_class,
|
lhs->lhs_class = defcl;
|
||||||
FALSE, lhs->lhs_classmember_idx);
|
lhs->lhs_type = oc_member_type_by_idx(defcl, FALSE,
|
||||||
|
lhs->lhs_classmember_idx);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user