mirror of
https://github.com/vim/vim.git
synced 2025-09-30 04:44:14 -04:00
patch 9.0.1031: Vim9 class is not implemented yet
Problem: Vim9 class is not implemented yet. Solution: Add very basic class support.
This commit is contained in:
@@ -113,6 +113,24 @@ generate_instr_debug(cctx_T *cctx)
|
||||
return isn;
|
||||
}
|
||||
|
||||
/*
|
||||
* Generate an ISN_CONSTRUCT instruction.
|
||||
* The object will have "size" members.
|
||||
*/
|
||||
int
|
||||
generate_CONSTRUCT(cctx_T *cctx, class_T *cl)
|
||||
{
|
||||
isn_T *isn;
|
||||
|
||||
RETURN_OK_IF_SKIP(cctx);
|
||||
if ((isn = generate_instr(cctx, ISN_CONSTRUCT)) == NULL)
|
||||
return FAIL;
|
||||
isn->isn_arg.construct.construct_size = sizeof(object_T)
|
||||
+ cl->class_obj_member_count * sizeof(typval_T);
|
||||
isn->isn_arg.construct.construct_class = cl;
|
||||
return OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* If type at "offset" isn't already VAR_STRING then generate ISN_2STRING.
|
||||
* But only for simple types.
|
||||
@@ -163,6 +181,8 @@ may_generate_2STRING(int offset, int tolerant, cctx_T *cctx)
|
||||
case VAR_JOB:
|
||||
case VAR_CHANNEL:
|
||||
case VAR_INSTR:
|
||||
case VAR_CLASS:
|
||||
case VAR_OBJECT:
|
||||
to_string_error(type->tt_type);
|
||||
return FAIL;
|
||||
}
|
||||
@@ -2403,6 +2423,7 @@ delete_instr(isn_T *isn)
|
||||
case ISN_COMPARESPECIAL:
|
||||
case ISN_COMPARESTRING:
|
||||
case ISN_CONCAT:
|
||||
case ISN_CONSTRUCT:
|
||||
case ISN_COND2BOOL:
|
||||
case ISN_DEBUG:
|
||||
case ISN_DEFER:
|
||||
@@ -2457,6 +2478,7 @@ delete_instr(isn_T *isn)
|
||||
case ISN_REDIRSTART:
|
||||
case ISN_RETURN:
|
||||
case ISN_RETURN_VOID:
|
||||
case ISN_RETURN_OBJECT:
|
||||
case ISN_SHUFFLE:
|
||||
case ISN_SLICE:
|
||||
case ISN_SOURCE:
|
||||
|
Reference in New Issue
Block a user