PHP Класс Zephir\SymbolTable

A symbol table stores all the variables defined in a method, their data types and default values
Показать файл Открыть проект Примеры использования класса

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

Свойство Тип Описание
$branchTempVariables
$branchVariables
$compilationContext
$localContext Zephir\Passes\LocalContextPass
$mustGrownStack
$tempVarCount

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

Метод Описание
__construct ( zephir\CompilationContext $compilationContext ) SymbolTable
addRawVariable ( Variable $variable ) : Variable Adds a raw variable to the symbol table (root branch)
addTemp ( string $type, zephir\CompilationContext $context ) : Variable Creates a temporary variable
addVariable ( integer $type, string $name, zephir\CompilationContext $compilationContext, mixed $defaultValue = null ) : Variable Adds a variable to the symbol table
getExpectedMutations ( string $variable ) : integer Returns the number of expected mutations for a variable
getLastCallLine ( ) : integer Returns the last line where any kind of call was performed within the method This is not necessary related to the symbol table but this information is gathered by the LocalContextPass
getLastUnsetLine ( ) : integer Returns the last line where an 'unset' operation was made within the current method This is not necessary related to the symbol table but this information is gathered by the LocalContextPass
getMustGrownStack ( ) : boolean Returns if the current symbol label must add a memory frame
getNextTempVar ( $compilationContext = null )
getTempComplexLiteralVariableForWrite ( string $type, zephir\CompilationContext $context ) : Variable Creates a temporary variable to be used in a write operation the body of the variable is freed between iterations instead of request a new full zval variable
getTempLocalVariableForWrite ( string $type, zephir\CompilationContext $context ) : Variable Creates a temporary variable to be used in a write operation
getTempNonTrackedUninitializedVariable ( string $type, zephir\CompilationContext $context ) : Variable Creates a temporary variable to be used in a read-only operation within native-array-access and property-access These kind of variables MUST not be tracked by the Zephir memory manager
getTempNonTrackedVariable ( $type, zephir\CompilationContext $context, boolean $initNonReferenced = false ) : Variable Creates a temporary variable to be used to point to a heap variable These kind of variables MUST not be tracked by the Zephir memory manager
getTempVariable ( string $type, zephir\CompilationContext $compilationContext ) : Variable Returns a temporal variable
getTempVariableForObserve ( string $type, zephir\CompilationContext $context ) : Variable Creates a temporary variable to be used as intermediate variable of a read operation Variables are automatically tracked by the memory manager
getTempVariableForObserveOrNullify ( string $type, zephir\CompilationContext $context ) : Variable Creates a temporary variable to be used as intermediate variable in a call operation Variables are automatically tracked by the memory manager
getTempVariableForWrite ( string $type, zephir\CompilationContext $context, $init = true ) : Variable Creates a temporary variable to be used in a write operation
getTemporalVariables ( ) : array Returns the temporal variables declared in a given context
getVariable ( $name, $compilationContext = null ) : Variable | boolean Returns a variable in the symbol table
getVariableForRead ( string $name, zephir\CompilationContext $compilationContext = null, array $statement = null ) : Variable Return a variable in the symbol table, it will be used for a read operation
getVariableForUpdate ( string $name, zephir\CompilationContext $compilationContext, array $statement = null ) : Variable Return a variable in the symbol table, it will be used for a mutating operation This method implies mutation of one of the members of the variable but no the variables it self
getVariableForWrite ( string $name, zephir\CompilationContext $compilationContext, array $statement = null ) : boolean | Variable Return a variable in the symbol table, it will be used for a write operation Some variables aren't writable themselves but their members do
getVariables ( ) : array Returns all the variables defined in the symbol table
getVariablesByBranch ( $branchId )
hasVariable ( string $name, $compilationContext = null ) : boolean Check if a variable is declared in the current symbol table
hasVariableInBranch ( $name, $compareBranch, $compilationContext = null )
isSuperGlobal ( string $name ) : boolean Checks if a variable is a superglobal
markTemporalVariablesIdle ( zephir\CompilationContext $compilationContext ) Traverses temporal variables created in a specific branch marking them as idle
mustGrownStack ( boolean $mustGrownStack ) Return a variable in the symbol table, it will be used for a write operation
resolveVariableToBranch ( $name, $compilationContext )
setLocalContext ( LocalContextPass $localContext ) Sets the local context information

Защищенные методы

Метод Описание
registerTempVariable ( string $type, string $location, Variable $variable, $compilationContext = null ) Register a variable as temporal
reuseTempVariable ( string $type, string $location, $compilationContext = null ) : Variable Reuse variables marked as idle after leave a branch

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

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

SymbolTable
public __construct ( zephir\CompilationContext $compilationContext )
$compilationContext zephir\CompilationContext

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

Adds a raw variable to the symbol table (root branch)
public addRawVariable ( Variable $variable ) : Variable
$variable Variable
Результат Variable

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

Creates a temporary variable
public addTemp ( string $type, zephir\CompilationContext $context ) : Variable
$type string
$context zephir\CompilationContext
Результат Variable

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

Adds a variable to the symbol table
public addVariable ( integer $type, string $name, zephir\CompilationContext $compilationContext, mixed $defaultValue = null ) : Variable
$type integer
$name string
$compilationContext zephir\CompilationContext
$defaultValue mixed
Результат Variable

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

Returns the number of expected mutations for a variable
public getExpectedMutations ( string $variable ) : integer
$variable string
Результат integer

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

Returns the last line where any kind of call was performed within the method This is not necessary related to the symbol table but this information is gathered by the LocalContextPass
public getLastCallLine ( ) : integer
Результат integer

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

Returns the last line where an 'unset' operation was made within the current method This is not necessary related to the symbol table but this information is gathered by the LocalContextPass
public getLastUnsetLine ( ) : integer
Результат integer

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

Returns if the current symbol label must add a memory frame
public getMustGrownStack ( ) : boolean
Результат boolean

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

public getNextTempVar ( $compilationContext = null )

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

Creates a temporary variable to be used in a write operation the body of the variable is freed between iterations instead of request a new full zval variable
public getTempComplexLiteralVariableForWrite ( string $type, zephir\CompilationContext $context ) : Variable
$type string
$context zephir\CompilationContext
Результат Variable

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

Creates a temporary variable to be used in a write operation
public getTempLocalVariableForWrite ( string $type, zephir\CompilationContext $context ) : Variable
$type string
$context zephir\CompilationContext
Результат Variable

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

Creates a temporary variable to be used in a read-only operation within native-array-access and property-access These kind of variables MUST not be tracked by the Zephir memory manager
public getTempNonTrackedUninitializedVariable ( string $type, zephir\CompilationContext $context ) : Variable
$type string
$context zephir\CompilationContext
Результат Variable

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

Creates a temporary variable to be used to point to a heap variable These kind of variables MUST not be tracked by the Zephir memory manager
public getTempNonTrackedVariable ( $type, zephir\CompilationContext $context, boolean $initNonReferenced = false ) : Variable
$type
$context zephir\CompilationContext
$initNonReferenced boolean
Результат Variable

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

Returns a temporal variable
public getTempVariable ( string $type, zephir\CompilationContext $compilationContext ) : Variable
$type string
$compilationContext zephir\CompilationContext
Результат Variable

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

Creates a temporary variable to be used as intermediate variable of a read operation Variables are automatically tracked by the memory manager
public getTempVariableForObserve ( string $type, zephir\CompilationContext $context ) : Variable
$type string
$context zephir\CompilationContext
Результат Variable

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

Creates a temporary variable to be used as intermediate variable in a call operation Variables are automatically tracked by the memory manager
public getTempVariableForObserveOrNullify ( string $type, zephir\CompilationContext $context ) : Variable
$type string
$context zephir\CompilationContext
Результат Variable

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

Creates a temporary variable to be used in a write operation
public getTempVariableForWrite ( string $type, zephir\CompilationContext $context, $init = true ) : Variable
$type string
$context zephir\CompilationContext
Результат Variable

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

Returns the temporal variables declared in a given context
public getTemporalVariables ( ) : array
Результат array

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

Returns a variable in the symbol table
public getVariable ( $name, $compilationContext = null ) : Variable | boolean
$name
Результат Variable | boolean

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

Return a variable in the symbol table, it will be used for a read operation
public getVariableForRead ( string $name, zephir\CompilationContext $compilationContext = null, array $statement = null ) : Variable
$name string
$compilationContext zephir\CompilationContext
$statement array
Результат Variable

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

Return a variable in the symbol table, it will be used for a mutating operation This method implies mutation of one of the members of the variable but no the variables it self
public getVariableForUpdate ( string $name, zephir\CompilationContext $compilationContext, array $statement = null ) : Variable
$name string
$compilationContext zephir\CompilationContext
$statement array
Результат Variable

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

Return a variable in the symbol table, it will be used for a write operation Some variables aren't writable themselves but their members do
public getVariableForWrite ( string $name, zephir\CompilationContext $compilationContext, array $statement = null ) : boolean | Variable
$name string
$compilationContext zephir\CompilationContext
$statement array
Результат boolean | Variable

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

Returns all the variables defined in the symbol table
public getVariables ( ) : array
Результат array

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

public getVariablesByBranch ( $branchId )

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

Check if a variable is declared in the current symbol table
public hasVariable ( string $name, $compilationContext = null ) : boolean
$name string
Результат boolean

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

public hasVariableInBranch ( $name, $compareBranch, $compilationContext = null )

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

Checks if a variable is a superglobal
public isSuperGlobal ( string $name ) : boolean
$name string
Результат boolean

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

Traverses temporal variables created in a specific branch marking them as idle
public markTemporalVariablesIdle ( zephir\CompilationContext $compilationContext )
$compilationContext zephir\CompilationContext

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

Return a variable in the symbol table, it will be used for a write operation
public mustGrownStack ( boolean $mustGrownStack )
$mustGrownStack boolean

registerTempVariable() защищенный Метод

Register a variable as temporal
protected registerTempVariable ( string $type, string $location, Variable $variable, $compilationContext = null )
$type string
$location string
$variable Variable

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

public resolveVariableToBranch ( $name, $compilationContext )

reuseTempVariable() защищенный Метод

Reuse variables marked as idle after leave a branch
protected reuseTempVariable ( string $type, string $location, $compilationContext = null ) : Variable
$type string
$location string
Результат Variable

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

Sets the local context information
public setLocalContext ( LocalContextPass $localContext )
$localContext Zephir\Passes\LocalContextPass

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

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

protected $branchTempVariables

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

protected $branchVariables

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

protected $compilationContext

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

protected LocalContextPass,Zephir\Passes $localContext
Результат Zephir\Passes\LocalContextPass

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

protected $mustGrownStack

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

protected $tempVarCount