mirror of
https://github.com/vim/vim.git
synced 2025-09-25 03:54:15 -04:00
patch 9.1.0523: Vim9: cannot downcast an object
Problem: Vim9: cannot downcast an object (Ernie Rael) Solution: Fix class downcasting issue (LemonBoy). When casting an object from one class to another the target type may be a subclass (downcast) or superclass (upcast) of the source one. Upcasts require a runtime type check to be emitted. Add a disassembly test. fixes: #13244 closes: #15079 Signed-off-by: LemonBoy <thatlemon@gmail.com> 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
05ff4e42fb
commit
50d485432c
@@ -2836,12 +2836,13 @@ compile_expr8(char_u **arg, cctx_T *cctx, ppconst_T *ppconst)
|
||||
type_T *actual;
|
||||
where_T where = WHERE_INIT;
|
||||
|
||||
where.wt_kind = WT_CAST;
|
||||
generate_ppconst(cctx, ppconst);
|
||||
actual = get_type_on_stack(cctx, 0);
|
||||
if (check_type_maybe(want_type, actual, FALSE, where) != OK)
|
||||
{
|
||||
if (need_type(actual, want_type, FALSE,
|
||||
-1, 0, cctx, FALSE, FALSE) == FAIL)
|
||||
if (need_type_where(actual, want_type, FALSE, -1, where, cctx, FALSE, FALSE)
|
||||
== FAIL)
|
||||
return FAIL;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user