private void insertCast(BinExpr expr, int type1, int type2) throws CompileError { if (CodeGen.rightIsStrong(type1, type2)) expr.setLeft(new CastExpr(type2, 0, expr.oprand1())); else exprType = type1; }
private void insertCast(BinExpr expr, int type1, int type2) throws CompileError { if (CodeGen.rightIsStrong(type1, type2)) expr.setLeft(new CastExpr(type2, 0, expr.oprand1())); else exprType = type1; }
public void atCondExpr(CondExpr expr) throws CompileError { booleanExpr(expr.condExpr()); expr.thenExpr().accept(this); int type1 = exprType; int dim1 = arrayDim; String cname1 = className; expr.elseExpr().accept(this); if (dim1 == 0 && dim1 == arrayDim) if (CodeGen.rightIsStrong(type1, exprType)) expr.setThen(new CastExpr(exprType, 0, expr.thenExpr())); else if (CodeGen.rightIsStrong(exprType, type1)) { expr.setElse(new CastExpr(type1, 0, expr.elseExpr())); exprType = type1; } }
@Override public void atCondExpr(CondExpr expr) throws CompileError { booleanExpr(expr.condExpr()); expr.thenExpr().accept(this); int type1 = exprType; int dim1 = arrayDim; @SuppressWarnings("unused") String cname1 = className; expr.elseExpr().accept(this); if (dim1 == 0 && dim1 == arrayDim) if (CodeGen.rightIsStrong(type1, exprType)) expr.setThen(new CastExpr(exprType, 0, expr.thenExpr())); else if (CodeGen.rightIsStrong(exprType, type1)) { expr.setElse(new CastExpr(type1, 0, expr.elseExpr())); exprType = type1; } }
private ASTree parseCast(SymbolTable tbl) throws CompileError { int t = lex.lookAhead(1); if (isBuiltinType(t) && nextIsBuiltinCast()) { lex.get(); // '(' lex.get(); // primitive type int dim = parseArrayDimension(); if (lex.get() != ')') throw new CompileError(") is missing", lex); return new CastExpr(t, dim, parseUnaryExpr(tbl)); } else if (t == Identifier && nextIsClassCast()) { lex.get(); // '(' ASTList name = parseClassType(tbl); int dim = parseArrayDimension(); if (lex.get() != ')') throw new CompileError(") is missing", lex); return new CastExpr(name, dim, parseUnaryExpr(tbl)); } else return parsePostfix(tbl); }
private ASTree parseCast(SymbolTable tbl) throws CompileError { int t = lex.lookAhead(1); if (isBuiltinType(t) && nextIsBuiltinCast()) { lex.get(); // '(' lex.get(); // primitive type int dim = parseArrayDimension(); if (lex.get() != ')') throw new CompileError(") is missing", lex); return new CastExpr(t, dim, parseUnaryExpr(tbl)); } else if (t == Identifier && nextIsClassCast()) { lex.get(); // '(' ASTList name = parseClassType(tbl); int dim = parseArrayDimension(); if (lex.get() != ')') throw new CompileError(") is missing", lex); return new CastExpr(name, dim, parseUnaryExpr(tbl)); } else return parsePostfix(tbl); }
private void insertCast(BinExpr expr, int type1, int type2) throws CompileError { if (CodeGen.rightIsStrong(type1, type2)) expr.setLeft(new CastExpr(type2, 0, expr.oprand1())); else exprType = type1; }
private void insertCast(BinExpr expr, int type1, int type2) throws CompileError { if (CodeGen.rightIsStrong(type1, type2)) expr.setLeft(new CastExpr(type2, 0, expr.oprand1())); else exprType = type1; }
private void insertCast(BinExpr expr, int type1, int type2) throws CompileError { if (CodeGen.rightIsStrong(type1, type2)) expr.setLeft(new CastExpr(type2, 0, expr.oprand1())); else exprType = type1; }
private void insertCast(BinExpr expr, int type1, int type2) throws CompileError { if (CodeGen.rightIsStrong(type1, type2)) expr.setLeft(new CastExpr(type2, 0, expr.oprand1())); else exprType = type1; }
private void insertCast(BinExpr expr, int type1, int type2) throws CompileError { if (CodeGen.rightIsStrong(type1, type2)) expr.setLeft(new CastExpr(type2, 0, expr.oprand1())); else exprType = type1; }
public void atCondExpr(CondExpr expr) throws CompileError { booleanExpr(expr.condExpr()); expr.thenExpr().accept(this); int type1 = exprType; int dim1 = arrayDim; String cname1 = className; expr.elseExpr().accept(this); if (dim1 == 0 && dim1 == arrayDim) if (CodeGen.rightIsStrong(type1, exprType)) expr.setThen(new CastExpr(exprType, 0, expr.thenExpr())); else if (CodeGen.rightIsStrong(exprType, type1)) { expr.setElse(new CastExpr(type1, 0, expr.elseExpr())); exprType = type1; } }
public void atCondExpr(CondExpr expr) throws CompileError { booleanExpr(expr.condExpr()); expr.thenExpr().accept(this); int type1 = exprType; int dim1 = arrayDim; String cname1 = className; expr.elseExpr().accept(this); if (dim1 == 0 && dim1 == arrayDim) if (CodeGen.rightIsStrong(type1, exprType)) expr.setThen(new CastExpr(exprType, 0, expr.thenExpr())); else if (CodeGen.rightIsStrong(exprType, type1)) { expr.setElse(new CastExpr(type1, 0, expr.elseExpr())); exprType = type1; } }
public void atCondExpr(CondExpr expr) throws CompileError { booleanExpr(expr.condExpr()); expr.thenExpr().accept(this); int type1 = exprType; int dim1 = arrayDim; String cname1 = className; expr.elseExpr().accept(this); if (dim1 == 0 && dim1 == arrayDim) if (CodeGen.rightIsStrong(type1, exprType)) expr.setThen(new CastExpr(exprType, 0, expr.thenExpr())); else if (CodeGen.rightIsStrong(exprType, type1)) { expr.setElse(new CastExpr(type1, 0, expr.elseExpr())); exprType = type1; } }
public void atCondExpr(CondExpr expr) throws CompileError { booleanExpr(expr.condExpr()); expr.thenExpr().accept(this); int type1 = exprType; int dim1 = arrayDim; String cname1 = className; expr.elseExpr().accept(this); if (dim1 == 0 && dim1 == arrayDim) if (CodeGen.rightIsStrong(type1, exprType)) expr.setThen(new CastExpr(exprType, 0, expr.thenExpr())); else if (CodeGen.rightIsStrong(exprType, type1)) { expr.setElse(new CastExpr(type1, 0, expr.elseExpr())); exprType = type1; } }
public void atCondExpr(CondExpr expr) throws CompileError { booleanExpr(expr.condExpr()); expr.thenExpr().accept(this); int type1 = exprType; int dim1 = arrayDim; String cname1 = className; expr.elseExpr().accept(this); if (dim1 == 0 && dim1 == arrayDim) if (CodeGen.rightIsStrong(type1, exprType)) expr.setThen(new CastExpr(exprType, 0, expr.thenExpr())); else if (CodeGen.rightIsStrong(exprType, type1)) { expr.setElse(new CastExpr(type1, 0, expr.elseExpr())); exprType = type1; } }
private ASTree parseCast(SymbolTable tbl) throws CompileError { int t = lex.lookAhead(1); if (isBuiltinType(t) && nextIsBuiltinCast()) { lex.get(); // '(' lex.get(); // primitive type int dim = parseArrayDimension(); if (lex.get() != ')') throw new CompileError(") is missing", lex); return new CastExpr(t, dim, parseUnaryExpr(tbl)); } else if (t == Identifier && nextIsClassCast()) { lex.get(); // '(' ASTList name = parseClassType(tbl); int dim = parseArrayDimension(); if (lex.get() != ')') throw new CompileError(") is missing", lex); return new CastExpr(name, dim, parseUnaryExpr(tbl)); } else return parsePostfix(tbl); }
private ASTree parseCast(SymbolTable tbl) throws CompileError { int t = lex.lookAhead(1); if (isBuiltinType(t) && nextIsBuiltinCast()) { lex.get(); // '(' lex.get(); // primitive type int dim = parseArrayDimension(); if (lex.get() != ')') throw new CompileError(") is missing", lex); return new CastExpr(t, dim, parseUnaryExpr(tbl)); } else if (t == Identifier && nextIsClassCast()) { lex.get(); // '(' ASTList name = parseClassType(tbl); int dim = parseArrayDimension(); if (lex.get() != ')') throw new CompileError(") is missing", lex); return new CastExpr(name, dim, parseUnaryExpr(tbl)); } else return parsePostfix(tbl); }
private ASTree parseCast(SymbolTable tbl) throws CompileError { int t = lex.lookAhead(1); if (isBuiltinType(t) && nextIsBuiltinCast()) { lex.get(); // '(' lex.get(); // primitive type int dim = parseArrayDimension(); if (lex.get() != ')') throw new CompileError(") is missing", lex); return new CastExpr(t, dim, parseUnaryExpr(tbl)); } else if (t == Identifier && nextIsClassCast()) { lex.get(); // '(' ASTList name = parseClassType(tbl); int dim = parseArrayDimension(); if (lex.get() != ')') throw new CompileError(") is missing", lex); return new CastExpr(name, dim, parseUnaryExpr(tbl)); } else return parsePostfix(tbl); }
private ASTree parseCast(SymbolTable tbl) throws CompileError { int t = lex.lookAhead(1); if (isBuiltinType(t) && nextIsBuiltinCast()) { lex.get(); // '(' lex.get(); // primitive type int dim = parseArrayDimension(); if (lex.get() != ')') throw new CompileError(") is missing", lex); return new CastExpr(t, dim, parseUnaryExpr(tbl)); } else if (t == Identifier && nextIsClassCast()) { lex.get(); // '(' ASTList name = parseClassType(tbl); int dim = parseArrayDimension(); if (lex.get() != ')') throw new CompileError(") is missing", lex); return new CastExpr(name, dim, parseUnaryExpr(tbl)); } else return parsePostfix(tbl); }