switch (left.getType().getTypeID()) { case TID_INT: return new JIntLiteral(getTokenReference(), compute(left.intValue(), right.intValue())); case TID_LONG: return new JLongLiteral(getTokenReference(), compute(left.longValue(), right.longValue())); case TID_FLOAT: return new JFloatLiteral(getTokenReference(), compute(left.floatValue(), right.floatValue())); case TID_DOUBLE: return new JDoubleLiteral(getTokenReference(), compute(left.doubleValue(), right.doubleValue()));
CType myType = getType(); switch (myType.getTypeID()) { case TID_INT: { int val1 = ((JIntLiteral)left.convertType(myType)).intValue(); int val2 = ((JIntLiteral)right.convertType(myType)).intValue(); return new JIntLiteral(getTokenReference(), compute(val1, val2)); } case TID_LONG: { long val1 = ((JLongLiteral)left.convertType(myType)).longValue(); long val2 = ((JLongLiteral)right.convertType(myType)).longValue(); return new JLongLiteral(getTokenReference(), compute(val1, val2)); } case TID_FLOAT: { float val1 = ((JFloatLiteral)left.convertType(myType)).floatValue(); float val2 = ((JFloatLiteral)right.convertType(myType)).floatValue(); return new JFloatLiteral(getTokenReference(), compute(val1, val2)); } case TID_DOUBLE: { double val1 = ((JDoubleLiteral)left.convertType(myType)).doubleValue(); double val2 = ((JDoubleLiteral)right.convertType(myType)).doubleValue(); return new JDoubleLiteral(getTokenReference(), compute(val1, val2)); }
  public JExpression constantFolding() {    switch (left.getType().getTypeID()) {    case TID_INT:      return new JIntLiteral(getTokenReference(), compute(left.intValue(), right.intValue()));    case TID_LONG:      return new JLongLiteral(getTokenReference(), compute(left.longValue(), right.longValue()));    case TID_FLOAT:      return new JFloatLiteral(getTokenReference(), compute(left.floatValue(), right.floatValue()));    case TID_DOUBLE:      return new JDoubleLiteral(getTokenReference(), compute(left.doubleValue(), right.doubleValue()));    default:      throw new InconsistencyException("unexpected type " + left.getType());    }  }