Lines Matching refs:ast

96 static bool zend_try_ct_eval_array(zval *result, zend_ast *ast);
99 static zend_op *zend_compile_var(znode *result, zend_ast *ast, uint32_t type, bool by_ref);
100 static zend_op *zend_delayed_compile_var(znode *result, zend_ast *ast, uint32_t type, bool by_ref);
101 static void zend_compile_expr(znode *result, zend_ast *ast);
102 static void zend_compile_stmt(zend_ast *ast);
103 static void zend_compile_assign(znode *result, zend_ast *ast);
1203 static zend_string *zend_resolve_class_name_ast(zend_ast *ast) /* {{{ */ in zend_resolve_class_name_ast() argument
1205 zval *class_name = zend_ast_get_zval(ast); in zend_resolve_class_name_ast()
1209 return zend_resolve_class_name(Z_STR_P(class_name), ast->attr); in zend_resolve_class_name_ast()
1224 static bool zend_is_call(zend_ast *ast);
1757 static zend_string *zend_resolve_const_class_name_reference(zend_ast *ast, const char *type) in zend_resolve_const_class_name_reference() argument
1759 zend_string *class_name = zend_ast_get_str(ast); in zend_resolve_const_class_name_reference()
1760 if (ZEND_FETCH_CLASS_DEFAULT != zend_get_class_fetch_type_ast(ast)) { in zend_resolve_const_class_name_reference()
1765 return zend_resolve_class_name(class_name, ast->attr); in zend_resolve_const_class_name_reference()
2138 zend_ast *zend_negate_num_string(zend_ast *ast) /* {{{ */ in zend_negate_num_string() argument
2140 zval *zv = zend_ast_get_zval(ast); in zend_negate_num_string()
2156 return ast; in zend_negate_num_string()
2499 static bool zend_ast_is_short_circuited(const zend_ast *ast) in zend_ast_is_short_circuited() argument
2501 switch (ast->kind) { in zend_ast_is_short_circuited()
2507 return zend_ast_is_short_circuited(ast->child[0]); in zend_ast_is_short_circuited()
2516 static void zend_assert_not_short_circuited(const zend_ast *ast) in zend_assert_not_short_circuited() argument
2518 if (zend_ast_is_short_circuited(ast)) { in zend_assert_not_short_circuited()
2529 static void zend_short_circuiting_mark_inner(zend_ast *ast) { in zend_short_circuiting_mark_inner() argument
2530 if (zend_ast_kind_is_short_circuited(ast->kind)) { in zend_short_circuiting_mark_inner()
2531 ast->attr |= ZEND_SHORT_CIRCUITING_INNER; in zend_short_circuiting_mark_inner()
2540 static void zend_short_circuiting_commit(uint32_t checkpoint, znode *result, zend_ast *ast) in zend_short_circuiting_commit() argument
2542 bool is_short_circuited = zend_ast_kind_is_short_circuited(ast->kind) in zend_short_circuiting_commit()
2543 || ast->kind == ZEND_AST_ISSET || ast->kind == ZEND_AST_EMPTY; in zend_short_circuiting_commit()
2550 if (ast->attr & ZEND_SHORT_CIRCUITING_INNER) { in zend_short_circuiting_commit()
2561 ast->kind == ZEND_AST_ISSET ? ZEND_SHORT_CIRCUITING_CHAIN_ISSET : in zend_short_circuiting_commit()
2562 ast->kind == ZEND_AST_EMPTY ? ZEND_SHORT_CIRCUITING_CHAIN_EMPTY : in zend_short_circuiting_commit()
2741 static inline bool zend_is_variable(zend_ast *ast) /* {{{ */ in zend_is_variable() argument
2743 return ast->kind == ZEND_AST_VAR in zend_is_variable()
2744 || ast->kind == ZEND_AST_DIM in zend_is_variable()
2745 || ast->kind == ZEND_AST_PROP in zend_is_variable()
2746 || ast->kind == ZEND_AST_NULLSAFE_PROP in zend_is_variable()
2747 || ast->kind == ZEND_AST_STATIC_PROP; in zend_is_variable()
2751 static inline bool zend_is_call(zend_ast *ast) /* {{{ */ in zend_is_call() argument
2753 return ast->kind == ZEND_AST_CALL in zend_is_call()
2754 || ast->kind == ZEND_AST_METHOD_CALL in zend_is_call()
2755 || ast->kind == ZEND_AST_NULLSAFE_METHOD_CALL in zend_is_call()
2756 || ast->kind == ZEND_AST_STATIC_CALL; in zend_is_call()
2760 static inline bool zend_is_variable_or_call(zend_ast *ast) /* {{{ */ in zend_is_variable_or_call() argument
2762 return zend_is_variable(ast) || zend_is_call(ast); in zend_is_variable_or_call()
2766 static inline bool zend_is_unticked_stmt(zend_ast *ast) /* {{{ */ in zend_is_unticked_stmt() argument
2768 return ast->kind == ZEND_AST_STMT_LIST || ast->kind == ZEND_AST_LABEL in zend_is_unticked_stmt()
2769 || ast->kind == ZEND_AST_PROP_DECL || ast->kind == ZEND_AST_CLASS_CONST_GROUP in zend_is_unticked_stmt()
2770 || ast->kind == ZEND_AST_USE_TRAIT || ast->kind == ZEND_AST_METHOD; in zend_is_unticked_stmt()
2774 static inline bool zend_can_write_to_variable(zend_ast *ast) /* {{{ */ in zend_can_write_to_variable() argument
2777 ast->kind == ZEND_AST_DIM in zend_can_write_to_variable()
2778 || ast->kind == ZEND_AST_PROP in zend_can_write_to_variable()
2780 ast = ast->child[0]; in zend_can_write_to_variable()
2783 return zend_is_variable_or_call(ast) && !zend_ast_is_short_circuited(ast); in zend_can_write_to_variable()
2896 static zend_result zend_try_compile_cv(znode *result, zend_ast *ast) /* {{{ */ in zend_try_compile_cv() argument
2898 zend_ast *name_ast = ast->child[0]; in zend_try_compile_cv()
2927 static zend_op *zend_compile_simple_var_no_cv(znode *result, zend_ast *ast, uint32_t type, bool del… in zend_compile_simple_var_no_cv() argument
2929 zend_ast *name_ast = ast->child[0]; in zend_compile_simple_var_no_cv()
2957 static bool is_this_fetch(zend_ast *ast) /* {{{ */ in is_this_fetch() argument
2959 if (ast->kind == ZEND_AST_VAR && ast->child[0]->kind == ZEND_AST_ZVAL) { in is_this_fetch()
2960 zval *name = zend_ast_get_zval(ast->child[0]); in is_this_fetch()
2968 static bool is_globals_fetch(const zend_ast *ast) in is_globals_fetch() argument
2970 if (ast->kind == ZEND_AST_VAR && ast->child[0]->kind == ZEND_AST_ZVAL) { in is_globals_fetch()
2971 zval *name = zend_ast_get_zval(ast->child[0]); in is_globals_fetch()
2978 static bool is_global_var_fetch(zend_ast *ast) in is_global_var_fetch() argument
2980 return ast->kind == ZEND_AST_DIM && is_globals_fetch(ast->child[0]); in is_global_var_fetch()
3003 static zend_op *zend_compile_simple_var(znode *result, zend_ast *ast, uint32_t type, bool delayed) … in zend_compile_simple_var() argument
3005 if (is_this_fetch(ast)) { in zend_compile_simple_var()
3013 } else if (is_globals_fetch(ast)) { in zend_compile_simple_var()
3020 } else if (zend_try_compile_cv(result, ast) == FAILURE) { in zend_compile_simple_var()
3021 return zend_compile_simple_var_no_cv(result, ast, type, delayed); in zend_compile_simple_var()
3027 static void zend_separate_if_call_and_write(znode *node, zend_ast *ast, uint32_t type) /* {{{ */ in zend_separate_if_call_and_write() argument
3033 && zend_is_call(ast)) { in zend_separate_if_call_and_write()
3055 static zend_op *zend_delayed_compile_dim(znode *result, zend_ast *ast, uint32_t type, bool by_ref) in zend_delayed_compile_dim() argument
3057 zend_ast *var_ast = ast->child[0]; in zend_delayed_compile_dim()
3058 zend_ast *dim_ast = ast->child[1]; in zend_delayed_compile_dim()
3118 static zend_op *zend_compile_dim(znode *result, zend_ast *ast, uint32_t type, bool by_ref) /* {{{ */ in zend_compile_dim() argument
3121 zend_delayed_compile_dim(result, ast, type, by_ref); in zend_compile_dim()
3126 static zend_op *zend_delayed_compile_prop(znode *result, zend_ast *ast, uint32_t type) /* {{{ */ in zend_delayed_compile_prop() argument
3128 zend_ast *obj_ast = ast->child[0]; in zend_delayed_compile_prop()
3129 zend_ast *prop_ast = ast->child[1]; in zend_delayed_compile_prop()
3133 bool nullsafe = ast->kind == ZEND_AST_NULLSAFE_PROP; in zend_delayed_compile_prop()
3200 static zend_op *zend_compile_prop(znode *result, zend_ast *ast, uint32_t type, bool by_ref) /* {{{ … in zend_compile_prop() argument
3203 zend_op *opline = zend_delayed_compile_prop(result, ast, type); in zend_compile_prop()
3211 static zend_op *zend_compile_static_prop(znode *result, zend_ast *ast, uint32_t type, bool by_ref, … in zend_compile_static_prop() argument
3213 zend_ast *class_ast = ast->child[0]; in zend_compile_static_prop()
3214 zend_ast *prop_ast = ast->child[1]; in zend_compile_static_prop()
3270 static bool zend_propagate_list_refs(zend_ast *ast) { /* {{{ */ in zend_propagate_list_refs() argument
3271 zend_ast_list *list = zend_ast_get_list(ast); in zend_propagate_list_refs()
3303 znode *result, zend_ast *ast, znode *expr_node, zend_ast_attr array_style) /* {{{ */ in zend_compile_list_assign() argument
3305 zend_ast_list *list = zend_ast_get_list(ast); in zend_compile_list_assign()
3392 static void zend_ensure_writable_variable(const zend_ast *ast) /* {{{ */ in zend_ensure_writable_variable() argument
3394 if (ast->kind == ZEND_AST_CALL) { in zend_ensure_writable_variable()
3398 ast->kind == ZEND_AST_METHOD_CALL in zend_ensure_writable_variable()
3399 || ast->kind == ZEND_AST_NULLSAFE_METHOD_CALL in zend_ensure_writable_variable()
3400 || ast->kind == ZEND_AST_STATIC_CALL in zend_ensure_writable_variable()
3404 if (zend_ast_is_short_circuited(ast)) { in zend_ensure_writable_variable()
3407 if (is_globals_fetch(ast)) { in zend_ensure_writable_variable()
3456 static void zend_compile_assign(znode *result, zend_ast *ast) /* {{{ */ in zend_compile_assign() argument
3458 zend_ast *var_ast = ast->child[0]; in zend_compile_assign()
3459 zend_ast *expr_ast = ast->child[1]; in zend_compile_assign()
3553 static void zend_compile_assign_ref(znode *result, zend_ast *ast) /* {{{ */ in zend_compile_assign_ref() argument
3555 zend_ast *target_ast = ast->child[0]; in zend_compile_assign_ref()
3556 zend_ast *source_ast = ast->child[1]; in zend_compile_assign_ref()
3625 static void zend_compile_compound_assign(znode *result, zend_ast *ast) /* {{{ */ in zend_compile_compound_assign() argument
3627 zend_ast *var_ast = ast->child[0]; in zend_compile_compound_assign()
3628 zend_ast *expr_ast = ast->child[1]; in zend_compile_compound_assign()
3629 uint32_t opcode = ast->attr; in zend_compile_compound_assign()
3722 zend_ast *ast, zend_function *fbc, bool *may_have_extra_named_args) /* {{{ */ in zend_compile_args() argument
3724 zend_ast_list *args = zend_ast_get_list(ast); in zend_compile_args()
3844 CG(zend_lineno) = zend_ast_get_lineno(ast); in zend_compile_args()
5066 static bool zend_compile_parent_property_hook_call(znode *result, zend_ast *ast, uint32_t type) in zend_compile_parent_property_hook_call() argument
5068 ZEND_ASSERT(ast->kind == ZEND_AST_STATIC_CALL); in zend_compile_parent_property_hook_call()
5070 zend_ast *class_ast = ast->child[0]; in zend_compile_parent_property_hook_call()
5071 zend_ast *method_ast = ast->child[1]; in zend_compile_parent_property_hook_call()
5092 zend_ast *args_ast = ast->child[2]; in zend_compile_parent_property_hook_call()
5131 static void zend_compile_call(znode *result, zend_ast *ast, uint32_t type) /* {{{ */ in zend_compile_call() argument
5133 zend_ast *name_ast = ast->child[0]; in zend_compile_call()
5134 zend_ast *args_ast = ast->child[1]; in zend_compile_call()
5141 zend_compile_dynamic_call(result, &name_node, args_ast, ast->lineno); in zend_compile_call()
5150 …zend_compile_assert(result, zend_ast_get_list(args_ast), Z_STR(name_node.u.constant), NULL, ast->l… in zend_compile_call()
5152 zend_compile_ns_call(result, &name_node, args_ast, ast->lineno, type); in zend_compile_call()
5170 zend_compile_assert(result, zend_ast_get_list(args_ast), lcname, fbc, ast->lineno); in zend_compile_call()
5180 zend_compile_dynamic_call(result, &name_node, args_ast, ast->lineno); in zend_compile_call()
5205 zend_compile_call_common(result, args_ast, fbc, ast->lineno); in zend_compile_call()
5210 static void zend_compile_method_call(znode *result, zend_ast *ast, uint32_t type) /* {{{ */ in zend_compile_method_call() argument
5212 zend_ast *obj_ast = ast->child[0]; in zend_compile_method_call()
5213 zend_ast *method_ast = ast->child[1]; in zend_compile_method_call()
5214 zend_ast *args_ast = ast->child[2]; in zend_compile_method_call()
5219 bool nullsafe = ast->kind == ZEND_AST_NULLSAFE_METHOD_CALL; in zend_compile_method_call()
5302 static void zend_compile_static_call(znode *result, zend_ast *ast, uint32_t type) /* {{{ */ in zend_compile_static_call() argument
5304 zend_ast *class_ast = ast->child[0]; in zend_compile_static_call()
5305 zend_ast *method_ast = ast->child[1]; in zend_compile_static_call()
5306 zend_ast *args_ast = ast->child[2]; in zend_compile_static_call()
5312 if (zend_compile_parent_property_hook_call(result, ast, type)) { in zend_compile_static_call()
5378 static void zend_compile_class_decl(znode *result, zend_ast *ast, bool toplevel);
5380 static void zend_compile_new(znode *result, zend_ast *ast) /* {{{ */ in zend_compile_new() argument
5382 zend_ast *class_ast = ast->child[0]; in zend_compile_new()
5383 zend_ast *args_ast = ast->child[1]; in zend_compile_new()
5406 zend_compile_call_common(&ctor_result, args_ast, NULL, ast->lineno); in zend_compile_new()
5411 static void zend_compile_clone(znode *result, zend_ast *ast) /* {{{ */ in zend_compile_clone() argument
5413 zend_ast *obj_ast = ast->child[0]; in zend_compile_clone()
5422 static void zend_compile_global_var(zend_ast *ast) /* {{{ */ in zend_compile_global_var() argument
5424 zend_ast *var_ast = ast->child[0]; in zend_compile_global_var()
5482 static void zend_compile_static_var(zend_ast *ast) /* {{{ */ in zend_compile_static_var() argument
5484 zend_ast *var_ast = ast->child[0]; in zend_compile_static_var()
5502 zend_eval_const_expr(&ast->child[1]); in zend_compile_static_var()
5503 zend_ast *value_ast = ast->child[1]; in zend_compile_static_var()
5536 static void zend_compile_unset(zend_ast *ast) /* {{{ */ in zend_compile_unset() argument
5538 zend_ast *var_ast = ast->child[0]; in zend_compile_unset()
5675 static void zend_compile_return(zend_ast *ast) /* {{{ */ in zend_compile_return() argument
5677 zend_ast *expr_ast = ast->child[0]; in zend_compile_return()
5731 static void zend_compile_echo(zend_ast *ast) /* {{{ */ in zend_compile_echo() argument
5734 zend_ast *expr_ast = ast->child[0]; in zend_compile_echo()
5744 static void zend_compile_throw(znode *result, zend_ast *ast) /* {{{ */ in zend_compile_throw() argument
5746 zend_ast *expr_ast = ast->child[0]; in zend_compile_throw()
5761 static void zend_compile_break_continue(zend_ast *ast) /* {{{ */ in zend_compile_break_continue() argument
5763 zend_ast *depth_ast = ast->child[0]; in zend_compile_break_continue()
5768 ZEND_ASSERT(ast->kind == ZEND_AST_BREAK || ast->kind == ZEND_AST_CONTINUE); in zend_compile_break_continue()
5774 "is no longer supported", ast->kind == ZEND_AST_BREAK ? "break" : "continue"); in zend_compile_break_continue()
5780 ast->kind == ZEND_AST_BREAK ? "break" : "continue"); in zend_compile_break_continue()
5790 ast->kind == ZEND_AST_BREAK ? "break" : "continue"); in zend_compile_break_continue()
5794 ast->kind == ZEND_AST_BREAK ? "break" : "continue", in zend_compile_break_continue()
5799 if (ast->kind == ZEND_AST_CONTINUE) { in zend_compile_break_continue()
5832 opline = zend_emit_op(NULL, ast->kind == ZEND_AST_BREAK ? ZEND_BRK : ZEND_CONT, NULL, NULL); in zend_compile_break_continue()
5899 static void zend_compile_goto(zend_ast *ast) /* {{{ */ in zend_compile_goto() argument
5901 zend_ast *label_ast = ast->child[0]; in zend_compile_goto()
5916 static void zend_compile_label(zend_ast *ast) /* {{{ */ in zend_compile_label() argument
5918 zend_string *label = zend_ast_get_str(ast->child[0]); in zend_compile_label()
5935 static void zend_compile_while(zend_ast *ast) /* {{{ */ in zend_compile_while() argument
5937 zend_ast *cond_ast = ast->child[0]; in zend_compile_while()
5938 zend_ast *stmt_ast = ast->child[1]; in zend_compile_while()
5959 static void zend_compile_do_while(zend_ast *ast) /* {{{ */ in zend_compile_do_while() argument
5961 zend_ast *stmt_ast = ast->child[0]; in zend_compile_do_while()
5962 zend_ast *cond_ast = ast->child[1]; in zend_compile_do_while()
5981 static void zend_compile_expr_list(znode *result, zend_ast *ast) /* {{{ */ in zend_compile_expr_list() argument
5989 if (!ast) { in zend_compile_expr_list()
5993 list = zend_ast_get_list(ast); in zend_compile_expr_list()
6003 static void zend_compile_for(zend_ast *ast) /* {{{ */ in zend_compile_for() argument
6005 zend_ast *init_ast = ast->child[0]; in zend_compile_for()
6006 zend_ast *cond_ast = ast->child[1]; in zend_compile_for()
6007 zend_ast *loop_ast = ast->child[2]; in zend_compile_for()
6008 zend_ast *stmt_ast = ast->child[3]; in zend_compile_for()
6037 static void zend_compile_foreach(zend_ast *ast) /* {{{ */ in zend_compile_foreach() argument
6039 zend_ast *expr_ast = ast->child[0]; in zend_compile_foreach()
6040 zend_ast *value_ast = ast->child[1]; in zend_compile_foreach()
6041 zend_ast *key_ast = ast->child[2]; in zend_compile_foreach()
6042 zend_ast *stmt_ast = ast->child[3]; in zend_compile_foreach()
6114 CG(zend_lineno) = ast->lineno; in zend_compile_foreach()
6129 static void zend_compile_if(zend_ast *ast) /* {{{ */ in zend_compile_if() argument
6131 zend_ast_list *list = zend_ast_get_list(ast); in zend_compile_if()
6237 static void zend_compile_switch(zend_ast *ast) /* {{{ */ in zend_compile_switch() argument
6239 zend_ast *expr_ast = ast->child[0]; in zend_compile_switch()
6240 zend_ast_list *cases = zend_ast_get_list(ast->child[1]); in zend_compile_switch()
6415 static void zend_compile_match(znode *result, zend_ast *ast) in zend_compile_match() argument
6417 zend_ast *expr_ast = ast->child[0]; in zend_compile_match()
6418 zend_ast_list *arms = zend_ast_get_list(ast->child[1]); in zend_compile_match()
6601 static void zend_compile_try(zend_ast *ast) /* {{{ */ in zend_compile_try() argument
6603 zend_ast *try_ast = ast->child[0]; in zend_compile_try()
6604 zend_ast_list *catches = zend_ast_get_list(ast->child[1]); in zend_compile_try()
6605 zend_ast *finally_ast = ast->child[2]; in zend_compile_try()
6776 bool zend_handle_encoding_declaration(zend_ast *ast) /* {{{ */ in zend_handle_encoding_declaration() argument
6778 zend_ast_list *declares = zend_ast_get_list(ast); in zend_handle_encoding_declaration()
6828 static zend_result zend_is_first_statement(zend_ast *ast, bool allow_nop) /* {{{ */ in zend_is_first_statement() argument
6831 zend_ast_list *file_ast = zend_ast_get_list(CG(ast)); in zend_is_first_statement()
6834 if (file_ast->child[i] == ast) { in zend_is_first_statement()
6849 static void zend_compile_declare(zend_ast *ast) /* {{{ */ in zend_compile_declare() argument
6851 zend_ast_list *declares = zend_ast_get_list(ast->child[0]); in zend_compile_declare()
6852 zend_ast *stmt_ast = ast->child[1]; in zend_compile_declare()
6873 if (FAILURE == zend_is_first_statement(ast, /* allow_nop */ 0)) { in zend_compile_declare()
6880 if (FAILURE == zend_is_first_statement(ast, /* allow_nop */ 0)) { in zend_compile_declare()
6885 if (ast->child[1] != NULL) { in zend_compile_declare()
6913 static void zend_compile_stmt_list(zend_ast *ast) /* {{{ */ in zend_compile_stmt_list() argument
6915 zend_ast_list *list = zend_ast_get_list(ast); in zend_compile_stmt_list()
6948 static zend_type zend_compile_single_typename(zend_ast *ast) in zend_compile_single_typename() argument
6950 ZEND_ASSERT(!(ast->attr & ZEND_TYPE_NULLABLE)); in zend_compile_single_typename()
6951 if (ast->kind == ZEND_AST_TYPE) { in zend_compile_single_typename()
6952 if (ast->attr == IS_STATIC && !CG(active_class_entry) && zend_is_scope_known()) { in zend_compile_single_typename()
6957 return (zend_type) ZEND_TYPE_INIT_CODE(ast->attr, 0, 0); in zend_compile_single_typename()
6959 zend_string *class_name = zend_ast_get_str(ast); in zend_compile_single_typename()
6963 if ((ast->attr & ZEND_NAME_NOT_FQ) != ZEND_NAME_NOT_FQ) { in zend_compile_single_typename()
6980 zend_string *orig_name = zend_ast_get_str(ast); in zend_compile_single_typename()
6981 uint32_t fetch_type = zend_get_class_fetch_type_ast(ast); in zend_compile_single_typename()
6983 class_name = zend_resolve_class_name_ast(ast); in zend_compile_single_typename()
6990 if (ast->attr == ZEND_NAME_NOT_FQ in zend_compile_single_typename()
7098 static zend_type zend_compile_typename(zend_ast *ast);
7101 zend_ast *ast, bool force_allow_null, bool *forced_allow_null) /* {{{ */ in zend_compile_typename_ex() argument
7103 bool is_marked_nullable = ast->attr & ZEND_TYPE_NULLABLE; in zend_compile_typename_ex()
7104 zend_ast_attr orig_ast_attr = ast->attr; in zend_compile_typename_ex()
7108 ast->attr &= ~ZEND_TYPE_NULLABLE; in zend_compile_typename_ex()
7111 if (ast->kind == ZEND_AST_TYPE_UNION) { in zend_compile_typename_ex()
7112 zend_ast_list *list = zend_ast_get_list(ast); in zend_compile_typename_ex()
7224 } else if (ast->kind == ZEND_AST_TYPE_INTERSECTION) { in zend_compile_typename_ex()
7225 zend_ast_list *list = zend_ast_get_list(ast); in zend_compile_typename_ex()
7291 type = zend_compile_single_typename(ast); in zend_compile_typename_ex()
7321 ast->attr = orig_ast_attr; in zend_compile_typename_ex()
7326 static zend_type zend_compile_typename(zend_ast *ast) in zend_compile_typename() argument
7329 return zend_compile_typename_ex(ast, false, &forced_allow_null); in zend_compile_typename()
7348 HashTable **attributes, zend_ast *ast, uint32_t offset, uint32_t target, uint32_t promoted in zend_compile_attributes() argument
7353 zend_ast_list *list = zend_ast_get_list(ast); in zend_compile_attributes()
7356 ZEND_ASSERT(ast->kind == ZEND_AST_ATTRIBUTE_LIST); in zend_compile_attributes()
7474 zend_ast *ast = *ast_ptr; in zend_property_hook_find_property_usage() local
7477 if (ast == NULL) { in zend_property_hook_find_property_usage()
7479 } else if (ast->kind == ZEND_AST_PROP || ast->kind == ZEND_AST_NULLSAFE_PROP) { in zend_property_hook_find_property_usage()
7480 zend_ast *object_ast = ast->child[0]; in zend_property_hook_find_property_usage()
7481 zend_ast *property_ast = ast->child[1]; in zend_property_hook_find_property_usage()
7500 if (!zend_ast_is_special(ast)) { in zend_property_hook_find_property_usage()
7501 zend_ast_apply(ast, zend_property_hook_find_property_usage, context); in zend_property_hook_find_property_usage()
7540 static void zend_compile_params(zend_ast *ast, zend_ast *return_type_ast, uint32_t fallback_return_… in zend_compile_params() argument
7542 zend_ast_list *list = zend_ast_get_list(ast); in zend_compile_params()
7892 static void find_implicit_binds_recursively(closure_info *info, zend_ast *ast) { in find_implicit_binds_recursively() argument
7893 if (!ast) { in find_implicit_binds_recursively()
7897 if (ast->kind == ZEND_AST_VAR) { in find_implicit_binds_recursively()
7898 zend_ast *name_ast = ast->child[0]; in find_implicit_binds_recursively()
7916 } else if (zend_ast_is_list(ast)) { in find_implicit_binds_recursively()
7917 zend_ast_list *list = zend_ast_get_list(ast); in find_implicit_binds_recursively()
7922 } else if (ast->kind == ZEND_AST_CLOSURE) { in find_implicit_binds_recursively()
7924 zend_ast_decl *closure_ast = (zend_ast_decl *) ast; in find_implicit_binds_recursively()
7933 } else if (ast->kind == ZEND_AST_ARROW_FUNC) { in find_implicit_binds_recursively()
7935 zend_ast_decl *closure_ast = (zend_ast_decl *) ast; in find_implicit_binds_recursively()
7937 } else if (!zend_ast_is_special(ast)) { in find_implicit_binds_recursively()
7938 uint32_t i, children = zend_ast_get_num_children(ast); in find_implicit_binds_recursively()
7940 find_implicit_binds_recursively(info, ast->child[i]); in find_implicit_binds_recursively()
7988 static void zend_compile_closure_uses(zend_ast *ast) /* {{{ */ in zend_compile_closure_uses() argument
7991 zend_ast_list *list = zend_ast_get_list(ast); in zend_compile_closure_uses()
8244 znode *result, zend_ast *ast, enum func_decl_level level, in zend_compile_func_decl_ex() argument
8248 zend_ast_decl *decl = (zend_ast_decl *) ast; in zend_compile_func_decl_ex()
8367 if (ast->kind == ZEND_AST_ARROW_FUNC && decl->child[2]->kind != ZEND_AST_RETURN) { in zend_compile_func_decl_ex()
8419 static zend_op_array *zend_compile_func_decl(znode *result, zend_ast *ast, enum func_decl_level lev… in zend_compile_func_decl() argument
8421 …return zend_compile_func_decl_ex(result, ast, level, /* property_info */ NULL, (zend_property_hook… in zend_compile_func_decl()
8614 static void zend_compile_prop_decl(zend_ast *ast, zend_ast *type_ast, uint32_t flags, zend_ast *att… in zend_compile_prop_decl() argument
8616 zend_ast_list *list = zend_ast_get_list(ast); in zend_compile_prop_decl()
8756 static void zend_compile_prop_group(zend_ast *ast) /* {{{ */ in zend_compile_prop_group() argument
8758 zend_ast *type_ast = ast->child[0]; in zend_compile_prop_group()
8759 zend_ast *prop_ast = ast->child[1]; in zend_compile_prop_group()
8760 zend_ast *attr_ast = ast->child[2]; in zend_compile_prop_group()
8762 zend_compile_prop_decl(prop_ast, type_ast, ast->attr, attr_ast); in zend_compile_prop_group()
8776 static void zend_compile_class_const_decl(zend_ast *ast, uint32_t flags, zend_ast *attr_ast, zend_a… in zend_compile_class_const_decl() argument
8778 zend_ast_list *list = zend_ast_get_list(ast); in zend_compile_class_const_decl()
8836 static void zend_compile_class_const_group(zend_ast *ast) /* {{{ */ in zend_compile_class_const_group() argument
8838 zend_ast *const_ast = ast->child[0]; in zend_compile_class_const_group()
8839 zend_ast *attr_ast = ast->child[1]; in zend_compile_class_const_group()
8840 zend_ast *type_ast = ast->child[2]; in zend_compile_class_const_group()
8842 zend_compile_class_const_decl(const_ast, ast->attr, attr_ast, type_ast); in zend_compile_class_const_group()
8846 static void zend_compile_method_ref(zend_ast *ast, zend_trait_method_reference *method_ref) /* {{{ … in zend_compile_method_ref() argument
8848 zend_ast *class_ast = ast->child[0]; in zend_compile_method_ref()
8849 zend_ast *method_ast = ast->child[1]; in zend_compile_method_ref()
8861 static void zend_compile_trait_precedence(zend_ast *ast) /* {{{ */ in zend_compile_trait_precedence() argument
8863 zend_ast *method_ref_ast = ast->child[0]; in zend_compile_trait_precedence()
8864 zend_ast *insteadof_ast = ast->child[1]; in zend_compile_trait_precedence()
8882 static void zend_compile_trait_alias(zend_ast *ast) /* {{{ */ in zend_compile_trait_alias() argument
8884 zend_ast *method_ref_ast = ast->child[0]; in zend_compile_trait_alias()
8885 zend_ast *alias_ast = ast->child[1]; in zend_compile_trait_alias()
8886 uint32_t modifiers = ast->attr; in zend_compile_trait_alias()
8906 static void zend_compile_use_trait(zend_ast *ast) /* {{{ */ in zend_compile_use_trait() argument
8908 zend_ast_list *traits = zend_ast_get_list(ast->child[0]); in zend_compile_use_trait()
8909 zend_ast_list *adaptations = ast->child[1] ? zend_ast_get_list(ast->child[1]) : NULL; in zend_compile_use_trait()
8949 static void zend_compile_implements(zend_ast *ast) /* {{{ */ in zend_compile_implements() argument
8951 zend_ast_list *list = zend_ast_get_list(ast); in zend_compile_implements()
9010 static void zend_compile_class_decl(znode *result, zend_ast *ast, bool toplevel) /* {{{ */ in zend_compile_class_decl() argument
9012 zend_ast_decl *decl = (zend_ast_decl *) ast; in zend_compile_class_decl()
9119 CG(zend_lineno) = ast->lineno; in zend_compile_class_decl()
9229 static void zend_compile_enum_case(zend_ast *ast) in zend_compile_enum_case() argument
9236 zend_string *enum_case_name = zval_make_interned_string(zend_ast_get_zval(ast->child[0])); in zend_compile_enum_case()
9247 zend_ast *case_value_ast = ast->child[1]; in zend_compile_enum_case()
9249 ast->child[1] = NULL; in zend_compile_enum_case()
9266 zend_ast *doc_comment_ast = ast->child[2]; in zend_compile_enum_case()
9276 zend_ast *attr_ast = ast->child[3]; in zend_compile_enum_case()
9343 static void zend_compile_use(zend_ast *ast) /* {{{ */ in zend_compile_use() argument
9345 zend_ast_list *list = zend_ast_get_list(ast); in zend_compile_use()
9348 uint32_t type = ast->attr; in zend_compile_use()
9416 static void zend_compile_group_use(zend_ast *ast) /* {{{ */ in zend_compile_group_use() argument
9419 zend_string *ns = zend_ast_get_str(ast->child[0]); in zend_compile_group_use()
9420 zend_ast_list *list = zend_ast_get_list(ast->child[1]); in zend_compile_group_use()
9430 inline_use->attr = ast->attr ? ast->attr : use->attr; in zend_compile_group_use()
9436 static void zend_compile_const_decl(zend_ast *ast) /* {{{ */ in zend_compile_const_decl() argument
9438 zend_ast_list *list = zend_ast_get_list(ast); in zend_compile_const_decl()
9479 static void zend_compile_namespace(zend_ast *ast) /* {{{ */ in zend_compile_namespace() argument
9481 zend_ast *name_ast = ast->child[0]; in zend_compile_namespace()
9482 zend_ast *stmt_ast = ast->child[1]; in zend_compile_namespace()
9507 if (is_first_namespace && FAILURE == zend_is_first_statement(ast, /* allow_nop */ 1)) { in zend_compile_namespace()
9542 static void zend_compile_halt_compiler(zend_ast *ast) /* {{{ */ in zend_compile_halt_compiler() argument
9544 zend_ast *offset_ast = ast->child[0]; in zend_compile_halt_compiler()
9564 static bool zend_try_ct_eval_magic_const(zval *zv, zend_ast *ast) /* {{{ */ in zend_try_ct_eval_magic_const() argument
9569 switch (ast->attr) { in zend_try_ct_eval_magic_const()
9571 ZVAL_LONG(zv, ast->lineno); in zend_try_ct_eval_magic_const()
9804 static bool zend_try_ct_eval_array(zval *result, zend_ast *ast) /* {{{ */ in zend_try_ct_eval_array() argument
9806 zend_ast_list *list = zend_ast_get_list(ast); in zend_try_ct_eval_array()
9811 if (ast->attr == ZEND_ARRAY_SYNTAX_LIST) { in zend_try_ct_eval_array()
9932 static void zend_compile_binary_op(znode *result, zend_ast *ast) /* {{{ */ in zend_compile_binary_op() argument
9934 zend_ast *left_ast = ast->child[0]; in zend_compile_binary_op()
9935 zend_ast *right_ast = ast->child[1]; in zend_compile_binary_op()
9936 uint32_t opcode = ast->attr; in zend_compile_binary_op()
10025 static void zend_compile_greater(znode *result, zend_ast *ast) /* {{{ */ in zend_compile_greater() argument
10027 zend_ast *left_ast = ast->child[0]; in zend_compile_greater()
10028 zend_ast *right_ast = ast->child[1]; in zend_compile_greater()
10031 ZEND_ASSERT(ast->kind == ZEND_AST_GREATER || ast->kind == ZEND_AST_GREATER_EQUAL); in zend_compile_greater()
10038 zend_ct_eval_greater(&result->u.constant, ast->kind, in zend_compile_greater()
10046 ast->kind == ZEND_AST_GREATER ? ZEND_IS_SMALLER : ZEND_IS_SMALLER_OR_EQUAL, in zend_compile_greater()
10051 static void zend_compile_unary_op(znode *result, zend_ast *ast) /* {{{ */ in zend_compile_unary_op() argument
10053 zend_ast *expr_ast = ast->child[0]; in zend_compile_unary_op()
10054 uint32_t opcode = ast->attr; in zend_compile_unary_op()
10070 static void zend_compile_unary_pm(znode *result, zend_ast *ast) /* {{{ */ in zend_compile_unary_pm() argument
10072 zend_ast *expr_ast = ast->child[0]; in zend_compile_unary_pm()
10075 ZEND_ASSERT(ast->kind == ZEND_AST_UNARY_PLUS || ast->kind == ZEND_AST_UNARY_MINUS); in zend_compile_unary_pm()
10080 && zend_try_ct_eval_unary_pm(&result->u.constant, ast->kind, &expr_node.u.constant)) { in zend_compile_unary_pm()
10087 ZVAL_LONG(&right_node.u.constant, (ast->kind == ZEND_AST_UNARY_PLUS) ? 1 : -1); in zend_compile_unary_pm()
10092 static void zend_compile_short_circuiting(znode *result, zend_ast *ast) /* {{{ */ in zend_compile_short_circuiting() argument
10094 zend_ast *left_ast = ast->child[0]; in zend_compile_short_circuiting()
10095 zend_ast *right_ast = ast->child[1]; in zend_compile_short_circuiting()
10101 ZEND_ASSERT(ast->kind == ZEND_AST_AND || ast->kind == ZEND_AST_OR); in zend_compile_short_circuiting()
10106 if ((ast->kind == ZEND_AST_AND && !zend_is_true(&left_node.u.constant)) in zend_compile_short_circuiting()
10107 || (ast->kind == ZEND_AST_OR && zend_is_true(&left_node.u.constant))) { in zend_compile_short_circuiting()
10128 opline_jmpz = zend_emit_op(NULL, ast->kind == ZEND_AST_AND ? ZEND_JMPZ_EX : ZEND_JMPNZ_EX, in zend_compile_short_circuiting()
10147 static void zend_compile_post_incdec(znode *result, zend_ast *ast) /* {{{ */ in zend_compile_post_incdec() argument
10149 zend_ast *var_ast = ast->child[0]; in zend_compile_post_incdec()
10150 ZEND_ASSERT(ast->kind == ZEND_AST_POST_INC || ast->kind == ZEND_AST_POST_DEC); in zend_compile_post_incdec()
10156 opline->opcode = ast->kind == ZEND_AST_POST_INC ? ZEND_POST_INC_OBJ : ZEND_POST_DEC_OBJ; in zend_compile_post_incdec()
10160 …opline->opcode = ast->kind == ZEND_AST_POST_INC ? ZEND_POST_INC_STATIC_PROP : ZEND_POST_DEC_STATIC… in zend_compile_post_incdec()
10168 zend_emit_op_tmp(result, ast->kind == ZEND_AST_POST_INC ? ZEND_POST_INC : ZEND_POST_DEC, in zend_compile_post_incdec()
10174 static void zend_compile_pre_incdec(znode *result, zend_ast *ast) /* {{{ */ in zend_compile_pre_incdec() argument
10176 zend_ast *var_ast = ast->child[0]; in zend_compile_pre_incdec()
10177 ZEND_ASSERT(ast->kind == ZEND_AST_PRE_INC || ast->kind == ZEND_AST_PRE_DEC); in zend_compile_pre_incdec()
10183 opline->opcode = ast->kind == ZEND_AST_PRE_INC ? ZEND_PRE_INC_OBJ : ZEND_PRE_DEC_OBJ; in zend_compile_pre_incdec()
10188 …opline->opcode = ast->kind == ZEND_AST_PRE_INC ? ZEND_PRE_INC_STATIC_PROP : ZEND_PRE_DEC_STATIC_PR… in zend_compile_pre_incdec()
10197 zend_emit_op_tmp(result, ast->kind == ZEND_AST_PRE_INC ? ZEND_PRE_INC : ZEND_PRE_DEC, in zend_compile_pre_incdec()
10203 static void zend_compile_cast(znode *result, zend_ast *ast) /* {{{ */ in zend_compile_cast() argument
10205 zend_ast *expr_ast = ast->child[0]; in zend_compile_cast()
10211 if (ast->attr == _IS_BOOL) { in zend_compile_cast()
10213 } else if (ast->attr == IS_NULL) { in zend_compile_cast()
10217 opline->extended_value = ast->attr; in zend_compile_cast()
10222 static void zend_compile_shorthand_conditional(znode *result, zend_ast *ast) /* {{{ */ in zend_compile_shorthand_conditional() argument
10224 zend_ast *cond_ast = ast->child[0]; in zend_compile_shorthand_conditional()
10225 zend_ast *false_ast = ast->child[2]; in zend_compile_shorthand_conditional()
10231 ZEND_ASSERT(ast->child[1] == NULL); in zend_compile_shorthand_conditional()
10247 static void zend_compile_conditional(znode *result, zend_ast *ast) /* {{{ */ in zend_compile_conditional() argument
10249 zend_ast *cond_ast = ast->child[0]; in zend_compile_conditional()
10250 zend_ast *true_ast = ast->child[1]; in zend_compile_conditional()
10251 zend_ast *false_ast = ast->child[2]; in zend_compile_conditional()
10282 zend_compile_shorthand_conditional(result, ast); in zend_compile_conditional()
10307 static void zend_compile_coalesce(znode *result, zend_ast *ast) /* {{{ */ in zend_compile_coalesce() argument
10309 zend_ast *expr_ast = ast->child[0]; in zend_compile_coalesce()
10310 zend_ast *default_ast = ast->child[1]; in zend_compile_coalesce()
10339 static void zend_compile_assign_coalesce(znode *result, zend_ast *ast) /* {{{ */ in zend_compile_assign_coalesce() argument
10341 zend_ast *var_ast = ast->child[0]; in zend_compile_assign_coalesce()
10342 zend_ast *default_ast = ast->child[1]; in zend_compile_assign_coalesce()
10442 static void zend_compile_print(znode *result, zend_ast *ast) /* {{{ */ in zend_compile_print() argument
10445 zend_ast *expr_ast = ast->child[0]; in zend_compile_print()
10458 static void zend_compile_yield(znode *result, zend_ast *ast) /* {{{ */ in zend_compile_yield() argument
10460 zend_ast *value_ast = ast->child[0]; in zend_compile_yield()
10461 zend_ast *key_ast = ast->child[1]; in zend_compile_yield()
10493 static void zend_compile_yield_from(znode *result, zend_ast *ast) /* {{{ */ in zend_compile_yield_from() argument
10495 zend_ast *expr_ast = ast->child[0]; in zend_compile_yield_from()
10510 static void zend_compile_instanceof(znode *result, zend_ast *ast) /* {{{ */ in zend_compile_instanceof() argument
10512 zend_ast *obj_ast = ast->child[0]; in zend_compile_instanceof()
10513 zend_ast *class_ast = ast->child[1]; in zend_compile_instanceof()
10542 static void zend_compile_include_or_eval(znode *result, zend_ast *ast) /* {{{ */ in zend_compile_include_or_eval() argument
10544 zend_ast *expr_ast = ast->child[0]; in zend_compile_include_or_eval()
10552 opline->extended_value = ast->attr; in zend_compile_include_or_eval()
10558 static void zend_compile_isset_or_empty(znode *result, zend_ast *ast) /* {{{ */ in zend_compile_isset_or_empty() argument
10560 zend_ast *var_ast = ast->child[0]; in zend_compile_isset_or_empty()
10565 ZEND_ASSERT(ast->kind == ZEND_AST_ISSET || ast->kind == ZEND_AST_EMPTY); in zend_compile_isset_or_empty()
10568 if (ast->kind == ZEND_AST_EMPTY) { in zend_compile_isset_or_empty()
10582 ZVAL_BOOL(&result->u.constant, ast->kind == ZEND_AST_ISSET); in zend_compile_isset_or_empty()
10598 ZEND_FETCH_GLOBAL | (ast->kind == ZEND_AST_EMPTY ? ZEND_ISEMPTY : 0); in zend_compile_isset_or_empty()
10632 if (!(ast->kind == ZEND_AST_ISSET)) { in zend_compile_isset_or_empty()
10638 static void zend_compile_silence(znode *result, zend_ast *ast) /* {{{ */ in zend_compile_silence() argument
10640 zend_ast *expr_ast = ast->child[0]; in zend_compile_silence()
10657 static void zend_compile_shell_exec(znode *result, zend_ast *ast) /* {{{ */ in zend_compile_shell_exec() argument
10659 zend_ast *expr_ast = ast->child[0]; in zend_compile_shell_exec()
10675 static void zend_compile_array(znode *result, zend_ast *ast) /* {{{ */ in zend_compile_array() argument
10677 zend_ast_list *list = zend_ast_get_list(ast); in zend_compile_array()
10682 if (zend_try_ct_eval_array(&result->u.constant, ast)) { in zend_compile_array()
10754 static void zend_compile_const(znode *result, zend_ast *ast) /* {{{ */ in zend_compile_const() argument
10756 zend_ast *name_ast = ast->child[0]; in zend_compile_const()
10765 zend_ast *last = CG(ast); in zend_compile_const()
10804 static void zend_compile_class_const(znode *result, zend_ast *ast) /* {{{ */ in zend_compile_class_const() argument
10811 zend_eval_const_expr(&ast->child[0]); in zend_compile_class_const()
10812 zend_eval_const_expr(&ast->child[1]); in zend_compile_class_const()
10814 class_ast = ast->child[0]; in zend_compile_class_const()
10815 const_ast = ast->child[1]; in zend_compile_class_const()
10845 static void zend_compile_class_name(znode *result, zend_ast *ast) /* {{{ */ in zend_compile_class_name() argument
10847 zend_ast *class_ast = ast->child[0]; in zend_compile_class_name()
10961 static void zend_compile_encaps_list(znode *result, zend_ast *ast) /* {{{ */ in zend_compile_encaps_list() argument
10967 zend_ast_list *list = zend_ast_get_list(ast); in zend_compile_encaps_list()
11040 static void zend_compile_magic_const(znode *result, zend_ast *ast) /* {{{ */ in zend_compile_magic_const() argument
11044 if (zend_try_ct_eval_magic_const(&result->u.constant, ast)) { in zend_compile_magic_const()
11049 ZEND_ASSERT(ast->attr == T_CLASS_C && in zend_compile_magic_const()
11081 zend_ast *ast = *ast_ptr; in zend_compile_const_expr_class_const() local
11082 zend_ast *class_ast = ast->child[0]; in zend_compile_const_expr_class_const()
11113 ast->attr |= ZEND_FETCH_CLASS_EXCEPTION; in zend_compile_const_expr_class_const()
11119 zend_ast *ast = *ast_ptr; in zend_compile_const_expr_class_name() local
11120 zend_ast *class_ast = ast->child[0]; in zend_compile_const_expr_class_name()
11134 ast->child[0] = NULL; in zend_compile_const_expr_class_name()
11135 ast->attr = fetch_type; in zend_compile_const_expr_class_name()
11147 zend_ast *ast = *ast_ptr; in zend_compile_const_expr_const() local
11148 zend_ast *name_ast = ast->child[0]; in zend_compile_const_expr_const()
11154 CG(zend_lineno) = zend_ast_get_lineno(ast); in zend_compile_const_expr_const()
11161 zend_ast_destroy(ast); in zend_compile_const_expr_const()
11166 zend_ast_destroy(ast); in zend_compile_const_expr_const()
11174 zend_ast *ast = *ast_ptr; in zend_compile_const_expr_magic_const() local
11177 ZEND_ASSERT(ast->attr == T_CLASS_C); in zend_compile_const_expr_magic_const()
11179 zend_ast_destroy(ast); in zend_compile_const_expr_magic_const()
11262 zend_ast *ast = *ast_ptr; in zend_compile_const_expr() local
11263 if (ast == NULL || ast->kind == ZEND_AST_ZVAL) { in zend_compile_const_expr()
11267 if (!zend_is_allowed_in_const_expr(ast->kind)) { in zend_compile_const_expr()
11271 switch (ast->kind) { in zend_compile_const_expr()
11299 zend_ast_apply(ast, zend_compile_const_expr, context); in zend_compile_const_expr()
11322 void zend_compile_top_stmt(zend_ast *ast) /* {{{ */ in zend_compile_top_stmt() argument
11324 if (!ast) { in zend_compile_top_stmt()
11328 if (ast->kind == ZEND_AST_STMT_LIST) { in zend_compile_top_stmt()
11329 zend_ast_list *list = zend_ast_get_list(ast); in zend_compile_top_stmt()
11337 if (ast->kind == ZEND_AST_FUNC_DECL) { in zend_compile_top_stmt()
11338 CG(zend_lineno) = ast->lineno; in zend_compile_top_stmt()
11339 zend_compile_func_decl(NULL, ast, FUNC_DECL_LEVEL_TOPLEVEL); in zend_compile_top_stmt()
11340 CG(zend_lineno) = ((zend_ast_decl *) ast)->end_lineno; in zend_compile_top_stmt()
11341 } else if (ast->kind == ZEND_AST_CLASS) { in zend_compile_top_stmt()
11342 CG(zend_lineno) = ast->lineno; in zend_compile_top_stmt()
11343 zend_compile_class_decl(NULL, ast, 1); in zend_compile_top_stmt()
11344 CG(zend_lineno) = ((zend_ast_decl *) ast)->end_lineno; in zend_compile_top_stmt()
11346 zend_compile_stmt(ast); in zend_compile_top_stmt()
11348 if (ast->kind != ZEND_AST_NAMESPACE && ast->kind != ZEND_AST_HALT_COMPILER) { in zend_compile_top_stmt()
11354 static void zend_compile_stmt(zend_ast *ast) /* {{{ */ in zend_compile_stmt() argument
11356 if (!ast) { in zend_compile_stmt()
11360 CG(zend_lineno) = ast->lineno; in zend_compile_stmt()
11362 if ((CG(compiler_options) & ZEND_COMPILE_EXTENDED_STMT) && !zend_is_unticked_stmt(ast)) { in zend_compile_stmt()
11366 switch (ast->kind) { in zend_compile_stmt()
11368 zend_compile_stmt_list(ast); in zend_compile_stmt()
11371 zend_compile_global_var(ast); in zend_compile_stmt()
11374 zend_compile_static_var(ast); in zend_compile_stmt()
11377 zend_compile_unset(ast); in zend_compile_stmt()
11380 zend_compile_return(ast); in zend_compile_stmt()
11383 zend_compile_echo(ast); in zend_compile_stmt()
11387 zend_compile_break_continue(ast); in zend_compile_stmt()
11390 zend_compile_goto(ast); in zend_compile_stmt()
11393 zend_compile_label(ast); in zend_compile_stmt()
11396 zend_compile_while(ast); in zend_compile_stmt()
11399 zend_compile_do_while(ast); in zend_compile_stmt()
11402 zend_compile_for(ast); in zend_compile_stmt()
11405 zend_compile_foreach(ast); in zend_compile_stmt()
11408 zend_compile_if(ast); in zend_compile_stmt()
11411 zend_compile_switch(ast); in zend_compile_stmt()
11414 zend_compile_try(ast); in zend_compile_stmt()
11417 zend_compile_declare(ast); in zend_compile_stmt()
11421 zend_compile_func_decl(NULL, ast, FUNC_DECL_LEVEL_NESTED); in zend_compile_stmt()
11424 zend_compile_enum_case(ast); in zend_compile_stmt()
11427 zend_compile_prop_group(ast); in zend_compile_stmt()
11430 zend_compile_class_const_group(ast); in zend_compile_stmt()
11433 zend_compile_use_trait(ast); in zend_compile_stmt()
11436 zend_compile_class_decl(NULL, ast, 0); in zend_compile_stmt()
11439 zend_compile_group_use(ast); in zend_compile_stmt()
11442 zend_compile_use(ast); in zend_compile_stmt()
11445 zend_compile_const_decl(ast); in zend_compile_stmt()
11448 zend_compile_namespace(ast); in zend_compile_stmt()
11451 zend_compile_halt_compiler(ast); in zend_compile_stmt()
11454 zend_compile_expr(NULL, ast); in zend_compile_stmt()
11459 zend_compile_expr(&result, ast); in zend_compile_stmt()
11464 if (FC(declarables).ticks && !zend_is_unticked_stmt(ast)) { in zend_compile_stmt()
11470 static void zend_compile_expr_inner(znode *result, zend_ast *ast) /* {{{ */ in zend_compile_expr_inner() argument
11473 CG(zend_lineno) = zend_ast_get_lineno(ast); in zend_compile_expr_inner()
11476 zend_compile_memoized_expr(result, ast); in zend_compile_expr_inner()
11480 switch (ast->kind) { in zend_compile_expr_inner()
11482 ZVAL_COPY(&result->u.constant, zend_ast_get_zval(ast)); in zend_compile_expr_inner()
11486 *result = *zend_ast_get_znode(ast); in zend_compile_expr_inner()
11498 zend_compile_var(result, ast, BP_VAR_R, 0); in zend_compile_expr_inner()
11501 zend_compile_assign(result, ast); in zend_compile_expr_inner()
11504 zend_compile_assign_ref(result, ast); in zend_compile_expr_inner()
11507 zend_compile_new(result, ast); in zend_compile_expr_inner()
11510 zend_compile_clone(result, ast); in zend_compile_expr_inner()
11513 zend_compile_compound_assign(result, ast); in zend_compile_expr_inner()
11516 zend_compile_binary_op(result, ast); in zend_compile_expr_inner()
11520 zend_compile_greater(result, ast); in zend_compile_expr_inner()
11523 zend_compile_unary_op(result, ast); in zend_compile_expr_inner()
11527 zend_compile_unary_pm(result, ast); in zend_compile_expr_inner()
11531 zend_compile_short_circuiting(result, ast); in zend_compile_expr_inner()
11535 zend_compile_post_incdec(result, ast); in zend_compile_expr_inner()
11539 zend_compile_pre_incdec(result, ast); in zend_compile_expr_inner()
11542 zend_compile_cast(result, ast); in zend_compile_expr_inner()
11545 zend_compile_conditional(result, ast); in zend_compile_expr_inner()
11548 zend_compile_coalesce(result, ast); in zend_compile_expr_inner()
11551 zend_compile_assign_coalesce(result, ast); in zend_compile_expr_inner()
11554 zend_compile_print(result, ast); in zend_compile_expr_inner()
11557 zend_compile_yield(result, ast); in zend_compile_expr_inner()
11560 zend_compile_yield_from(result, ast); in zend_compile_expr_inner()
11563 zend_compile_instanceof(result, ast); in zend_compile_expr_inner()
11566 zend_compile_include_or_eval(result, ast); in zend_compile_expr_inner()
11570 zend_compile_isset_or_empty(result, ast); in zend_compile_expr_inner()
11573 zend_compile_silence(result, ast); in zend_compile_expr_inner()
11576 zend_compile_shell_exec(result, ast); in zend_compile_expr_inner()
11579 zend_compile_array(result, ast); in zend_compile_expr_inner()
11582 zend_compile_const(result, ast); in zend_compile_expr_inner()
11585 zend_compile_class_const(result, ast); in zend_compile_expr_inner()
11588 zend_compile_class_name(result, ast); in zend_compile_expr_inner()
11591 zend_compile_encaps_list(result, ast); in zend_compile_expr_inner()
11594 zend_compile_magic_const(result, ast); in zend_compile_expr_inner()
11598 zend_compile_func_decl(result, ast, FUNC_DECL_LEVEL_NESTED); in zend_compile_expr_inner()
11601 zend_compile_throw(result, ast); in zend_compile_expr_inner()
11604 zend_compile_match(result, ast); in zend_compile_expr_inner()
11612 static void zend_compile_expr(znode *result, zend_ast *ast) in zend_compile_expr() argument
11617 zend_compile_expr_inner(result, ast); in zend_compile_expr()
11618 zend_short_circuiting_commit(checkpoint, result, ast); in zend_compile_expr()
11621 static zend_op *zend_compile_var_inner(znode *result, zend_ast *ast, uint32_t type, bool by_ref) in zend_compile_var_inner() argument
11623 CG(zend_lineno) = zend_ast_get_lineno(ast); in zend_compile_var_inner()
11626 switch (ast->kind) { in zend_compile_var_inner()
11631 zend_compile_memoized_expr(result, ast); in zend_compile_var_inner()
11637 switch (ast->kind) { in zend_compile_var_inner()
11639 return zend_compile_simple_var(result, ast, type, 0); in zend_compile_var_inner()
11641 return zend_compile_dim(result, ast, type, by_ref); in zend_compile_var_inner()
11644 return zend_compile_prop(result, ast, type, by_ref); in zend_compile_var_inner()
11646 return zend_compile_static_prop(result, ast, type, by_ref, 0); in zend_compile_var_inner()
11648 zend_compile_call(result, ast, type); in zend_compile_var_inner()
11651 zend_compile_parent_property_hook_call(result, ast, type); in zend_compile_var_inner()
11655 zend_compile_method_call(result, ast, type); in zend_compile_var_inner()
11658 zend_compile_static_call(result, ast, type); in zend_compile_var_inner()
11661 *result = *zend_ast_get_znode(ast); in zend_compile_var_inner()
11669 zend_compile_expr(result, ast); in zend_compile_var_inner()
11674 static zend_op *zend_compile_var(znode *result, zend_ast *ast, uint32_t type, bool by_ref) /* {{{ */ in zend_compile_var() argument
11677 zend_op *opcode = zend_compile_var_inner(result, ast, type, by_ref); in zend_compile_var()
11678 zend_short_circuiting_commit(checkpoint, result, ast); in zend_compile_var()
11682 static zend_op *zend_delayed_compile_var(znode *result, zend_ast *ast, uint32_t type, bool by_ref) … in zend_delayed_compile_var() argument
11684 switch (ast->kind) { in zend_delayed_compile_var()
11686 return zend_compile_simple_var(result, ast, type, 1); in zend_delayed_compile_var()
11688 return zend_delayed_compile_dim(result, ast, type, by_ref); in zend_delayed_compile_var()
11692 zend_op *opline = zend_delayed_compile_prop(result, ast, type); in zend_delayed_compile_var()
11699 return zend_compile_static_prop(result, ast, type, by_ref, 1); in zend_delayed_compile_var()
11701 return zend_compile_var(result, ast, type, 0); in zend_delayed_compile_var()
11708 zend_ast *ast = *ast_ptr; in zend_eval_const_expr() local
11711 if (!ast) { in zend_eval_const_expr()
11717 switch (ast->kind) { in zend_eval_const_expr()
11719 zend_eval_const_expr(&ast->child[0]); in zend_eval_const_expr()
11720 zend_eval_const_expr(&ast->child[1]); in zend_eval_const_expr()
11721 if (ast->child[0]->kind != ZEND_AST_ZVAL || ast->child[1]->kind != ZEND_AST_ZVAL) { in zend_eval_const_expr()
11725 if (!zend_try_ct_eval_binary_op(&result, ast->attr, in zend_eval_const_expr()
11726 zend_ast_get_zval(ast->child[0]), zend_ast_get_zval(ast->child[1])) in zend_eval_const_expr()
11733 zend_eval_const_expr(&ast->child[0]); in zend_eval_const_expr()
11734 zend_eval_const_expr(&ast->child[1]); in zend_eval_const_expr()
11735 if (ast->child[0]->kind != ZEND_AST_ZVAL || ast->child[1]->kind != ZEND_AST_ZVAL) { in zend_eval_const_expr()
11739 zend_ct_eval_greater(&result, ast->kind, in zend_eval_const_expr()
11740 zend_ast_get_zval(ast->child[0]), zend_ast_get_zval(ast->child[1])); in zend_eval_const_expr()
11746 zend_eval_const_expr(&ast->child[0]); in zend_eval_const_expr()
11747 zend_eval_const_expr(&ast->child[1]); in zend_eval_const_expr()
11748 if (ast->child[0]->kind != ZEND_AST_ZVAL) { in zend_eval_const_expr()
11752 child0_is_true = zend_is_true(zend_ast_get_zval(ast->child[0])); in zend_eval_const_expr()
11753 if (child0_is_true == (ast->kind == ZEND_AST_OR)) { in zend_eval_const_expr()
11754 ZVAL_BOOL(&result, ast->kind == ZEND_AST_OR); in zend_eval_const_expr()
11758 if (ast->child[1]->kind != ZEND_AST_ZVAL) { in zend_eval_const_expr()
11762 child1_is_true = zend_is_true(zend_ast_get_zval(ast->child[1])); in zend_eval_const_expr()
11763 if (ast->kind == ZEND_AST_OR) { in zend_eval_const_expr()
11771 zend_eval_const_expr(&ast->child[0]); in zend_eval_const_expr()
11772 if (ast->child[0]->kind != ZEND_AST_ZVAL) { in zend_eval_const_expr()
11776 if (!zend_try_ct_eval_unary_op(&result, ast->attr, zend_ast_get_zval(ast->child[0]))) { in zend_eval_const_expr()
11782 zend_eval_const_expr(&ast->child[0]); in zend_eval_const_expr()
11783 if (ast->child[0]->kind != ZEND_AST_ZVAL) { in zend_eval_const_expr()
11787 if (!zend_try_ct_eval_unary_pm(&result, ast->kind, zend_ast_get_zval(ast->child[0]))) { in zend_eval_const_expr()
11793 if (ast->child[0]->kind == ZEND_AST_DIM) { in zend_eval_const_expr()
11794 ast->child[0]->attr |= ZEND_DIM_IS; in zend_eval_const_expr()
11796 zend_eval_const_expr(&ast->child[0]); in zend_eval_const_expr()
11798 if (ast->child[0]->kind != ZEND_AST_ZVAL) { in zend_eval_const_expr()
11800 zend_eval_const_expr(&ast->child[1]); in zend_eval_const_expr()
11804 if (Z_TYPE_P(zend_ast_get_zval(ast->child[0])) == IS_NULL) { in zend_eval_const_expr()
11805 zend_eval_const_expr(&ast->child[1]); in zend_eval_const_expr()
11806 *ast_ptr = ast->child[1]; in zend_eval_const_expr()
11807 ast->child[1] = NULL; in zend_eval_const_expr()
11808 zend_ast_destroy(ast); in zend_eval_const_expr()
11810 *ast_ptr = ast->child[0]; in zend_eval_const_expr()
11811 ast->child[0] = NULL; in zend_eval_const_expr()
11812 zend_ast_destroy(ast); in zend_eval_const_expr()
11818 zend_eval_const_expr(&ast->child[0]); in zend_eval_const_expr()
11819 if (ast->child[0]->kind != ZEND_AST_ZVAL) { in zend_eval_const_expr()
11821 if (ast->child[1]) { in zend_eval_const_expr()
11822 zend_eval_const_expr(&ast->child[1]); in zend_eval_const_expr()
11824 zend_eval_const_expr(&ast->child[2]); in zend_eval_const_expr()
11828 child = &ast->child[2 - zend_is_true(zend_ast_get_zval(ast->child[0]))]; in zend_eval_const_expr()
11834 zend_ast_destroy(ast); in zend_eval_const_expr()
11844 if (ast->child[1] == NULL) { in zend_eval_const_expr()
11849 if ((ast->attr & ZEND_DIM_IS) && ast->child[0]->kind == ZEND_AST_DIM) { in zend_eval_const_expr()
11850 ast->child[0]->attr |= ZEND_DIM_IS; in zend_eval_const_expr()
11853 zend_eval_const_expr(&ast->child[0]); in zend_eval_const_expr()
11854 zend_eval_const_expr(&ast->child[1]); in zend_eval_const_expr()
11855 if (ast->child[0]->kind != ZEND_AST_ZVAL || ast->child[1]->kind != ZEND_AST_ZVAL) { in zend_eval_const_expr()
11859 container = zend_ast_get_zval(ast->child[0]); in zend_eval_const_expr()
11860 dim = zend_ast_get_zval(ast->child[1]); in zend_eval_const_expr()
11902 if (!zend_try_ct_eval_array(&result, ast)) { in zend_eval_const_expr()
11907 if (!zend_try_ct_eval_magic_const(&result, ast)) { in zend_eval_const_expr()
11913 zend_ast *name_ast = ast->child[0]; in zend_eval_const_expr()
11932 zend_eval_const_expr(&ast->child[0]); in zend_eval_const_expr()
11933 zend_eval_const_expr(&ast->child[1]); in zend_eval_const_expr()
11935 if (UNEXPECTED(ast->child[1]->kind != ZEND_AST_ZVAL in zend_eval_const_expr()
11936 || Z_TYPE_P(zend_ast_get_zval(ast->child[1])) != IS_STRING)) { in zend_eval_const_expr()
11940 class_ast = ast->child[0]; in zend_eval_const_expr()
11941 name_ast = ast->child[1]; in zend_eval_const_expr()
11958 zend_ast *class_ast = ast->child[0]; in zend_eval_const_expr()
11970 zend_ast_list *list = zend_ast_get_list(ast); in zend_eval_const_expr()
11977 zend_eval_const_expr(&ast->child[0]); in zend_eval_const_expr()
11978 zend_eval_const_expr(&ast->child[1]); in zend_eval_const_expr()
11981 zend_eval_const_expr(&ast->child[1]); in zend_eval_const_expr()
11984 zend_eval_const_expr(&ast->child[2]); in zend_eval_const_expr()
11988 zend_eval_const_expr(&ast->child[0]); in zend_eval_const_expr()
11989 zend_eval_const_expr(&ast->child[1]); in zend_eval_const_expr()
11995 zend_ast_destroy(ast); in zend_eval_const_expr()