From 1fbaa07820c6f216703baa48dc6ddd07832b1bc7 Mon Sep 17 00:00:00 2001 From: tianfenghan Date: Thu, 16 Apr 2026 11:30:12 +0800 Subject: [PATCH] =?UTF-8?q?fix(aot):=20=E4=BF=AE=E5=A4=8D=E9=9D=99?= =?UTF-8?q?=E6=80=81=E6=96=B9=E6=B3=95=E8=B0=83=E7=94=A8=E4=B8=AD=E7=9A=84?= =?UTF-8?q?=E5=8D=A0=E4=BD=8D=E7=AC=A6=E7=94=9F=E6=88=90=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 将 Symbol::getCalledCe() 替换为 Symbol::getCalledClass() 以正确处理静态方法调用 - 添加了针对 static::bar(...) 语法的测试用例 - 确保继承类中的静态方法调用能够正确解析到子类方法 --- src/Php/CompilerBase.php | 2 +- .../001.phpt} | 0 tests/aot/place-holder/002.phpt | 31 +++++++++++++++++++ .../003.phpt} | 0 4 files changed, 32 insertions(+), 1 deletion(-) rename tests/aot/{place-holder.phpt => place-holder/001.phpt} (100%) create mode 100644 tests/aot/place-holder/002.phpt rename tests/aot/{place-holder-002.phpt => place-holder/003.phpt} (100%) diff --git a/src/Php/CompilerBase.php b/src/Php/CompilerBase.php index 7cb3df0a..a5e4a125 100644 --- a/src/Php/CompilerBase.php +++ b/src/Php/CompilerBase.php @@ -4049,7 +4049,7 @@ class CompilerBase extends \PhpAot\Core\Translator $methodPtr = $this->identifierToStr($expr->name, literal: true); $fn = Symbol::getCalledCe() . ', php::getMethod(' . Symbol::getCalledCe() . ', ' . $methodPtr . ')'; $this->context->beforeStmtLines[] = '// Static Method Call: static::' . $this->parseIdentifier($expr->name) . '()'; - $placeHolder = $this->genArray([Symbol::getCalledCe(), $methodPtr]); + $placeHolder = $this->genArray([Symbol::getCalledClass(), $methodPtr]); } elseif ($this->isNameExpr($expr->class)) { if ($class === 'self') { $class = $this->class; diff --git a/tests/aot/place-holder.phpt b/tests/aot/place-holder/001.phpt similarity index 100% rename from tests/aot/place-holder.phpt rename to tests/aot/place-holder/001.phpt diff --git a/tests/aot/place-holder/002.phpt b/tests/aot/place-holder/002.phpt new file mode 100644 index 00000000..bf1cae4a --- /dev/null +++ b/tests/aot/place-holder/002.phpt @@ -0,0 +1,31 @@ +--TEST-- +place-holder +--FILE-- + +--EXPECT-- +baz \ No newline at end of file diff --git a/tests/aot/place-holder-002.phpt b/tests/aot/place-holder/003.phpt similarity index 100% rename from tests/aot/place-holder-002.phpt rename to tests/aot/place-holder/003.phpt