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
import java.util.Hashtable;
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.SCStatementException;
import de.dhbwstuttgart.syntaxtree.Class;
@ -109,5 +112,7 @@ public abstract class Expr extends ExprStmt
public ConstraintsSet TYPEStmt(TypeAssumptions assumptions){
throw new NotImplementedException(); //wird die TYPEStmt-Methode innerhalb einer Expr aufgerufen, dann ist etwas schief gelaufen.
}
public abstract InstructionList genByteCode(ClassGen _cg);
}
// ino.end

View File

@ -5,6 +5,8 @@ package de.dhbwstuttgart.syntaxtree.statement;
import java.util.Hashtable;
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.logger.Logger;
@ -91,9 +93,13 @@ public class Null extends Literal
}
@Override
public void genByteCode(ClassGen _cg) {
// TODO Auto-generated method stub
public InstructionList genByteCode(ClassGen cg) {
InstructionFactory _factory = new InstructionFactory(cg, cg.getConstantPool());
InstructionList il = new InstructionList();
il.append(_factory.ACONST_NULL);
return il;
}
}

View File

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