mirror of
https://github.com/vim/vim.git
synced 2025-09-25 03:54:15 -04:00
patch 9.0.1045: in a class object members cannot be initialized
Problem: In a class object members cannot be initialized. Solution: Support initializing object members. Make "dissassemble" work on an object method.
This commit is contained in:
@@ -132,15 +132,16 @@ generate_CONSTRUCT(cctx_T *cctx, class_T *cl)
|
||||
}
|
||||
|
||||
/*
|
||||
* Generate ISN_OBJ_MEMBER - access object member by indes.
|
||||
* Generate ISN_GET_OBJ_MEMBER - access member of object at bottom of stack by
|
||||
* index.
|
||||
*/
|
||||
int
|
||||
generate_OBJ_MEMBER(cctx_T *cctx, int idx, type_T *type)
|
||||
generate_GET_OBJ_MEMBER(cctx_T *cctx, int idx, type_T *type)
|
||||
{
|
||||
RETURN_OK_IF_SKIP(cctx);
|
||||
|
||||
// drop the object type
|
||||
isn_T *isn = generate_instr_drop(cctx, ISN_OBJ_MEMBER, 1);
|
||||
isn_T *isn = generate_instr_drop(cctx, ISN_GET_OBJ_MEMBER, 1);
|
||||
if (isn == NULL)
|
||||
return FAIL;
|
||||
|
||||
@@ -148,6 +149,24 @@ generate_OBJ_MEMBER(cctx_T *cctx, int idx, type_T *type)
|
||||
return push_type_stack2(cctx, type, &t_any);
|
||||
}
|
||||
|
||||
/*
|
||||
* Generate ISN_STORE_THIS - store value in member of "this" object with member
|
||||
* index "idx".
|
||||
*/
|
||||
int
|
||||
generate_STORE_THIS(cctx_T *cctx, int idx)
|
||||
{
|
||||
RETURN_OK_IF_SKIP(cctx);
|
||||
|
||||
// drop the value type
|
||||
isn_T *isn = generate_instr_drop(cctx, ISN_STORE_THIS, 1);
|
||||
if (isn == NULL)
|
||||
return FAIL;
|
||||
|
||||
isn->isn_arg.number = idx;
|
||||
return OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* If type at "offset" isn't already VAR_STRING then generate ISN_2STRING.
|
||||
* But only for simple types.
|
||||
@@ -2458,6 +2477,7 @@ delete_instr(isn_T *isn)
|
||||
case ISN_FINISH:
|
||||
case ISN_FOR:
|
||||
case ISN_GETITEM:
|
||||
case ISN_GET_OBJ_MEMBER:
|
||||
case ISN_JUMP:
|
||||
case ISN_JUMP_IF_ARG_SET:
|
||||
case ISN_LISTAPPEND:
|
||||
@@ -2477,7 +2497,6 @@ delete_instr(isn_T *isn)
|
||||
case ISN_NEWDICT:
|
||||
case ISN_NEWLIST:
|
||||
case ISN_NEWPARTIAL:
|
||||
case ISN_OBJ_MEMBER:
|
||||
case ISN_OPANY:
|
||||
case ISN_OPFLOAT:
|
||||
case ISN_OPNR:
|
||||
@@ -2495,8 +2514,8 @@ delete_instr(isn_T *isn)
|
||||
case ISN_REDIREND:
|
||||
case ISN_REDIRSTART:
|
||||
case ISN_RETURN:
|
||||
case ISN_RETURN_VOID:
|
||||
case ISN_RETURN_OBJECT:
|
||||
case ISN_RETURN_VOID:
|
||||
case ISN_SHUFFLE:
|
||||
case ISN_SLICE:
|
||||
case ISN_SOURCE:
|
||||
@@ -2504,6 +2523,7 @@ delete_instr(isn_T *isn)
|
||||
case ISN_STOREINDEX:
|
||||
case ISN_STORENR:
|
||||
case ISN_STOREOUTER:
|
||||
case ISN_STORE_THIS:
|
||||
case ISN_STORERANGE:
|
||||
case ISN_STOREREG:
|
||||
case ISN_STOREV:
|
||||
|
Reference in New Issue
Block a user