Skip to content

Commit 1d656f8

Browse files
committed
refs #578 peephole optimization
1 parent 79f6252 commit 1d656f8

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/Compiler.php

+5-1
Original file line numberDiff line numberDiff line change
@@ -5004,15 +5004,19 @@ protected function libMapMerge($args)
50045004
$map2 = $this->assertMap($args[1]);
50055005

50065006
foreach ($map2[1] as $i2 => $key2) {
5007+
$key = $this->compileStringContent($this->coerceString($key2));
5008+
50075009
foreach ($map1[1] as $i1 => $key1) {
5008-
if ($this->compileStringContent($this->coerceString($key1)) === $this->compileStringContent($this->coerceString($key2))) {
5010+
if ($key === $this->compileStringContent($this->coerceString($key1))) {
50095011
$map1[2][$i1] = $map2[2][$i2];
50105012
continue 2;
50115013
}
50125014
}
5015+
50135016
$map1[1][] = $map2[1][$i2];
50145017
$map1[2][] = $map2[2][$i2];
50155018
}
5019+
50165020
return $map1;
50175021
}
50185022

0 commit comments

Comments
 (0)