@@ -114,7 +114,7 @@ ZEND_API zend_ast * ZEND_FASTCALL zend_ast_create_class_const_or_name(zend_ast *
114114
115115ZEND_API zend_ast * zend_ast_create_decl (
116116 zend_ast_kind kind , uint32_t flags , uint32_t start_lineno , zend_string * doc_comment ,
117- zend_string * name , zend_ast * child0 , zend_ast * child1 , zend_ast * child2 , zend_ast * child3
117+ zend_string * name , zend_ast * child0 , zend_ast * child1 , zend_ast * child2 , zend_ast * child3 , zend_ast * child4
118118) {
119119 zend_ast_decl * ast ;
120120
@@ -126,12 +126,12 @@ ZEND_API zend_ast *zend_ast_create_decl(
126126 ast -> flags = flags ;
127127 ast -> lex_pos = LANG_SCNG (yy_text );
128128 ast -> doc_comment = doc_comment ;
129- ast -> attributes = NULL ;
130129 ast -> name = name ;
131130 ast -> child [0 ] = child0 ;
132131 ast -> child [1 ] = child1 ;
133132 ast -> child [2 ] = child2 ;
134133 ast -> child [3 ] = child3 ;
134+ ast -> child [4 ] = child4 ;
135135
136136 return (zend_ast * ) ast ;
137137}
@@ -858,13 +858,11 @@ ZEND_API void ZEND_FASTCALL zend_ast_destroy(zend_ast *ast)
858858 if (decl -> doc_comment ) {
859859 zend_string_release_ex (decl -> doc_comment , 0 );
860860 }
861- if (decl -> attributes ) {
862- zend_ast_destroy (decl -> attributes );
863- }
864861 zend_ast_destroy (decl -> child [0 ]);
865862 zend_ast_destroy (decl -> child [1 ]);
866863 zend_ast_destroy (decl -> child [2 ]);
867- ast = decl -> child [3 ];
864+ zend_ast_destroy (decl -> child [3 ]);
865+ ast = decl -> child [4 ];
868866 goto tail_call ;
869867 }
870868}
@@ -1445,9 +1443,9 @@ static ZEND_COLD void zend_ast_export_ex(smart_str *str, zend_ast *ast, int prio
14451443 case ZEND_AST_ARROW_FUNC :
14461444 case ZEND_AST_METHOD :
14471445 decl = (zend_ast_decl * ) ast ;
1448- if (decl -> attributes ) {
1449- zend_bool newlines = (ast -> kind == ZEND_AST_CLOSURE || ast -> kind == ZEND_AST_ARROW_FUNC );
1450- zend_ast_export_attributes (str , decl -> attributes , indent , newlines );
1446+ if (decl -> child [ 4 ] ) {
1447+ zend_bool newlines = ! (ast -> kind == ZEND_AST_CLOSURE || ast -> kind == ZEND_AST_ARROW_FUNC );
1448+ zend_ast_export_attributes (str , decl -> child [ 4 ] , indent , newlines );
14511449 }
14521450 if (decl -> flags & ZEND_ACC_PUBLIC ) {
14531451 smart_str_appends (str , "public " );
@@ -1505,8 +1503,8 @@ static ZEND_COLD void zend_ast_export_ex(smart_str *str, zend_ast *ast, int prio
15051503 break ;
15061504 case ZEND_AST_CLASS :
15071505 decl = (zend_ast_decl * ) ast ;
1508- if (decl -> attributes ) {
1509- zend_ast_export_attributes (str , decl -> attributes , indent , 1 );
1506+ if (decl -> child [ 4 ] ) {
1507+ zend_ast_export_attributes (str , decl -> child [ 4 ] , indent , 1 );
15101508 }
15111509 if (decl -> flags & ZEND_ACC_INTERFACE ) {
15121510 smart_str_appends (str , "interface " );
@@ -1839,8 +1837,8 @@ static ZEND_COLD void zend_ast_export_ex(smart_str *str, zend_ast *ast, int prio
18391837 smart_str_appends (str , "new " );
18401838 if (ast -> child [0 ]-> kind == ZEND_AST_CLASS ) {
18411839 zend_ast_decl * decl = (zend_ast_decl * ) ast -> child [0 ];
1842- if (decl -> attributes ) {
1843- zend_ast_export_attributes (str , decl -> attributes , indent , 0 );
1840+ if (decl -> child [ 4 ] ) {
1841+ zend_ast_export_attributes (str , decl -> child [ 4 ] , indent , 0 );
18441842 }
18451843 smart_str_appends (str , "class" );
18461844 if (zend_ast_get_list (ast -> child [1 ])-> children ) {
@@ -2185,7 +2183,7 @@ zend_ast * ZEND_FASTCALL zend_ast_with_attributes(zend_ast *ast, zend_ast *attr)
21852183 case ZEND_AST_METHOD :
21862184 case ZEND_AST_CLASS :
21872185 case ZEND_AST_ARROW_FUNC :
2188- ((zend_ast_decl * ) ast )-> attributes = attr ;
2186+ ((zend_ast_decl * ) ast )-> child [ 4 ] = attr ;
21892187 break ;
21902188 case ZEND_AST_PROP_GROUP :
21912189 ast -> child [2 ] = attr ;
0 commit comments