Skip to content

Commit 7e07622

Browse files
TimWollaarnaud-lb
andauthored
zend_vm_gen: Simplify line number tracking logic
Co-authored-by: Arnaud Le Blanc <[email protected]>
1 parent 1d21222 commit 7e07622

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

Zend/zend_vm_gen.php

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -553,23 +553,17 @@
553553
function out($f, $s) {
554554
global $line_nos;
555555

556-
$line_no = &$line_nos[(int)$f];
557-
if ($line_no === null) {
558-
$line_no = 1;
559-
}
560-
561556
fputs($f,$s);
562-
$line_no += substr_count($s, "\n");
557+
558+
$line_nos[(int)$f] ??= 1;
559+
$line_nos[(int)$f] += substr_count($s, "\n");
563560
}
564561

565562
// Resets #line directives in resulting executor
566563
function out_line($f) {
567564
global $line_nos, $executor_file;
568565

569-
$line_no = &$line_nos[(int)$f];
570-
if ($line_no === null) {
571-
$line_no = 1;
572-
}
566+
$line_no = $line_nos[(int)$f] ??= 1;
573567

574568
fputs($f,"#line ".($line_no+1)." \"".$executor_file."\"\n");
575569
++$line_no;

0 commit comments

Comments
 (0)