Fix corrupted args for io.lines and file:lines on reuse stack elements.

This commit is contained in:
Enyby
2019-10-12 16:08:36 +03:00
parent db58e1808b
commit 60d130cecc
2 changed files with 63 additions and 61 deletions

View File

@@ -707,8 +707,10 @@ public abstract class Varargs {
/** Return Varargs that cannot be using a shared array for the storage, and is flattened. /** Return Varargs that cannot be using a shared array for the storage, and is flattened.
* Internal utility method not intended to be called directly from user code. * Internal utility method not intended to be called directly from user code.
* @return Varargs containing same values, but flattened and with a new array if needed. * @return Varargs containing same values, but flattened and with a new array if needed.
* @exclude
* @hide
*/ */
Varargs dealias() { public Varargs dealias() {
int n = narg(); int n = narg();
switch (n) { switch (n) {
case 0: return LuaValue.NONE; case 0: return LuaValue.NONE;

View File

@@ -290,7 +290,7 @@ public class IoLib extends TwoArgFunction {
public IoLibV(File f, String name, int opcode, IoLib iolib, boolean toclose, Varargs args) { public IoLibV(File f, String name, int opcode, IoLib iolib, boolean toclose, Varargs args) {
this(f, name, opcode, iolib); this(f, name, opcode, iolib);
this.toclose = toclose; this.toclose = toclose;
this.args = args; this.args = args.dealias();
} }
public IoLibV(File f, String name, int opcode, IoLib iolib) { public IoLibV(File f, String name, int opcode, IoLib iolib) {
super(); super();