classFlowRule
final class FlowRule
Lowers the flow control statements of stored programs.
Rule: MYSQL-PROGRAM-FLOW-LOWERING-001. Scope: sp_proc_stmt_if, sp_if, sp_elseifs, case_stmt_specification, simple_case_stmt, searched_case_stmt, simple_when_clause_list, searched_when_clause_list, simple_when_clause, searched_when_clause, else_clause_opt, sp_labeled_control, sp_unlabeled_control, sp_opt_label, sp_proc_stmt_return, sp_proc_stmt_leave, sp_proc_stmt_iterate. The chain of ELSEIF rules is followed with a loop. Constructs: IfStatement, SimpleCase, SearchedCase, ConditionalBranch, Loop, WhileLoop, RepeatLoop, Leave, Iterate, ReturnStatement. Terminates: every child is a strict subtree; the ELSEIF chain and the lists are walked iteratively. Source: https://dev.mysql.com/doc/refman/8.4/en/flow-control-statements.html. Status: Implemented.
Methods§
public function __construct(private Lowering $lowering)Parameters
$lowering | Lowering | The lowering this rule belongs to |
public function conditional(Form $form): IfStatementLowers IF: the form of sp_proc_stmt_if.
Parameters
$form | Form |
Returns
Throws
ImplementationGap When a production has no ruleTest cases 1
Called from 1
Calls 7
- static-call ImplementationGap::production() line 69
- new StatementRule line 71
- method-call Lowering::form() line 74
- method-call Form::node() line 74
- new ConditionalBranch line 79
- method-call StatementRule::statements() line 79
- new IfStatement line 89
public function choice(Form $form): SimpleCase|SearchedCaseLowers the CASE statement: the form of case_stmt_specification.
Parameters
$form | Form |
Returns
Throws
ImplementationGap When a production has no ruleCalled from 1
Calls 11
- static-call ImplementationGap::production() line 100
- method-call Lowering::form() line 102
- method-call Form::node() line 102
- new StatementRule line 108
- method-call Sequence::items() line 110
- new Sequence line 110
- class-const FlowRule::WHENS() line 110
- new ConditionalBranch line 115
- method-call StatementRule::statements() line 115
- new SearchedCase line 124
- new SimpleCase line 124
public function labeled(Form $form): Loop|WhileLoop|RepeatLoopLowers a labeled loop: the form of sp_labeled_control.
Parameters
$form | Form |
Returns
Throws
ImplementationGap When a production has no ruleCalled from 1
Calls 4
- static-call ImplementationGap::production() line 135
- method-call FlowRule::loop() line 138
- method-call Form::node() line 138
- method-call FlowRule::endLabel() line 138
Lowers the optional label after END: a node of sp_opt_label; an absent label is null.
Parameters
$label | Node |
Returns
?NameThrows
ImplementationGap When a production has no ruleCalled from 2
- method-call SqlSemantics\Platform\MySql\Lowering\Routine\Program\BlockRule::block() packages/sql-semantics-mysql/src/Lowering/Routine/Program/BlockRule.php:73
- method-call SqlSemantics\Platform\MySql\Lowering\Routine\Program\FlowRule::labeled() packages/sql-semantics-mysql/src/Lowering/Routine/Program/FlowRule.php:138
Calls 2
- method-call Lowering::form() line 148
- static-call ImplementationGap::production() line 153
Lowers LOOP, WHILE or REPEAT with the labels written around it: a node of sp_unlabeled_control.
Returns
Throws
ImplementationGap When a production has no ruleCalled from 2
- method-call SqlSemantics\Platform\MySql\Lowering\Routine\Program\FlowRule::labeled() packages/sql-semantics-mysql/src/Lowering/Routine/Program/FlowRule.php:138
- method-call SqlSemantics\Platform\MySql\Lowering\Routine\Program\StatementRule::statement() packages/sql-semantics-mysql/src/Lowering/Routine/Program/StatementRule.php:84
Calls 7
- method-call Lowering::form() line 164
- new StatementRule line 165
- new Loop line 168
- method-call StatementRule::statements() line 168
- new WhileLoop line 169
- new RepeatLoop line 170
- static-call ImplementationGap::production() line 171
public function jump(Form $form): ProgramStatement|StatementLowers RETURN, LEAVE or ITERATE: the form of sp_proc_stmt_return, sp_proc_stmt_leave or sp_proc_stmt_iterate.
Parameters
$form | Form |
Returns
Throws
ImplementationGap When a production has no ruleCalled from 1
Calls 5
- new ReturnStatement line 183
- method-call Form::node() line 183
- new Leave line 184
- new Iterate line 185
- static-call ImplementationGap::production() line 186
Private surface 2§
Implementation details, listed for orientation only.
private const WHENS = ['simple_when_clause_list: simple_when_clause', 'simple_when_clause_list: simpl…private Lowering $loweringTest cases 1§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 1
Relations§
Instantiated in 2
- new SqlSemantics\Platform\MySql\Lowering\Routine\Program\BlockRule::block() packages/sql-semantics-mysql/src/Lowering/Routine/Program/BlockRule.php:73
- new SqlSemantics\Platform\MySql\Lowering\Routine\Program\StatementRule::statement() packages/sql-semantics-mysql/src/Lowering/Routine/Program/StatementRule.php:79
Method calls 6
- method-call SqlSemantics\Platform\MySql\Lowering\Routine\Program\BlockRule::block() packages/sql-semantics-mysql/src/Lowering/Routine/Program/BlockRule.php:73
- method-call SqlSemantics\Platform\MySql\Lowering\Routine\Program\StatementRule::statement() packages/sql-semantics-mysql/src/Lowering/Routine/Program/StatementRule.php:84
- method-call SqlSemantics\Platform\MySql\Lowering\Routine\Program\StatementRule::statement() packages/sql-semantics-mysql/src/Lowering/Routine/Program/StatementRule.php:86
- method-call SqlSemantics\Platform\MySql\Lowering\Routine\Program\StatementRule::statement() packages/sql-semantics-mysql/src/Lowering/Routine/Program/StatementRule.php:87
- method-call SqlSemantics\Platform\MySql\Lowering\Routine\Program\StatementRule::statement() packages/sql-semantics-mysql/src/Lowering/Routine/Program/StatementRule.php:88
- method-call SqlSemantics\Platform\MySql\Lowering\Routine\Program\StatementRule::statement() packages/sql-semantics-mysql/src/Lowering/Routine/Program/StatementRule.php:89