@@ -1744,6 +1744,51 @@ static ZEND_COLD void zend_ast_export_type(smart_str *str, zend_ast *ast, int in
17441744 zend_ast_export_ns_name (str , ast , 0 , indent );
17451745}
17461746
1747+ static ZEND_COLD void zend_ast_export_hook_list (smart_str * str , zend_ast_list * hook_list , int indent )
1748+ {
1749+ smart_str_appends (str , " {" );
1750+ smart_str_appendc (str , '\n' );
1751+ indent ++ ;
1752+ zend_ast_export_indent (str , indent );
1753+
1754+ for (uint32_t i = 0 ; i < hook_list -> children ; i ++ ) {
1755+ zend_ast_decl * hook = (zend_ast_decl * )hook_list -> child [i ];
1756+ zend_ast_export_visibility (str , hook -> flags , ZEND_MODIFIER_TARGET_PROPERTY );
1757+ if (hook -> flags & ZEND_ACC_FINAL ) {
1758+ smart_str_appends (str , "final " );
1759+ }
1760+ switch (i ) {
1761+ case ZEND_PROPERTY_HOOK_GET :
1762+ smart_str_appends (str , "get" );
1763+ break ;
1764+ case ZEND_PROPERTY_HOOK_SET :
1765+ smart_str_appends (str , "set" );
1766+ break ;
1767+ }
1768+ zend_ast * body = hook -> child [2 ];
1769+ if (body == NULL ) {
1770+ smart_str_appendc (str , ';' );
1771+ } else if (body -> kind == ZEND_AST_PROPERTY_HOOK_SHORT_BODY ) {
1772+ smart_str_appends (str , " => " );
1773+ zend_ast_export_ex (str , body -> child [0 ], 0 , indent );
1774+ smart_str_appendc (str , ';' );
1775+ } else {
1776+ smart_str_appends (str , " {\n" );
1777+ zend_ast_export_stmt (str , body , indent + 1 );
1778+ zend_ast_export_indent (str , indent );
1779+ smart_str_appendc (str , '}' );
1780+ }
1781+ if (i < (hook_list -> children - 1 )) {
1782+ smart_str_appendc (str , '\n' );
1783+ zend_ast_export_indent (str , indent );
1784+ }
1785+ }
1786+ smart_str_appendc (str , '\n' );
1787+ indent -- ;
1788+ zend_ast_export_indent (str , indent );
1789+ smart_str_appendc (str , '}' );
1790+ }
1791+
17471792#define BINARY_OP (_op , _p , _pl , _pr ) do { \
17481793 op = _op; \
17491794 p = _p; \
@@ -2389,49 +2434,7 @@ static ZEND_COLD void zend_ast_export_ex(smart_str *str, zend_ast *ast, int prio
23892434 }
23902435
23912436 if (ast -> child [3 ]) {
2392- zend_ast_list * hook_list = zend_ast_get_list (ast -> child [3 ]);
2393-
2394- smart_str_appends (str , " {" );
2395- smart_str_appendc (str , '\n' );
2396- indent ++ ;
2397- zend_ast_export_indent (str , indent );
2398-
2399- for (uint32_t i = 0 ; i < hook_list -> children ; i ++ ) {
2400- zend_ast_decl * hook = (zend_ast_decl * )hook_list -> child [i ];
2401- zend_ast_export_visibility (str , hook -> flags , ZEND_MODIFIER_TARGET_PROPERTY );
2402- if (hook -> flags & ZEND_ACC_FINAL ) {
2403- smart_str_appends (str , "final " );
2404- }
2405- switch (i ) {
2406- case ZEND_PROPERTY_HOOK_GET :
2407- smart_str_appends (str , "get" );
2408- break ;
2409- case ZEND_PROPERTY_HOOK_SET :
2410- smart_str_appends (str , "set" );
2411- break ;
2412- }
2413- zend_ast * body = hook -> child [2 ];
2414- if (body == NULL ) {
2415- smart_str_appendc (str , ';' );
2416- } else if (body -> kind == ZEND_AST_PROPERTY_HOOK_SHORT_BODY ) {
2417- smart_str_appends (str , " => " );
2418- zend_ast_export_ex (str , body -> child [0 ], 0 , indent );
2419- smart_str_appendc (str , ';' );
2420- } else {
2421- smart_str_appends (str , " {\n" );
2422- zend_ast_export_stmt (str , body , indent + 1 );
2423- zend_ast_export_indent (str , indent );
2424- smart_str_appendc (str , '}' );
2425- }
2426- if (i < (hook_list -> children - 1 )) {
2427- smart_str_appendc (str , '\n' );
2428- zend_ast_export_indent (str , indent );
2429- }
2430- }
2431- smart_str_appendc (str , '\n' );
2432- indent -- ;
2433- zend_ast_export_indent (str , indent );
2434- smart_str_appendc (str , '}' );
2437+ zend_ast_export_hook_list (str , zend_ast_get_list (ast -> child [3 ]), indent );
24352438 }
24362439 break ;
24372440 case ZEND_AST_CONST_ELEM :
0 commit comments