Code clean

This commit is contained in:
Mikhael Bogdanov
2014-05-21 12:26:07 +04:00
parent 6ad2814b01
commit a622638e45
5 changed files with 10 additions and 18 deletions
@@ -49,7 +49,7 @@ public interface CallGenerator {
} }
@Override @Override
public void genCallWithoutNullAssertion( public void genCallWithoutAssertions(
@NotNull CallableMethod method, @NotNull ExpressionCodegen codegen @NotNull CallableMethod method, @NotNull ExpressionCodegen codegen
) { ) {
method.invokeWithoutAssertions(codegen.v); method.invokeWithoutAssertions(codegen.v);
@@ -92,7 +92,7 @@ public interface CallGenerator {
void genCall(@NotNull CallableMethod callableMethod, @Nullable ResolvedCall<?> resolvedCall, boolean callDefault, @NotNull ExpressionCodegen codegen); void genCall(@NotNull CallableMethod callableMethod, @Nullable ResolvedCall<?> resolvedCall, boolean callDefault, @NotNull ExpressionCodegen codegen);
void genCallWithoutNullAssertion(@NotNull CallableMethod callableMethod, @NotNull ExpressionCodegen codegen); void genCallWithoutAssertions(@NotNull CallableMethod callableMethod, @NotNull ExpressionCodegen codegen);
void afterParameterPut(@NotNull Type type, StackValue stackValue, @NotNull ValueParameterDescriptor valueParameterDescriptor); void afterParameterPut(@NotNull Type type, StackValue stackValue, @NotNull ValueParameterDescriptor valueParameterDescriptor);
@@ -45,7 +45,6 @@ import org.jetbrains.jet.lang.resolve.calls.CallResolverUtil;
import org.jetbrains.jet.lang.resolve.constants.ArrayValue; import org.jetbrains.jet.lang.resolve.constants.ArrayValue;
import org.jetbrains.jet.lang.resolve.constants.CompileTimeConstant; import org.jetbrains.jet.lang.resolve.constants.CompileTimeConstant;
import org.jetbrains.jet.lang.resolve.constants.JavaClassValue; import org.jetbrains.jet.lang.resolve.constants.JavaClassValue;
import org.jetbrains.jet.lang.resolve.java.JvmAbi;
import org.jetbrains.jet.lang.resolve.name.FqName; import org.jetbrains.jet.lang.resolve.name.FqName;
import org.jetbrains.jet.lang.types.lang.KotlinBuiltIns; import org.jetbrains.jet.lang.types.lang.KotlinBuiltIns;
import org.jetbrains.org.objectweb.asm.AnnotationVisitor; import org.jetbrains.org.objectweb.asm.AnnotationVisitor;
@@ -580,13 +579,13 @@ public class FunctionCodegen extends ParentCodegenAwareImpl {
@NotNull MethodContext methodContext, @NotNull MethodContext methodContext,
@NotNull JvmMethodSignature signature, @NotNull JvmMethodSignature signature,
@NotNull FunctionDescriptor functionDescriptor, @NotNull FunctionDescriptor functionDescriptor,
boolean aStatic, boolean isStatic,
@NotNull MethodVisitor mv, @NotNull MethodVisitor mv,
@NotNull DefaultParameterValueLoader loadStrategy, @NotNull DefaultParameterValueLoader loadStrategy,
@Nullable JetNamedFunction function @Nullable JetNamedFunction function
) { ) {
mv.visitCode(); mv.visitCode();
generateDefaultImplBody(methodContext, signature, functionDescriptor, aStatic, mv, loadStrategy, function, getParentCodegen(), state); generateDefaultImplBody(methodContext, signature, functionDescriptor, isStatic, mv, loadStrategy, function, getParentCodegen(), state);
endVisit(mv, "default method", callableDescriptorToDeclaration(state.getBindingContext(), functionDescriptor)); endVisit(mv, "default method", callableDescriptorToDeclaration(state.getBindingContext(), functionDescriptor));
} }
@@ -594,7 +593,7 @@ public class FunctionCodegen extends ParentCodegenAwareImpl {
@NotNull MethodContext methodContext, @NotNull MethodContext methodContext,
@NotNull JvmMethodSignature signature, @NotNull JvmMethodSignature signature,
@NotNull FunctionDescriptor functionDescriptor, @NotNull FunctionDescriptor functionDescriptor,
boolean aStatic, boolean isStatic,
@NotNull MethodVisitor mv, @NotNull MethodVisitor mv,
@NotNull DefaultParameterValueLoader loadStrategy, @NotNull DefaultParameterValueLoader loadStrategy,
@Nullable JetNamedFunction function, @Nullable JetNamedFunction function,
@@ -603,7 +602,7 @@ public class FunctionCodegen extends ParentCodegenAwareImpl {
) { ) {
FrameMap frameMap = new FrameMap(); FrameMap frameMap = new FrameMap();
if (!aStatic) { if (!isStatic) {
frameMap.enterTemp(OBJECT_TYPE); frameMap.enterTemp(OBJECT_TYPE);
} }
@@ -630,7 +629,7 @@ public class FunctionCodegen extends ParentCodegenAwareImpl {
CallGenerator generator = codegen.getOrCreateCallGenerator(functionDescriptor, function); CallGenerator generator = codegen.getOrCreateCallGenerator(functionDescriptor, function);
InstructionAdapter iv = new InstructionAdapter(mv); InstructionAdapter iv = new InstructionAdapter(mv);
loadExplicitArgumentsOnStack(iv, OBJECT_TYPE, aStatic, signature); loadExplicitArgumentsOnStack(iv, OBJECT_TYPE, isStatic, signature);
generator.putHiddenParams(); generator.putHiddenParams();
for (int index = 0; index < paramDescrs.size(); index++) { for (int index = 0; index < paramDescrs.size(); index++) {
@@ -663,7 +662,7 @@ public class FunctionCodegen extends ParentCodegenAwareImpl {
method = state.getTypeMapper().mapToCallableMethod(functionDescriptor, false, methodContext); method = state.getTypeMapper().mapToCallableMethod(functionDescriptor, false, methodContext);
} }
generator.genCallWithoutNullAssertion(method, codegen); generator.genCallWithoutAssertions(method, codegen);
iv.areturn(signature.getReturnType()); iv.areturn(signature.getReturnType());
} }
@@ -107,7 +107,7 @@ public class InlineCodegen implements CallGenerator {
} }
@Override @Override
public void genCallWithoutNullAssertion( public void genCallWithoutAssertions(
@NotNull CallableMethod callableMethod, @NotNull ExpressionCodegen codegen @NotNull CallableMethod callableMethod, @NotNull ExpressionCodegen codegen
) { ) {
genCall(callableMethod, null, false, codegen); genCall(callableMethod, null, false, codegen);
@@ -100,7 +100,7 @@ public class InliningContext {
} }
public boolean isRoot() { public boolean isRoot() {
return false; return parent == null;
} }
@NotNull @NotNull
@@ -19,9 +19,7 @@ package org.jetbrains.jet.codegen.inline;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.jet.codegen.context.CodegenContext; import org.jetbrains.jet.codegen.context.CodegenContext;
import org.jetbrains.jet.codegen.state.GenerationState; import org.jetbrains.jet.codegen.state.GenerationState;
import org.jetbrains.jet.lang.psi.Call;
import org.jetbrains.jet.lang.psi.JetElement; import org.jetbrains.jet.lang.psi.JetElement;
import org.jetbrains.jet.lang.psi.JetExpression;
import java.util.Collections; import java.util.Collections;
import java.util.Map; import java.util.Map;
@@ -48,11 +46,6 @@ public class RootInliningContext extends InliningContext {
this.classNameToInline = classNameToInline; this.classNameToInline = classNameToInline;
} }
@Override
public boolean isRoot() {
return true;
}
@Override @Override
@NotNull @NotNull
public String getClassNameToInline() { public String getClassNameToInline() {