forked from aniani/vim
patch 9.1.1146: Vim9: wrong context being used when evaluating class member
Problem: Vim9: wrong context being used when evaluating class member (lifepillar, Ernie Rael) Solution: Use the correct script context when evaluating a class member init expression(Yegappan Lakshmanan) fixes: #14011 fixes: #14402 closes: #15112 closes: #16660 Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
committed by
Christian Brabandt
parent
5090a1fecb
commit
16f2d3a465
@@ -2506,6 +2506,23 @@ generate_store_lhs(cctx_T *cctx, lhs_T *lhs, int instr_count, int is_decl)
|
||||
return OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* Generate instruction to set the script context. Used to evaluate an
|
||||
* object member variable initialization expression in the context of the
|
||||
* script where the class is defined.
|
||||
*/
|
||||
int
|
||||
generate_SCRIPTCTX_SET(cctx_T *cctx, sctx_T new_sctx)
|
||||
{
|
||||
isn_T *isn;
|
||||
|
||||
RETURN_OK_IF_SKIP(cctx);
|
||||
if ((isn = generate_instr(cctx, ISN_SCRIPTCTX_SET)) == NULL)
|
||||
return FAIL;
|
||||
isn->isn_arg.setsctx = new_sctx;
|
||||
return OK;
|
||||
}
|
||||
|
||||
#if defined(FEAT_PROFILE) || defined(PROTO)
|
||||
void
|
||||
may_generate_prof_end(cctx_T *cctx, int prof_lnum)
|
||||
@@ -2821,6 +2838,7 @@ delete_instr(isn_T *isn)
|
||||
case ISN_UNPACK:
|
||||
case ISN_USEDICT:
|
||||
case ISN_WHILE:
|
||||
case ISN_SCRIPTCTX_SET:
|
||||
// nothing allocated
|
||||
break;
|
||||
}
|
||||
|
Reference in New Issue
Block a user