Decompiler: fix switch with expression as case value
This commit is contained in:
parent
4550ff7f06
commit
8207e0771c
|
@ -605,6 +605,18 @@ function codeSwitch()
|
|||
break;
|
||||
}
|
||||
|
||||
switch (functionCall()) {
|
||||
case func1():
|
||||
echo 'case1';
|
||||
break;
|
||||
|
||||
case func2():
|
||||
case func3():
|
||||
case 1 + 1:
|
||||
echo 'case2';
|
||||
break;
|
||||
}
|
||||
|
||||
switch ('emptySwitch()') {
|
||||
}
|
||||
|
||||
|
|
|
@ -1328,7 +1328,13 @@ class Decompiler
|
|||
|
||||
echo $this->EX['indent'], 'switch (', str($this->getOpVal($caseOp['op1'], true), $this->EX), ") {", PHP_EOL;
|
||||
$caseIsOut = false;
|
||||
$caseExpressionBegin = $range[0];
|
||||
foreach ($cases as $caseFirst => $caseLast) {
|
||||
if ($caseExpressionBegin < $caseFirst) {
|
||||
$this->recognizeAndDecompileClosedBlocks(array($caseExpressionBegin, $caseFirst - 1));
|
||||
}
|
||||
$caseExpressionBegin = $caseLast + 1;
|
||||
|
||||
if ($caseIsOut && empty($lastCaseFall)) {
|
||||
echo PHP_EOL;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue