Skip to content

Commit c2c7274

Browse files
committed
fix compilation warnings, rename batch_use to group_use
1 parent 072d1da commit c2c7274

File tree

9 files changed

+39
-38
lines changed

9 files changed

+39
-38
lines changed

Zend/tests/ns_088.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
--TEST--
2-
Nested batch use statements syntax error
2+
Nested group use statements syntax error
33
--FILE--
44
<?php
55
namespace Fiz\Biz\Buz {

Zend/tests/ns_089.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
--TEST--
2-
Batch use statements
2+
Group use statements
33
--FILE--
44
<?php
55
namespace Foo\Bar\Baz {

Zend/tests/ns_090.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
--TEST--
2-
Batch use statements declared inline
2+
Group use statements declared inline
33
--FILE--
44
<?php
55
namespace Foo\Bar\Baz {

Zend/tests/ns_091.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
--TEST--
2-
Batch use statements with compound namespaces
2+
Group use statements with compound namespaces
33
--FILE--
44
<?php
55
namespace Foo\Bar {

Zend/tests/ns_092.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
--TEST--
2-
Typed batch use statements
2+
Typed group use statements
33
--FILE--
44
<?php
55
namespace Foo\Bar {

Zend/tests/ns_093.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
--TEST--
2-
Batch use declarations and whitespace nuances
2+
Group use declarations and whitespace nuances
33
--FILE--
44
<?php
55

Zend/zend_ast.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ enum _zend_ast_kind {
132132
ZEND_AST_NAMESPACE,
133133
ZEND_AST_USE_ELEM,
134134
ZEND_AST_TRAIT_ALIAS,
135-
ZEND_AST_BATCH_USE,
135+
ZEND_AST_GROUP_USE,
136136

137137
/* 3 child nodes */
138138
ZEND_AST_METHOD_CALL = 3 << ZEND_AST_NUM_CHILDREN_SHIFT,

Zend/zend_compile.c

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -4935,26 +4935,6 @@ static void zend_check_already_in_use(uint32_t type, zend_string *old_name, zend
49354935
}
49364936
/* }}} */
49374937

4938-
void zend_compile_batch_use(zend_ast *ast) /* {{{ */
4939-
{
4940-
zend_string *ns = zend_ast_get_str(ast->child[0]);
4941-
zend_ast_list *list = zend_ast_get_list(ast->child[1]);
4942-
uint32_t i;
4943-
4944-
for (i = 0; i < list->children; i++) {
4945-
zend_ast *use = list->child[i];
4946-
zval *name_zval = zend_ast_get_zval(use->child[0]);
4947-
zend_string *name = Z_STR_P(name_zval);
4948-
zend_string *compound_ns = zend_concat_names(ns->val, ns->len, name->val, name->len);
4949-
zend_string_release(name);
4950-
ZVAL_STR(name_zval, compound_ns);
4951-
zend_ast_list *inline_use = zend_ast_create_list(1, ZEND_AST_USE, use);
4952-
inline_use->attr = ast->attr ? ast->attr : use->attr;
4953-
zend_compile_use(inline_use);
4954-
}
4955-
}
4956-
/* }}} */
4957-
49584938
void zend_compile_use(zend_ast *ast) /* {{{ */
49594939
{
49604940
zend_ast_list *list = zend_ast_get_list(ast);
@@ -5064,6 +5044,27 @@ void zend_compile_use(zend_ast *ast) /* {{{ */
50645044
}
50655045
/* }}} */
50665046

5047+
void zend_compile_group_use(zend_ast *ast) /* {{{ */
5048+
{
5049+
zend_string *ns = zend_ast_get_str(ast->child[0]);
5050+
zend_ast_list *list = zend_ast_get_list(ast->child[1]);
5051+
uint32_t i;
5052+
5053+
for (i = 0; i < list->children; i++) {
5054+
zend_ast *use = list->child[i];
5055+
zval *name_zval = zend_ast_get_zval(use->child[0]);
5056+
zend_string *name = Z_STR_P(name_zval);
5057+
zend_string *compound_ns = zend_concat_names(ns->val, ns->len, name->val, name->len);
5058+
zend_string_release(name);
5059+
ZVAL_STR(name_zval, compound_ns);
5060+
zend_ast *inline_use = zend_ast_create_list(1, ZEND_AST_USE, use);
5061+
inline_use->attr = ast->attr ? ast->attr : use->attr;
5062+
zend_compile_use(inline_use);
5063+
}
5064+
}
5065+
/* }}} */
5066+
5067+
50675068
void zend_compile_const_decl(zend_ast *ast) /* {{{ */
50685069
{
50695070
zend_ast_list *list = zend_ast_get_list(ast);
@@ -6459,8 +6460,8 @@ void zend_compile_stmt(zend_ast *ast) /* {{{ */
64596460
case ZEND_AST_CLASS:
64606461
zend_compile_class_decl(ast);
64616462
break;
6462-
case ZEND_AST_BATCH_USE:
6463-
zend_compile_batch_use(ast);
6463+
case ZEND_AST_GROUP_USE:
6464+
zend_compile_group_use(ast);
64646465
break;
64656466
case ZEND_AST_USE:
64666467
zend_compile_use(ast);

Zend/zend_language_parser.y

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -229,8 +229,8 @@ static YYSIZE_T zend_yytnamerr(char*, const char*);
229229
%type <ast> top_statement namespace_name name statement function_declaration_statement
230230
%type <ast> class_declaration_statement trait_declaration_statement
231231
%type <ast> interface_declaration_statement interface_extends_list
232-
%type <ast> batch_use_declarations inline_use_declarations inline_use_declaration
233-
%type <ast> mixed_batch_use_declarations use_declaration const_decl inner_statement
232+
%type <ast> group_use_declarations inline_use_declarations inline_use_declaration
233+
%type <ast> mixed_group_use_declarations use_declaration const_decl inner_statement
234234
%type <ast> expr optional_expr while_statement for_statement foreach_variable
235235
%type <ast> foreach_statement declare_statement finally_statement unset_variable variable
236236
%type <ast> extends_from parameter optional_type argument expr_without_variable global_var
@@ -298,23 +298,23 @@ top_statement:
298298
| T_NAMESPACE { RESET_DOC_COMMENT(); }
299299
'{' top_statement_list '}'
300300
{ $$ = zend_ast_create(ZEND_AST_NAMESPACE, NULL, $4); }
301-
| T_USE mixed_batch_use_declarations ';' { $$ = $2; }
302-
| T_USE T_FUNCTION batch_use_declarations ';' { $$ = $3; $3->attr = T_FUNCTION; }
303-
| T_USE T_CONST batch_use_declarations ';' { $$ = $3; $3->attr = T_CONST; }
301+
| T_USE mixed_group_use_declarations ';' { $$ = $2; }
302+
| T_USE T_FUNCTION group_use_declarations ';' { $$ = $3; $$->attr = T_FUNCTION; }
303+
| T_USE T_CONST group_use_declarations ';' { $$ = $3; $$->attr = T_CONST; }
304304
| T_USE use_declarations ';' { $$ = $2; $$->attr = T_CLASS; }
305305
| T_USE T_FUNCTION use_declarations ';' { $$ = $3; $$->attr = T_FUNCTION; }
306306
| T_USE T_CONST use_declarations ';' { $$ = $3; $$->attr = T_CONST; }
307307
| T_CONST const_list ';' { $$ = $2; }
308308
;
309309

310-
batch_use_declarations:
310+
group_use_declarations:
311311
namespace_name T_NS_SEPARATOR '{' use_declarations '}'
312-
{$$ = zend_ast_create(ZEND_AST_BATCH_USE, $1, $4); }
312+
{$$ = zend_ast_create(ZEND_AST_GROUP_USE, $1, $4); }
313313
;
314314

315-
mixed_batch_use_declarations:
315+
mixed_group_use_declarations:
316316
namespace_name T_NS_SEPARATOR '{' inline_use_declarations '}'
317-
{$$ = zend_ast_create(ZEND_AST_BATCH_USE, $1, $4);}
317+
{$$ = zend_ast_create(ZEND_AST_GROUP_USE, $1, $4);}
318318
;
319319

320320
inline_use_declarations:

0 commit comments

Comments
 (0)