PHP Класс Zephir\Variable

This represents a variable in a symbol table
Показать файл Открыть проект Примеры использования класса

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

Свойство Тип Описание
$associatedClass Associated class
$branch zephir\Branch Branch where the variable was declared
$classTypes Class types
$defaultInitValue
$doublePointer
$dynamicTypes array Current dynamic type of the variable
$idle Temporal variables are marked as idle
$initBranch Branch where the variable was initialized for the first time
$initBranches
$initialized Whether the variable has received any assignment
$isExternal
$localOnly
$lowName Compiled variable's name
$memoryTracked
$mustInitNull
$name Variable's name
$node AST node where the variable was originally declared or created
$numberMutates Number of mutations to the variable
$numberSkips Initialization skips
$numberUses Number of times the variable has been read
$possibleValue Possible constant value assigned to the variable
$possibleValueBranch Branch where the variable got its last possible value
$readOnly
$reusable Reusable temporary variables?
$temporal Whether the variable is temporal or not
$type Variable's type
$used Whether the variable was used or not
$usedNode Last AST node where the variable was used
$variantInits

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

Метод Описание
__construct ( string $type, string $name, zephir\Branch $branch, mixed $defaultInitValue = null ) Variable constructor
enableDefaultAutoInitValue ( ) Sets an automatic safe default init value according to its type
getAssociatedClass ( ) : ClassDefinition Returns the class related to the variable
getBranch ( ) : zephir\Branch Get the branch where the variable was declared
getClassTypes ( ) : array Returns the PHP classes associated to the variable
getDefaultInitValue ( ) : mixed Returns the default init value
getDynamicTypes ( ) : array Returns the current dynamic type in a polymorphic variable
getInitBranch ( ) : boolean | integer Get init branch
getInitBranches ( ) : array Get init marked branch
getLastUsedNode ( ) : array Returns the last node where the variable was assigned or used
getName ( ) : string Returns variable's name
getNumberMutations ( ) : integer Returns the number of mutations performed over the variable
getNumberUses ( ) : integer Return the number of uses
getOriginal ( ) : array Returns the original AST node where the variable was declared
getPossibleValue ( ) : mixed Returns the latest CompiledExpression assigned to a variable
getPossibleValueBranch ( ) : zephir\Branch Returns the branch where the variable was assigned for the last time
getRealName ( ) : string Returns variable's real name
getSkipVariant ( ) : integer Get the number of initializations remaining to skip
getType ( ) : string Returns the type of variable
hasAnyDynamicType ( mixed $types ) : boolean Checks if the variable has any of the passed dynamic
hasDifferentDynamicType ( array | string $types ) : boolean Check if the variable has at least one dynamic type to the ones passed in the list
increaseMutates ( ) Increase the number of mutations a variable may have
increaseUses ( ) Increase the number of uses a variable may have
increaseVariantIfNull ( ) Increase the number of times the variable has been initialized
initComplexLiteralVariant ( zephir\CompilationContext $compilationContext ) Initializes a variant variable that is intended to have the special behavior of only freed its body value instead of the full variable
initNonReferenced ( zephir\CompilationContext $compilationContext ) * Allocate memory for variable and init it null val
initVariant ( zephir\CompilationContext $compilationContext ) Initializes a variant variable
isArray ( ) : boolean Shortcut is type double?
isBoolean ( ) : boolean Shortcut is type bool?
isDouble ( ) : boolean Shortcut is type double?
isDoublePointer ( ) Returns the variable
isExternal ( ) : boolean Check if the variable is a parameter
isIdle ( ) : boolean Checks if the variable is idle
isInitialized ( ) : boolean Check if the variable is initialized or not
isInt ( ) : boolean Shortcut is type int?
isLocalOnly ( ) : boolean Checks if the variable is local-only scoped
isMemoryTracked ( ) : boolean Checks if the variable is tracked by the memory manager
isNotVariable ( ) : boolean Shortcut is type variable or string?
isNotVariableAndArray ( ) : boolean Shortcut is type variable or array?
isNotVariableAndString ( ) : boolean Shortcut is type variable or string?
isReadOnly ( ) : boolean Returns if the variable is read only
isReusable ( ) : boolean Checks if the temporary variable is reusable
isString ( ) : boolean Shortcut is type string?
isTemporal ( ) : boolean Returns whether the variable is temporal or not
isUsed ( ) : boolean Checks whether the last value assigned was used
isVariable ( ) : boolean Shortcut is type variable?
mustInitNull ( ) : boolean Set if the variable must be initialized to null
observeOrNullifyVariant ( zephir\CompilationContext $compilationContext ) Observes a variable in the memory frame without initialization or nullify an existing allocated variable
observeVariant ( zephir\CompilationContext $compilationContext ) Observes a variable in the memory frame without initialization
separate ( zephir\CompilationContext $compilationContext ) Separates variables before being updated
setAssociatedClass ( ClassDefinition $associatedClass ) Sets the PHP class related to variable
setClassTypes ( string | array $classTypes ) Sets the PHP class related to variable
setDefaultInitValue ( mixed $value ) Sets the default init value
setDynamicTypes ( string | array $types ) Sets the current dynamic type in a polymorphic variable
setIdle ( boolean $idle ) Once a temporal variable is unused in a specific branch it is marked as idle
setIsDoublePointer ( boolean $doublePointer ) Marks the variable to be defined as a double pointer
setIsExternal ( boolean $isExternal ) Set if the symbol is a parameter of the method or not
setIsInitialized ( boolean $initialized, zephir\CompilationContext $compilationContext ) Sets if the variable is initialized This allow to throw an exception if the variable is being read without prior initialization
setLocalOnly ( boolean $localOnly ) Sets if the variable is local-only scoped
setLowName ( string $lowName ) Sets the compiled variable's name
setMemoryTracked ( boolean $memoryTracked ) Sets if the variable is not tracked by the memory manager
setMustInitNull ( boolean $mustInitNull ) : boolean Set if the variable must be initialized to null
setOriginal ( array $node ) Set the original AST node where the variable was declared
setPossibleValue ( zephir\CompiledExpression $possibleValue, zephir\CompilationContext $compilationContext ) Sets the latest CompiledExpression assigned to a variable
setReadOnly ( boolean $readOnly ) Sets if the variable is read only
setReusable ( boolean $reusable ) Some temporary variables can't be reused
setTemporal ( boolean $temporal ) Sets whether the variable is temporal or not
setUsed ( boolean $used, array $node ) Sets the latest node where a variable was used
skipInitVariant ( integer $numberSkips ) Skips variable initialization
trackVariant ( zephir\CompilationContext $compilationContext ) Tells the compiler a generated code will track the variable

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

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

Variable constructor
public __construct ( string $type, string $name, zephir\Branch $branch, mixed $defaultInitValue = null )
$type string
$name string
$branch zephir\Branch
$defaultInitValue mixed

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

Sets an automatic safe default init value according to its type

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

Returns the class related to the variable
public getAssociatedClass ( ) : ClassDefinition
Результат ClassDefinition

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

Get the branch where the variable was declared
public getBranch ( ) : zephir\Branch
Результат zephir\Branch

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

Returns the PHP classes associated to the variable
public getClassTypes ( ) : array
Результат array

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

Returns the default init value
public getDefaultInitValue ( ) : mixed
Результат mixed

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

Returns the current dynamic type in a polymorphic variable
public getDynamicTypes ( ) : array
Результат array

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

Get init branch
public getInitBranch ( ) : boolean | integer
Результат boolean | integer

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

Get init marked branch
public getInitBranches ( ) : array
Результат array

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

Returns the last node where the variable was assigned or used
public getLastUsedNode ( ) : array
Результат array

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

Returns variable's name
public getName ( ) : string
Результат string

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

Returns the number of mutations performed over the variable
public getNumberMutations ( ) : integer
Результат integer

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

Return the number of uses
public getNumberUses ( ) : integer
Результат integer

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

Returns the original AST node where the variable was declared
public getOriginal ( ) : array
Результат array

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

Returns the latest CompiledExpression assigned to a variable
public getPossibleValue ( ) : mixed
Результат mixed

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

Returns the branch where the variable was assigned for the last time
public getPossibleValueBranch ( ) : zephir\Branch
Результат zephir\Branch

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

Returns variable's real name
public getRealName ( ) : string
Результат string

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

Get the number of initializations remaining to skip
public getSkipVariant ( ) : integer
Результат integer

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

Returns the type of variable
public getType ( ) : string
Результат string

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

Checks if the variable has any of the passed dynamic
public hasAnyDynamicType ( mixed $types ) : boolean
$types mixed
Результат boolean

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

Check if the variable has at least one dynamic type to the ones passed in the list
public hasDifferentDynamicType ( array | string $types ) : boolean
$types array | string
Результат boolean

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

Increase the number of mutations a variable may have
public increaseMutates ( )

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

Increase the number of uses a variable may have
public increaseUses ( )

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

Increase the number of times the variable has been initialized

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

Initializes a variant variable that is intended to have the special behavior of only freed its body value instead of the full variable
public initComplexLiteralVariant ( zephir\CompilationContext $compilationContext )
$compilationContext zephir\CompilationContext

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

* Allocate memory for variable and init it null val
public initNonReferenced ( zephir\CompilationContext $compilationContext )
$compilationContext zephir\CompilationContext

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

Initializes a variant variable
public initVariant ( zephir\CompilationContext $compilationContext )
$compilationContext zephir\CompilationContext

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

Shortcut is type double?
public isArray ( ) : boolean
Результат boolean

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

Shortcut is type bool?
public isBoolean ( ) : boolean
Результат boolean

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

Shortcut is type double?
public isDouble ( ) : boolean
Результат boolean

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

Returns the variable
public isDoublePointer ( )

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

Check if the variable is a parameter
public isExternal ( ) : boolean
Результат boolean

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

Checks if the variable is idle
public isIdle ( ) : boolean
Результат boolean

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

Check if the variable is initialized or not
public isInitialized ( ) : boolean
Результат boolean

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

Shortcut is type int?
public isInt ( ) : boolean
Результат boolean

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

Checks if the variable is local-only scoped
public isLocalOnly ( ) : boolean
Результат boolean

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

Checks if the variable is tracked by the memory manager
public isMemoryTracked ( ) : boolean
Результат boolean

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

Shortcut is type variable or string?
public isNotVariable ( ) : boolean
Результат boolean

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

Shortcut is type variable or array?
public isNotVariableAndArray ( ) : boolean
Результат boolean

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

Shortcut is type variable or string?
public isNotVariableAndString ( ) : boolean
Результат boolean

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

Returns if the variable is read only
public isReadOnly ( ) : boolean
Результат boolean

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

Checks if the temporary variable is reusable
public isReusable ( ) : boolean
Результат boolean

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

Shortcut is type string?
public isString ( ) : boolean
Результат boolean

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

Returns whether the variable is temporal or not
public isTemporal ( ) : boolean
Результат boolean

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

Checks whether the last value assigned was used
public isUsed ( ) : boolean
Результат boolean

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

Shortcut is type variable?
public isVariable ( ) : boolean
Результат boolean

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

Set if the variable must be initialized to null
public mustInitNull ( ) : boolean
Результат boolean

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

Observes a variable in the memory frame without initialization or nullify an existing allocated variable
public observeOrNullifyVariant ( zephir\CompilationContext $compilationContext )
$compilationContext zephir\CompilationContext

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

Observes a variable in the memory frame without initialization
public observeVariant ( zephir\CompilationContext $compilationContext )
$compilationContext zephir\CompilationContext

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

Separates variables before being updated
public separate ( zephir\CompilationContext $compilationContext )
$compilationContext zephir\CompilationContext

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

Sets the PHP class related to variable
public setAssociatedClass ( ClassDefinition $associatedClass )
$associatedClass ClassDefinition

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

Sets the PHP class related to variable
public setClassTypes ( string | array $classTypes )
$classTypes string | array

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

Sets the default init value
public setDefaultInitValue ( mixed $value )
$value mixed

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

Sets the current dynamic type in a polymorphic variable
public setDynamicTypes ( string | array $types )
$types string | array

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

Once a temporal variable is unused in a specific branch it is marked as idle
public setIdle ( boolean $idle )
$idle boolean

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

Marks the variable to be defined as a double pointer
public setIsDoublePointer ( boolean $doublePointer )
$doublePointer boolean

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

Set if the symbol is a parameter of the method or not
public setIsExternal ( boolean $isExternal )
$isExternal boolean

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

Sets if the variable is initialized This allow to throw an exception if the variable is being read without prior initialization
public setIsInitialized ( boolean $initialized, zephir\CompilationContext $compilationContext )
$initialized boolean
$compilationContext zephir\CompilationContext

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

Sets if the variable is local-only scoped
public setLocalOnly ( boolean $localOnly )
$localOnly boolean

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

Sets the compiled variable's name
public setLowName ( string $lowName )
$lowName string

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

Sets if the variable is not tracked by the memory manager
public setMemoryTracked ( boolean $memoryTracked )
$memoryTracked boolean

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

Set if the variable must be initialized to null
public setMustInitNull ( boolean $mustInitNull ) : boolean
$mustInitNull boolean
Результат boolean

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

Set the original AST node where the variable was declared
public setOriginal ( array $node )
$node array

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

Sets the latest CompiledExpression assigned to a variable
public setPossibleValue ( zephir\CompiledExpression $possibleValue, zephir\CompilationContext $compilationContext )
$possibleValue zephir\CompiledExpression
$compilationContext zephir\CompilationContext

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

Sets if the variable is read only
public setReadOnly ( boolean $readOnly )
$readOnly boolean

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

Some temporary variables can't be reused
public setReusable ( boolean $reusable )
$reusable boolean

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

Sets whether the variable is temporal or not
public setTemporal ( boolean $temporal )
$temporal boolean

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

Sets the latest node where a variable was used
public setUsed ( boolean $used, array $node )
$used boolean
$node array

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

Skips variable initialization
public skipInitVariant ( integer $numberSkips )
$numberSkips integer

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

Tells the compiler a generated code will track the variable
public trackVariant ( zephir\CompilationContext $compilationContext )
$compilationContext zephir\CompilationContext

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

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

Associated class
protected $associatedClass

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

Branch where the variable was declared
protected Branch,zephir $branch
Результат zephir\Branch

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

Class types
protected $classTypes

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

protected $defaultInitValue

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

protected $doublePointer

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

Current dynamic type of the variable
protected array $dynamicTypes
Результат array

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

Temporal variables are marked as idle
protected $idle

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

Branch where the variable was initialized for the first time
protected $initBranch

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

protected $initBranches

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

Whether the variable has received any assignment
protected $initialized

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

protected $isExternal

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

protected $localOnly

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

Compiled variable's name
protected $lowName

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

protected $memoryTracked

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

protected $mustInitNull

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

Variable's name
protected $name

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

AST node where the variable was originally declared or created
protected $node

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

Number of mutations to the variable
protected $numberMutates

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

Initialization skips
protected $numberSkips

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

Number of times the variable has been read
protected $numberUses

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

Possible constant value assigned to the variable
protected $possibleValue

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

Branch where the variable got its last possible value
protected $possibleValueBranch

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

protected $readOnly

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

Reusable temporary variables?
protected $reusable

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

Whether the variable is temporal or not
protected $temporal

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

Variable's type
protected $type

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

Whether the variable was used or not
protected $used

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

Last AST node where the variable was used
protected $usedNode

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

protected $variantInits