Пример #1
0
 public void genConversionOperation(
     FixedPrecisionType type, Context ctx, TabbedWriter out, AsExpression arg) {
   Type toType = arg.getEType();
   Type fromType = arg.getObjectExpr().getType();
   if ((arg.getConversionOperation() != null) && TypeUtils.isNumericType(fromType)) {
     if (needsConversion(fromType, toType)
         && CommonUtilities.proceedWithConversion(ctx, arg.getConversionOperation())) {
       out.print(ctx.getNativeImplementationMapping(toType) + '.');
       out.print(CommonUtilities.getOpName(ctx, arg.getConversionOperation()));
       out.print("(");
       Expression objectExpr = arg.getObjectExpr();
       if (objectExpr instanceof BoxingExpression) {
         objectExpr = ((BoxingExpression) objectExpr).getExpr();
       }
       ctx.invoke(genExpression, objectExpr, ctx, out);
       ctx.invoke(genTypeDependentOptions, arg.getEType(), ctx, out, arg);
       out.print(")");
     } else {
       ctx.invoke(genExpression, arg.getObjectExpr(), ctx, out);
     }
   } else {
     // we need to invoke the logic in type template to call back to the other conversion
     // situations
     ctx.invokeSuper(this, genConversionOperation, type, ctx, out, arg);
   }
 }