diff src/vim9expr.c @ 31694:2f61e308b997 v9.0.1179

patch 9.0.1179: not all errors around inheritance are tested Commit: https://github.com/vim/vim/commit/6aa0937fb88001a5ea18e732aad4c625e9b2baeb Author: Bram Moolenaar <Bram@vim.org> Date: Wed Jan 11 17:59:38 2023 +0000 patch 9.0.1179: not all errors around inheritance are tested Problem: Not all errors around inheritance are tested. Solution: Add more tests. Fix uncovered problems.
author Bram Moolenaar <Bram@vim.org>
date Wed, 11 Jan 2023 19:00:06 +0100
parents 2f1af1b2f82d
children 1b2bde0c64f2
line wrap: on
line diff
--- a/src/vim9expr.c
+++ b/src/vim9expr.c
@@ -268,14 +268,14 @@ compile_class_object_index(cctx_T *cctx,
     if (type == &t_super)
     {
 	if (cctx->ctx_ufunc == NULL || cctx->ctx_ufunc->uf_class == NULL)
+	{
 	    emsg(_(e_using_super_not_in_class_function));
-	else
-	{
-	    is_super = TRUE;
-	    cl = cctx->ctx_ufunc->uf_class;
-	    // Remove &t_super from the stack.
-	    --cctx->ctx_type_stack.ga_len;
+	    return FAIL;
 	}
+	is_super = TRUE;
+	cl = cctx->ctx_ufunc->uf_class;
+	// Remove &t_super from the stack.
+	--cctx->ctx_type_stack.ga_len;
     }
     else if (type->tt_type == VAR_CLASS)
     {
@@ -2261,6 +2261,7 @@ compile_subscript(
 	    // class constructor: SomeClass.new()
 	    // object member: someObject.varname, this.varname
 	    // object method: someObject.SomeMethod(), this.SomeMethod()
+	    *arg = p;
 	    if (compile_class_object_index(cctx, arg, type) == FAIL)
 		return FAIL;
 	}