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 int compileOprands(BinExpr expr) throws CompileError { expr.oprand1().accept(this); int type1 = exprType; int dim1 = arrayDim; expr.oprand2().accept(this); if (dim1 != arrayDim) if (type1 != NULL && exprType != NULL) throw new CompileError("incompatible array types"); else if (exprType == NULL) arrayDim = dim1; if (type1 == NULL) return exprType; else return type1; }
private int compileOprands(BinExpr expr) throws CompileError { expr.oprand1().accept(this); int type1 = exprType; int dim1 = arrayDim; expr.oprand2().accept(this); if (dim1 != arrayDim) if (type1 != NULL && exprType != NULL) throw new CompileError("incompatible array types"); else if (exprType == NULL) arrayDim = dim1; if (type1 == NULL) return exprType; return type1; }
private void booleanExpr(ASTree expr) throws CompileError { int op = CodeGen.getCompOperator(expr); if (op == EQ) { // ==, !=, ... BinExpr bexpr = (BinExpr)expr; bexpr.oprand1().accept(this); int type1 = exprType; int dim1 = arrayDim; bexpr.oprand2().accept(this); if (dim1 == 0 && arrayDim == 0) insertCast(bexpr, type1, exprType); } else if (op == '!') ((Expr)expr).oprand1().accept(this); else if (op == ANDAND || op == OROR) { BinExpr bexpr = (BinExpr)expr; bexpr.oprand1().accept(this); bexpr.oprand2().accept(this); } else // others expr.accept(this); exprType = BOOLEAN; arrayDim = 0; }
private void booleanExpr(ASTree expr) throws CompileError { int op = CodeGen.getCompOperator(expr); if (op == EQ) { // ==, !=, ... BinExpr bexpr = (BinExpr)expr; bexpr.oprand1().accept(this); int type1 = exprType; int dim1 = arrayDim; bexpr.oprand2().accept(this); if (dim1 == 0 && arrayDim == 0) insertCast(bexpr, type1, exprType); } else if (op == '!') ((Expr)expr).oprand1().accept(this); else if (op == ANDAND || op == OROR) { BinExpr bexpr = (BinExpr)expr; bexpr.oprand1().accept(this); bexpr.oprand2().accept(this); } else // others expr.accept(this); exprType = BOOLEAN; arrayDim = 0; }
private Expr atPlusExpr(BinExpr expr) throws CompileError { ASTree left = expr.oprand1(); ASTree right = expr.oprand2(); if (right == null) {
private Expr atPlusExpr(BinExpr expr) throws CompileError { ASTree left = expr.oprand1(); ASTree right = expr.oprand2(); if (right == null) {
expr.oprand1().accept(this); ASTree right = expr.oprand2(); if (right == null)
ASTree left = expr.oprand1(); ASTree right = expr.oprand2(); left.accept(this);
ASTree left = expr.oprand1(); ASTree right = expr.oprand2(); left.accept(this);
expr.oprand1().accept(this); ASTree right = expr.oprand2(); if (right == null)
else if ((isAndAnd = (op == ANDAND)) || op == OROR) { BinExpr bexpr = (BinExpr)expr; if (booleanExpr(!isAndAnd, bexpr.oprand1())) { exprType = BOOLEAN; arrayDim = 0;
else if ((isAndAnd = (op == ANDAND)) || op == OROR) { BinExpr bexpr = (BinExpr)expr; if (booleanExpr(!isAndAnd, bexpr.oprand1())) { exprType = BOOLEAN; arrayDim = 0;
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; }
private int compileOprands(BinExpr expr) throws CompileError { expr.oprand1().accept(this); int type1 = exprType; int dim1 = arrayDim; expr.oprand2().accept(this); if (dim1 != arrayDim) if (type1 != NULL && exprType != NULL) throw new CompileError("incompatible array types"); else if (exprType == NULL) arrayDim = dim1; if (type1 == NULL) return exprType; else return type1; }