StackValue.Property also needs to implement dupReceiver()
This commit is contained in:
@@ -427,5 +427,17 @@ public abstract class StackValue {
|
|||||||
v.visitMethodInsn(isStatic ? Opcodes.INVOKESTATIC : isInterface ? Opcodes.INVOKEINTERFACE : Opcodes.INVOKEVIRTUAL, owner, setter.getName(), setter.getDescriptor());
|
v.visitMethodInsn(isStatic ? Opcodes.INVOKESTATIC : isInterface ? Opcodes.INVOKEINTERFACE : Opcodes.INVOKEVIRTUAL, owner, setter.getName(), setter.getDescriptor());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void dupReceiver(InstructionAdapter v, int below) {
|
||||||
|
if (!isStatic) {
|
||||||
|
if (below == 1) {
|
||||||
|
v.dupX1();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
v.dup();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
class Slot() {
|
||||||
|
var vitality: Int = 10000
|
||||||
|
|
||||||
|
fun increaseVitality(delta: Int) {
|
||||||
|
vitality += delta
|
||||||
|
if (vitality > 65535) vitality = 65535;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun box(): String {
|
||||||
|
val s = Slot()
|
||||||
|
s.increaseVitality(1000)
|
||||||
|
return if (s.vitality == 11000) "OK" else "fail"
|
||||||
|
}
|
||||||
@@ -414,4 +414,8 @@ public class NamespaceGenTest extends CodegenTestCase {
|
|||||||
final Method main = generateFunction();
|
final Method main = generateFunction();
|
||||||
main.invoke(null); // must not fail
|
main.invoke(null); // must not fail
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void testIncrementProperty() throws Exception {
|
||||||
|
blackBoxFile("incrementProperty.jet");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user