예제 #1
0
 @Override
 public StackValue generate(
     ExpressionCodegen codegen,
     InstructionAdapter v,
     @NotNull Type expectedType,
     @Nullable PsiElement element,
     @Nullable List<JetExpression> arguments,
     StackValue receiver,
     @NotNull GenerationState state) {
   JetCallExpression call = (JetCallExpression) element;
   ResolvedCall<? extends CallableDescriptor> resolvedCall =
       codegen.getBindingContext().get(BindingContext.RESOLVED_CALL, call.getCalleeExpression());
   CallableDescriptor resultingDescriptor = resolvedCall.getResultingDescriptor();
   Type type =
       state
           .getInjector()
           .getJetTypeMapper()
           .mapType(
               resultingDescriptor.getReturnType().getArguments().get(0).getType(),
               MapTypeMode.VALUE);
   JvmPrimitiveType primitiveType = JvmPrimitiveType.getByAsmType(type);
   if (primitiveType != null) {
     v.getstatic(
         primitiveType.getWrapper().getAsmType().getInternalName(), "TYPE", "Ljava/lang/Class;");
   } else {
     v.aconst(type);
   }
   return StackValue.onStack(JetTypeMapper.JL_CLASS_TYPE);
 }
예제 #2
0
파일: AsmUtil.java 프로젝트: bashor/kotlin
 public static Type boxType(Type asmType) {
   JvmPrimitiveType jvmPrimitiveType = JvmPrimitiveType.getByAsmType(asmType);
   if (jvmPrimitiveType != null) {
     return jvmPrimitiveType.getWrapper().getAsmType();
   } else {
     return asmType;
   }
 }
예제 #3
0
 @Override
 public StackValue generate(
     ExpressionCodegen codegen,
     InstructionAdapter v,
     @NotNull Type expectedType,
     @Nullable PsiElement element,
     @Nullable List<JetExpression> arguments,
     StackValue receiver,
     @NotNull GenerationState state) {
   JvmPrimitiveType primitiveType = JvmPrimitiveType.getByAsmType(receiver.type);
   if (primitiveType != null) {
     v.getstatic(
         primitiveType.getWrapper().getAsmType().getInternalName(), "TYPE", "Ljava/lang/Class;");
   } else {
     receiver.put(receiver.type, v);
     v.invokevirtual("java/lang/Object", "getClass", "()Ljava/lang/Class;");
   }
   return StackValue.onStack(AsmTypeConstants.getType(Class.class));
 }