JavaTXCompilerInJavaTX/src/de/dhbwstuttgart/syntaxtree/operator/MinusOp.java
2014-09-04 16:35:44 +02:00

47 lines
1.3 KiB
Java
Executable File

// ino.module.MinusOp.8603.package
package de.dhbwstuttgart.syntaxtree.operator;
// ino.end
// ino.module.MinusOp.8603.import
import java.util.Vector;
import de.dhbwstuttgart.bytecode.ClassFile;
import de.dhbwstuttgart.bytecode.CodeAttribute;
import de.dhbwstuttgart.bytecode.JVMCode;
import de.dhbwstuttgart.myexception.JVMCodeException;
import de.dhbwstuttgart.syntaxtree.statement.Binary;
import de.dhbwstuttgart.syntaxtree.statement.Expr;
// ino.class.MinusOp.24211.declaration
public class MinusOp extends AddOp
// ino.end
// ino.class.MinusOp.24211.body
{
// ino.method.MinusOp.24215.definition
public MinusOp(int offset, int variableLength)
// ino.end
// ino.method.MinusOp.24215.body
{
super(offset,variableLength);
}
// ino.end
// ino.method.codegen.24218.definition
public void codegen(ClassFile classfile, CodeAttribute code, Expr expr, boolean neg, Vector paralist)
throws JVMCodeException
// ino.end
// ino.method.codegen.24218.body
{
Expr expr1 = ((Binary)expr).get_Expr1();
Expr expr2 = ((Binary)expr).get_Expr2();
expr1.codegen(classfile, code, paralist);
expr2.codegen(classfile, code, paralist);
if(!neg) code.add_code(JVMCode.nsub(expr1.getTypeName()));
else code.add_code(JVMCode.nadd(expr1.getTypeName()));
}
// ino.end
}
// ino.end