diff src/vim9class.c @ 31706:824fc05d9571 v9.0.1185

patch 9.0.1185: using class from imported script not tested Commit: https://github.com/vim/vim/commit/a86655af84f1596f0f3ef22813724fe06f1e4809 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Jan 12 17:06:27 2023 +0000 patch 9.0.1185: using class from imported script not tested Problem: Using class from imported script not tested. Solution: Add tests. Implement what is missing.
author Bram Moolenaar <Bram@vim.org>
date Thu, 12 Jan 2023 18:15:05 +0100
parents 69ee530cac28
children 1949c2613b3e
line wrap: on
line diff
--- a/src/vim9class.c
+++ b/src/vim9class.c
@@ -244,9 +244,13 @@ ex_class(exarg_T *eap)
     }
     char_u *name_start = arg;
 
+    // "export class" gets used when creating the class, don't use "is_export"
+    // for the items inside the class.
+    int class_export = is_export;
+    is_export = FALSE;
+
     // TODO:
     //    generics: <Tkey, Tentry>
-    //	  handle "is_export" if it is set
 
     // Name for "extends BaseClass"
     char_u *extends = NULL;
@@ -558,7 +562,7 @@ early_ret:
     {
 	typval_T tv;
 	tv.v_type = VAR_UNKNOWN;
-	if (eval_variable(extends, 0, 0, &tv, NULL, EVAL_VAR_IMPORT) == FAIL)
+	if (eval_variable_import(extends, &tv) == FAIL)
 	{
 	    semsg(_(e_class_name_not_found_str), extends);
 	    success = FALSE;
@@ -594,7 +598,7 @@ early_ret:
 	    char_u *impl = ((char_u **)ga_impl.ga_data)[i];
 	    typval_T tv;
 	    tv.v_type = VAR_UNKNOWN;
-	    if (eval_variable(impl, 0, 0, &tv, NULL, EVAL_VAR_IMPORT) == FAIL)
+	    if (eval_variable_import(impl, &tv) == FAIL)
 	    {
 		semsg(_(e_interface_name_not_found_str), impl);
 		success = FALSE;
@@ -930,6 +934,7 @@ early_ret:
 	typval_T tv;
 	tv.v_type = VAR_CLASS;
 	tv.vval.v_class = cl;
+	is_export = class_export;
 	set_var_const(cl->class_name, current_sctx.sc_sid,
 					     NULL, &tv, FALSE, ASSIGN_DECL, 0);
 	return;