Example #1
0
 private boolean isBoxed(ClosureCall call) {
   // FIXME: these conditions are copied over from Emitter.printApplyMethodName() and
   // X10PrettyPrinterVisitor.visit(ClosureCall)
   Expr target = call.target();
   if (target instanceof ParExpr) {
     target = ((ParExpr) target).expr();
   }
   boolean newClosure = target instanceof Closure_c;
   MethodInstance mi = call.closureInstance();
   if ((!newClosure && !mi.returnType().isVoid() && mi.formalTypes().size() == 0)
       || !(mi.returnType().isVoid() || (newClosure && !mi.returnType().isParameterType()))) {
     // in this case generic apply$G is used
     return true;
   }
   Type type = call.closureInstance().def().returnType().get();
   if (isBoxedType(type)) return true;
   return false;
 }