classLeave
final class Leave
implements ProgramStatement
uses Snapshot
Public API: explicitly declared with
@visibility public.LEAVE: leaves the block or loop that has the label.
The facts follow MYSQL-PROGRAM-FLOW-001. Source: https://dev.mysql.com/doc/refman/8.4/en/leave.html.
$create = (new \SqlSemantics\Platform\MySql\Semantics())->analyze('CREATE PROCEDURE p() again: LOOP LEAVE again; END LOOP');
[$create->statement->body->statements[0]->label->value, $create->facts->diagnostics] // => ['again', []]Properties§
public Name $labelMethods§
public function __construct(public Name $label)Parameters
$label | Name | The label of the enclosing statement |
public function deriveProgram(Derivation $derivation, ProgramScope $scope): voidChecks that an enclosing statement has the label.
Parameters
$derivation | Derivation | |
$scope | ProgramScope |
Calls 2
- method-call FlowFacts::jump() line 43
- new FlowFacts line 43
public function render(Output $out): voidWrites the statement.
Parameters
$out | Output |
Calls 2
- method-call Output::keyword() line 51
- class-const NameUse::Label() line 51
Test cases 14§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 1
LeaveTestcalls
Other tests reaching this symbol 13
BlockRuleTest::testBlockLowersALabeledBlockcallsFlowRuleTest::providerLabeledLowersALabeledLoopcallsFlowRuleTest::testConditionalLowersAnIfWithoutElsecallsFlowRuleTest::testJumpLowersReturnLeaveAndIteratecallsProgramFactsTest::testBodyKeepsAProgramStatementAndAnSqlStatementcallsReturnSearchTest::providerFoundIsFalseWithoutReturncallsReturnSearchTest::testNestedAnswersTheStatementsOfALoopcallsBlockTest::testAnEndLabelWithoutALabelIsRejectedcallsLoopTest::testAnEndLabelWithoutALabelIsRejectedcallsRepeatLoopTest::testAnEndLabelWithoutALabelIsRejectedcallsWhileLoopTest::testAnEndLabelWithoutALabelIsRejectedcallsHandlerDeclarationTest::testAHandlerWithoutConditionsIsRejectedcallsProgramStatementTest::providerDeriveProgramIsImplementedByTheProgramStatementClassescalls