Permalink
Browse files

Replaced function with constant.

  • Loading branch information...
Evgeny Gerashchenko Evgeny Gerashchenko
Evgeny Gerashchenko authored and Evgeny Gerashchenko committed Mar 19, 2013
1 parent e42db4b commit 20e5990f4e219261cf9cbb9f023b38dd6a54440a
Showing with 5 additions and 7 deletions.
  1. +5 −7 compiler/frontend/src/org/jetbrains/jet/lang/types/lang/KotlinBuiltIns.java
@@ -85,6 +85,8 @@
.put(new FqName("jet.Unit"), Name.identifier("Tuple0"))
.build();
+ private static final int FUNCTION_TRAIT_COUNT = 23;
+
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
private static volatile KotlinBuiltIns instance = null;
@@ -170,8 +172,8 @@ private KotlinBuiltIns(@NotNull Project project) {
this.builtInsModule = new ModuleDescriptor(Name.special("<built-ins lazy module>"));
this.analyzer = createLazyResolveSession(project);
- this.functionClassesSet = computeIndexedClasses("Function", getFunctionTraitCount());
- this.extensionFunctionClassesSet = computeIndexedClasses("ExtensionFunction", getFunctionTraitCount());
+ this.functionClassesSet = computeIndexedClasses("Function", FUNCTION_TRAIT_COUNT);
+ this.extensionFunctionClassesSet = computeIndexedClasses("ExtensionFunction", FUNCTION_TRAIT_COUNT);
this.primitiveTypeToClass = new EnumMap<PrimitiveType, ClassDescriptor>(PrimitiveType.class);
this.primitiveTypeToJetType = new EnumMap<PrimitiveType, JetType>(PrimitiveType.class);
@@ -185,7 +187,7 @@ private KotlinBuiltIns(@NotNull Project project) {
this.arrayClass = getBuiltInClassByName("Array");
this.deprecatedAnnotationClass = getBuiltInClassByName("deprecated");
this.dataAnnotationClass = getBuiltInClassByName("data");
- this.functionClasses = new ClassDescriptor[getFunctionTraitCount()];
+ this.functionClasses = new ClassDescriptor[FUNCTION_TRAIT_COUNT];
for (int i = 0; i < functionClasses.length; i++) {
functionClasses[i] = getBuiltInClassByName("Function" + i);
}
@@ -830,10 +832,6 @@ public boolean isPrimitiveArray(@NotNull JetType type) {
// Functions
- public int getFunctionTraitCount() {
- return 23;
- }
-
@NotNull
private ImmutableSet<ClassDescriptor> computeIndexedClasses(@NotNull String prefix, int count) {
ImmutableSet.Builder<ClassDescriptor> builder = ImmutableSet.builder();

0 comments on commit 20e5990

Please sign in to comment.