diff src/structs.h @ 35524:e907407c9fe5 v9.1.0523

patch 9.1.0523: Vim9: cannot downcast an object Commit: https://github.com/vim/vim/commit/50d485432c61cae4fea776d26bb051c270f79881 Author: LemonBoy <thatlemon@gmail.com> Date: Thu Jul 4 17:03:17 2024 +0200 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>
author Christian Brabandt <cb@256bit.org>
date Thu, 04 Jul 2024 17:15:03 +0200
parents 9a52a7b13fc5
children a35a8ae0b315
line wrap: on
line diff
--- a/src/structs.h
+++ b/src/structs.h
@@ -4902,7 +4902,8 @@ typedef enum {
     WT_MEMBER,
     WT_METHOD,		// object method
     WT_METHOD_ARG,	// object method argument type
-    WT_METHOD_RETURN	// object method return type
+    WT_METHOD_RETURN,	// object method return type
+    WT_CAST,		// type cast
 } wherekind_T;
 
 // Struct used to pass the location of a type check.  Used in error messages to