endfor
assert_equal('yes no abc', getline(1))
+ setline(1, 'from')
+ v9.CheckDefExecFailure(['s/from/\=g:notexist/'], 'E121: Undefined variable: g:notexist')
+
bwipe!
v9.CheckDefFailure(['s/from/\="x")/'], 'E488:')
unlet g:Get
enddef
+def s:ClosureArg(arg: string)
+ var Ref = () => arg .. "x"
+enddef
+
+def Test_disassemble_closure_arg()
+ var res = execute('disass s:ClosureArg')
+ assert_match('<SNR>\d\+_ClosureArg\_s*' ..
+ 'var Ref = () => arg .. "x"\_s*' ..
+ '\d FUNCREF <lambda>\d\+',
+ res)
+ var lres = execute('disass ' .. matchstr(res, '<lambda>\d\+'))
+ assert_match('<lambda>\d\+\_s*' ..
+ 'return arg .. "x"\_s*' ..
+ '\d LOADOUTER level 1 arg\[-1]\_s*' ..
+ '\d PUSHS "x"\_s*' ..
+ '\d CONCAT size 2\_s*' ..
+ '\d RETURN',
+ lres)
+enddef
def EchoArg(arg: string): string
return arg
res)
enddef
+def s:RetLegacy(): string
+ legacy return "yes"
+enddef
+
+def Test_disassemble_return_legacy()
+ var res = execute('disass s:RetLegacy')
+ assert_match('<SNR>\d*_RetLegacy\_s*' ..
+ 'legacy return "yes"\_s*' ..
+ '\d CMDMOD legacy\_s*' ..
+ '\d EVAL legacy "yes"\_s*' ..
+ '\d CHECKTYPE string stack\[-1]\_s*' ..
+ '\d CMDMOD_REV\_s*' ..
+ '\d RETURN',
+ res)
+enddef
+
def s:EchoMessages()
echohl ErrorMsg | echom v:exception | echohl NONE
enddef
endfor
END
v9.CheckDefExecFailure(lines, 'E1017:', 1)
+
+ lines =<< trim END
+ for [a, b] in g:listlist
+ echo a
+ endfor
+ END
+ g:listlist = [1, 2, 3]
+ v9.CheckDefExecFailure(lines, 'E1140:', 1)
enddef
def Test_for_loop_with_try_continue()
break;
case ISN_LOADOUTER:
{
- if (iptr->isn_arg.number < 0)
+ if (iptr->isn_arg.outer.outer_idx < 0)
smsg("%s%4d LOADOUTER level %d arg[%d]", pfx, current,
iptr->isn_arg.outer.outer_depth,
iptr->isn_arg.outer.outer_idx