moved method

This commit is contained in:
Svetlana Isakova
2013-11-29 19:49:58 +04:00
parent 29acef7842
commit 3df37ee113
2 changed files with 26 additions and 21 deletions
@@ -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());
}
}