unneeded parameter inlined

This commit is contained in:
Alex Tkachman
2012-08-23 21:06:08 +03:00
parent b2d9e02b2c
commit 7419b237ba
4 changed files with 10 additions and 11 deletions
@@ -905,7 +905,7 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> {
.getCalleeExpression()
.getConstructorReferenceExpression());
assert superConstructor != null;
CallableMethod superCallable = typeMapper.mapToCallableMethod(superConstructor, OwnerKind.IMPLEMENTATION,
CallableMethod superCallable = typeMapper.mapToCallableMethod(superConstructor,
typeMapper.hasThis0(superConstructor.getContainingDeclaration()));
Type[] argumentTypes = superCallable.getSignature().getAsmMethod().getArgumentTypes();
Collections.addAll(consArgTypes, argumentTypes);
@@ -2755,7 +2755,7 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> {
}
CallableMethod method = typeMapper
.mapToCallableMethod((ConstructorDescriptor) constructorDescriptor, OwnerKind.IMPLEMENTATION, typeMapper
.mapToCallableMethod((ConstructorDescriptor) constructorDescriptor, typeMapper
.hasThis0(((ConstructorDescriptor) constructorDescriptor).getContainingDeclaration()));
invokeMethodWithArguments(method, expression, StackValue.none());
}
@@ -208,7 +208,7 @@ public class GenerationState {
ConstructorDescriptor constructorDescriptor = bindingContext.get(BindingContext.CONSTRUCTOR, objectDeclaration);
assert constructorDescriptor != null;
CallableMethod callableMethod = typeMapper.mapToCallableMethod(
constructorDescriptor, OwnerKind.IMPLEMENTATION,
constructorDescriptor,
typeMapper.hasThis0(constructorDescriptor.getContainingDeclaration()));
return new GeneratedAnonymousClassDescriptor(nameAndVisitor.first, callableMethod.getSignature().getAsmMethod(),
objectContext.outerWasUsed, null);
@@ -582,7 +582,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
null);
}
else {
callableMethod = typeMapper.mapToCallableMethod(constructorDescriptor, kind,
callableMethod = typeMapper.mapToCallableMethod(constructorDescriptor,
typeMapper.hasThis0(constructorDescriptor.getContainingDeclaration()));
constructorMethod = callableMethod.getSignature();
}
@@ -608,7 +608,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
declarationDescriptor = ((ClassDescriptorFromSource) declarationDescriptor).getUnsubstitutedPrimaryConstructor();
}
ConstructorDescriptor superConstructor = (ConstructorDescriptor) declarationDescriptor;
CallableMethod superCallable = typeMapper.mapToCallableMethod(superConstructor, OwnerKind.IMPLEMENTATION, typeMapper
CallableMethod superCallable = typeMapper.mapToCallableMethod(superConstructor, typeMapper
.hasThis0(superConstructor.getContainingDeclaration()));
firstSuperArgument = insert;
for (Type t : superCallable.getSignature().getAsmMethod().getArgumentTypes()) {
@@ -1075,7 +1075,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
}
CallableMethod method = typeMapper
.mapToCallableMethod(constructorDescriptor, kind, typeMapper.hasThis0(constructorDescriptor.getContainingDeclaration()));
.mapToCallableMethod(constructorDescriptor, typeMapper.hasThis0(constructorDescriptor.getContainingDeclaration()));
if (myClass instanceof JetObjectDeclaration &&
superCall instanceof JetDelegatorToSuperCall &&
@@ -1085,7 +1085,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
.getCalleeExpression()
.getConstructorReferenceExpression());
assert superConstructor != null;
CallableMethod superCallable = typeMapper.mapToCallableMethod(superConstructor, OwnerKind.IMPLEMENTATION,
CallableMethod superCallable = typeMapper.mapToCallableMethod(superConstructor,
typeMapper.hasThis0(superConstructor.getContainingDeclaration()));
int nextVar = firstSuperArgument + 1;
for (Type t : superCallable.getSignature().getAsmMethod().getArgumentTypes()) {
@@ -1168,7 +1168,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
ConstructorDescriptor constructorDescriptor = (ConstructorDescriptor) bindingContext
.get(BindingContext.REFERENCE_TARGET, superCall.getCalleeExpression().getConstructorReferenceExpression());
assert constructorDescriptor != null;
CallableMethod method = typeMapper.mapToCallableMethod(constructorDescriptor, OwnerKind.IMPLEMENTATION, typeMapper
CallableMethod method = typeMapper.mapToCallableMethod(constructorDescriptor, typeMapper
.hasThis0(constructorDescriptor.getContainingDeclaration()));
codegen.invokeMethodWithArguments(method, superCall, StackValue.none());
}
@@ -1022,11 +1022,10 @@ public class JetTypeMapper {
return signatureWriter.makeJvmMethodSignature("<init>");
}
public CallableMethod mapToCallableMethod(ConstructorDescriptor descriptor, OwnerKind kind, boolean hasThis0) {
public CallableMethod mapToCallableMethod(ConstructorDescriptor descriptor, boolean hasThis0) {
final JvmMethodSignature method = mapConstructorSignature(descriptor, hasThis0);
MapTypeMode mapTypeMode = ownerKindToMapTypeMode(kind);
JetType defaultType = descriptor.getContainingDeclaration().getDefaultType();
Type mapped = mapType(defaultType, mapTypeMode);
Type mapped = mapType(defaultType, MapTypeMode.IMPL);
if (mapped.getSort() != Type.OBJECT) {
throw new IllegalStateException("type must have been mapped to object: " + defaultType + ", actual: " + mapped);
}