Null eingefuegt

This commit is contained in:
Martin Plümicke 2015-06-18 12:34:09 +02:00
parent 7530e01ea9
commit 99c719251d
3 changed files with 18 additions and 5 deletions

View File

@ -4,8 +4,11 @@ package de.dhbwstuttgart.syntaxtree.statement;
// ino.module.Expr.8630.import // ino.module.Expr.8630.import
import java.util.Hashtable; import java.util.Hashtable;
import java.util.Iterator; import java.util.Iterator;
import de.dhbwstuttgart.typeinference.Menge;
import org.apache.bcel.generic.ClassGen;
import org.apache.bcel.generic.InstructionList;
import de.dhbwstuttgart.typeinference.Menge;
import de.dhbwstuttgart.myexception.CTypeReconstructionException; import de.dhbwstuttgart.myexception.CTypeReconstructionException;
import de.dhbwstuttgart.myexception.SCStatementException; import de.dhbwstuttgart.myexception.SCStatementException;
import de.dhbwstuttgart.syntaxtree.Class; import de.dhbwstuttgart.syntaxtree.Class;
@ -109,5 +112,7 @@ public abstract class Expr extends ExprStmt
public ConstraintsSet TYPEStmt(TypeAssumptions assumptions){ public ConstraintsSet TYPEStmt(TypeAssumptions assumptions){
throw new NotImplementedException(); //wird die TYPEStmt-Methode innerhalb einer Expr aufgerufen, dann ist etwas schief gelaufen. throw new NotImplementedException(); //wird die TYPEStmt-Methode innerhalb einer Expr aufgerufen, dann ist etwas schief gelaufen.
} }
public abstract InstructionList genByteCode(ClassGen _cg);
} }
// ino.end // ino.end

View File

@ -5,6 +5,8 @@ package de.dhbwstuttgart.syntaxtree.statement;
import java.util.Hashtable; import java.util.Hashtable;
import org.apache.bcel.generic.ClassGen; import org.apache.bcel.generic.ClassGen;
import org.apache.bcel.generic.InstructionFactory;
import org.apache.bcel.generic.InstructionList;
import de.dhbwstuttgart.typeinference.Menge; import de.dhbwstuttgart.typeinference.Menge;
import de.dhbwstuttgart.logger.Logger; import de.dhbwstuttgart.logger.Logger;
@ -91,10 +93,14 @@ public class Null extends Literal
} }
@Override @Override
public void genByteCode(ClassGen _cg) { public InstructionList genByteCode(ClassGen cg) {
// TODO Auto-generated method stub InstructionFactory _factory = new InstructionFactory(cg, cg.getConstantPool());
InstructionList il = new InstructionList();
il.append(_factory.ACONST_NULL);
return il;
} }
} }
// ino.end // ino.end

View File

@ -134,8 +134,10 @@ public class Return extends Statement
@Override @Override
public InstructionList genByteCode(ClassGen cg) { public InstructionList genByteCode(ClassGen cg) {
InstructionList il = retexpr.genByteCode(cg);
InstructionFactory _factory = new InstructionFactory(cg, cg.getConstantPool()); InstructionFactory _factory = new InstructionFactory(cg, cg.getConstantPool());
InstructionList il = new InstructionList();
il.append(_factory.createReturn(org.apache.bcel.generic.Type.VOID)); il.append(_factory.createReturn(org.apache.bcel.generic.Type.VOID));
//TO BE DONE //TO BE DONE