Move method visitNamedFunction from ExpressionTypingVisitorForStatements to BasicExpressionTypingVisitor.
This commit done only for clean history
This commit is contained in:
+32
@@ -56,6 +56,7 @@ import org.jetbrains.kotlin.resolve.constants.CompileTimeConstantChecker;
|
|||||||
import org.jetbrains.kotlin.resolve.constants.IntegerValueTypeConstant;
|
import org.jetbrains.kotlin.resolve.constants.IntegerValueTypeConstant;
|
||||||
import org.jetbrains.kotlin.resolve.constants.evaluate.ConstantExpressionEvaluator;
|
import org.jetbrains.kotlin.resolve.constants.evaluate.ConstantExpressionEvaluator;
|
||||||
import org.jetbrains.kotlin.resolve.scopes.JetScope;
|
import org.jetbrains.kotlin.resolve.scopes.JetScope;
|
||||||
|
import org.jetbrains.kotlin.resolve.scopes.WritableScope;
|
||||||
import org.jetbrains.kotlin.resolve.scopes.WritableScopeImpl;
|
import org.jetbrains.kotlin.resolve.scopes.WritableScopeImpl;
|
||||||
import org.jetbrains.kotlin.resolve.scopes.receivers.ExpressionReceiver;
|
import org.jetbrains.kotlin.resolve.scopes.receivers.ExpressionReceiver;
|
||||||
import org.jetbrains.kotlin.resolve.scopes.receivers.ReceiverValue;
|
import org.jetbrains.kotlin.resolve.scopes.receivers.ReceiverValue;
|
||||||
@@ -1288,6 +1289,37 @@ public class BasicExpressionTypingVisitor extends ExpressionTypingVisitor {
|
|||||||
return JetTypeInfo.create(null, context.dataFlowInfo);
|
return JetTypeInfo.create(null, context.dataFlowInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public JetTypeInfo visitNamedFunction(
|
||||||
|
@NotNull JetNamedFunction function, ExpressionTypingContext data
|
||||||
|
) {
|
||||||
|
return visitNamedFunction(function, data, false, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public JetTypeInfo visitNamedFunction(
|
||||||
|
@NotNull JetNamedFunction function,
|
||||||
|
@NotNull ExpressionTypingContext context,
|
||||||
|
boolean isStatement,
|
||||||
|
@Nullable WritableScope statementScope // must be not null if isStatement
|
||||||
|
) {
|
||||||
|
SimpleFunctionDescriptor functionDescriptor = components.expressionTypingServices.getDescriptorResolver().
|
||||||
|
resolveFunctionDescriptorWithAnnotationArguments(
|
||||||
|
context.scope.getContainingDeclaration(), context.scope, function, context.trace, context.dataFlowInfo);
|
||||||
|
|
||||||
|
statementScope.addFunctionDescriptor(functionDescriptor);
|
||||||
|
JetScope functionInnerScope = FunctionDescriptorUtil.getFunctionInnerScope(context.scope, functionDescriptor, context.trace);
|
||||||
|
components.expressionTypingServices.checkFunctionReturnType(functionInnerScope, function, functionDescriptor, context.dataFlowInfo, null, context.trace);
|
||||||
|
|
||||||
|
components.expressionTypingServices.resolveValueParameters(function.getValueParameters(), functionDescriptor.getValueParameters(),
|
||||||
|
context.scope, context.dataFlowInfo, context.trace);
|
||||||
|
|
||||||
|
ModifiersChecker.create(context.trace, components.additionalCheckerProvider).checkModifiersForLocalDeclaration(function, functionDescriptor);
|
||||||
|
if (!function.hasBody()) {
|
||||||
|
context.trace.report(NON_MEMBER_FUNCTION_NO_BODY.on(function, functionDescriptor));
|
||||||
|
}
|
||||||
|
return DataFlowUtils.checkStatementType(function, context, context.dataFlowInfo);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public JetTypeInfo visitRootPackageExpression(@NotNull JetRootPackageExpression expression, ExpressionTypingContext context) {
|
public JetTypeInfo visitRootPackageExpression(@NotNull JetRootPackageExpression expression, ExpressionTypingContext context) {
|
||||||
if (!JetPsiUtil.isLHSOfDot(expression)) {
|
if (!JetPsiUtil.isLHSOfDot(expression)) {
|
||||||
|
|||||||
+1
-19
@@ -23,14 +23,12 @@ import org.jetbrains.annotations.Nullable;
|
|||||||
import org.jetbrains.kotlin.builtins.KotlinBuiltIns;
|
import org.jetbrains.kotlin.builtins.KotlinBuiltIns;
|
||||||
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor;
|
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor;
|
||||||
import org.jetbrains.kotlin.descriptors.FunctionDescriptor;
|
import org.jetbrains.kotlin.descriptors.FunctionDescriptor;
|
||||||
import org.jetbrains.kotlin.descriptors.SimpleFunctionDescriptor;
|
|
||||||
import org.jetbrains.kotlin.descriptors.VariableDescriptor;
|
import org.jetbrains.kotlin.descriptors.VariableDescriptor;
|
||||||
import org.jetbrains.kotlin.diagnostics.Errors;
|
import org.jetbrains.kotlin.diagnostics.Errors;
|
||||||
import org.jetbrains.kotlin.lexer.JetTokens;
|
import org.jetbrains.kotlin.lexer.JetTokens;
|
||||||
import org.jetbrains.kotlin.name.Name;
|
import org.jetbrains.kotlin.name.Name;
|
||||||
import org.jetbrains.kotlin.psi.*;
|
import org.jetbrains.kotlin.psi.*;
|
||||||
import org.jetbrains.kotlin.resolve.AnnotationResolver;
|
import org.jetbrains.kotlin.resolve.AnnotationResolver;
|
||||||
import org.jetbrains.kotlin.resolve.FunctionDescriptorUtil;
|
|
||||||
import org.jetbrains.kotlin.resolve.ModifiersChecker;
|
import org.jetbrains.kotlin.resolve.ModifiersChecker;
|
||||||
import org.jetbrains.kotlin.resolve.TemporaryBindingTrace;
|
import org.jetbrains.kotlin.resolve.TemporaryBindingTrace;
|
||||||
import org.jetbrains.kotlin.resolve.calls.context.TemporaryTraceAndCache;
|
import org.jetbrains.kotlin.resolve.calls.context.TemporaryTraceAndCache;
|
||||||
@@ -41,7 +39,6 @@ import org.jetbrains.kotlin.resolve.calls.results.OverloadResolutionResultsUtil;
|
|||||||
import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowInfo;
|
import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowInfo;
|
||||||
import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowValue;
|
import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowValue;
|
||||||
import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowValueFactory;
|
import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowValueFactory;
|
||||||
import org.jetbrains.kotlin.resolve.scopes.JetScope;
|
|
||||||
import org.jetbrains.kotlin.resolve.scopes.WritableScope;
|
import org.jetbrains.kotlin.resolve.scopes.WritableScope;
|
||||||
import org.jetbrains.kotlin.resolve.scopes.receivers.ExpressionReceiver;
|
import org.jetbrains.kotlin.resolve.scopes.receivers.ExpressionReceiver;
|
||||||
import org.jetbrains.kotlin.types.JetType;
|
import org.jetbrains.kotlin.types.JetType;
|
||||||
@@ -178,22 +175,7 @@ public class ExpressionTypingVisitorForStatements extends ExpressionTypingVisito
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public JetTypeInfo visitNamedFunction(@NotNull JetNamedFunction function, ExpressionTypingContext context) {
|
public JetTypeInfo visitNamedFunction(@NotNull JetNamedFunction function, ExpressionTypingContext context) {
|
||||||
SimpleFunctionDescriptor functionDescriptor = components.expressionTypingServices.getDescriptorResolver().
|
return basic.visitNamedFunction(function, context, true, scope);
|
||||||
resolveFunctionDescriptorWithAnnotationArguments(
|
|
||||||
scope.getContainingDeclaration(), scope, function, context.trace, context.dataFlowInfo);
|
|
||||||
|
|
||||||
scope.addFunctionDescriptor(functionDescriptor);
|
|
||||||
JetScope functionInnerScope = FunctionDescriptorUtil.getFunctionInnerScope(context.scope, functionDescriptor, context.trace);
|
|
||||||
components.expressionTypingServices.checkFunctionReturnType(functionInnerScope, function, functionDescriptor, context.dataFlowInfo, null, context.trace);
|
|
||||||
|
|
||||||
components.expressionTypingServices.resolveValueParameters(function.getValueParameters(), functionDescriptor.getValueParameters(),
|
|
||||||
scope, context.dataFlowInfo, context.trace);
|
|
||||||
|
|
||||||
ModifiersChecker.create(context.trace, components.additionalCheckerProvider).checkModifiersForLocalDeclaration(function, functionDescriptor);
|
|
||||||
if (!function.hasBody()) {
|
|
||||||
context.trace.report(NON_MEMBER_FUNCTION_NO_BODY.on(function, functionDescriptor));
|
|
||||||
}
|
|
||||||
return DataFlowUtils.checkStatementType(function, context, context.dataFlowInfo);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user