Skip to content

Commit c15bd94

Browse files
committed
UIMacros: added /* line */ comment
1 parent 29578d9 commit c15bd94

File tree

2 files changed

+14
-13
lines changed

2 files changed

+14
-13
lines changed

src/Bridges/ApplicationLatte/UIMacros.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -131,11 +131,12 @@ public function macroControl(MacroNode $node, PhpWriter $writer)
131131
public function macroLink(MacroNode $node, PhpWriter $writer)
132132
{
133133
$node->modifiers = preg_replace('#\|safeurl\s*(?=\||$)#Di', '', $node->modifiers);
134+
$line = $node->startLine ? " /* line $node->startLine */" : '';
134135
return $writer->using($node, $this->getCompiler())
135136
->write(
136137
'echo %escape(%modify('
137138
. ($node->name === 'plink' ? '$this->global->uiPresenter' : '$this->global->uiControl')
138-
. '->link(%node.word, %node.array?)))'
139+
. "->link(%node.word, %node.array?)))$line;"
139140
);
140141
}
141142

tests/Bridges.Latte/UIMacros.link.phpt

+12-12
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@ $compiler->setContentType($compiler::CONTENT_TEXT);
1818
UIMacros::install($compiler);
1919

2020
// {link ...}
21-
Assert::same('<?php echo $this->global->uiControl->link("p") ?>', $compiler->expandMacro('link', 'p', '')->openingCode);
22-
Assert::same('<?php echo ($this->filters->filter)($this->global->uiControl->link("p")) ?>', $compiler->expandMacro('link', 'p', 'filter')->openingCode);
23-
Assert::same('<?php echo $this->global->uiControl->link("p:a") ?>', $compiler->expandMacro('link', 'p:a', '')->openingCode);
24-
Assert::same('<?php echo $this->global->uiControl->link($dest) ?>', $compiler->expandMacro('link', '$dest', '')->openingCode);
25-
Assert::same('<?php echo $this->global->uiControl->link($p:$a) ?>', $compiler->expandMacro('link', '$p:$a', '')->openingCode);
26-
Assert::same('<?php echo $this->global->uiControl->link("$p:$a") ?>', $compiler->expandMacro('link', '"$p:$a"', '')->openingCode);
27-
Assert::same('<?php echo $this->global->uiControl->link("p:a") ?>', $compiler->expandMacro('link', '"p:a"', '')->openingCode);
28-
Assert::same('<?php echo $this->global->uiControl->link(\'p:a\') ?>', $compiler->expandMacro('link', "'p:a'", '')->openingCode);
29-
30-
Assert::same('<?php echo $this->global->uiControl->link("p", [\'param\']) ?>', $compiler->expandMacro('link', 'p param', '')->openingCode);
31-
Assert::same('<?php echo $this->global->uiControl->link("p", [\'param\' => 123]) ?>', $compiler->expandMacro('link', 'p param => 123', '')->openingCode);
32-
Assert::same('<?php echo $this->global->uiControl->link("p", [\'param\' => 123]) ?>', $compiler->expandMacro('link', 'p, param => 123', '')->openingCode);
21+
Assert::same('<?php echo $this->global->uiControl->link("p"); ?>', $compiler->expandMacro('link', 'p', '')->openingCode);
22+
Assert::same('<?php echo ($this->filters->filter)($this->global->uiControl->link("p")); ?>', $compiler->expandMacro('link', 'p', 'filter')->openingCode);
23+
Assert::same('<?php echo $this->global->uiControl->link("p:a"); ?>', $compiler->expandMacro('link', 'p:a', '')->openingCode);
24+
Assert::same('<?php echo $this->global->uiControl->link($dest); ?>', $compiler->expandMacro('link', '$dest', '')->openingCode);
25+
Assert::same('<?php echo $this->global->uiControl->link($p:$a); ?>', $compiler->expandMacro('link', '$p:$a', '')->openingCode);
26+
Assert::same('<?php echo $this->global->uiControl->link("$p:$a"); ?>', $compiler->expandMacro('link', '"$p:$a"', '')->openingCode);
27+
Assert::same('<?php echo $this->global->uiControl->link("p:a"); ?>', $compiler->expandMacro('link', '"p:a"', '')->openingCode);
28+
Assert::same('<?php echo $this->global->uiControl->link(\'p:a\'); ?>', $compiler->expandMacro('link', "'p:a'", '')->openingCode);
29+
30+
Assert::same('<?php echo $this->global->uiControl->link("p", [\'param\']); ?>', $compiler->expandMacro('link', 'p param', '')->openingCode);
31+
Assert::same('<?php echo $this->global->uiControl->link("p", [\'param\' => 123]); ?>', $compiler->expandMacro('link', 'p param => 123', '')->openingCode);
32+
Assert::same('<?php echo $this->global->uiControl->link("p", [\'param\' => 123]); ?>', $compiler->expandMacro('link', 'p, param => 123', '')->openingCode);

0 commit comments

Comments
 (0)