1
0
Fork 0

Decompiler/dump: adaptive padding for op line number

This commit is contained in:
Xuefer 2015-07-08 20:00:02 +08:00
parent c62abcbe2e
commit a2bc018e99
1 changed files with 5 additions and 4 deletions

View File

@ -2662,11 +2662,11 @@ class Decompiler
}
}
// }}}
function dumpOp($op) // {{{
function dumpOp($op, $padding = 4) // {{{
{
assert('isset($op)');
echo str_pad($op['line'], 4);
echo str_pad($op['lineno'], 4);
echo str_pad($op['line'], $padding);
echo str_pad($op['lineno'], $padding);
if (isset($op['oldopcode'])) {
$name = '//' . xcache_get_opcode($op['oldopcode']);
@ -2709,9 +2709,10 @@ class Decompiler
$Ts = $this->EX['Ts'];
$this->EX['Ts'] = null;
}
$padding = max(strlen($range[1]), strlen($this->EX['opcodes'][$range[1]]['lineno'])) + 1;
for ($i = $range[0]; $i <= $range[1]; ++$i) {
echo $this->EX['indent'];
$this->dumpOp($this->EX['opcodes'][$i]);
$this->dumpOp($this->EX['opcodes'][$i], $padding);
}
if (!$ts) {
$this->EX['Ts'] = $Ts;