Skip to content

Commit 215eaff

Browse files
committed
Remove version 15
1 parent b118bc6 commit 215eaff

File tree

9 files changed

+157
-329
lines changed

9 files changed

+157
-329
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -474,9 +474,9 @@ Supported since 2015-12-14. Deprecated since 2016-08-04.
474474
it was a simple string containing the name.
475475
* Nested `AST_STMT_LIST`s are now flattened out.
476476

477-
### 15 (deprecated)
477+
### 15 (removed)
478478

479-
Supported since 2015-10-21. Deprecated since 2016-04-30.
479+
Supported since 2015-10-21. Deprecated since 2016-04-30. Removed since 2016-08-04.
480480

481481
* In line with an upstream change, the `docComment` property on `AST_PROP_DECL` has been moved to
482482
`AST_PROP_ELEM`. This means that each property in one property declaration can have its own

ast.c

Lines changed: 41 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ static void ast_fill_children_ht(HashTable *ht, zend_ast *ast, zend_long version
318318
!is_list && version >= 30 ? ast_kind_child_name(ast->kind, i) : NULL;
319319
zval child_zv;
320320

321-
if (version >= 20 && ast->kind == ZEND_AST_STMT_LIST) {
321+
if (ast->kind == ZEND_AST_STMT_LIST) {
322322
if (child != NULL && child->kind == ZEND_AST_STMT_LIST) {
323323
ast_fill_children_ht(ht, child, version);
324324
continue;
@@ -383,7 +383,7 @@ static void ast_fill_children_ht(HashTable *ht, zend_ast *ast, zend_long version
383383
}
384384
} else if (ast->kind == ZEND_AST_CLOSURE_USES) {
385385
ast_create_virtual_node(&child_zv, AST_CLOSURE_VAR, child, version);
386-
} else if (version >= 20 && ast_is_var_name(child, ast, i)) {
386+
} else if (ast_is_var_name(child, ast, i)) {
387387
ast_create_virtual_node(&child_zv, ZEND_AST_VAR, child, version);
388388
} else if (version >= 40 && ast_should_normalize_list(child, ast, i)) {
389389
if (child) {
@@ -441,46 +441,44 @@ static void ast_to_zval(zval *zv, zend_ast *ast, zend_long version) {
441441
return;
442442
}
443443

444-
if (version >= 20) {
445-
switch (ast->kind) {
446-
case ZEND_AST_ASSIGN_OP:
447-
ast->attr = ast_assign_op_to_binary_op(ast->attr);
448-
break;
449-
case ZEND_AST_GREATER:
444+
switch (ast->kind) {
445+
case ZEND_AST_ASSIGN_OP:
446+
ast->attr = ast_assign_op_to_binary_op(ast->attr);
447+
break;
448+
case ZEND_AST_GREATER:
449+
ast->kind = ZEND_AST_BINARY_OP;
450+
ast->attr = AST_BINARY_IS_GREATER;
451+
break;
452+
case ZEND_AST_GREATER_EQUAL:
453+
ast->kind = ZEND_AST_BINARY_OP;
454+
ast->attr = AST_BINARY_IS_GREATER_OR_EQUAL;
455+
break;
456+
case ZEND_AST_OR:
457+
ast->kind = ZEND_AST_BINARY_OP;
458+
ast->attr = AST_BINARY_BOOL_OR;
459+
break;
460+
case ZEND_AST_AND:
461+
ast->kind = ZEND_AST_BINARY_OP;
462+
ast->attr = AST_BINARY_BOOL_AND;
463+
break;
464+
case ZEND_AST_COALESCE:
465+
if (version >= 40) {
450466
ast->kind = ZEND_AST_BINARY_OP;
451-
ast->attr = AST_BINARY_IS_GREATER;
452-
break;
453-
case ZEND_AST_GREATER_EQUAL:
454-
ast->kind = ZEND_AST_BINARY_OP;
455-
ast->attr = AST_BINARY_IS_GREATER_OR_EQUAL;
456-
break;
457-
case ZEND_AST_OR:
458-
ast->kind = ZEND_AST_BINARY_OP;
459-
ast->attr = AST_BINARY_BOOL_OR;
460-
break;
461-
case ZEND_AST_AND:
462-
ast->kind = ZEND_AST_BINARY_OP;
463-
ast->attr = AST_BINARY_BOOL_AND;
464-
break;
465-
case ZEND_AST_COALESCE:
466-
if (version >= 40) {
467-
ast->kind = ZEND_AST_BINARY_OP;
468-
ast->attr = AST_BINARY_COALESCE;
469-
}
470-
break;
471-
case ZEND_AST_SILENCE:
472-
ast->kind = ZEND_AST_UNARY_OP;
473-
ast->attr = AST_SILENCE;
474-
break;
475-
case ZEND_AST_UNARY_PLUS:
476-
ast->kind = ZEND_AST_UNARY_OP;
477-
ast->attr = AST_PLUS;
478-
break;
479-
case ZEND_AST_UNARY_MINUS:
480-
ast->kind = ZEND_AST_UNARY_OP;
481-
ast->attr = AST_MINUS;
482-
break;
483-
}
467+
ast->attr = AST_BINARY_COALESCE;
468+
}
469+
break;
470+
case ZEND_AST_SILENCE:
471+
ast->kind = ZEND_AST_UNARY_OP;
472+
ast->attr = AST_SILENCE;
473+
break;
474+
case ZEND_AST_UNARY_PLUS:
475+
ast->kind = ZEND_AST_UNARY_OP;
476+
ast->attr = AST_PLUS;
477+
break;
478+
case ZEND_AST_UNARY_MINUS:
479+
ast->kind = ZEND_AST_UNARY_OP;
480+
ast->attr = AST_MINUS;
481+
break;
484482
}
485483

486484
#if PHP_VERSION_ID >= 70100
@@ -554,7 +552,7 @@ static void ast_to_zval(zval *zv, zend_ast *ast, zend_long version) {
554552
ast_fill_children_ht(Z_ARRVAL(tmp_zv), ast, version);
555553
}
556554

557-
static const zend_long versions[] = {15, 20, 30, 35, 40};
555+
static const zend_long versions[] = {20, 30, 35, 40};
558556
static const size_t versions_count = sizeof(versions)/sizeof(versions[0]);
559557

560558
static zend_string *ast_version_info() {
@@ -588,7 +586,7 @@ static int ast_check_version(zend_long version) {
588586
zend_string *version_info;
589587

590588
if (ast_version_known(version)) {
591-
if (version == 15 || version == 20) {
589+
if (version == 20) {
592590
php_error_docref(NULL, E_DEPRECATED,
593591
"Version " ZEND_LONG_FMT " is deprecated", version);
594592
}

tests/assign_ops.phpt

Lines changed: 49 additions & 126 deletions
Original file line numberDiff line numberDiff line change
@@ -21,157 +21,80 @@ $a <<= $b;
2121
$a >>= $b;
2222
PHP;
2323

24-
echo ast_dump(ast\parse_code($code, $version=15)), "\n";
25-
echo ast_dump(ast\parse_code($code, $version=20)), "\n";
24+
echo ast_dump(ast\parse_code($code, $version=40)), "\n";
2625

2726
?>
2827
--EXPECTF--
29-
Deprecated: ast\parse_code(): Version 15 is deprecated in %s on line %d
30-
AST_STMT_LIST
31-
0: AST_ASSIGN_OP
32-
flags: ASSIGN_BITWISE_OR (31)
33-
0: AST_VAR
34-
0: "a"
35-
1: AST_VAR
36-
0: "b"
37-
1: AST_ASSIGN_OP
38-
flags: ASSIGN_BITWISE_AND (32)
39-
0: AST_VAR
40-
0: "a"
41-
1: AST_VAR
42-
0: "b"
43-
2: AST_ASSIGN_OP
44-
flags: ASSIGN_BITWISE_XOR (33)
45-
0: AST_VAR
46-
0: "a"
47-
1: AST_VAR
48-
0: "b"
49-
3: AST_ASSIGN_OP
50-
flags: ASSIGN_CONCAT (30)
51-
0: AST_VAR
52-
0: "a"
53-
1: AST_VAR
54-
0: "b"
55-
4: AST_ASSIGN_OP
56-
flags: ASSIGN_ADD (23)
57-
0: AST_VAR
58-
0: "a"
59-
1: AST_VAR
60-
0: "b"
61-
5: AST_ASSIGN_OP
62-
flags: ASSIGN_SUB (24)
63-
0: AST_VAR
64-
0: "a"
65-
1: AST_VAR
66-
0: "b"
67-
6: AST_ASSIGN_OP
68-
flags: ASSIGN_MUL (25)
69-
0: AST_VAR
70-
0: "a"
71-
1: AST_VAR
72-
0: "b"
73-
7: AST_ASSIGN_OP
74-
flags: ASSIGN_DIV (26)
75-
0: AST_VAR
76-
0: "a"
77-
1: AST_VAR
78-
0: "b"
79-
8: AST_ASSIGN_OP
80-
flags: ASSIGN_MOD (27)
81-
0: AST_VAR
82-
0: "a"
83-
1: AST_VAR
84-
0: "b"
85-
9: AST_ASSIGN_OP
86-
flags: ASSIGN_POW (167)
87-
0: AST_VAR
88-
0: "a"
89-
1: AST_VAR
90-
0: "b"
91-
10: AST_ASSIGN_OP
92-
flags: ASSIGN_SHIFT_LEFT (28)
93-
0: AST_VAR
94-
0: "a"
95-
1: AST_VAR
96-
0: "b"
97-
11: AST_ASSIGN_OP
98-
flags: ASSIGN_SHIFT_RIGHT (29)
99-
0: AST_VAR
100-
0: "a"
101-
1: AST_VAR
102-
0: "b"
103-
104-
Deprecated: ast\parse_code(): Version 20 is deprecated in %s on line %d
10528
AST_STMT_LIST
10629
0: AST_ASSIGN_OP
10730
flags: BINARY_BITWISE_OR (9)
108-
0: AST_VAR
109-
0: "a"
110-
1: AST_VAR
111-
0: "b"
31+
var: AST_VAR
32+
name: "a"
33+
expr: AST_VAR
34+
name: "b"
11235
1: AST_ASSIGN_OP
11336
flags: BINARY_BITWISE_AND (10)
114-
0: AST_VAR
115-
0: "a"
116-
1: AST_VAR
117-
0: "b"
37+
var: AST_VAR
38+
name: "a"
39+
expr: AST_VAR
40+
name: "b"
11841
2: AST_ASSIGN_OP
11942
flags: BINARY_BITWISE_XOR (11)
120-
0: AST_VAR
121-
0: "a"
122-
1: AST_VAR
123-
0: "b"
43+
var: AST_VAR
44+
name: "a"
45+
expr: AST_VAR
46+
name: "b"
12447
3: AST_ASSIGN_OP
12548
flags: BINARY_CONCAT (8)
126-
0: AST_VAR
127-
0: "a"
128-
1: AST_VAR
129-
0: "b"
49+
var: AST_VAR
50+
name: "a"
51+
expr: AST_VAR
52+
name: "b"
13053
4: AST_ASSIGN_OP
13154
flags: BINARY_ADD (1)
132-
0: AST_VAR
133-
0: "a"
134-
1: AST_VAR
135-
0: "b"
55+
var: AST_VAR
56+
name: "a"
57+
expr: AST_VAR
58+
name: "b"
13659
5: AST_ASSIGN_OP
13760
flags: BINARY_SUB (2)
138-
0: AST_VAR
139-
0: "a"
140-
1: AST_VAR
141-
0: "b"
61+
var: AST_VAR
62+
name: "a"
63+
expr: AST_VAR
64+
name: "b"
14265
6: AST_ASSIGN_OP
14366
flags: BINARY_MUL (3)
144-
0: AST_VAR
145-
0: "a"
146-
1: AST_VAR
147-
0: "b"
67+
var: AST_VAR
68+
name: "a"
69+
expr: AST_VAR
70+
name: "b"
14871
7: AST_ASSIGN_OP
14972
flags: BINARY_DIV (4)
150-
0: AST_VAR
151-
0: "a"
152-
1: AST_VAR
153-
0: "b"
73+
var: AST_VAR
74+
name: "a"
75+
expr: AST_VAR
76+
name: "b"
15477
8: AST_ASSIGN_OP
15578
flags: BINARY_MOD (5)
156-
0: AST_VAR
157-
0: "a"
158-
1: AST_VAR
159-
0: "b"
79+
var: AST_VAR
80+
name: "a"
81+
expr: AST_VAR
82+
name: "b"
16083
9: AST_ASSIGN_OP
16184
flags: BINARY_POW (166)
162-
0: AST_VAR
163-
0: "a"
164-
1: AST_VAR
165-
0: "b"
85+
var: AST_VAR
86+
name: "a"
87+
expr: AST_VAR
88+
name: "b"
16689
10: AST_ASSIGN_OP
16790
flags: BINARY_SHIFT_LEFT (6)
168-
0: AST_VAR
169-
0: "a"
170-
1: AST_VAR
171-
0: "b"
91+
var: AST_VAR
92+
name: "a"
93+
expr: AST_VAR
94+
name: "b"
17295
11: AST_ASSIGN_OP
17396
flags: BINARY_SHIFT_RIGHT (7)
174-
0: AST_VAR
175-
0: "a"
176-
1: AST_VAR
177-
0: "b"
97+
var: AST_VAR
98+
name: "a"
99+
expr: AST_VAR
100+
name: "b"

0 commit comments

Comments
 (0)