Browse Source

decompiler: improvements late binding function, sample code organize

git-svn-id: svn://svn.lighttpd.net/xcache/trunk@751 c26eb9a1-5813-0410-bd6c-c2e55f420ca7
3.0
Xuefer 11 years ago
parent
commit
489be67bd9
  1. 7
      Decompiler.class.php
  2. 39
      decompilesample.php

7
Decompiler.class.php

@ -1275,7 +1275,9 @@ class Decompiler
exit;
}
$class = &$this->dc['class_table'][$key];
$class['name'] = unquoteName($this->getOpVal($op2, $EX), $EX);
if (!isset($class['name'])) {
$class['name'] = unquoteName($this->getOpVal($op2, $EX), $EX);
}
if ($opc == XC_DECLARE_INHERITED_CLASS || $opc == XC_DECLARE_INHERITED_CLASS_DELAYED) {
$ext /= XC_SIZEOF_TEMP_VARIABLE;
$class['parent'] = $T[$ext];
@ -1563,6 +1565,9 @@ class Decompiler
case XC_EXT_FCALL_END:
case XC_EXT_NOP:
break;
case XC_DECLARE_FUNCTION:
$this->dfunction($this->dc['function_table'][$op1['constant']], $EX['indent']);
break;
case XC_DECLARE_LAMBDA_FUNCTION:
ob_start();
$this->dfunction($this->dc['function_table'][$op1['constant']], $EX['indent']);

39
decompilesample.php

@ -89,6 +89,7 @@ interface IInterface
function f1($f)
{
echo __FUNCTION__;
echo $f;
}
@ -148,18 +149,23 @@ final class Child extends ClassName implements IInterface
}
}
if ($late) {
class LateBindingClass
{}
function lateBindingFunction($arg)
{
echo 'lateFunction';
}
}
echo "\r\n";
echo "\r";
echo "\n";
echo str_replace(array('a' => 'a', 'b' => 'c'), 'b');
$object = new ClassName();
$object = new $className();
try {
echo 'code being try';
}
catch (Exception $e) {
echo $e;
}
$result = $object instanceof ClassName;
$cloned = clone $object;
$a = 1;
$a = $b + $c;
@ -191,15 +197,28 @@ $a = $b--;
$a = --$b;
$a = $obj->b--;
$a = --$obj->b;
$a = $b and $c;
$a = $b or $c;
$a = $b xor $c;
$a = !$b;
$a = $b and $c;
$a = $b or $c;
$a = $b && $c;
$a = $b || $c;
$a = $b ? $c : $d;
$a = f1() ? f2() : f3();
$a = $b instanceof ClassName;
try {
echo 'outer try 1';
try {
echo 'inner try';
}
catch (InnerException $e) {
echo $e;
}
echo 'outer try 2';
}
catch (OuterException $e) {
echo $e;
}
if ($a) {
echo 'if ($a)';
@ -252,6 +271,8 @@ require 'require.php';
require_once 'require_once.php';
include 'include.php';
include_once 'include_once.php';
echo __FILE__;
echo __LINE__;
//* >= PHP 5.3
echo $this::CONST_VALUE;

Loading…
Cancel
Save