Class ReturnAnalyzer


  • public class ReturnAnalyzer
    extends Object
    The ReturnAnalyzer class analyzes body of some TBasic function for correctness of returns sequence and return types and detects unreachable code.
    • Constructor Detail

      • ReturnAnalyzer

        public ReturnAnalyzer​(IOpenClass returnType,
                              AlgorithmCompiler compiler)
        Create an instance of ReturnAnalyzer for analysis of some function from TBasic compiler.
        Parameters:
        returnType - Expected return type of function
        compiler - Associated TBasic compiler.
    • Method Detail

      • analyze

        public SuitablityAsReturn analyze​(List<AlgorithmTreeNode> nodesToAnalyze,
                                          IBindingContext bindingContext)
        Make full analysis of correctness of returns sequence and return types and detects unreachable code.
        Parameters:
        nodesToAnalyze - Body of some function to analyze.
        Returns:
        Correctness of code.
        Throws:
        SyntaxNodeException - If function contains unreachable code or incorrect return type.
      • getReturnType

        public IOpenClass getReturnType()
        Returns:
        Expected return type of function