CheckScriptSuccess(lines)
enddef
+def Shadowed(): list<number>
+ var FuncList: list<func: number> = [{ -> 42}]
+ return FuncList->map({_, Shadowed -> Shadowed()})
+enddef
+
+def Test_lambda_arg_shadows_func()
+ assert_equal([42], Shadowed())
+enddef
+
def Line_continuation_in_def(dir: string = ''): string
var path: string = empty(dir)
\ ? 'empty'
goto theend;
}
- // If we can find the function by name generate the right call.
- // Skip global functions here, a local funcref takes precedence.
- ufunc = find_func(name, FALSE, cctx);
- if (ufunc != NULL && !func_is_global(ufunc))
- {
- res = generate_CALL(cctx, ufunc, argcount);
- goto theend;
+ // An argument or local variable can be a function reference, this
+ // overrules a function name.
+ if (lookup_local(namebuf, varlen, cctx) == NULL
+ && arg_exists(namebuf, varlen, NULL, NULL, NULL, cctx) != OK)
+ {
+ // If we can find the function by name generate the right call.
+ // Skip global functions here, a local funcref takes precedence.
+ ufunc = find_func(name, FALSE, cctx);
+ if (ufunc != NULL && !func_is_global(ufunc))
+ {
+ res = generate_CALL(cctx, ufunc, argcount);
+ goto theend;
+ }
}
// If the name is a variable, load it and use PCALL.