Problem: Not strict enough checking syntax of method invocation.
Solution: Check there is no white space inside ->method(.
name(expr8 [, args])
There can also be methods specifically for the type of "expr8".
-"->name(" must not contain white space. There can be white space before "->"
-and after the "(".
-
-This allows for chaining, using the type that the method returns: >
+This allows for chaining, passing the value that one method returns to the
+next method: >
mylist->filter(filterexpr)->map(mapexpr)->sort()->join()
<
+ *E274*
+"->name(" must not contain white space. There can be white space before the
+"->" and after the "(", thus you can split the lines like this: >
+ mylist
+ \ ->filter(filterexpr)
+ \ ->map(mapexpr)
+ \ ->sort()
+ \ ->join()
+<
*expr9*
number
semsg(_(e_missingparen), name);
ret = FAIL;
}
+ else if (VIM_ISWHITE((*arg)[-1]))
+ {
+ if (verbose)
+ semsg(_("E274: No white space allowed before parenthesis"));
+ ret = FAIL;
+ }
else
ret = eval_func(arg, name, len, rettv, evaluate, &base);
}
delfunc Concat
endfunc
+
+func Test_method_syntax()
+ eval [1, 2, 3] ->sort( )
+ eval [1, 2, 3]
+ \ ->sort(
+ \ )
+ call assert_fails('eval [1, 2, 3]-> sort()', 'E260:')
+ call assert_fails('eval [1, 2, 3]->sort ()', 'E274:')
+ call assert_fails('eval [1, 2, 3]-> sort ()', 'E260:')
+endfunc
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 1828,
/**/
1827,
/**/