Compiler for lua 5.2 fixes.

This commit is contained in:
James Roseborough
2012-09-03 18:39:56 +00:00
parent be1fae0b1d
commit b90998c6d4
3 changed files with 4 additions and 7 deletions

View File

@@ -223,7 +223,7 @@ public class Print extends Lua {
case OP_GETTABUP: case OP_GETTABUP:
case OP_SETTABUP: case OP_SETTABUP:
ps.print(" ; "); ps.print(" ; ");
printConstant( ps, f, bx ); printConstant( ps, f, b );
break; break;
case OP_GETTABLE: case OP_GETTABLE:
case OP_SELF: case OP_SELF:

View File

@@ -1109,6 +1109,7 @@ public class FuncState extends LuaC {
int codeABx(int o, int a, int bc) { int codeABx(int o, int a, int bc) {
_assert (getOpMode(o) == iABx || getOpMode(o) == iAsBx); _assert (getOpMode(o) == iABx || getOpMode(o) == iAsBx);
_assert (getCMode(o) == OpArgN); _assert (getCMode(o) == OpArgN);
_assert (bc >= 0 && bc <= Lua.MAXARG_Bx);
return this.code(CREATE_ABx(o, a, bc), this.ls.lastline); return this.code(CREATE_ABx(o, a, bc), this.ls.lastline);
} }

View File

@@ -1064,14 +1064,9 @@ public class LexState {
} }
void open_func (FuncState fs, BlockCnt bl) { void open_func (FuncState fs, BlockCnt bl) {
LuaC L = this.L;
Prototype f = new Prototype(); Prototype f = new Prototype();
if ( this.fs!=null )
f.source = this.fs.f.source;
fs.f = f;
fs.prev = this.fs; /* linked list of funcstates */ fs.prev = this.fs; /* linked list of funcstates */
fs.ls = this; fs.ls = this;
fs.L = L;
this.fs = fs; this.fs = fs;
fs.pc = 0; fs.pc = 0;
fs.lasttarget = -1; fs.lasttarget = -1;
@@ -1079,6 +1074,7 @@ public class LexState {
fs.freereg = 0; fs.freereg = 0;
fs.nk = 0; fs.nk = 0;
fs.np = 0; fs.np = 0;
fs.nups = 0;
fs.nlocvars = 0; fs.nlocvars = 0;
fs.nactvar = 0; fs.nactvar = 0;
fs.firstlocal = dyd.n_actvar; fs.firstlocal = dyd.n_actvar;
@@ -1266,9 +1262,9 @@ public class LexState {
/* body -> `(' parlist `)' chunk END */ /* body -> `(' parlist `)' chunk END */
FuncState new_fs = new FuncState(); FuncState new_fs = new FuncState();
BlockCnt bl = new BlockCnt(); BlockCnt bl = new BlockCnt();
open_func(new_fs, bl);
new_fs.f = addprototype(); new_fs.f = addprototype();
new_fs.f.linedefined = line; new_fs.f.linedefined = line;
open_func(new_fs, bl);
this.checknext('('); this.checknext('(');
if (needself) { if (needself) {
new_localvarliteral("self"); new_localvarliteral("self");