@@ -1786,6 +1786,51 @@ static ZEND_COLD void zend_ast_export_type(smart_str *str, zend_ast *ast, int in
17861786 goto append_default_value; \
17871787 } while (0)
17881788
1789+ static ZEND_COLD void zend_ast_export_hook_list (smart_str * str , zend_ast_list * hook_list , int indent )
1790+ {
1791+ smart_str_appends (str , " {" );
1792+ smart_str_appendc (str , '\n' );
1793+ indent ++ ;
1794+ zend_ast_export_indent (str , indent );
1795+
1796+ for (uint32_t i = 0 ; i < hook_list -> children ; i ++ ) {
1797+ zend_ast_decl * hook = (zend_ast_decl * )hook_list -> child [i ];
1798+ zend_ast_export_visibility (str , hook -> flags , ZEND_MODIFIER_TARGET_PROPERTY );
1799+ if (hook -> flags & ZEND_ACC_FINAL ) {
1800+ smart_str_appends (str , "final " );
1801+ }
1802+ switch (i ) {
1803+ case ZEND_PROPERTY_HOOK_GET :
1804+ smart_str_appends (str , "get" );
1805+ break ;
1806+ case ZEND_PROPERTY_HOOK_SET :
1807+ smart_str_appends (str , "set" );
1808+ break ;
1809+ }
1810+ zend_ast * body = hook -> child [2 ];
1811+ if (body == NULL ) {
1812+ smart_str_appendc (str , ';' );
1813+ } else if (body -> kind == ZEND_AST_PROPERTY_HOOK_SHORT_BODY ) {
1814+ smart_str_appends (str , " => " );
1815+ zend_ast_export_ex (str , body -> child [0 ], 0 , indent );
1816+ smart_str_appendc (str , ';' );
1817+ } else {
1818+ smart_str_appends (str , " {\n" );
1819+ zend_ast_export_stmt (str , body , indent + 1 );
1820+ zend_ast_export_indent (str , indent );
1821+ smart_str_appendc (str , '}' );
1822+ }
1823+ if (i < (hook_list -> children - 1 )) {
1824+ smart_str_appendc (str , '\n' );
1825+ zend_ast_export_indent (str , indent );
1826+ }
1827+ }
1828+ smart_str_appendc (str , '\n' );
1829+ indent -- ;
1830+ zend_ast_export_indent (str , indent );
1831+ smart_str_appendc (str , '}' );
1832+ }
1833+
17891834static ZEND_COLD void zend_ast_export_ex (smart_str * str , zend_ast * ast , int priority , int indent )
17901835{
17911836 zend_ast_decl * decl ;
@@ -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