'\d 2STRING stack\[-1\]\_s*' ..
'\d\+ PUSHS ".txt"\_s*' ..
'\d\+ EXECCONCAT 4\_s*' ..
- '\d\+ PUSHNR 0\_s*' ..
- '\d\+ RETURN',
+ '\d\+ RETURN 0',
res)
enddef
'\d EXEC norm! m\[jjm\]\_s*' ..
' :''\[,''\]yank\_s*' ..
'\d EXEC :''\[,''\]yank\_s*' ..
- '\d PUSHNR 0\_s*' ..
- '\d RETURN',
+ '\d RETURN 0',
res)
enddef
' :3put ="text"\_s*' ..
'\d PUSHS "text"\_s*' ..
'\d PUT = 3\_s*' ..
- '\d PUSHNR 0\_s*' ..
- '\d RETURN',
+ '\d RETURN 0',
res)
enddef
' :$-2put a\_s*' ..
'\d RANGE $-2\_s*' ..
'\d PUT a range\_s*' ..
- '\d PUSHNR 0\_s*' ..
- '\d RETURN',
+ '\d RETURN 0',
res)
enddef
'\d\+ PUSHS "a"\_s*' ..
'\d\+ LOAD $1\_s*' ..
'\d\+ STOREDICT\_s*' ..
- '\d\+ PUSHNR 0\_s*' ..
- '\d\+ RETURN',
+ '\d\+ RETURN 0',
res)
enddef
'\d LOAD $0\_s*' ..
'\d MEMBER dd\_s*' ..
'\d STOREINDEX\_s*' ..
- '\d\+ PUSHNR 0\_s*' ..
- '\d\+ RETURN',
+ '\d\+ RETURN 0',
res)
enddef
'\d\+ STORE $1\_s*' ..
'\d\+ SLICE 2\_s*' ..
'\d\+ STORE $2\_s*' ..
- '\d\+ PUSHNR 0\_s*' ..
- '\d\+ RETURN',
+ '\d\+ RETURN 0',
res)
enddef
'\d\+ CHECKTYPE number stack\[-1\]\_s*' ..
'\d\+ LISTAPPEND\_s*' ..
'\d\+ DROP\_s*' ..
- '\d\+ PUSHNR 0\_s*' ..
- '\d\+ RETURN',
+ '\d\+ RETURN 0',
res)
enddef
'\d\+ CHECKTYPE number stack\[-1\]\_s*' ..
'\d\+ BLOBAPPEND\_s*' ..
'\d\+ DROP\_s*' ..
- '\d\+ PUSHNR 0\_s*' ..
- '\d\+ RETURN',
+ '\d\+ RETURN 0',
res)
enddef
'\d LOAD arg\[-1\]\_s*' ..
'\d CONCAT\_s*' ..
'\d STOREOUTER $0\_s*' ..
- '\d PUSHNR 0\_s*' ..
- '\d RETURN',
+ '\d RETURN 0',
res)
res = execute('disass g:Get')
'\d PCALL top (argc 1)\_s*' ..
'\d PCALL end\_s*' ..
'\d DROP\_s*' ..
- '\d PUSHNR 0\_s*' ..
- '\d RETURN',
+ '\d RETURN 0',
res)
enddef
'\d PUSHS "UserFunc"\_s*' ..
'\d BCALL funcref(argc 1)\_s*' ..
'\d STORE $2\_s*' ..
- '\d PUSHNR 0\_s*' ..
- '\d RETURN',
+ '\d RETURN 0',
instr)
enddef
'var chan1: channel\_s*' ..
'\d PUSHCHANNEL 0\_s*' ..
'\d STORE $2\_s*' ..
- '\d PUSHNR 0\_s*' ..
- '\d RETURN',
+ '\d RETURN 0',
instr)
enddef
'echomsg "inner"\_s*' ..
'enddef\_s*' ..
'\d NEWFUNC <lambda>\d\+ Inner\_s*' ..
- '\d PUSHNR 0\_s*' ..
- '\d RETURN',
+ '\d RETURN 0',
instr)
enddef
'\d DEF /Info\_s*' ..
'def /Info/\_s*' ..
'\d DEF /Info/\_s*' ..
- '\d PUSHNR 0\_s*' ..
- '\d RETURN',
+ '\d RETURN 0',
instr)
enddef
'endfor\_s*' ..
'\d\+ JUMP -> 8\_s*' ..
'\d\+ DROP\_s*' ..
- '\d\+ PUSHNR 0\_s*' ..
- '\d\+ RETURN',
+ '\d\+ RETURN 0',
instr)
enddef
'\d NEWLIST size 2\_s*' ..
'\d SETTYPE list<number>\_s*' ..
'\d STORE $0\_s*' ..
- '\d PUSHNR 0\_s*' ..
- '\d RETURN\_s*',
+ '\d RETURN 0\_s*',
instr)
enddef
'echo "" ?? "empty string"\_s*' ..
'\d\+ PUSHS "empty string"\_s*' ..
'\d\+ ECHO 1\_s*' ..
- '\d\+ PUSHNR 0\_s*' ..
- '\d\+ RETURN',
+ '\d\+ RETURN 0',
res)
enddef
'if ' .. substitute(case[0], '[[~]', '\\\0', 'g') .. '.*' ..
'\d PUSHNR 42.*' ..
'\d ECHO 1.*' ..
- '\d PUSHNR 0.*' ..
- '\d RETURN.*',
+ '\d RETURN 0',
instr)
else
# condition false, function just returns
'if ' .. substitute(case[0], '[[~]', '\\\0', 'g') .. '[ \n]*' ..
'echo 42[ \n]*' ..
'endif[ \n]*' ..
- '\s*\d PUSHNR 0.*' ..
- '\d RETURN.*',
+ '\d RETURN 0',
instr)
endif
'\d\+ LOAD $1\_s*' ..
'\d\+ CONCAT\_s*' ..
'\d\+ EXECUTE 1\_s*' ..
- '\d\+ PUSHNR 0\_s*' ..
- '\d\+ RETURN',
+ '\d\+ RETURN 0',
res)
enddef
"echoerr 'went' .. 'wrong'\\_s*" ..
'\d PUSHS "wentwrong"\_s*' ..
'\d ECHOERR 1\_s*' ..
- '\d PUSHNR 0\_s*' ..
- '\d RETURN',
+ '\d RETURN 0',
res)
enddef
'\d SHUFFLE 2 up 1\_s*' ..
'\d BCALL append(argc 2)\_s*' ..
'\d DROP\_s*' ..
- '\d PUSHNR 0\_s*' ..
- '\d RETURN',
+ '\d RETURN 0',
res)
enddef
'\d PUSHS "error"\_s*' ..
'\d ECHOERR 1\_s*' ..
'\d CMDMOD_REV\_s*' ..
- '\d PUSHNR 0\_s*' ..
- '\d RETURN',
+ '\d RETURN 0',
res)
enddef
ISN_PCALL, // call partial, use isn_arg.pfunc
ISN_PCALL_END, // cleanup after ISN_PCALL with cpf_top set
ISN_RETURN, // return, result is on top of stack
+ ISN_RETURN_ZERO, // Push zero, then return
ISN_FUNCREF, // push a function ref to dfunc isn_arg.funcref
ISN_NEWFUNC, // create a global function from a lambda function
ISN_DEF, // list functions
}
// Return zero if there is no return at the end.
- generate_PUSHNR(&cctx, 0);
- generate_instr(&cctx, ISN_RETURN);
+ generate_instr(&cctx, ISN_RETURN_ZERO);
}
{
case ISN_PUSHSPEC:
case ISN_PUT:
case ISN_RETURN:
+ case ISN_RETURN_ZERO:
case ISN_SHUFFLE:
case ISN_SLICE:
case ISN_STORE:
break;
// return from a :def function call
+ case ISN_RETURN_ZERO:
+ if (GA_GROW(&ectx.ec_stack, 1) == FAIL)
+ goto failed;
+ tv = STACK_TV_BOT(0);
+ ++ectx.ec_stack.ga_len;
+ tv->v_type = VAR_NUMBER;
+ tv->vval.v_number = 0;
+ tv->v_lock = 0;
+ // FALLTHROUGH
+
case ISN_RETURN:
{
garray_T *trystack = &ectx.ec_trystack;
case ISN_RETURN:
smsg("%4d RETURN", current);
break;
+ case ISN_RETURN_ZERO:
+ smsg("%4d RETURN 0", current);
+ break;
case ISN_FUNCREF:
{
funcref_T *funcref = &iptr->isn_arg.funcref;