Example #1
0
 @NotNull
 public static List<ValueParameterDescriptor> getValueParameters(
     @NotNull FunctionDescriptor functionDescriptor, @NotNull KotlinType type) {
   assert isFunctionOrExtensionFunctionType(type);
   List<TypeProjection> parameterTypes = getParameterTypeProjectionsFromFunctionType(type);
   List<ValueParameterDescriptor> valueParameters =
       new ArrayList<ValueParameterDescriptor>(parameterTypes.size());
   for (int i = 0; i < parameterTypes.size(); i++) {
     TypeProjection parameterType = parameterTypes.get(i);
     ValueParameterDescriptorImpl valueParameterDescriptor =
         new ValueParameterDescriptorImpl(
             functionDescriptor,
             null,
             i,
             Annotations.Companion.getEMPTY(),
             Name.identifier("p" + (i + 1)),
             parameterType.getType(),
             /* declaresDefaultValue = */ false,
             /* isCrossinline = */ false,
             /* isNoinline = */ false,
             null,
             SourceElement.NO_SOURCE);
     valueParameters.add(valueParameterDescriptor);
   }
   return valueParameters;
 }
Example #2
0
 @NotNull
 public KotlinType getEnumType(@NotNull KotlinType argument) {
   Variance projectionType = Variance.INVARIANT;
   List<TypeProjectionImpl> types =
       Collections.singletonList(new TypeProjectionImpl(projectionType, argument));
   return KotlinTypeImpl.create(Annotations.Companion.getEMPTY(), getEnum(), false, types);
 }