final class ProgramScope
Restricted visibility: declared "@visibility SqlSemantics\Platform\MySql". Code outside that scope must not name this declaration.

What names mean at one position of a stored program.

Rule: MYSQL-PROGRAM-SCOPE-001. The scope holds the environment in which the parameters and local variables are visible as rows (the innermost block first, so an inner declaration hides an outer one), the action time and event of a trigger, the labels of the enclosing blocks and loops, and the conditions and cursors declared around the position, the innermost last. Names of variables, labels, conditions and cursors are compared without regard to letter case. It is a working value of one derivation. Terminates: every search is over a finite list. Source: https://dev.mysql.com/doc/refman/8.4/en/local-variable-scope.html, https://dev.mysql.com/doc/refman/8.4/en/statement-labels.html. Status: Implemented.

Properties§

public Environment $environment
public ProgramKind|null $kind = null
public list<Name> $blocks = []
public list<Name> $loops = []
public list<ConditionDeclaration> $conditions = []
public list<Name> $cursors = []
public TriggerTime|null $time = null
public TriggerEvent|null $event = null

Methods§

public function __construct(
    public Environment $environment,
    public ProgramKind|null $kind = null,
    public list<Name> $blocks = [],
    public list<Name> $loops = [],
    public list<ConditionDeclaration> $conditions = [],
    public list<Name> $cursors = [],
    public TriggerTime|null $time = null,
    public TriggerEvent|null $event = null,
)

Parameters

$environmentEnvironmentThe environment the variables are visible in
$kindProgramKind|nullThe kind of program the position belongs to; null outside a program
$blockslist<Name>The labels of the enclosing blocks
$loopslist<Name>The labels of the enclosing loops
$conditionslist<ConditionDeclaration>The conditions in scope, the innermost last
$cursorslist<Name>The cursors in scope
$timeTriggerTime|nullThe action time of the trigger the position belongs to; null outside a trigger
$eventTriggerEvent|nullThe event of the trigger the position belongs to; null outside a trigger
public function variable(Name $name): bool

Tells whether a parameter or local variable with the name is in scope.

Parameters

$nameName

Returns

bool
Test cases 1
Called from 1
Calls 2
public function labeled(?Name $label, bool $loop): self
public function declared(
    Environment $environment,
    list<ConditionDeclaration> $conditions,
    list<Name> $cursors,
): self

Answers the scope after declarations: another environment, and the conditions and cursors now in scope.

Parameters

$environmentEnvironment
$conditionslist<ConditionDeclaration>
$cursorslist<Name>

Returns

self
Called from 1
Calls 1
public function handler(): self

Answers the scope of the statement of a handler, which sees no label outside the handler.

Returns

self
Calls 1

Test cases 8§

Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.

Dedicated tests 7
Other tests reaching this symbol 1

Relations§

Instantiated in 7
Method calls 12
Type declarations 35