Remove name passing into UpVal instances.

This commit is contained in:
James Roseborough
2008-04-23 17:34:04 +00:00
parent 06e4efd93c
commit 53fa0d1ca0
2 changed files with 5 additions and 7 deletions

View File

@@ -848,7 +848,7 @@ public class LuaState extends Lua {
if (o == LuaState.OP_GETUPVAL) {
newClosure.upVals[j] = cl.upVals[b];
} else if (o == LuaState.OP_MOVE) {
newClosure.upVals[j] = findUpVal( proto.upvalues[j], base + b );
newClosure.upVals[j] = findUpVal( base + b );
} else {
throw new java.lang.IllegalArgumentException(
"bad opcode: " + o);
@@ -879,7 +879,7 @@ public class LuaState extends Lua {
}
}
private UpVal findUpVal( LString upValName, int target ) {
private UpVal findUpVal( int target ) {
UpVal up;
int i;
for ( i = this.upvals.size() - 1; i >= 0; --i ) {
@@ -891,7 +891,7 @@ public class LuaState extends Lua {
}
}
up = new UpVal( upValName, this, target );
up = new UpVal( this, target );
this.upvals.insertElementAt( up, i + 1 );
return up;
}

View File

@@ -24,19 +24,17 @@ package org.luaj.vm;
public class UpVal {
private LString name;
LuaState state;
int position;
LValue value;
public UpVal( LString string, LuaState state, int i ) {
this.name = string;
public UpVal( LuaState state, int i ) {
this.state = state;
this.position = i;
}
public String toString() {
return "up."+name;
return "up."+position;
}
public LValue getValue() {