Rename FunctionTypesUtil -> JvmFunctionImplTypes

It's not an util class anymore
This commit is contained in:
Alexander Udalov
2014-05-06 22:31:45 +04:00
parent c7277250d9
commit fb54ecf443
4 changed files with 14 additions and 13 deletions
@@ -2418,7 +2418,7 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
JetType kFunctionType = bindingContext.get(EXPRESSION_TYPE, expression); JetType kFunctionType = bindingContext.get(EXPRESSION_TYPE, expression);
assert kFunctionType != null : "Callable reference is not type checked: " + expression.getText(); assert kFunctionType != null : "Callable reference is not type checked: " + expression.getText();
ClassDescriptor kFunctionImpl = state.getFunctionTypesUtil().kFunctionTypeToImpl(kFunctionType); ClassDescriptor kFunctionImpl = state.getJvmFunctionImplTypes().kFunctionTypeToImpl(kFunctionType);
assert kFunctionImpl != null : "Impl type is not found for the function type: " + kFunctionType; assert kFunctionImpl != null : "Impl type is not found for the function type: " + kFunctionType;
Type closureSuperClass = typeMapper.mapType(kFunctionImpl); Type closureSuperClass = typeMapper.mapType(kFunctionImpl);
@@ -37,7 +37,7 @@ import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
public class FunctionTypesUtil { public class JvmFunctionImplTypes {
private final List<ClassDescriptor> functions; private final List<ClassDescriptor> functions;
private final List<ClassDescriptor> extensionFunctions; private final List<ClassDescriptor> extensionFunctions;
private final List<ClassDescriptor> kFunctions; private final List<ClassDescriptor> kFunctions;
@@ -46,7 +46,7 @@ public class FunctionTypesUtil {
private final ImmutableMap<ClassDescriptor, ClassDescriptor> kFunctionToImpl; private final ImmutableMap<ClassDescriptor, ClassDescriptor> kFunctionToImpl;
public FunctionTypesUtil(@NotNull ReflectionTypes reflectionTypes) { public JvmFunctionImplTypes(@NotNull ReflectionTypes reflectionTypes) {
int n = KotlinBuiltIns.FUNCTION_TRAIT_COUNT; int n = KotlinBuiltIns.FUNCTION_TRAIT_COUNT;
functions = new ArrayList<ClassDescriptor>(n); functions = new ArrayList<ClassDescriptor>(n);
extensionFunctions = new ArrayList<ClassDescriptor>(n); extensionFunctions = new ArrayList<ClassDescriptor>(n);
@@ -22,7 +22,7 @@ import com.intellij.psi.tree.TokenSet;
import com.intellij.util.containers.Stack; import com.intellij.util.containers.Stack;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import org.jetbrains.jet.codegen.FunctionTypesUtil; import org.jetbrains.jet.codegen.JvmFunctionImplTypes;
import org.jetbrains.jet.codegen.SamCodegenUtil; import org.jetbrains.jet.codegen.SamCodegenUtil;
import org.jetbrains.jet.codegen.state.GenerationState; import org.jetbrains.jet.codegen.state.GenerationState;
import org.jetbrains.jet.lang.descriptors.*; import org.jetbrains.jet.lang.descriptors.*;
@@ -88,13 +88,13 @@ class CodegenAnnotatingVisitor extends JetVisitorVoid {
private final BindingTrace bindingTrace; private final BindingTrace bindingTrace;
private final BindingContext bindingContext; private final BindingContext bindingContext;
private final GenerationState.GenerateClassFilter filter; private final GenerationState.GenerateClassFilter filter;
private final FunctionTypesUtil functionTypesUtil; private final JvmFunctionImplTypes functionImplTypes;
public CodegenAnnotatingVisitor(@NotNull GenerationState state) { public CodegenAnnotatingVisitor(@NotNull GenerationState state) {
this.bindingTrace = state.getBindingTrace(); this.bindingTrace = state.getBindingTrace();
this.bindingContext = state.getBindingContext(); this.bindingContext = state.getBindingContext();
this.filter = state.getGenerateDeclaredClassFilter(); this.filter = state.getGenerateDeclaredClassFilter();
this.functionTypesUtil = state.getFunctionTypesUtil(); this.functionImplTypes = state.getJvmFunctionImplTypes();
} }
@NotNull @NotNull
@@ -270,7 +270,7 @@ class CodegenAnnotatingVisitor extends JetVisitorVoid {
if (functionDescriptor == null) return; if (functionDescriptor == null) return;
String name = inventAnonymousClassName(expression); String name = inventAnonymousClassName(expression);
JetType superType = functionTypesUtil.getSuperTypeForClosure(functionDescriptor, false); JetType superType = functionImplTypes.getSuperTypeForClosure(functionDescriptor, false);
ClassDescriptor classDescriptor = recordClassForFunction(functionDescriptor, superType); ClassDescriptor classDescriptor = recordClassForFunction(functionDescriptor, superType);
recordClosure(functionLiteral, classDescriptor, name); recordClosure(functionLiteral, classDescriptor, name);
@@ -319,7 +319,7 @@ class CodegenAnnotatingVisitor extends JetVisitorVoid {
ResolvedCall<?> referencedFunction = bindingContext.get(RESOLVED_CALL, expression.getCallableReference()); ResolvedCall<?> referencedFunction = bindingContext.get(RESOLVED_CALL, expression.getCallableReference());
if (referencedFunction == null) return; if (referencedFunction == null) return;
JetType superType = JetType superType =
functionTypesUtil.getSuperTypeForClosure((FunctionDescriptor) referencedFunction.getResultingDescriptor(), true); functionImplTypes.getSuperTypeForClosure((FunctionDescriptor) referencedFunction.getResultingDescriptor(), true);
String name = inventAnonymousClassName(expression); String name = inventAnonymousClassName(expression);
ClassDescriptor classDescriptor = recordClassForFunction(functionDescriptor, superType); ClassDescriptor classDescriptor = recordClassForFunction(functionDescriptor, superType);
@@ -373,7 +373,7 @@ class CodegenAnnotatingVisitor extends JetVisitorVoid {
} }
else { else {
String name = inventAnonymousClassName(function); String name = inventAnonymousClassName(function);
JetType superType = functionTypesUtil.getSuperTypeForClosure(functionDescriptor, false); JetType superType = functionImplTypes.getSuperTypeForClosure(functionDescriptor, false);
ClassDescriptor classDescriptor = recordClassForFunction(functionDescriptor, superType); ClassDescriptor classDescriptor = recordClassForFunction(functionDescriptor, superType);
recordClosure(function, classDescriptor, name); recordClosure(function, classDescriptor, name);
@@ -98,7 +98,7 @@ public class GenerationState {
@Nullable @Nullable
private List<ScriptDescriptor> earlierScriptsForReplInterpreter; private List<ScriptDescriptor> earlierScriptsForReplInterpreter;
private final FunctionTypesUtil functionTypesUtil; private final JvmFunctionImplTypes functionImplTypes;
public GenerationState( public GenerationState(
@NotNull Project project, @NotNull Project project,
@@ -141,7 +141,7 @@ public class GenerationState {
this.generateClassFilter = generateClassFilter; this.generateClassFilter = generateClassFilter;
ReflectionTypes reflectionTypes = new ReflectionTypes(getAnyModule()); ReflectionTypes reflectionTypes = new ReflectionTypes(getAnyModule());
this.functionTypesUtil = new FunctionTypesUtil(reflectionTypes); this.functionImplTypes = new JvmFunctionImplTypes(reflectionTypes);
} }
@NotNull @NotNull
@@ -217,13 +217,14 @@ public class GenerationState {
return generateNotNullParamAssertions; return generateNotNullParamAssertions;
} }
@NotNull
public GenerateClassFilter getGenerateDeclaredClassFilter() { public GenerateClassFilter getGenerateDeclaredClassFilter() {
return generateClassFilter; return generateClassFilter;
} }
@NotNull @NotNull
public FunctionTypesUtil getFunctionTypesUtil() { public JvmFunctionImplTypes getJvmFunctionImplTypes() {
return functionTypesUtil; return functionImplTypes;
} }
public boolean isInlineEnabled() { public boolean isInlineEnabled() {