Remove unused parameter from zend_compile_typename()

The force_allow_null parameter is always false, therefore it is not needed. This simplification paves the road for deprecating implicitly nullable parameter types.
This commit is contained in:
Máté Kocsis 2023-12-24 14:14:35 +01:00
parent f1f33ee3a1
commit 012ec21def
No known key found for this signature in database
GPG key ID: FD055E41728BF310

View file

@ -6560,7 +6560,7 @@ static void zend_is_type_list_redundant_by_single_type(zend_type_list *type_list
}
}
static zend_type zend_compile_typename(zend_ast *ast, bool force_allow_null);
static zend_type zend_compile_typename(zend_ast *ast);
static zend_type zend_compile_typename_ex(
zend_ast *ast, bool force_allow_null, bool *forced_allow_null) /* {{{ */
@ -6601,7 +6601,7 @@ static zend_type zend_compile_typename_ex(
/* Mark type as list type */
ZEND_TYPE_SET_LIST(type, type_list);
single_type = zend_compile_typename(type_ast, false);
single_type = zend_compile_typename(type_ast);
ZEND_ASSERT(ZEND_TYPE_IS_INTERSECTION(single_type));
type_list->types[type_list->num_types++] = single_type;
@ -6788,10 +6788,10 @@ static zend_type zend_compile_typename_ex(
}
/* }}} */
static zend_type zend_compile_typename(zend_ast *ast, bool force_allow_null)
static zend_type zend_compile_typename(zend_ast *ast)
{
bool forced_allow_null;
return zend_compile_typename_ex(ast, force_allow_null, &forced_allow_null);
return zend_compile_typename_ex(ast, false, &forced_allow_null);
}
/* May convert value from int to float. */
@ -6937,8 +6937,7 @@ static void zend_compile_params(zend_ast *ast, zend_ast *return_type_ast, uint32
arg_infos = safe_emalloc(sizeof(zend_arg_info), list->children + 1, 0);
arg_infos->name = NULL;
if (return_type_ast) {
arg_infos->type = zend_compile_typename(
return_type_ast, /* force_allow_null */ 0);
arg_infos->type = zend_compile_typename(return_type_ast);
ZEND_TYPE_FULL_MASK(arg_infos->type) |= _ZEND_ARG_INFO_FLAGS(
(op_array->fn_flags & ZEND_ACC_RETURN_REFERENCE) != 0, /* is_variadic */ 0, /* is_tentative */ 0);
} else {
@ -7141,7 +7140,7 @@ static void zend_compile_params(zend_ast *ast, zend_ast *return_type_ast, uint32
/* Recompile the type, as it has different memory management requirements. */
zend_type type = ZEND_TYPE_INIT_NONE(0);
if (type_ast) {
type = zend_compile_typename(type_ast, /* force_allow_null */ 0);
type = zend_compile_typename(type_ast);
}
/* Don't give the property an explicit default value. For typed properties this means
@ -7715,7 +7714,7 @@ static void zend_compile_prop_decl(zend_ast *ast, zend_ast *type_ast, uint32_t f
zend_type type = ZEND_TYPE_INIT_NONE(0);
if (type_ast) {
type = zend_compile_typename(type_ast, /* force_allow_null */ 0);
type = zend_compile_typename(type_ast);
if (ZEND_TYPE_FULL_MASK(type) & (MAY_BE_VOID|MAY_BE_NEVER|MAY_BE_CALLABLE)) {
zend_string *str = zend_type_to_string(type);
@ -7830,7 +7829,7 @@ static void zend_compile_class_const_decl(zend_ast *ast, uint32_t flags, zend_as
zend_type type = ZEND_TYPE_INIT_NONE(0);
if (type_ast) {
type = zend_compile_typename(type_ast, /* force_allow_null */ 0);
type = zend_compile_typename(type_ast);
uint32_t type_mask = ZEND_TYPE_PURE_MASK(type);
@ -8023,7 +8022,7 @@ static zend_string *zend_generate_anon_class_name(zend_ast_decl *decl)
static void zend_compile_enum_backing_type(zend_class_entry *ce, zend_ast *enum_backing_type_ast)
{
ZEND_ASSERT(ce->ce_flags & ZEND_ACC_ENUM);
zend_type type = zend_compile_typename(enum_backing_type_ast, 0);
zend_type type = zend_compile_typename(enum_backing_type_ast);
uint32_t type_mask = ZEND_TYPE_PURE_MASK(type);
if (ZEND_TYPE_IS_COMPLEX(type) || (type_mask != MAY_BE_LONG && type_mask != MAY_BE_STRING)) {
zend_string *type_string = zend_type_to_string(type);