- 在 ArgInfo 中添加 property 属性标识参数是否为属性提升 - 引入 PropertyPromotion trait 处理属性提升代码生成 - 在编译器中实现构造方法属性提升的解析和代码生成逻辑 - 支持将 promoted 参数转换为类属性定义 - 生成对应的 this_.setProperty 调用代码 - 更新函数信息解析以处理属性提升参数pull/1/head
parent
15ea7023f0
commit
35117d5c14
4 changed files with 53 additions and 4 deletions
@ -0,0 +1,16 @@ |
||||
<?php |
||||
|
||||
namespace PhpAot\Php\Generator; |
||||
|
||||
use PhpAot\Php\ArgInfo; |
||||
|
||||
trait PropertyPromotion |
||||
{ |
||||
protected function genPropertyPromotion(ArgInfo $argInfo): string |
||||
{ |
||||
$code = ''; |
||||
$code .= "this_.setProperty(" . $this->genCharPtr($argInfo->name) . ", " . $argInfo->name . ")"; |
||||
$code .= ";\n"; |
||||
return $code; |
||||
} |
||||
} |
||||
Loading…
Reference in new issue