PHP Класс 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
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$lastCallLine
$lastUnsetLine
$mutations
$uses
$variables

Открытые методы

Метод Описание
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

Описание методов

declareVariables() публичный Метод

public declareVariables ( array $statement )
$statement array

getLastCallLine() публичный Метод

Returns the line where the latest call in the method was made
public getLastCallLine ( ) : integer
Результат integer

getLastUnsetLine() публичный Метод

Returns the line where the latest unset operation was made
public getLastUnsetLine ( ) : integer
Результат integer

getLastVariableUseLine() публичный Метод

Returns the latest line where a variable was read
public getLastVariableUseLine ( string $variable ) : integer
$variable string
Результат integer

getNumberOfMutations() публичный Метод

Returns the number of assignment instructions that mutated a variable
public getNumberOfMutations ( string $variable ) : integer
$variable string
Результат integer

increaseMutations() публичный Метод

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

markLastUse() публичный Метод

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

markVariableNoLocal() публичный Метод

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

pass() публичный Метод

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

passArray() публичный Метод

public passArray ( array $expression )
$expression array

passCall() публичный Метод

public passCall ( array $expression )
$expression array

passExpression() публичный Метод

public passExpression ( array $expression )
$expression array

passLetStatement() публичный Метод

public passLetStatement ( array $statement )
$statement array

passNew() публичный Метод

public passNew ( array $expression )
$expression array

passStatementBlock() публичный Метод

public passStatementBlock ( array $statements )
$statements array

shouldBeLocal() публичный Метод

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
Результат boolean

Описание свойств

$lastCallLine защищенное свойство

protected $lastCallLine

$lastUnsetLine защищенное свойство

protected $lastUnsetLine

$mutations защищенное свойство

protected $mutations

$uses защищенное свойство

protected $uses

$variables защищенное свойство

protected $variables