return &t_string;
}
+ static type_T *
+ret_maparg(int argcount, type_T **argtypes UNUSED)
+{
+ // Assume that if the fourth argument is passed it's non-zero
+ if (argcount == 4)
+ return &t_dict_any;
+ return &t_string;
+}
+
static type_T *ret_f_function(int argcount, type_T **argtypes);
/*
#endif
},
{"map", 2, 2, FEARG_1, ret_any, f_map},
- {"maparg", 1, 4, FEARG_1, ret_string, f_maparg},
+ {"maparg", 1, 4, FEARG_1, ret_maparg, f_maparg},
{"mapcheck", 1, 3, FEARG_1, ret_string, f_mapcheck},
{"mapset", 3, 3, FEARG_1, ret_void, f_mapset},
{"match", 2, 4, FEARG_1, ret_any, f_match},
abclear
endfunc
+def Test_vim9_maparg()
+ nmap { w
+ let one: string = maparg('{')
+ assert_equal('w', one)
+ let two: string = maparg('{', 'n')
+ assert_equal('w', two)
+ let three: string = maparg('{', 'n', 0)
+ assert_equal('w', three)
+ let four: dict<any> = maparg('{', 'n', 0, 1)
+ call assert_equal(['{', 'w', 'n'], [four.lhs, four.rhs, four.mode])
+ nunmap {
+enddef
+
func Test_mapcheck()
call assert_equal('', mapcheck('a'))
call assert_equal('', mapcheck('abc'))