Class OrderingResultSources
- All Implemented Interfaces:
org.antlr.v4.runtime.tree.ParseTreeListener, EK9Listener
OrderingTotality (E07188): for every method, operator and function that returns an
Integer, finds where the returning variable can get its value and records the PARTIAL sources - an unset
Integer(), a <=> of a partial type, a call of another callable (decided later, once every source
has been walked). Holds no state of its own beyond the shared collector, so it is safe in the phase's parallel
per-source walk.
THE reading of "where can the returning variable get its value": its initialiser and every plain assignment to it
anywhere in the body (:, :=, :=?), and for a local variable named by a source, that
variable's own initialiser and assignments. The assignments are taken without regard to order; the INITIALISER of a
returning variable (the callable's, or a switch, try or loop expression's) is left out when every path gives the
variable a new value - the same definite-assignment analysis as E08050, on the same branch pull-ups
(IfStatementOrError, SwitchStatementOrError, TryStatementOrError,
ForStatementOrError, WhileStatementOrError, reused as ConstructorFieldInitialisationListener
reuses them), asked through SymbolsAndScopes.isInitialiserReplaced. So <- rtn as Integer: Integer()
followed by an if/else that assigns on every arm is total; without the else it is not.
-
Field Summary
Fields inherited from class AbstractEK9PhaseListener
symbolsAndScopes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidExit a parse tree produced byEK9Parser.assignmentStatement().voidExit a parse tree produced byEK9Parser.forStatementExpression().voidExit a parse tree produced byEK9Parser.functionDeclaration().voidExit a parse tree produced byEK9Parser.ifStatement().voidExit a parse tree produced byEK9Parser.methodDeclaration().voidExit a parse tree produced byEK9Parser.operatorDeclaration().voidA returning variable declared WITH a value is followed from here, in the scope it is declared in (the callable, switch, try or loop), so the end of its construct can ask whether every path replaced that value.voidExit a parse tree produced byEK9Parser.switchStatementExpression().voidExit a parse tree produced byEK9Parser.throwStatement().voidExit a parse tree produced byEK9Parser.tryStatementExpression().voidExit a parse tree produced byEK9Parser.whileStatementExpression().Methods inherited from class ScopeStackConsistencyListener
enterApplicationDeclaration, enterBlock, enterCatchStatementExpression, enterClassDeclaration, enterComponentDeclaration, enterDynamicClassDeclaration, enterDynamicFunctionDeclaration, enterDynamicVariableCapture, enterFinallyStatementExpression, enterForStatementExpression, enterFunctionDeclaration, enterIfStatement, enterInstructionBlock, enterMethodDeclaration, enterOperatorDeclaration, enterPackageBlock, enterRecordDeclaration, enterReturningParam, enterServiceDeclaration, enterServiceOperationDeclaration, enterSingleStatementBlock, enterStreamExpression, enterStreamStatement, enterSwitchStatementExpression, enterTernaryPart, enterTextBodyDeclaration, enterTextDeclaration, enterTraitDeclaration, enterTryStatementExpression, enterTypeDeclaration, enterWhileStatementExpressionMethods inherited from class AbstractEK9PhaseListener
exitApplicationDeclaration, exitBlock, exitCatchStatementExpression, exitClassDeclaration, exitComponentDeclaration, exitDynamicClassDeclaration, exitDynamicFunctionDeclaration, exitDynamicVariableCapture, exitFinallyStatementExpression, exitInstructionBlock, exitModuleDeclaration, exitPackageBlock, exitRecordDeclaration, exitServiceDeclaration, exitServiceOperationDeclaration, exitSingleStatementBlock, exitStreamExpression, exitStreamStatement, exitTernaryPart, exitTextBodyDeclaration, exitTextDeclaration, exitTraitDeclaration, exitTypeDeclaration, getErrorListener, getParsedModule, isScopeStackEmpty, pullBlockTerminationUp, pullIfElseTerminationUp, pullSwitchCaseDefaultUp, pullTryCatchFinallyUpMethods inherited from class EK9BaseListener
enterAccessModifier, enterAggregateParts, enterAggregateProperty, enterAllowingOnly, enterApplicationBlock, enterArgumentParam, enterAspectDeclaration, enterAssertDoesNotThrowExpression, enterAssertPanicExpression, enterAssertStatement, enterAssertThrowsExpression, enterAssignmentExpression, enterAssignmentStatement, enterBinaryLit, enterBinaryLiteral, enterBlockStatement, enterBooleanLit, enterBooleanLiteral, enterBytesLit, enterBytesLiteral, enterCall, enterCaseExpression, enterCaseStatement, enterCharacterLit, enterCharacterLiteral, enterClassBlock, enterColourLit, enterColourLiteral, enterCompilationUnit, enterComponentBlock, enterConstantBlock, enterConstantDeclaration, enterConstantInitialiser, enterConstrainDeclaration, enterConstrainType, enterDateLit, enterDateLiteral, enterDateTimeLit, enterDateTimeLiteral, enterDeclareArgumentParam, enterDecorationDimensionLiteral, enterDecorationResolutionLiteral, enterDefaultOperator, enterDict, enterDimensionLit, enterDirective, enterDirectivePart, enterDottedName, enterDurationLit, enterDurationLiteral, enterDynamicFunctionBody, enterElseOnlyBlock, enterEmptyBlock, enterEnumerationDeclaration, enterEveryRule, enterExcludedControlFlowStatement, enterExcludedInstantiation, enterExcludedListComprehension, enterExcludedLiteral, enterExcludedParameters, enterExpression, enterExpressionParam, enterExtendDeclaration, enterExtendPreamble, enterFloatingPointLit, enterFloatingPointLiteral, enterForLoop, enterForRange, enterFunctionBlock, enterHttpAccess, enterHttpVerb, enterIdentifier, enterIdentifierReference, enterIfControlBlock, enterInitValuePair, enterIntegerLit, enterIntegerLiteral, enterList, enterMillisecondLit, enterMillisecondLiteral, enterModuleBlock, enterModuleDeclaration, enterModuleSegment, enterMoneyLit, enterMoneyLiteral, enterNonIdentifierOperator, enterObjectAccess, enterObjectAccessExpression, enterObjectAccessStart, enterObjectAccessType, enterOperationCall, enterOperationDetails, enterOperator, enterParameterisedArgs, enterParameterisedDetail, enterParameterisedParams, enterParameterisedType, enterParamExpression, enterPathLit, enterPathLiteral, enterPipelinePart, enterPreFlowAndControl, enterPreFlowStatement, enterPrimary, enterPrimaryReference, enterProgramBlock, enterRange, enterRecordBlock, enterReferencesBlock, enterRegExLit, enterRegisterStatement, enterRegularExpressionLiteral, enterRequireStatement, enterReservedWord, enterResolutionLit, enterSecurityConstraint, enterServiceBlock, enterSheBang, enterStatement, enterStreamCat, enterStreamExpressionTermination, enterStreamFor, enterStreamPart, enterStreamSource, enterStreamStatementTermination, enterStringLit, enterStringLiteral, enterStringPart, enterTextBlock, enterThrowStatement, enterTimeLit, enterTimeLiteral, enterTraitBlock, enterTraitPreamble, enterTraitReference, enterTraitsList, enterTypeBlock, enterTypeDef, enterVariableDeclaration, enterVariableOnlyDeclaration, enterVersionNumberLit, enterVersionNumberLiteral, enterWebVariableCorrelation, exitAccessModifier, exitAggregateParts, exitAggregateProperty, exitAllowingOnly, exitApplicationBlock, exitArgumentParam, exitAspectDeclaration, exitAssertDoesNotThrowExpression, exitAssertPanicExpression, exitAssertStatement, exitAssertThrowsExpression, exitAssignmentExpression, exitBinaryLit, exitBinaryLiteral, exitBlockStatement, exitBooleanLit, exitBooleanLiteral, exitBytesLit, exitBytesLiteral, exitCall, exitCaseExpression, exitCaseStatement, exitCharacterLit, exitCharacterLiteral, exitClassBlock, exitColourLit, exitColourLiteral, exitCompilationUnit, exitComponentBlock, exitConstantBlock, exitConstantDeclaration, exitConstantInitialiser, exitConstrainDeclaration, exitConstrainType, exitDateLit, exitDateLiteral, exitDateTimeLit, exitDateTimeLiteral, exitDeclareArgumentParam, exitDecorationDimensionLiteral, exitDecorationResolutionLiteral, exitDefaultOperator, exitDict, exitDimensionLit, exitDirective, exitDirectivePart, exitDottedName, exitDurationLit, exitDurationLiteral, exitDynamicFunctionBody, exitElseOnlyBlock, exitEmptyBlock, exitEnumerationDeclaration, exitEveryRule, exitExcludedControlFlowStatement, exitExcludedInstantiation, exitExcludedListComprehension, exitExcludedLiteral, exitExcludedParameters, exitExpression, exitExpressionParam, exitExtendDeclaration, exitExtendPreamble, exitFloatingPointLit, exitFloatingPointLiteral, exitForLoop, exitForRange, exitFunctionBlock, exitHttpAccess, exitHttpVerb, exitIdentifier, exitIdentifierReference, exitIfControlBlock, exitInitValuePair, exitIntegerLit, exitIntegerLiteral, exitList, exitMillisecondLit, exitMillisecondLiteral, exitModuleBlock, exitModuleSegment, exitMoneyLit, exitMoneyLiteral, exitNonIdentifierOperator, exitObjectAccess, exitObjectAccessExpression, exitObjectAccessStart, exitObjectAccessType, exitOperationCall, exitOperationDetails, exitOperator, exitParameterisedArgs, exitParameterisedDetail, exitParameterisedParams, exitParameterisedType, exitParamExpression, exitPathLit, exitPathLiteral, exitPipelinePart, exitPreFlowAndControl, exitPreFlowStatement, exitPrimary, exitPrimaryReference, exitProgramBlock, exitRange, exitRecordBlock, exitReferencesBlock, exitRegExLit, exitRegisterStatement, exitRegularExpressionLiteral, exitRequireStatement, exitReservedWord, exitResolutionLit, exitSecurityConstraint, exitServiceBlock, exitSheBang, exitStatement, exitStreamCat, exitStreamExpressionTermination, exitStreamFor, exitStreamPart, exitStreamSource, exitStreamStatementTermination, exitStringLit, exitStringLiteral, exitStringPart, exitTextBlock, exitTimeLit, exitTimeLiteral, exitTraitBlock, exitTraitPreamble, exitTraitReference, exitTraitsList, exitTypeBlock, exitTypeDef, exitVariableDeclaration, exitVariableOnlyDeclaration, exitVersionNumberLit, exitVersionNumberLiteral, exitWebVariableCorrelation, visitErrorNode, visitTerminal
-
Constructor Details
-
OrderingResultSources
OrderingResultSources(ParsedModule parsedModule, OrderingTotality totality)
-
-
Method Details
-
exitReturningParam
A returning variable declared WITH a value is followed from here, in the scope it is declared in (the callable, switch, try or loop), so the end of its construct can ask whether every path replaced that value.- Specified by:
exitReturningParamin interfaceEK9Listener- Overrides:
exitReturningParamin classAbstractEK9PhaseListener- Parameters:
ctx- the parse tree
-
exitAssignmentStatement
Description copied from class:EK9BaseListenerExit a parse tree produced byEK9Parser.assignmentStatement().The default implementation does nothing.
- Specified by:
exitAssignmentStatementin interfaceEK9Listener- Overrides:
exitAssignmentStatementin classEK9BaseListener- Parameters:
ctx- the parse tree
-
exitThrowStatement
Description copied from class:EK9BaseListenerExit a parse tree produced byEK9Parser.throwStatement().The default implementation does nothing.
- Specified by:
exitThrowStatementin interfaceEK9Listener- Overrides:
exitThrowStatementin classEK9BaseListener- Parameters:
ctx- the parse tree
-
exitIfStatement
Description copied from class:EK9BaseListenerExit a parse tree produced byEK9Parser.ifStatement().The default implementation does nothing.
- Specified by:
exitIfStatementin interfaceEK9Listener- Overrides:
exitIfStatementin classAbstractEK9PhaseListener- Parameters:
ctx- the parse tree
-
exitSwitchStatementExpression
Description copied from class:EK9BaseListenerExit a parse tree produced byEK9Parser.switchStatementExpression().The default implementation does nothing.
- Specified by:
exitSwitchStatementExpressionin interfaceEK9Listener- Overrides:
exitSwitchStatementExpressionin classAbstractEK9PhaseListener- Parameters:
ctx- the parse tree
-
exitTryStatementExpression
Description copied from class:EK9BaseListenerExit a parse tree produced byEK9Parser.tryStatementExpression().The default implementation does nothing.
- Specified by:
exitTryStatementExpressionin interfaceEK9Listener- Overrides:
exitTryStatementExpressionin classAbstractEK9PhaseListener- Parameters:
ctx- the parse tree
-
exitForStatementExpression
Description copied from class:EK9BaseListenerExit a parse tree produced byEK9Parser.forStatementExpression().The default implementation does nothing.
- Specified by:
exitForStatementExpressionin interfaceEK9Listener- Overrides:
exitForStatementExpressionin classAbstractEK9PhaseListener- Parameters:
ctx- the parse tree
-
exitWhileStatementExpression
Description copied from class:EK9BaseListenerExit a parse tree produced byEK9Parser.whileStatementExpression().The default implementation does nothing.
- Specified by:
exitWhileStatementExpressionin interfaceEK9Listener- Overrides:
exitWhileStatementExpressionin classAbstractEK9PhaseListener- Parameters:
ctx- the parse tree
-
exitOperatorDeclaration
Description copied from class:EK9BaseListenerExit a parse tree produced byEK9Parser.operatorDeclaration().The default implementation does nothing.
- Specified by:
exitOperatorDeclarationin interfaceEK9Listener- Overrides:
exitOperatorDeclarationin classAbstractEK9PhaseListener- Parameters:
ctx- the parse tree
-
exitMethodDeclaration
Description copied from class:EK9BaseListenerExit a parse tree produced byEK9Parser.methodDeclaration().The default implementation does nothing.
- Specified by:
exitMethodDeclarationin interfaceEK9Listener- Overrides:
exitMethodDeclarationin classAbstractEK9PhaseListener- Parameters:
ctx- the parse tree
-
exitFunctionDeclaration
Description copied from class:EK9BaseListenerExit a parse tree produced byEK9Parser.functionDeclaration().The default implementation does nothing.
- Specified by:
exitFunctionDeclarationin interfaceEK9Listener- Overrides:
exitFunctionDeclarationin classAbstractEK9PhaseListener- Parameters:
ctx- the parse tree
-