Esempio n. 1
0
 public static boolean isOptimizableRangeTo(CallableDescriptor rangeTo) {
   if ("rangeTo".equals(rangeTo.getName().getName())) {
     if (isPrimitiveNumberClassDescriptor(rangeTo.getContainingDeclaration())) {
       return true;
     }
   }
   return false;
 }
Esempio n. 2
0
  private static void genNotNullAssertion(
      @NotNull InstructionAdapter v,
      @NotNull GenerationState state,
      @NotNull CallableDescriptor descriptor,
      @NotNull String assertMethodToCall) {
    if (!state.isGenerateNotNullAssertions()) return;

    if (!isDeclaredInJava(descriptor, state.getBindingContext())) return;

    JetType type = descriptor.getReturnType();
    if (type == null || isNullableType(type)) return;

    Type asmType = state.getTypeMapper().mapReturnType(type);
    if (asmType.getSort() == Type.OBJECT || asmType.getSort() == Type.ARRAY) {
      v.dup();
      v.visitLdcInsn(descriptor.getContainingDeclaration().getName().asString());
      v.visitLdcInsn(descriptor.getName().asString());
      v.invokestatic(
          "jet/runtime/Intrinsics",
          assertMethodToCall,
          "(Ljava/lang/Object;Ljava/lang/String;Ljava/lang/String;)V");
    }
  }
Esempio n. 3
0
 public static boolean isCompareTo(@NotNull CallableDescriptor descriptor) {
   return descriptor.getName().equals(OperatorConventions.COMPARE_TO);
 }