From 668f44025416fca7442305dfe176752bbf8d2234 Mon Sep 17 00:00:00 2001 From: tianfenghan Date: Fri, 6 Feb 2026 18:43:16 +0800 Subject: [PATCH] =?UTF-8?q?refactor(php):=20=E7=A7=BB=E9=99=A4=E5=BE=AA?= =?UTF-8?q?=E7=8E=AF=E5=8F=98=E9=87=8F=E5=A3=B0=E6=98=8E=E7=9A=84=E7=89=B9?= =?UTF-8?q?=E6=AE=8A=E5=A4=84=E7=90=86=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 删除了对 Expr_Assign 类型表达式的特殊处理 - 移除了循环变量声明的本地变量添加逻辑 - 简化了条件表达式解析流程 - 统一了表达式处理方式,不再区分赋值表达式类型 --- src/Php/CompilerBase.php | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/src/Php/CompilerBase.php b/src/Php/CompilerBase.php index 5fae5e63..67d24168 100644 --- a/src/Php/CompilerBase.php +++ b/src/Php/CompilerBase.php @@ -1544,16 +1544,6 @@ class CompilerBase extends \PhpAot\Core\Translator $list_cond = []; foreach ($cond as $expr) { - if ($expr->getType() === 'Expr_Assign') { - $left = $expr->var; - $name = $this->parseIdentifier($left); - $type = $this->detectExprType($expr->expr); - // for 循环的变量声明,必须在循环体之外,不能创建 scope tmp var - if (!$this->hasVar($name)) { - $this->addLocalVar($name, $type); - } - $code .= $name . ' = (' . $this->parseIdentifier($expr->expr) . ');'; - } $list_cond[] = $this->parseExpr($expr); }