@@ -1761,6 +1761,44 @@ static ZEND_COLD void zend_ast_export_type(smart_str *str, zend_ast *ast, int in
17611761 zend_ast_export_ns_name (str , ast , 0 , indent );
17621762}
17631763
1764+ static ZEND_COLD void zend_ast_export_hook_list (smart_str * str , zend_ast_list * hook_list , int indent )
1765+ {
1766+ smart_str_appends (str , " {" );
1767+ smart_str_appendc (str , '\n' );
1768+ indent ++ ;
1769+ zend_ast_export_indent (str , indent );
1770+
1771+ for (uint32_t i = 0 ; i < hook_list -> children ; i ++ ) {
1772+ zend_ast_decl * hook = (zend_ast_decl * )hook_list -> child [i ];
1773+ zend_ast_export_visibility (str , hook -> flags , ZEND_MODIFIER_TARGET_PROPERTY );
1774+ if (hook -> flags & ZEND_ACC_FINAL ) {
1775+ smart_str_appends (str , "final " );
1776+ }
1777+ smart_str_append (str , hook -> name );
1778+ zend_ast * body = hook -> child [2 ];
1779+ if (body == NULL ) {
1780+ smart_str_appendc (str , ';' );
1781+ } else if (body -> kind == ZEND_AST_PROPERTY_HOOK_SHORT_BODY ) {
1782+ smart_str_appends (str , " => " );
1783+ zend_ast_export_ex (str , body -> child [0 ], 0 , indent );
1784+ smart_str_appendc (str , ';' );
1785+ } else {
1786+ smart_str_appends (str , " {\n" );
1787+ zend_ast_export_stmt (str , body , indent + 1 );
1788+ zend_ast_export_indent (str , indent );
1789+ smart_str_appendc (str , '}' );
1790+ }
1791+ if (i < (hook_list -> children - 1 )) {
1792+ smart_str_appendc (str , '\n' );
1793+ zend_ast_export_indent (str , indent );
1794+ }
1795+ }
1796+ smart_str_appendc (str , '\n' );
1797+ indent -- ;
1798+ zend_ast_export_indent (str , indent );
1799+ smart_str_appendc (str , '}' );
1800+ }
1801+
17641802#define BINARY_OP (_op , _p , _pl , _pr ) do { \
17651803 op = _op; \
17661804 p = _p; \
@@ -2406,49 +2444,7 @@ static ZEND_COLD void zend_ast_export_ex(smart_str *str, zend_ast *ast, int prio
24062444 }
24072445
24082446 if (ast -> child [3 ]) {
2409- zend_ast_list * hook_list = zend_ast_get_list (ast -> child [3 ]);
2410-
2411- smart_str_appends (str , " {" );
2412- smart_str_appendc (str , '\n' );
2413- indent ++ ;
2414- zend_ast_export_indent (str , indent );
2415-
2416- for (uint32_t i = 0 ; i < hook_list -> children ; i ++ ) {
2417- zend_ast_decl * hook = (zend_ast_decl * )hook_list -> child [i ];
2418- zend_ast_export_visibility (str , hook -> flags , ZEND_MODIFIER_TARGET_PROPERTY );
2419- if (hook -> flags & ZEND_ACC_FINAL ) {
2420- smart_str_appends (str , "final " );
2421- }
2422- switch (i ) {
2423- case ZEND_PROPERTY_HOOK_GET :
2424- smart_str_appends (str , "get" );
2425- break ;
2426- case ZEND_PROPERTY_HOOK_SET :
2427- smart_str_appends (str , "set" );
2428- break ;
2429- }
2430- zend_ast * body = hook -> child [2 ];
2431- if (body == NULL ) {
2432- smart_str_appendc (str , ';' );
2433- } else if (body -> kind == ZEND_AST_PROPERTY_HOOK_SHORT_BODY ) {
2434- smart_str_appends (str , " => " );
2435- zend_ast_export_ex (str , body -> child [0 ], 0 , indent );
2436- smart_str_appendc (str , ';' );
2437- } else {
2438- smart_str_appends (str , " {\n" );
2439- zend_ast_export_stmt (str , body , indent + 1 );
2440- zend_ast_export_indent (str , indent );
2441- smart_str_appendc (str , '}' );
2442- }
2443- if (i < (hook_list -> children - 1 )) {
2444- smart_str_appendc (str , '\n' );
2445- zend_ast_export_indent (str , indent );
2446- }
2447- }
2448- smart_str_appendc (str , '\n' );
2449- indent -- ;
2450- zend_ast_export_indent (str , indent );
2451- smart_str_appendc (str , '}' );
2447+ zend_ast_export_hook_list (str , zend_ast_get_list (ast -> child [3 ]), indent );
24522448 }
24532449 break ;
24542450 case ZEND_AST_CONST_ELEM :
@@ -2575,6 +2571,7 @@ static ZEND_COLD void zend_ast_export_ex(smart_str *str, zend_ast *ast, int prio
25752571 if (ast -> child [3 ]) {
25762572 zend_ast_export_attributes (str , ast -> child [3 ], indent , 0 );
25772573 }
2574+ zend_ast_export_visibility (str , ast -> attr , ZEND_MODIFIER_TARGET_CPP );
25782575 if (ast -> child [0 ]) {
25792576 zend_ast_export_type (str , ast -> child [0 ], indent );
25802577 smart_str_appendc (str , ' ' );
@@ -2587,7 +2584,14 @@ static ZEND_COLD void zend_ast_export_ex(smart_str *str, zend_ast *ast, int prio
25872584 }
25882585 smart_str_appendc (str , '$' );
25892586 zend_ast_export_name (str , ast -> child [1 ], 0 , indent );
2590- APPEND_DEFAULT_VALUE (2 );
2587+ if (ast -> child [2 ]) {
2588+ smart_str_appends (str , " = " );
2589+ zend_ast_export_ex (str , ast -> child [2 ], 0 , indent );
2590+ }
2591+ if (ast -> child [5 ]) {
2592+ zend_ast_export_hook_list (str , zend_ast_get_list (ast -> child [5 ]), indent );
2593+ }
2594+ break ;
25912595 case ZEND_AST_ENUM_CASE :
25922596 if (ast -> child [3 ]) {
25932597 zend_ast_export_attributes (str , ast -> child [3 ], indent , 1 );
0 commit comments