moved method
This commit is contained in:
@@ -74,6 +74,30 @@ public class JetFlowInformationProvider {
|
||||
return pseudocodeVariablesData;
|
||||
}
|
||||
|
||||
public void checkFunction(
|
||||
@NotNull JetDeclarationWithBody function,
|
||||
@NotNull JetType expectedReturnType,
|
||||
boolean isLocalObject
|
||||
) {
|
||||
boolean isPropertyAccessor = function instanceof JetPropertyAccessor;
|
||||
if (!isPropertyAccessor) {
|
||||
recordInitializedVariables();
|
||||
}
|
||||
|
||||
if (isLocalObject) return;
|
||||
|
||||
checkDefiniteReturn(expectedReturnType);
|
||||
|
||||
if (!isPropertyAccessor) {
|
||||
// Property accessor is checked through initialization of a class/object or package properties (at 'checkDeclarationContainer')
|
||||
markUninitializedVariables();
|
||||
}
|
||||
|
||||
markUnusedVariables();
|
||||
|
||||
markUnusedLiteralsInBlock();
|
||||
}
|
||||
|
||||
private void collectReturnExpressions(@NotNull final Collection<JetElement> returnedExpressions) {
|
||||
final Set<Instruction> instructions = Sets.newHashSet(pseudocode.getInstructions());
|
||||
SubroutineExitInstruction exitInstruction = pseudocode.getExitInstruction();
|
||||
|
||||
@@ -91,28 +91,9 @@ public class ControlFlowAnalyzer {
|
||||
}
|
||||
|
||||
private void checkFunction(JetDeclarationWithBody function, @NotNull JetType expectedReturnType) {
|
||||
assert function instanceof JetDeclaration;
|
||||
|
||||
JetExpression bodyExpression = function.getBodyExpression();
|
||||
if (bodyExpression == null) return;
|
||||
JetFlowInformationProvider flowInformationProvider = new JetFlowInformationProvider((JetDeclaration) function, trace);
|
||||
|
||||
boolean isPropertyAccessor = function instanceof JetPropertyAccessor;
|
||||
if (!isPropertyAccessor) {
|
||||
flowInformationProvider.recordInitializedVariables();
|
||||
}
|
||||
|
||||
if (topDownAnalysisParameters.isDeclaredLocally()) return;
|
||||
|
||||
flowInformationProvider.checkDefiniteReturn(expectedReturnType);
|
||||
|
||||
if (!isPropertyAccessor) {
|
||||
// Property accessor is checked through initialization of a class/object or package properties (at 'checkDeclarationContainer')
|
||||
flowInformationProvider.markUninitializedVariables();
|
||||
}
|
||||
|
||||
flowInformationProvider.markUnusedVariables();
|
||||
|
||||
flowInformationProvider.markUnusedLiteralsInBlock();
|
||||
JetFlowInformationProvider flowInformationProvider = new JetFlowInformationProvider(function, trace);
|
||||
flowInformationProvider.checkFunction(function, expectedReturnType, topDownAnalysisParameters.isDeclaredLocally());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user