PHP Class Zephir\Passes\LocalContextPass

This pass tries to check whether variables only do exist in the local context of the method block or if they're used externally which will unallow variables to be placed in the stack This pass also tracks the number of initializations a variable may have, this allows to mark variables as read-only after their last initialization. The number of mutations is relative, since assignments inside cycles/loops may perform a n-number of mutations
Afficher le fichier Open project: phalcon/zephir Class Usage Examples

Protected Properties

Свойство Type Description
$lastCallLine
$lastUnsetLine
$mutations
$uses
$variables

Méthodes publiques

Méthode Description
declareVariables ( array $statement )
getLastCallLine ( ) : integer Returns the line where the latest call in the method was made
getLastUnsetLine ( ) : integer Returns the line where the latest unset operation was made
getLastVariableUseLine ( string $variable ) : integer Returns the latest line where a variable was read
getNumberOfMutations ( string $variable ) : integer Returns the number of assignment instructions that mutated a variable
increaseMutations ( string $variable ) Increase the number of mutations a variable has inside a statement block
markLastUse ( string $variable, array $node ) Marks the latest use/read of a variable
markVariableNoLocal ( string $variable ) Marks a variable to mandatory be stored in the heap
pass ( Zephir\StatementsBlock $block ) Do the compilation pass
passArray ( array $expression )
passCall ( array $expression )
passExpression ( array $expression )
passLetStatement ( array $statement )
passNew ( array $expression )
passStatementBlock ( array $statements )
shouldBeLocal ( string $variable ) : boolean Asks the local context information whether a variable can be stored in the stack instead of the heap

Method Details

declareVariables() public méthode

public declareVariables ( array $statement )
$statement array

getLastCallLine() public méthode

Returns the line where the latest call in the method was made
public getLastCallLine ( ) : integer
Résultat integer

getLastUnsetLine() public méthode

Returns the line where the latest unset operation was made
public getLastUnsetLine ( ) : integer
Résultat integer

getLastVariableUseLine() public méthode

Returns the latest line where a variable was read
public getLastVariableUseLine ( string $variable ) : integer
$variable string
Résultat integer

getNumberOfMutations() public méthode

Returns the number of assignment instructions that mutated a variable
public getNumberOfMutations ( string $variable ) : integer
$variable string
Résultat integer

increaseMutations() public méthode

Increase the number of mutations a variable has inside a statement block
public increaseMutations ( string $variable )
$variable string

markLastUse() public méthode

Marks the latest use/read of a variable
public markLastUse ( string $variable, array $node )
$variable string
$node array

markVariableNoLocal() public méthode

Marks a variable to mandatory be stored in the heap
public markVariableNoLocal ( string $variable )
$variable string

pass() public méthode

Do the compilation pass
public pass ( Zephir\StatementsBlock $block )
$block Zephir\StatementsBlock

passArray() public méthode

public passArray ( array $expression )
$expression array

passCall() public méthode

public passCall ( array $expression )
$expression array

passExpression() public méthode

public passExpression ( array $expression )
$expression array

passLetStatement() public méthode

public passLetStatement ( array $statement )
$statement array

passNew() public méthode

public passNew ( array $expression )
$expression array

passStatementBlock() public méthode

public passStatementBlock ( array $statements )
$statements array

shouldBeLocal() public méthode

Asks the local context information whether a variable can be stored in the stack instead of the heap
public shouldBeLocal ( string $variable ) : boolean
$variable string
Résultat boolean

Property Details

$lastCallLine protected_oe property

protected $lastCallLine

$lastUnsetLine protected_oe property

protected $lastUnsetLine

$mutations protected_oe property

protected $mutations

$uses protected_oe property

protected $uses

$variables protected_oe property

protected $variables