diff --git a/bin/compiler.php b/bin/compiler.php index cb9ae8a1..ba9b950e 100755 --- a/bin/compiler.php +++ b/bin/compiler.php @@ -48,7 +48,7 @@ foreach ($list as $k => $file) { $translator->sortFiles($list); // ็”Ÿๆˆ C++ ๆ–‡ไปถ -foreach ($list as $file) { +foreach ($list as $k => $file) { try { if (FileScanner::isPhpFile($file)) { $cppFile = $translator->convert($file); @@ -61,6 +61,7 @@ foreach ($list as $file) { } catch (Unsupported $e) { echo " unsupported syntax: " . $e->getMessage() . "\n"; echo " skip: " . $file . "\n"; + unset($list[$k]); } } diff --git a/examples/class/main.php b/examples/class/main.php index 37ed55f1..04e5dfb7 100644 --- a/examples/class/main.php +++ b/examples/class/main.php @@ -4,3 +4,8 @@ function main() { var_dump("hello"); } + +function test2(stdClass $o) +{ + var_dump($o); +} diff --git a/src/Php/CompilerBase.php b/src/Php/CompilerBase.php index 27c4c6a3..657c8b01 100644 --- a/src/Php/CompilerBase.php +++ b/src/Php/CompilerBase.php @@ -100,6 +100,7 @@ class CompilerBase extends \PhpAot\Core\Translator 'argv' => self::TYPE_ARRAY, ]; protected array $localVars = []; + protected array $varTypes = []; protected array $objectWrappers = []; protected bool $strictTypes = false; @@ -969,7 +970,7 @@ class CompilerBase extends \PhpAot\Core\Translator '}'; } - protected function parseType($type) + protected function parseType($type): string { if ($type == null) { return self::TYPE_VAR; @@ -990,8 +991,8 @@ class CompilerBase extends \PhpAot\Core\Translator case 'string': return self::TYPE_STR; default: - var_dump($name); - abort($type); + $this->varTypes[$name] = $name; + return self::TYPE_OBJECT; } }