PHP Class Zephir\CompilerFile

This class represents every file compiled in a project Every file may contain a class or an interface
Afficher le fichier Open project: phalcon/zephir Class Usage Examples

Protected Properties

Свойство Type Description
$_aliasManager zephir\AliasManager
$_classDefinition ClassDefinition
$_className
$_compiledFile
$_config zephir\Config
$_external
$_filePath
$_functionDefinitions zephir\FunctionDefinition[]
$_headerCBlocks array
$_ir Original internal representation (IR) of the file
$_logger zephir\Logger
$_namespace Namespace of the
$_originalNode

Méthodes publiques

Méthode Description
__construct ( string $className, string $filePath, zephir\Config $config, zephir\Logger $logger ) CompilerFile constructor
addFunction ( Compiler $compiler, zephir\FunctionDefinition $func, array $statement = null ) Adds a function to the function definitions
applyClassHeaders ( zephir\CompilationContext $compilationContext )
checkDependencies ( Compiler $compiler ) Check dependencies
compile ( Compiler $compiler, zephir\StringsManager $stringsManager ) Compiles the file
compileClass ( zephir\CompilationContext $compilationContext, string $namespace, array $classStatement ) Compiles the class/interface contained in the file
compileComment ( zephir\CompilationContext $compilationContext, array $topStatement ) Compiles a comment as a top-level statement
compileFunction ( zephir\CompilationContext $compilationContext, zephir\FunctionDefinition $functionDefinition ) Compiles a function
genIR ( Compiler $compiler ) : array Compiles the file generating a JSON intermediate representation
getClassDefinition ( ) : ClassDefinition
getCompiledFile ( ) : string Returns the path to the compiled file
getFilePath ( ) : string Returns the path to the source file
getFunctionDefinitions ( )
isExternal ( ) : boolean
preCompile ( Compiler $compiler ) Pre-compiles a Zephir file. Generates the IR and perform basic validations
preCompileClass ( zephir\CompilationContext $compilationContext, string $namespace, array $topStatement, array $docblock ) Creates a definition for a class
preCompileInterface ( string $namespace, array $topStatement, array $docblock ) Creates a definition for an interface
setIsExternal ( boolean $external ) Sets if the class belongs to an external dependency or not

Méthodes protégées

Méthode Description
_processShorcuts ( array $property, ClassDefinition $classDefinition ) Creates the property shortcuts
createReturnsType ( array $types ) : array | null
getFullName ( string $name ) : string Transform class/interface name to FQN format

Method Details

__construct() public méthode

CompilerFile constructor
public __construct ( string $className, string $filePath, zephir\Config $config, zephir\Logger $logger )
$className string
$filePath string
$config zephir\Config
$logger zephir\Logger

_processShorcuts() protected méthode

Creates the property shortcuts
protected _processShorcuts ( array $property, ClassDefinition $classDefinition )
$property array
$classDefinition ClassDefinition

addFunction() public méthode

Adds a function to the function definitions
public addFunction ( Compiler $compiler, zephir\FunctionDefinition $func, array $statement = null )
$compiler Compiler
$func zephir\FunctionDefinition
$statement array

applyClassHeaders() public méthode

public applyClassHeaders ( zephir\CompilationContext $compilationContext )
$compilationContext zephir\CompilationContext

checkDependencies() public méthode

Check dependencies
public checkDependencies ( Compiler $compiler )
$compiler Compiler

compile() public méthode

Compiles the file
public compile ( Compiler $compiler, zephir\StringsManager $stringsManager )
$compiler Compiler
$stringsManager zephir\StringsManager

compileClass() public méthode

Compiles the class/interface contained in the file
public compileClass ( zephir\CompilationContext $compilationContext, string $namespace, array $classStatement )
$compilationContext zephir\CompilationContext
$namespace string
$classStatement array

compileComment() public méthode

Compiles a comment as a top-level statement
public compileComment ( zephir\CompilationContext $compilationContext, array $topStatement )
$compilationContext zephir\CompilationContext
$topStatement array

compileFunction() public méthode

Compiles a function
public compileFunction ( zephir\CompilationContext $compilationContext, zephir\FunctionDefinition $functionDefinition )
$compilationContext zephir\CompilationContext
$functionDefinition zephir\FunctionDefinition

createReturnsType() protected méthode

protected createReturnsType ( array $types ) : array | null
$types array
Résultat array | null

genIR() public méthode

Compiles the file generating a JSON intermediate representation
public genIR ( Compiler $compiler ) : array
$compiler Compiler
Résultat array

getClassDefinition() public méthode

public getClassDefinition ( ) : ClassDefinition
Résultat ClassDefinition

getCompiledFile() public méthode

Returns the path to the compiled file
public getCompiledFile ( ) : string
Résultat string

getFilePath() public méthode

Returns the path to the source file
public getFilePath ( ) : string
Résultat string

getFullName() protected méthode

Transform class/interface name to FQN format
protected getFullName ( string $name ) : string
$name string
Résultat string

getFunctionDefinitions() public méthode

isExternal() public méthode

public isExternal ( ) : boolean
Résultat boolean

preCompile() public méthode

Pre-compiles a Zephir file. Generates the IR and perform basic validations
public preCompile ( Compiler $compiler )
$compiler Compiler

preCompileClass() public méthode

Creates a definition for a class
public preCompileClass ( zephir\CompilationContext $compilationContext, string $namespace, array $topStatement, array $docblock )
$compilationContext zephir\CompilationContext
$namespace string
$topStatement array
$docblock array

preCompileInterface() public méthode

Creates a definition for an interface
public preCompileInterface ( string $namespace, array $topStatement, array $docblock )
$namespace string
$topStatement array
$docblock array

setIsExternal() public méthode

Sets if the class belongs to an external dependency or not
public setIsExternal ( boolean $external )
$external boolean

Property Details

$_aliasManager protected_oe property

protected AliasManager,zephir $_aliasManager
Résultat zephir\AliasManager

$_classDefinition protected_oe property

protected ClassDefinition,zephir $_classDefinition
Résultat ClassDefinition

$_className protected_oe property

protected $_className

$_compiledFile protected_oe property

protected $_compiledFile

$_config protected_oe property

protected Config,zephir $_config
Résultat zephir\Config

$_external protected_oe property

protected $_external

$_filePath protected_oe property

protected $_filePath

$_functionDefinitions protected_oe property

protected FunctionDefinition[],zephir $_functionDefinitions
Résultat zephir\FunctionDefinition[]

$_headerCBlocks protected_oe property

protected array $_headerCBlocks
Résultat array

$_ir protected_oe property

Original internal representation (IR) of the file
protected $_ir

$_logger protected_oe property

protected Logger,zephir $_logger
Résultat zephir\Logger

$_namespace protected_oe property

Namespace of the
protected $_namespace

$_originalNode protected_oe property

protected $_originalNode