Skip to content

Commit 8668381

Browse files
committed
Replace "\t" with "\0" for the linebreak-or-whitespace placeholder
fixes hhvm#102
1 parent 8535dc0 commit 8668381

File tree

8 files changed

+8
-8
lines changed

8 files changed

+8
-8
lines changed

docs/_docs/overview/hack-builder.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ As readable code is a goal of Hack Codegen, several whitespace helpers are provi
3939
- `->indent()`: increase the number of spaces added to the start of any new non-empty lines
4040
(by default, this increases by 2 spaces - see `IHackCodegenConfig` to change this)
4141
- `->unindent()`: do the opposite
42-
- `->addLineWithSuggestedLineBreaks()`: any `\t` in the input string is replaced with a
42+
- `->addLineWithSuggestedLineBreaks()`: any `\0` in the input string is replaced with a
4343
space if it will still fit in the desired maximum line length, otherwise a newline is
4444
added (and indented if needed)
4545
- `->addMultilineCall($call, $args)`: either renders the call all on one line, or with

examples/dorm/CodegenDorm.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ private function getGetters(): Vector<CodegenMethod> {
150150
HackBuilderValues::literal(),
151151
)
152152
->addWithSuggestedLineBreaksf(
153-
"return %s === null\t? null\t: %s;",
153+
"return %s === null\0? null\0: %s;",
154154
'$value',
155155
$return_data,
156156
);

src/BaseCodeBuilder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
*/
2222
abstract class BaseCodeBuilder {
2323

24-
const string DELIMITER = "\t";
24+
const string DELIMITER = "\0";
2525

2626
private _Private\StrBuffer $code;
2727
private bool $isNewLine = true;

src/CodegenClassish.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ protected function buildConsts(HackBuilder $builder): void {
393393
$builder->addWithSuggestedLineBreaksf('abstract const %s;', $name);
394394
} else {
395395
$builder->addWithSuggestedLineBreaksf(
396-
"const %s =\t%s;",
396+
"const %s =\0%s;",
397397
$name,
398398
(string)$value,
399399
);

src/CodegenEnum.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ protected function buildConsts(HackBuilder $builder): void {
8282
$builder->addDocBlock($comment);
8383
}
8484
$builder
85-
->addWithSuggestedLineBreaksf("%s =\t%s;", $name, (string)$value)
85+
->addWithSuggestedLineBreaksf("%s =\0%s;", $name, (string)$value)
8686
->newLine();
8787
}
8888
}

src/HackBuilder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ public function addAssignment<T>(
184184
): this {
185185
$this->assertIsVariable($var_name);
186186
return $this->addWithSuggestedLineBreaksf(
187-
"%s =\t%s;\n",
187+
"%s =\0%s;\n",
188188
$var_name,
189189
$renderer->render($this->config, $value),
190190
);

src/key-value-render/HackBuilderNativeKeyValueCollectionRenderer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ final public function render(IHackCodegenConfig $config, T $values): string {
3737
$builder = (new HackBuilder($config))->openContainer($this->container);
3838
foreach ($values as $key => $value) {
3939
$builder->addWithSuggestedLineBreaksf(
40-
"%s =>\t%s,\n",
40+
"%s =>\0%s,\n",
4141
$key_renderer->render($config, $key),
4242
$value_renderer->render($config, $value),
4343
);

src/key-value-render/HackBuilderShapeRenderer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ final public function render(
5050
IHackBuilderValueRenderer::class,
5151
);
5252
$builder->addWithSuggestedLineBreaksf(
53-
"%s =>\t%s,\n",
53+
"%s =>\0%s,\n",
5454
$key_renderer->render($config, $key),
5555
$value_renderer->render($config, $value),
5656
);

0 commit comments

Comments
 (0)