Skip to content
This repository was archived by the owner on May 5, 2019. It is now read-only.

Commit bc775ca

Browse files
committed
Rename CompileContext to Program
1 parent 94a9e36 commit bc775ca

File tree

8 files changed

+26
-26
lines changed

8 files changed

+26
-26
lines changed

Diff for: compat/CompileContext.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,20 @@
22

33
namespace Handlebars;
44

5-
class CompileContext
5+
class Program
66
{
77
/**
88
* @var Opcode[]
99
*/
1010
public $opcodes;
1111

1212
/**
13-
* @var CompileContext[]
13+
* @var Program[]
1414
*/
1515
public $children;
1616

1717
/**
18-
* @var CompileContext[]
18+
* @var Program[]
1919
*/
2020
public $decorators;
2121

Diff for: src/Compiler/PhpCompiler.php

+6-6
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
use SplStack;
66
use Handlebars\Hash;
7-
use Handlebars\CompileContext;
7+
use Handlebars\Program;
88
use Handlebars\CompileException;
99
use Handlebars\InvalidArgumentException;
1010
use Handlebars\Opcode;
@@ -28,7 +28,7 @@ class PhpCompiler
2828
const EOL = "\n";
2929

3030
/**
31-
* @var CompileContext
31+
* @var Program
3232
*/
3333
private $environment;
3434

@@ -152,14 +152,14 @@ class PhpCompiler
152152
private $decorators;
153153

154154
/**
155-
* @param CompileContext $environment
155+
* @param Program $environment
156156
* @param array $options
157157
* @param mixed $context
158158
* @param boolean $asObject
159159
* @return array|string
160160
* @throws CompileException
161161
*/
162-
public function compile(CompileContext $environment, array $options = null, $context = null, $asObject = false)
162+
public function compile(Program $environment, array $options = null, $context = null, $asObject = false)
163163
{
164164
settype($options, 'array');
165165

@@ -237,11 +237,11 @@ private function reinit()
237237
}
238238

239239
/**
240-
* @param CompileContext $environment
240+
* @param Program $environment
241241
* @param array $options
242242
* @return void
243243
*/
244-
private function compileChildren(CompileContext $environment, array $options = array())
244+
private function compileChildren(Program $environment, array $options = array())
245245
{
246246
foreach( $environment->children as $i => $child ) {
247247
$compiler = new self();

Diff for: src/VM/Preprocessor.php

+6-6
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
use SplStack;
66
use Handlebars\CompileException;
7-
use Handlebars\CompileContext;
7+
use Handlebars\Program;
88
use Handlebars\Opcode;
99

1010
class Preprocessor
@@ -25,10 +25,10 @@ class Preprocessor
2525
private $guid = 0;
2626

2727
/**
28-
* @param CompileContext $opcodes
28+
* @param Program $opcodes
2929
* @return array
3030
*/
31-
public function compile(CompileContext $opcodes)
31+
public function compile(Program $opcodes)
3232
{
3333
// Init
3434
$this->programStack = new SplStack();
@@ -42,10 +42,10 @@ public function compile(CompileContext $opcodes)
4242
}
4343

4444
/**
45-
* @param CompileContext $program
45+
* @param Program $program
4646
* @throws CompileException
4747
*/
48-
private function scanProgram(CompileContext $program)
48+
private function scanProgram(Program $program)
4949
{
5050
$program->guid = $this->guid++;
5151
$this->programsByGuid[$program->guid] = $program;
@@ -72,7 +72,7 @@ private function scanProgram(CompileContext $program)
7272
foreach( $decoratorOpcodes as $opcode ) {
7373
$this->scanOpcode($opcode);
7474
}
75-
$this->programsByGuid[$program->guid . '_d'] = new CompileContext($decoratorOpcodes, array(), 0);
75+
$this->programsByGuid[$program->guid . '_d'] = new Program($decoratorOpcodes, array(), 0);
7676
}
7777

7878
$this->programStack->pop();

Diff for: src/VM/Runtime.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,16 @@
44

55
use Handlebars\Impl;
66
use Handlebars\Runtime as BaseRuntime;
7-
use Handlebars\CompileContext;
7+
use Handlebars\Program;
88

99
class Runtime extends BaseRuntime
1010
{
1111
/**
12-
* @var CompileContext
12+
* @var Program
1313
*/
1414
private $opcodes;
1515

16-
public function __construct(Impl $handlebars, CompileContext $opcodes)
16+
public function __construct(Impl $handlebars, Program $opcodes)
1717
{
1818
parent::__construct($handlebars);
1919

Diff for: src/VM/StackFrame.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22

33
namespace Handlebars\VM;
44

5-
use Handlebars\CompileContext;
5+
use Handlebars\Program;
66

77
class StackFrame
88
{
99
public $context;
1010
public $data;
1111

1212
/**
13-
* @var CompileContext
13+
* @var Program
1414
*/
1515
public $program;
1616

Diff for: src/VM/VM.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
use SplDoublyLinkedList;
77

88
use Handlebars\ClosureWrapper;
9-
use Handlebars\CompileContext;
9+
use Handlebars\Program;
1010
use Handlebars\DepthList;
1111
use Handlebars\Hash;
1212
use Handlebars\Opcode;
@@ -197,7 +197,7 @@ public function frame()
197197
}
198198

199199

200-
public function executeProgramByRef(CompileContext $program, $context = null, $options = null)
200+
public function executeProgramByRef(Program $program, $context = null, $options = null)
201201
{
202202
/** @var StackFrame $frame */
203203

Diff for: tests/SpecTestModel.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace Handlebars\Tests;
44

5-
use Handlebars\CompileContext;
5+
use Handlebars\Program;
66
use Handlebars\Opcode;
77

88
class SpecTestModel
@@ -144,7 +144,7 @@ private function convertContext(array $context)
144144

145145
$blockParams = isset($context['blockParams']) ? $context['blockParams'] : null;
146146

147-
$obj = new CompileContext($opcodes, $children, $blockParams);
147+
$obj = new Program($opcodes, $children, $blockParams);
148148
$obj->decorators = $decorators;
149149

150150
foreach( array('useDepths', 'usePartial', 'useDecorators', 'isSimple', 'options', 'compileOptions') as $k ) {

Diff for: tests/VM/PreprocessorTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace Handlebars\Tests\VM;
44

5-
use Handlebars\CompileContext;
5+
use Handlebars\Program;
66
use Handlebars\Handlebars;
77
use Handlebars\Opcode;
88
use Handlebars\VM\Preprocessor;
@@ -14,7 +14,7 @@ public function testCompileThrowsOnMissingProgramReference()
1414
{
1515
$this->setExpectedException('\\Handlebars\\CompileException');
1616

17-
$context = new CompileContext(array(
17+
$context = new Program(array(
1818
new Opcode('pushProgram', array(2))
1919
), array(), 0);
2020

0 commit comments

Comments
 (0)