fix(php): 修复编译器基础类中的对象重置和错误消息

- 在resetFunction方法中添加objects数组的重置
- 更新错误消息以提供更详细的原生方法查找失败信息
- 修正错误消息中包含类名和方法名的格式
pull/1/head
韩天峰 5 months ago
parent 9526f9992b
commit 3df8a36674
  1. 21
      src/Php/CompilerBase.php

@ -574,16 +574,17 @@ class CompilerBase extends \PhpAot\Core\Translator
protected function resetFunction(): void
{
$this->localVars = [];
$this->staticVars = [];
$this->arguments = [];
$this->localVars = [];
$this->staticVars = [];
$this->arguments = [];
$this->objects = [];
$this->objectWrappers = [];
$this->ceWrappers = [];
$this->tmpVarIndex = 0;
$this->inLoop = false;
$this->function = '';
$this->functionDef = null;
$this->inClosure = false;
$this->ceWrappers = [];
$this->tmpVarIndex = 0;
$this->inLoop = false;
$this->function = '';
$this->functionDef = null;
$this->inClosure = false;
}
protected function resetMethod(): void
@ -1607,7 +1608,7 @@ class CompilerBase extends \PhpAot\Core\Translator
return false;
}
if (!$this->hasNativeClass($classDef->extends)) {
$this->climate->error('Class `' . $classDef->extends . '` is not defined');
$this->climate->error('Native method `' . $class . '::' . $method . '()` not found, the parent class `' . $classDef->extends . '` is not defined');
return false;
}
$classDef = $this->getClassDef($classDef->extends);

Loading…
Cancel
Save