Skip to content

Commit bfde348

Browse files
committed
Remove unused method Result::buffer()
1 parent abffd44 commit bfde348

File tree

2 files changed

+0
-32
lines changed

2 files changed

+0
-32
lines changed

src/main/php/lang/ast/Result.class.php

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
<?php namespace lang\ast;
22

3-
use io\streams\{MemoryOutputStream, StringWriter};
4-
53
class Result {
64
public $out;
75
public $codegen;
@@ -31,23 +29,4 @@ public function __construct($out, $preamble= '<?php ') {
3129
public function temp() {
3230
return '$'.$this->codegen->symbol();
3331
}
34-
35-
/**
36-
* Collects emitted code into a buffer and returns it
37-
*
38-
* @param function(lang.ast.Result): void $callable
39-
* @return string
40-
*/
41-
public function buffer($callable) {
42-
$out= $this->out;
43-
$buffer= new MemoryOutputStream();
44-
$this->out= new StringWriter($buffer);
45-
46-
try {
47-
$callable($this);
48-
return $buffer->getBytes();
49-
} finally {
50-
$this->out= $out;
51-
}
52-
}
5332
}

src/test/php/lang/ast/unittest/ResultTest.class.php

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,4 @@ public function writes_preamble($preamble) {
3030
$r= new Result(new StringWriter($out), $preamble);
3131
Assert::equals($preamble, $out->bytes());
3232
}
33-
34-
#[Test]
35-
public function writing_via_buffer_does_not_affect_underlying_output() {
36-
$out= new MemoryOutputStream();
37-
$r= new Result(new StringWriter($out));
38-
$r->buffer(function($r) {
39-
$r->out->write('namespace test;');
40-
$r->out->write('use unittest\Assert;');
41-
});
42-
Assert::equals('<?php ', $out->bytes());
43-
}
4433
}

0 commit comments

Comments
 (0)