@@ -1569,6 +1569,16 @@ static ZEND_COLD void zend_ast_export_ns_name(smart_str *str, zend_ast *ast, int
1569
1569
zend_ast_export_ex (str , ast , priority , indent );
1570
1570
}
1571
1571
1572
+ static ZEND_COLD void zend_ast_export_class_name (smart_str * str , zend_ast * ast , int priority , int indent )
1573
+ {
1574
+ if (ast -> kind == ZEND_AST_CLASS_REF ) {
1575
+ ZEND_ASSERT (ast -> child [1 ] == NULL && "Generic params not supported yet" );
1576
+ zend_ast_export_ns_name (str , ast -> child [0 ], priority , indent );
1577
+ return ;
1578
+ }
1579
+ zend_ast_export_ex (str , ast , priority , indent );
1580
+ }
1581
+
1572
1582
static ZEND_COLD bool zend_ast_valid_var_char (char ch )
1573
1583
{
1574
1584
unsigned char c = (unsigned char )ch ;
@@ -1689,7 +1699,7 @@ static ZEND_COLD void zend_ast_export_name_list_ex(smart_str *str, zend_ast_list
1689
1699
if (i != 0 ) {
1690
1700
smart_str_appends (str , separator );
1691
1701
}
1692
- zend_ast_export_name (str , list -> child [i ], 0 , indent );
1702
+ zend_ast_export_class_name (str , list -> child [i ], 0 , indent );
1693
1703
i ++ ;
1694
1704
}
1695
1705
}
@@ -1861,7 +1871,7 @@ static ZEND_COLD void zend_ast_export_zval(smart_str *str, zval *zv, int priorit
1861
1871
static ZEND_COLD void zend_ast_export_class_no_header (smart_str * str , zend_ast_decl * decl , int indent ) {
1862
1872
if (decl -> child [0 ]) {
1863
1873
smart_str_appends (str , " extends " );
1864
- zend_ast_export_ns_name (str , decl -> child [0 ], 0 , indent );
1874
+ zend_ast_export_class_name (str , decl -> child [0 ], 0 , indent );
1865
1875
}
1866
1876
if (decl -> child [1 ]) {
1867
1877
smart_str_appends (str , " implements " );
@@ -1881,7 +1891,7 @@ static ZEND_COLD void zend_ast_export_attribute_group(smart_str *str, zend_ast *
1881
1891
if (i ) {
1882
1892
smart_str_appends (str , ", " );
1883
1893
}
1884
- zend_ast_export_ns_name (str , attr -> child [0 ], 0 , indent );
1894
+ zend_ast_export_class_name (str , attr -> child [0 ], 0 , indent );
1885
1895
1886
1896
if (attr -> child [1 ]) {
1887
1897
smart_str_appendc (str , '(' );
@@ -1953,7 +1963,7 @@ static ZEND_COLD void zend_ast_export_type(smart_str *str, zend_ast *ast, int in
1953
1963
if (ast -> attr & ZEND_TYPE_NULLABLE ) {
1954
1964
smart_str_appendc (str , '?' );
1955
1965
}
1956
- zend_ast_export_ns_name (str , ast , 0 , indent );
1966
+ zend_ast_export_class_name (str , ast , 0 , indent );
1957
1967
}
1958
1968
1959
1969
static ZEND_COLD void zend_ast_export_hook_list (smart_str * str , zend_ast_list * hook_list , int indent )
@@ -2419,7 +2429,7 @@ static ZEND_COLD void zend_ast_export_ex(smart_str *str, zend_ast *ast, int prio
2419
2429
zend_ast_export_var (str , ast -> child [1 ], 0 , indent );
2420
2430
break ;
2421
2431
case ZEND_AST_STATIC_PROP :
2422
- zend_ast_export_ns_name (str , ast -> child [0 ], 0 , indent );
2432
+ zend_ast_export_class_name (str , ast -> child [0 ], 0 , indent );
2423
2433
smart_str_appends (str , "::$" );
2424
2434
zend_ast_export_var (str , ast -> child [1 ], 0 , indent );
2425
2435
break ;
@@ -2439,10 +2449,13 @@ static ZEND_COLD void zend_ast_export_ex(smart_str *str, zend_ast *ast, int prio
2439
2449
smart_str_appends (str , "..." );
2440
2450
break ;
2441
2451
case ZEND_AST_CLASS_CONST :
2442
- zend_ast_export_ns_name (str , ast -> child [0 ], 0 , indent );
2452
+ zend_ast_export_class_name (str , ast -> child [0 ], 0 , indent );
2443
2453
smart_str_appends (str , "::" );
2444
2454
zend_ast_export_name (str , ast -> child [1 ], 0 , indent );
2445
2455
break ;
2456
+ case ZEND_AST_CLASS_REF :
2457
+ ZEND_ASSERT (false && "TODO" );
2458
+ break ;
2446
2459
case ZEND_AST_CLASS_NAME :
2447
2460
if (ast -> child [0 ] == NULL ) {
2448
2461
/* The const expr representation stores the fetch type instead. */
@@ -2456,7 +2469,7 @@ static ZEND_COLD void zend_ast_export_ex(smart_str *str, zend_ast *ast, int prio
2456
2469
EMPTY_SWITCH_DEFAULT_CASE ()
2457
2470
}
2458
2471
} else {
2459
- zend_ast_export_ns_name (str , ast -> child [0 ], 0 , indent );
2472
+ zend_ast_export_class_name (str , ast -> child [0 ], 0 , indent );
2460
2473
}
2461
2474
smart_str_appends (str , "::class" );
2462
2475
break ;
@@ -2534,7 +2547,7 @@ static ZEND_COLD void zend_ast_export_ex(smart_str *str, zend_ast *ast, int prio
2534
2547
}
2535
2548
zend_ast_export_class_no_header (str , decl , indent );
2536
2549
} else {
2537
- zend_ast_export_ns_name (str , ast -> child [0 ], 0 , indent );
2550
+ zend_ast_export_class_name (str , ast -> child [0 ], 0 , indent );
2538
2551
smart_str_appendc (str , '(' );
2539
2552
zend_ast_export_ex (str , ast -> child [1 ], 0 , indent );
2540
2553
smart_str_appendc (str , ')' );
@@ -2543,7 +2556,7 @@ static ZEND_COLD void zend_ast_export_ex(smart_str *str, zend_ast *ast, int prio
2543
2556
case ZEND_AST_INSTANCEOF :
2544
2557
zend_ast_export_ex (str , ast -> child [0 ], 0 , indent );
2545
2558
smart_str_appends (str , " instanceof " );
2546
- zend_ast_export_ns_name (str , ast -> child [1 ], 0 , indent );
2559
+ zend_ast_export_class_name (str , ast -> child [1 ], 0 , indent );
2547
2560
break ;
2548
2561
case ZEND_AST_YIELD :
2549
2562
if (priority > 70 ) smart_str_appendc (str , '(' );
@@ -2724,17 +2737,6 @@ static ZEND_COLD void zend_ast_export_ex(smart_str *str, zend_ast *ast, int prio
2724
2737
smart_str_appends (str , ": " );
2725
2738
ast = ast -> child [1 ];
2726
2739
goto tail_call ;
2727
- // TODO Export generic types
2728
- //case ZEND_AST_ASSOCIATED_TYPE:
2729
- // smart_str_appends(str, "type ");
2730
- // zend_ast_export_name(str, ast->child[0], 0, indent);
2731
- // if (ast->child[1]) {
2732
- // smart_str_appends(str, " : ");
2733
- // smart_str_appends(str, " : ");
2734
- // zend_ast_export_type(str, ast->child[1], indent);
2735
- // }
2736
- // smart_str_appendc(str, ';');
2737
- //break;
2738
2740
2739
2741
/* 3 child nodes */
2740
2742
case ZEND_AST_METHOD_CALL :
@@ -2747,7 +2749,7 @@ static ZEND_COLD void zend_ast_export_ex(smart_str *str, zend_ast *ast, int prio
2747
2749
smart_str_appendc (str , ')' );
2748
2750
break ;
2749
2751
case ZEND_AST_STATIC_CALL :
2750
- zend_ast_export_ns_name (str , ast -> child [0 ], 0 , indent );
2752
+ zend_ast_export_class_name (str , ast -> child [0 ], 0 , indent );
2751
2753
smart_str_appends (str , "::" );
2752
2754
zend_ast_export_var (str , ast -> child [1 ], 0 , indent );
2753
2755
smart_str_appendc (str , '(' );
0 commit comments