summaryrefslogtreecommitdiff
path: root/lcode.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2017-11-29 14:57:36 -0200
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2017-11-29 14:57:36 -0200
commit745eb4199333f153a28c75837b6a1addf614f4a9 (patch)
tree9eb2cfe63700db8e2102d980d603ee294111cb14 /lcode.c
parentc766e4103db888063c4f928747afd6eb448e306f (diff)
downloadlua-github-745eb4199333f153a28c75837b6a1addf614f4a9.tar.gz
new opcodes OP_RETURN0/OP_RETURN1
Diffstat (limited to 'lcode.c')
-rw-r--r--lcode.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/lcode.c b/lcode.c
index 97aa9dda..8f9fa408 100644
--- a/lcode.c
+++ b/lcode.c
@@ -1,5 +1,5 @@
/*
-** $Id: lcode.c,v 2.137 2017/11/28 12:58:18 roberto Exp roberto $
+** $Id: lcode.c,v 2.138 2017/11/28 15:26:15 roberto Exp roberto $
** Code generator for Lua
** See Copyright Notice in lua.h
*/
@@ -152,7 +152,17 @@ int luaK_jump (FuncState *fs) {
** Code a 'return' instruction
*/
void luaK_ret (FuncState *fs, int first, int nret) {
- luaK_codeABC(fs, OP_RETURN, first, nret+1, 0);
+ switch (nret) {
+ case 0:
+ luaK_codeABC(fs, OP_RETURN0, 0, 0, 0);
+ break;
+ case 1:
+ luaK_codeABC(fs, OP_RETURN1, first, 0, 0);
+ break;
+ default:
+ luaK_codeABC(fs, OP_RETURN, first, nret + 1, 0);
+ break;
+ }
}