Пример #1
0
  private void makePrimitive(@NotNull PrimitiveType primitiveType) {
    KotlinType type = getBuiltInTypeByClassName(primitiveType.getTypeName().asString());
    KotlinType arrayType = getBuiltInTypeByClassName(primitiveType.getArrayTypeName().asString());

    primitiveTypeToArrayKotlinType.put(primitiveType, arrayType);
    primitiveKotlinTypeToKotlinArrayType.put(type, arrayType);
    kotlinArrayTypeToPrimitiveKotlinType.put(arrayType, type);
  }
Пример #2
0
 {
   primitiveTypes = new HashSet<FqNameUnsafe>(0);
   primitiveArrays = new HashSet<FqNameUnsafe>(0);
   for (PrimitiveType primitiveType : PrimitiveType.values()) {
     primitiveTypes.add(fqNameUnsafe(primitiveType.getTypeName().asString()));
     primitiveArrays.add(fqNameUnsafe(primitiveType.getArrayTypeName().asString()));
   }
 }
Пример #3
0
  private void makePrimitive(@NotNull PrimitiveType primitiveType) {
    JetType type = getBuiltInTypeByClassName(primitiveType.getTypeName().asString());
    JetType arrayType = getBuiltInTypeByClassName(primitiveType.getArrayTypeName().asString());

    primitiveTypeToNullableJetType.put(primitiveType, TypeUtils.makeNullable(type));
    primitiveTypeToArrayJetType.put(primitiveType, arrayType);
    primitiveJetTypeToJetArrayType.put(type, arrayType);
    jetArrayTypeToPrimitiveJetType.put(arrayType, type);
  }
Пример #4
0
 {
   fqNameToPrimitiveType = new HashMap<FqNameUnsafe, PrimitiveType>(0);
   arrayClassFqNameToPrimitiveType = new HashMap<FqNameUnsafe, PrimitiveType>(0);
   for (PrimitiveType primitiveType : PrimitiveType.values()) {
     fqNameToPrimitiveType.put(
         fqNameUnsafe(primitiveType.getTypeName().asString()), primitiveType);
     arrayClassFqNameToPrimitiveType.put(
         fqNameUnsafe(primitiveType.getArrayTypeName().asString()), primitiveType);
   }
 }
Пример #5
0
  protected KotlinBuiltIns() {
    LockBasedStorageManager storageManager = new LockBasedStorageManager();
    builtInsModule =
        new ModuleDescriptorImpl(
            Name.special("<built-ins module>"),
            storageManager,
            ModuleParameters.Empty.INSTANCE,
            this);

    PackageFragmentProvider packageFragmentProvider =
        BuiltInsPackageFragmentProviderKt.createBuiltInPackageFragmentProvider(
            storageManager,
            builtInsModule,
            BUILT_INS_PACKAGE_FQ_NAMES,
            new BuiltInFictitiousFunctionClassFactory(storageManager, builtInsModule),
            getAdditionalSupertypesProvider(),
            new Function1<String, InputStream>() {
              @Override
              public InputStream invoke(String path) {
                return KotlinBuiltIns.class.getClassLoader().getResourceAsStream(path);
              }
            });

    builtInsModule.initialize(packageFragmentProvider);
    builtInsModule.setDependencies(builtInsModule);

    builtinsPackageFragment =
        (BuiltinsPackageFragment)
            single(packageFragmentProvider.getPackageFragments(BUILT_INS_PACKAGE_FQ_NAME));
    annotationPackageFragment =
        (BuiltinsPackageFragment)
            single(packageFragmentProvider.getPackageFragments(ANNOTATION_PACKAGE_FQ_NAME));

    primitiveTypeToArrayKotlinType = new EnumMap<PrimitiveType, KotlinType>(PrimitiveType.class);
    primitiveKotlinTypeToKotlinArrayType = new HashMap<KotlinType, KotlinType>();
    kotlinArrayTypeToPrimitiveKotlinType = new HashMap<KotlinType, KotlinType>();
    for (PrimitiveType primitive : PrimitiveType.values()) {
      makePrimitive(primitive);
    }
  }
Пример #6
0
 @NotNull
 public ClassDescriptor getPrimitiveArrayClassDescriptor(@NotNull PrimitiveType type) {
   return getBuiltInClassByName(type.getArrayTypeName().asString());
 }
Пример #7
0
 private void doInitialize() {
   for (PrimitiveType primitive : PrimitiveType.values()) {
     makePrimitive(primitive);
   }
 }