From e8faf96c41a93f812429faf76d51324efceb7153 Mon Sep 17 00:00:00 2001 From: "Natalia.Ukhorskaya" Date: Thu, 4 Jul 2013 12:30:30 +0400 Subject: [PATCH] Remove redundant parameter --- .../jet/lang/resolve/DescriptorResolver.java | 13 +++++-------- .../expressions/ControlStructureTypingVisitor.java | 6 +++--- .../types/expressions/ExpressionTypingUtils.java | 2 +- .../ExpressionTypingVisitorForStatements.java | 2 +- 4 files changed, 10 insertions(+), 13 deletions(-) diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/DescriptorResolver.java b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/DescriptorResolver.java index 869cfdf69f4..ac6399a0a82 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/DescriptorResolver.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/DescriptorResolver.java @@ -720,13 +720,12 @@ public class DescriptorResolver { @NotNull public VariableDescriptor resolveLocalVariableDescriptor( - @NotNull DeclarationDescriptor containingDeclaration, @NotNull JetScope scope, @NotNull JetParameter parameter, BindingTrace trace ) { JetType type = resolveParameterType(scope, parameter, trace); - return resolveLocalVariableDescriptor(containingDeclaration, parameter, type, trace, scope); + return resolveLocalVariableDescriptor(parameter, type, trace, scope); } private JetType resolveParameterType(JetScope scope, JetParameter parameter, BindingTrace trace) { @@ -746,14 +745,13 @@ public class DescriptorResolver { } public VariableDescriptor resolveLocalVariableDescriptor( - @NotNull DeclarationDescriptor containingDeclaration, @NotNull JetParameter parameter, @NotNull JetType type, BindingTrace trace, @NotNull JetScope scope ) { VariableDescriptor variableDescriptor = new LocalVariableDescriptor( - containingDeclaration, + scope.getContainingDeclaration(), annotationResolver.resolveAnnotationsWithArguments(scope, parameter.getModifierList(), trace), JetPsiUtil.safeName(parameter.getName()), type, @@ -764,12 +762,12 @@ public class DescriptorResolver { @NotNull public VariableDescriptor resolveLocalVariableDescriptor( - DeclarationDescriptor containingDeclaration, JetScope scope, JetVariableDeclaration variable, DataFlowInfo dataFlowInfo, BindingTrace trace ) { + DeclarationDescriptor containingDeclaration = scope.getContainingDeclaration(); if (JetPsiUtil.isScriptDeclaration(variable)) { PropertyDescriptorImpl propertyDescriptor = new PropertyDescriptorImpl( containingDeclaration, @@ -791,7 +789,7 @@ public class DescriptorResolver { } else { VariableDescriptorImpl variableDescriptor = - resolveLocalVariableDescriptorWithType(scope, containingDeclaration, variable, null, trace); + resolveLocalVariableDescriptorWithType(scope, variable, null, trace); JetType type = getVariableType(variableDescriptor, scope, variable, dataFlowInfo, false, trace); // For a local variable the type must not be deferred @@ -803,13 +801,12 @@ public class DescriptorResolver { @NotNull public VariableDescriptorImpl resolveLocalVariableDescriptorWithType( @NotNull JetScope scope, - @NotNull DeclarationDescriptor containingDeclaration, @NotNull JetVariableDeclaration variable, @Nullable JetType type, @NotNull BindingTrace trace ) { VariableDescriptorImpl variableDescriptor = new LocalVariableDescriptor( - containingDeclaration, + scope.getContainingDeclaration(), annotationResolver.resolveAnnotationsWithArguments(scope, variable.getModifierList(), trace), JetPsiUtil.safeName(variable.getName()), type, diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/types/expressions/ControlStructureTypingVisitor.java b/compiler/frontend/src/org/jetbrains/jet/lang/types/expressions/ControlStructureTypingVisitor.java index 48fdfe7a872..93968fecf40 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/types/expressions/ControlStructureTypingVisitor.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/types/expressions/ControlStructureTypingVisitor.java @@ -320,7 +320,7 @@ public class ControlStructureTypingVisitor extends ExpressionTypingVisitor { JetTypeReference typeReference = loopParameter.getTypeReference(); VariableDescriptor variableDescriptor; if (typeReference != null) { - variableDescriptor = context.expressionTypingServices.getDescriptorResolver().resolveLocalVariableDescriptor(context.scope.getContainingDeclaration(), context.scope, loopParameter, context.trace); + variableDescriptor = context.expressionTypingServices.getDescriptorResolver().resolveLocalVariableDescriptor(context.scope, loopParameter, context.trace); JetType actualParameterType = variableDescriptor.getType(); if (expectedParameterType != null && !JetTypeChecker.INSTANCE.isSubtypeOf(expectedParameterType, actualParameterType)) { @@ -331,7 +331,7 @@ public class ControlStructureTypingVisitor extends ExpressionTypingVisitor { if (expectedParameterType == null) { expectedParameterType = ErrorUtils.createErrorType("Error"); } - variableDescriptor = context.expressionTypingServices.getDescriptorResolver().resolveLocalVariableDescriptor(context.scope.getContainingDeclaration(), loopParameter, expectedParameterType, context.trace, context.scope); + variableDescriptor = context.expressionTypingServices.getDescriptorResolver().resolveLocalVariableDescriptor(loopParameter, expectedParameterType, context.trace, context.scope); } { @@ -433,7 +433,7 @@ public class ControlStructureTypingVisitor extends ExpressionTypingVisitor { DescriptorResolver.checkParameterHasNoValOrVar(context.trace, catchParameter, VAL_OR_VAR_ON_CATCH_PARAMETER); VariableDescriptor variableDescriptor = context.expressionTypingServices.getDescriptorResolver().resolveLocalVariableDescriptor( - context.scope.getContainingDeclaration(), context.scope, catchParameter, context.trace); + context.scope, catchParameter, context.trace); JetType throwableType = KotlinBuiltIns.getInstance().getThrowable().getDefaultType(); DataFlowUtils.checkType(variableDescriptor.getType(), catchParameter, context.replaceExpectedType(throwableType)); if (catchBody != null) { diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/types/expressions/ExpressionTypingUtils.java b/compiler/frontend/src/org/jetbrains/jet/lang/types/expressions/ExpressionTypingUtils.java index 554a9c58b9e..68a31de17f5 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/types/expressions/ExpressionTypingUtils.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/types/expressions/ExpressionTypingUtils.java @@ -423,7 +423,7 @@ public class ExpressionTypingUtils { componentType = ErrorUtils.createErrorType(componentName + "() return type"); } VariableDescriptor variableDescriptor = context.expressionTypingServices.getDescriptorResolver(). - resolveLocalVariableDescriptorWithType(writableScope, writableScope.getContainingDeclaration(), entry, componentType, context.trace); + resolveLocalVariableDescriptorWithType(writableScope, entry, componentType, context.trace); VariableDescriptor olderVariable = writableScope.getLocalVariable(variableDescriptor.getName()); checkVariableShadowing(context, variableDescriptor, olderVariable); diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/types/expressions/ExpressionTypingVisitorForStatements.java b/compiler/frontend/src/org/jetbrains/jet/lang/types/expressions/ExpressionTypingVisitorForStatements.java index db61f734c2e..0a6e19b3c03 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/types/expressions/ExpressionTypingVisitorForStatements.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/types/expressions/ExpressionTypingVisitorForStatements.java @@ -119,7 +119,7 @@ public class ExpressionTypingVisitorForStatements extends ExpressionTypingVisito } VariableDescriptor propertyDescriptor = context.expressionTypingServices.getDescriptorResolver(). - resolveLocalVariableDescriptor(scope.getContainingDeclaration(), scope, property, context.dataFlowInfo, context.trace); + resolveLocalVariableDescriptor(scope, property, context.dataFlowInfo, context.trace); JetExpression initializer = property.getInitializer(); DataFlowInfo dataFlowInfo = context.dataFlowInfo; if (initializer != null) {