fixed issue in boxing
This commit is contained in:
@@ -129,7 +129,7 @@ public class CodeGenImpl extends CodeGenBase
|
||||
StmtAnalyzer stmtAnalyzer = new StmtAnalyzer(funcInfo);
|
||||
int emptySlotNum = 4;
|
||||
|
||||
// backend.emitLW(A0, SP, varSlotMap.get(varName)) to load the variable using its name
|
||||
// example usage: backend.emitLW(A0, SP, varSlotMap.get(varName)) to load the variable using its name
|
||||
Map<String, Integer> varSlotMap = stmtAnalyzer.varSlotMap;
|
||||
|
||||
for (int i = 0; i < funcInfo.getParams().size(); i++) {
|
||||
@@ -214,6 +214,7 @@ public class CodeGenImpl extends CodeGenBase
|
||||
private Map<SymbolInfo, Integer> offsetMap = new HashMap<>();
|
||||
|
||||
/** Variable to keep track of slots of stored variables on stack */
|
||||
// example usage: backend.emitLW(A0, SP, varSlotMap.get(varName)) to load the variable using its name
|
||||
private Map<String, Integer> varSlotMap = new HashMap<>();
|
||||
|
||||
private final String size_label;
|
||||
@@ -304,13 +305,13 @@ public class CodeGenImpl extends CodeGenBase
|
||||
|
||||
if (expr.getInferredType().equals(Type.INT_TYPE)) {
|
||||
if (formalParamInfo.getVarType().equals(Type.OBJECT_TYPE) || formalParamInfo.getVarType().equals(Type.INT_TYPE)) {
|
||||
backend.emitJ(makeintLabel, "Box integer");
|
||||
backend.emitJAL(makeintLabel, "Box integer");
|
||||
} else {
|
||||
// FIXME: passed argument does not match formal parameter
|
||||
}
|
||||
} else if (expr.getInferredType().equals(Type.BOOL_TYPE)) {
|
||||
if (formalParamInfo.getVarType().equals(Type.OBJECT_TYPE) || formalParamInfo.getVarType().equals(Type.BOOL_TYPE)) {
|
||||
backend.emitJ(makeboolLabel, "Box boolean");
|
||||
backend.emitJAL(makeboolLabel, "Box boolean");
|
||||
} else {
|
||||
// FIXME: passed argument does not match formal parameter
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user