|
|
|
@ -358,7 +358,11 @@ public class CodeGenImpl extends CodeGenBase
|
|
|
|
|
|
|
|
|
|
if (expr.getInferredType().equals(Type.INT_TYPE))
|
|
|
|
|
{
|
|
|
|
|
if ((functionId.name.equals("print")) &&(formalParamInfo.getVarType().equals(Type.OBJECT_TYPE) || formalParamInfo.getVarType().equals(Type.INT_TYPE)))
|
|
|
|
|
if (!formalParamInfo.getVarType().equals(Type.OBJECT_TYPE) && !formalParamInfo.getVarType().equals(Type.INT_TYPE)) {
|
|
|
|
|
backend.emitJAL(errorNI, "Passed argument does not match formal parameter");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
else if ((functionId.name.equals("print")) &&(formalParamInfo.getVarType().equals(Type.OBJECT_TYPE) || formalParamInfo.getVarType().equals(Type.INT_TYPE)))
|
|
|
|
|
{
|
|
|
|
|
if(!(args.size() == 1 && (args.get(0) instanceof CallExpr) &&
|
|
|
|
|
(sym.get(((CallExpr) args.get(0)).function.name) instanceof ClassInfo)))
|
|
|
|
@ -366,23 +370,18 @@ public class CodeGenImpl extends CodeGenBase
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
// FIXME: passed argument does not match formal parameter
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else if (expr.getInferredType().equals(Type.BOOL_TYPE))
|
|
|
|
|
{
|
|
|
|
|
if ((functionId.name.equals("print"))&&(formalParamInfo.getVarType().equals(Type.OBJECT_TYPE) || formalParamInfo.getVarType().equals(Type.BOOL_TYPE)))
|
|
|
|
|
if (!formalParamInfo.getVarType().equals(Type.OBJECT_TYPE) && !formalParamInfo.getVarType().equals(Type.BOOL_TYPE)) {
|
|
|
|
|
backend.emitJAL(errorNI, "Passed argument does not match formal parameter");
|
|
|
|
|
} else if ((functionId.name.equals("print"))&&(formalParamInfo.getVarType().equals(Type.OBJECT_TYPE) || formalParamInfo.getVarType().equals(Type.BOOL_TYPE)))
|
|
|
|
|
{
|
|
|
|
|
if(!(args.size() == 1 && (args.get(0) instanceof CallExpr) &&
|
|
|
|
|
(sym.get(((CallExpr) args.get(0)).function.name) instanceof ClassInfo)))
|
|
|
|
|
backend.emitJAL(makeboolLabel, "Box boolean");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
// FIXME: passed argument does not match formal parameter
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// All expressions should save their end result in A0
|
|
|
|
|