diff src/vim9expr.c @ 33587:c470d4fd5eba v9.0.2038

patch 9.0.2038: Vim9: object method funcref not cleaned up after use Commit: https://github.com/vim/vim/commit/f3eac695bfe3453fe2a8b980601c55835406f14b Author: Yegappan Lakshmanan <yegappan@yahoo.com> Date: Tue Oct 17 11:00:45 2023 +0200 patch 9.0.2038: Vim9: object method funcref not cleaned up after use Problem: Vim9: object method funcref not cleaned up after use Solution: Clean up type stack after using object method funcref, remove now longer used ISN_DEFEROBJ instrunction closes: #13360 Signed-off-by: Christian Brabandt <cb@256bit.org> Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
author Christian Brabandt <cb@256bit.org>
date Tue, 17 Oct 2023 11:15:06 +0200
parents 86dbcbb94fdb
children de690130ba43
line wrap: on
line diff
--- a/src/vim9expr.c
+++ b/src/vim9expr.c
@@ -450,9 +450,9 @@ compile_class_object_index(cctx_T *cctx,
 		return FAIL;
 	    }
 	    *arg = name_end;
-	    if (type->tt_type == VAR_OBJECT)
-		return generate_FUNCREF(cctx, fp, cl, TRUE, m_idx, NULL);
-	    return generate_FUNCREF(cctx, fp, NULL, FALSE, 0, NULL);
+	    // Remove the object type from the stack
+	    --cctx->ctx_type_stack.ga_len;
+	    return generate_FUNCREF(cctx, fp, cl, TRUE, m_idx, NULL);
 	}
 
 	member_not_found_msg(cl, VAR_OBJECT, name, len);
@@ -490,9 +490,9 @@ compile_class_object_index(cctx_T *cctx,
 		return FAIL;
 	    }
 	    *arg = name_end;
-	    if (type->tt_type == VAR_CLASS)
-		return generate_FUNCREF(cctx, fp, cl, FALSE, m_idx, NULL);
-	    return generate_FUNCREF(cctx, fp, NULL, FALSE, 0, NULL);
+	    // Remove the class type from the stack
+	    --cctx->ctx_type_stack.ga_len;
+	    return generate_FUNCREF(cctx, fp, cl, FALSE, m_idx, NULL);
 	}
 
 	member_not_found_msg(cl, VAR_CLASS, name, len);