Print now can print fields of thisClass
This commit is contained in:
parent
6a56f51050
commit
e801717444
@ -60,9 +60,13 @@ public class PrintStatement extends AbstractType implements IStatement {
|
|||||||
}
|
}
|
||||||
counter++;
|
counter++;
|
||||||
}
|
}
|
||||||
|
// If not a localVar, maybe a class field of this class
|
||||||
if (index == -1){
|
if (index == -1){
|
||||||
throw new Exception("Variable " + variableName + " not found");
|
String typeOfField = typeContext.get(thisClass).get(variableName);
|
||||||
|
if (typeOfField == null){
|
||||||
|
throw new Exception("Variable " + variableName + " not found in local variables or class fields.");
|
||||||
|
}
|
||||||
|
mv.visitFieldInsn(Opcodes.GETSTATIC, thisClass, variableName, "I");
|
||||||
}
|
}
|
||||||
|
|
||||||
mv.visitVarInsn(Opcodes.ILOAD, index);
|
mv.visitVarInsn(Opcodes.ILOAD, index);
|
||||||
|
Loading…
Reference in New Issue
Block a user