- Work on extension integration.

- WIP of the inline view token
- Began work on compiled-code caching
This commit is contained in:
mcndave committed 2019-09-04 15:14:49 +00:00
1 parent 66c7b349d1
commit f8e3dbd60f
8 files changed
+105 -11

No files matched your search

+11 -4
View File
@@ -6,16 +6,21 @@ class Picea
{
public Compiler\Context $context;
public function __construct(?Context $context = null)
public Compiler $compiler;
public function __construct(?Context $context = null, ?Compiler $compiler = null)
{
$this->context = $context ?? new Compiler\BaseContext();
$this->compiler = $compiler ?: $this->instanciateCompiler();
}
public function compileSource(string $source) : array
{
$this->compiler->loadSourceCode($source);
return [
'context' => $context = clone $this->context,
'source' => $this->instanciateCompiler($source)->compile($context)
'source' => $this->compiler->compile($context),
];
}
@@ -29,9 +34,11 @@ class Picea
throw new \ErrorException("Given file could not be opened `$filePath`. This could indicate a permission misconfiguration on your file or folder");
}
$this->compiler->loadSourceCode($fileContent);
return [
'context' => $context = clone $this->context,
'source' => $this->instanciateCompiler($fileContent)->compile($context)
'source' => $this->compiler->compile($context),
];
}
@@ -57,7 +64,7 @@ class Picea
}
public function instanciateCompiler(string $sourceCode) : Compiler
public function instanciateCompiler(string $sourceCode = "") : Compiler
{
$compiler = new Compiler();
$compiler->loadSourceCode($sourceCode);