E1388 vim9class.txt /*E1388*
E1389 vim9class.txt /*E1389*
E139 message.txt /*E139*
+E1390 vim9class.txt /*E1390*
E140 message.txt /*E140*
E1400 builtin.txt /*E1400*
E1401 builtin.txt /*E1401*
this.col = col
enddef
endclass
-
+<
+ *E1390*
Not only is this text you need to write, it also has the type of each
variables twice. Since this is so common a shorter way to write new() is
provided: >
INIT(= N_("E1388: Public keyword not supported for a method"));
EXTERN char e_missing_name_after_implements[]
INIT(= N_("E1389: Missing name after implements"));
+EXTERN char e_cannot_use_an_object_variable_except_with_the_new_method_str[]
+ INIT(= N_("E1390: Cannot use an object variable \"this.%s\" except with the \"new\" method"));
#endif
EXTERN char e_cannot_mix_positional_and_non_positional_str[]
INIT(= N_("E1400: Cannot mix positional and non-positional arguments: %s"));
INIT(= N_("E1405: Invalid format specifier: %s"));
EXTERN char e_aptypes_is_null_nr_str[]
INIT(= "E1408: Internal error: ap_types or ap_types[idx] is NULL: %d: %s");
-// E1390 - E1399 unused
+// E1391 - E1399 unused
END
v9.CheckSourceFailure(lines, 'E1013:')
+ lines =<< trim END
+ vim9script
+
+ class C
+ this.str: string
+ def MethodA(this.str)
+ enddef
+ endclass
+ END
+ v9.CheckSourceFailure(lines, 'E1390: Cannot use an object variable "this.str" except with the "new" method')
+
lines =<< trim END
vim9script
++p;
char_u *argend = p;
+ // object variable this. can be used only in a constructor
+ if (STRNCMP(eap->arg, "new", 3) != 0)
+ {
+ c = *argend;
+ *argend = NUL;
+ semsg(_(e_cannot_use_an_object_variable_except_with_the_new_method_str), arg);
+ *argend = c;
+ break;
+ }
+
if (*skipwhite(p) == '=')
{
char_u *defval = skipwhite(skipwhite(p) + 1);
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 1948,
/**/
1947,
/**/