public void atStringL(StringL s) throws CompileError { exprType = CLASS; arrayDim = 0; className = jvmJavaLangString; bytecode.addLdc(s.get()); }
@Override public void atStringL(StringL s) throws CompileError { exprType = CLASS; arrayDim = 0; className = jvmJavaLangString; bytecode.addLdc(s.get()); }
private boolean isConstant(BinExpr expr, int op, ASTree left, ASTree right) throws CompileError { left = stripPlusExpr(left); right = stripPlusExpr(right); ASTree newExpr = null; if (left instanceof StringL && right instanceof StringL && op == '+') newExpr = new StringL(((StringL)left).get() + ((StringL)right).get()); else if (left instanceof IntConst) newExpr = ((IntConst)left).compute(op, right); else if (left instanceof DoubleConst) newExpr = ((DoubleConst)left).compute(op, right); if (newExpr == null) return false; // not a constant expression else { expr.setOperator('+'); expr.setOprand1(newExpr); expr.setOprand2(null); newExpr.accept(this); // for setting exprType, arrayDim, ... return true; } }
private boolean isConstant(BinExpr expr, int op, ASTree left, ASTree right) throws CompileError { left = stripPlusExpr(left); right = stripPlusExpr(right); ASTree newExpr = null; if (left instanceof StringL && right instanceof StringL && op == '+') newExpr = new StringL(((StringL)left).get() + ((StringL)right).get()); else if (left instanceof IntConst) newExpr = ((IntConst)left).compute(op, right); else if (left instanceof DoubleConst) newExpr = ((DoubleConst)left).compute(op, right); if (newExpr == null) return false; // not a constant expression expr.setOperator('+'); expr.setOprand1(newExpr); expr.setOprand2(null); newExpr.accept(this); // for setting exprType, arrayDim, ... return true; }
int getConstantValue2(ConstPool cp, CtClass type, ASTree tree) { if (type.isPrimitive()) { if (tree instanceof IntConst) { long value = ((IntConst)tree).get(); if (type == CtClass.doubleType) return cp.addDoubleInfo((double)value); else if (type == CtClass.floatType) return cp.addFloatInfo((float)value); else if (type == CtClass.longType) return cp.addLongInfo(value); else if (type != CtClass.voidType) return cp.addIntegerInfo((int)value); } else if (tree instanceof DoubleConst) { double value = ((DoubleConst)tree).get(); if (type == CtClass.floatType) return cp.addFloatInfo((float)value); else if (type == CtClass.doubleType) return cp.addDoubleInfo(value); } } else if (tree instanceof StringL && type.getName().equals(javaLangString)) return cp.addStringInfo(((StringL)tree).get()); return 0; } }
int getConstantValue2(ConstPool cp, CtClass type, ASTree tree) { if (type.isPrimitive()) { if (tree instanceof IntConst) { long value = ((IntConst)tree).get(); if (type == CtClass.doubleType) return cp.addDoubleInfo(value); else if (type == CtClass.floatType) return cp.addFloatInfo(value); else if (type == CtClass.longType) return cp.addLongInfo(value); else if (type != CtClass.voidType) return cp.addIntegerInfo((int)value); } else if (tree instanceof DoubleConst) { double value = ((DoubleConst)tree).get(); if (type == CtClass.floatType) return cp.addFloatInfo((float)value); else if (type == CtClass.doubleType) return cp.addDoubleInfo(value); } } else if (tree instanceof StringL && type.getName().equals(javaLangString)) return cp.addStringInfo(((StringL)tree).get()); return 0; } }
public void atStringL(StringL s) throws CompileError { exprType = CLASS; arrayDim = 0; className = jvmJavaLangString; bytecode.addLdc(s.get()); }
public void atStringL(StringL s) throws CompileError { exprType = CLASS; arrayDim = 0; className = jvmJavaLangString; bytecode.addLdc(s.get()); }
public void atStringL(StringL s) throws CompileError { exprType = CLASS; arrayDim = 0; className = jvmJavaLangString; bytecode.addLdc(s.get()); }
public void atStringL(StringL s) throws CompileError { exprType = CLASS; arrayDim = 0; className = jvmJavaLangString; bytecode.addLdc(s.get()); }
public void atStringL(StringL s) throws CompileError { exprType = CLASS; arrayDim = 0; className = jvmJavaLangString; bytecode.addLdc(s.get()); }
private boolean isConstant(BinExpr expr, int op, ASTree left, ASTree right) throws CompileError { left = stripPlusExpr(left); right = stripPlusExpr(right); ASTree newExpr = null; if (left instanceof StringL && right instanceof StringL && op == '+') newExpr = new StringL(((StringL)left).get() + ((StringL)right).get()); else if (left instanceof IntConst) newExpr = ((IntConst)left).compute(op, right); else if (left instanceof DoubleConst) newExpr = ((DoubleConst)left).compute(op, right); if (newExpr == null) return false; // not a constant expression else { expr.setOperator('+'); expr.setOprand1(newExpr); expr.setOprand2(null); newExpr.accept(this); // for setting exprType, arrayDim, ... return true; } }
private boolean isConstant(BinExpr expr, int op, ASTree left, ASTree right) throws CompileError { left = stripPlusExpr(left); right = stripPlusExpr(right); ASTree newExpr = null; if (left instanceof StringL && right instanceof StringL && op == '+') newExpr = new StringL(((StringL)left).get() + ((StringL)right).get()); else if (left instanceof IntConst) newExpr = ((IntConst)left).compute(op, right); else if (left instanceof DoubleConst) newExpr = ((DoubleConst)left).compute(op, right); if (newExpr == null) return false; // not a constant expression else { expr.setOperator('+'); expr.setOprand1(newExpr); expr.setOprand2(null); newExpr.accept(this); // for setting exprType, arrayDim, ... return true; } }
private boolean isConstant(BinExpr expr, int op, ASTree left, ASTree right) throws CompileError { left = stripPlusExpr(left); right = stripPlusExpr(right); ASTree newExpr = null; if (left instanceof StringL && right instanceof StringL && op == '+') newExpr = new StringL(((StringL)left).get() + ((StringL)right).get()); else if (left instanceof IntConst) newExpr = ((IntConst)left).compute(op, right); else if (left instanceof DoubleConst) newExpr = ((DoubleConst)left).compute(op, right); if (newExpr == null) return false; // not a constant expression else { expr.setOperator('+'); expr.setOprand1(newExpr); expr.setOprand2(null); newExpr.accept(this); // for setting exprType, arrayDim, ... return true; } }
private boolean isConstant(BinExpr expr, int op, ASTree left, ASTree right) throws CompileError { left = stripPlusExpr(left); right = stripPlusExpr(right); ASTree newExpr = null; if (left instanceof StringL && right instanceof StringL && op == '+') newExpr = new StringL(((StringL)left).get() + ((StringL)right).get()); else if (left instanceof IntConst) newExpr = ((IntConst)left).compute(op, right); else if (left instanceof DoubleConst) newExpr = ((DoubleConst)left).compute(op, right); if (newExpr == null) return false; // not a constant expression else { expr.setOperator('+'); expr.setOprand1(newExpr); expr.setOprand2(null); newExpr.accept(this); // for setting exprType, arrayDim, ... return true; } }
private boolean isConstant(BinExpr expr, int op, ASTree left, ASTree right) throws CompileError { left = stripPlusExpr(left); right = stripPlusExpr(right); ASTree newExpr = null; if (left instanceof StringL && right instanceof StringL && op == '+') newExpr = new StringL(((StringL)left).get() + ((StringL)right).get()); else if (left instanceof IntConst) newExpr = ((IntConst)left).compute(op, right); else if (left instanceof DoubleConst) newExpr = ((DoubleConst)left).compute(op, right); if (newExpr == null) return false; // not a constant expression else { expr.setOperator('+'); expr.setOprand1(newExpr); expr.setOprand2(null); newExpr.accept(this); // for setting exprType, arrayDim, ... return true; } }
int getConstantValue2(ConstPool cp, CtClass type, ASTree tree) { if (type.isPrimitive()) { if (tree instanceof IntConst) { long value = ((IntConst)tree).get(); if (type == CtClass.doubleType) return cp.addDoubleInfo((double)value); else if (type == CtClass.floatType) return cp.addFloatInfo((float)value); else if (type == CtClass.longType) return cp.addLongInfo(value); else if (type != CtClass.voidType) return cp.addIntegerInfo((int)value); } else if (tree instanceof DoubleConst) { double value = ((DoubleConst)tree).get(); if (type == CtClass.floatType) return cp.addFloatInfo((float)value); else if (type == CtClass.doubleType) return cp.addDoubleInfo(value); } } else if (tree instanceof StringL && type.getName().equals(javaLangString)) return cp.addStringInfo(((StringL)tree).get()); return 0; } }
int getConstantValue2(ConstPool cp, CtClass type, ASTree tree) { if (type.isPrimitive()) { if (tree instanceof IntConst) { long value = ((IntConst)tree).get(); if (type == CtClass.doubleType) return cp.addDoubleInfo((double)value); else if (type == CtClass.floatType) return cp.addFloatInfo((float)value); else if (type == CtClass.longType) return cp.addLongInfo(value); else if (type != CtClass.voidType) return cp.addIntegerInfo((int)value); } else if (tree instanceof DoubleConst) { double value = ((DoubleConst)tree).get(); if (type == CtClass.floatType) return cp.addFloatInfo((float)value); else if (type == CtClass.doubleType) return cp.addDoubleInfo(value); } } else if (tree instanceof StringL && type.getName().equals(javaLangString)) return cp.addStringInfo(((StringL)tree).get()); return 0; } }
int getConstantValue2(ConstPool cp, CtClass type, ASTree tree) { if (type.isPrimitive()) { if (tree instanceof IntConst) { long value = ((IntConst)tree).get(); if (type == CtClass.doubleType) return cp.addDoubleInfo((double)value); else if (type == CtClass.floatType) return cp.addFloatInfo((float)value); else if (type == CtClass.longType) return cp.addLongInfo(value); else if (type != CtClass.voidType) return cp.addIntegerInfo((int)value); } else if (tree instanceof DoubleConst) { double value = ((DoubleConst)tree).get(); if (type == CtClass.floatType) return cp.addFloatInfo((float)value); else if (type == CtClass.doubleType) return cp.addDoubleInfo(value); } } else if (tree instanceof StringL && type.getName().equals(javaLangString)) return cp.addStringInfo(((StringL)tree).get()); return 0; } }
int getConstantValue2(ConstPool cp, CtClass type, ASTree tree) { if (type.isPrimitive()) { if (tree instanceof IntConst) { long value = ((IntConst)tree).get(); if (type == CtClass.doubleType) return cp.addDoubleInfo((double)value); else if (type == CtClass.floatType) return cp.addFloatInfo((float)value); else if (type == CtClass.longType) return cp.addLongInfo(value); else if (type != CtClass.voidType) return cp.addIntegerInfo((int)value); } else if (tree instanceof DoubleConst) { double value = ((DoubleConst)tree).get(); if (type == CtClass.floatType) return cp.addFloatInfo((float)value); else if (type == CtClass.doubleType) return cp.addDoubleInfo(value); } } else if (tree instanceof StringL && type.getName().equals(javaLangString)) return cp.addStringInfo(((StringL)tree).get()); return 0; } }