Remove do_bind_inherited_class; use do_bind_class

Pass NULL as the second parameter. I don't know if in the past these
differed more, but there isn't any point to having both of them
anymore.
This commit is contained in:
Levi Morrison 2018-11-06 18:39:22 -07:00 committed by Nikita Popov
parent b7b3a65e1d
commit 74d15b535a
4 changed files with 9 additions and 34 deletions

View File

@ -1073,31 +1073,7 @@ ZEND_API int do_bind_function(zval *lcname) /* {{{ */
}
/* }}} */
ZEND_API int do_bind_class(zval *lcname) /* {{{ */
{
zend_class_entry *ce;
zval *rtd_key, *zv;
rtd_key = lcname + 1;
zv = zend_hash_find_ex(EG(class_table), Z_STR_P(rtd_key), 1);
if (UNEXPECTED(!zv)) {
zend_error_noreturn(E_COMPILE_ERROR, "Cannot declare %s, because the name is already in use", Z_STRVAL_P(lcname));
return FAILURE;
}
ce = (zend_class_entry*)Z_PTR_P(zv);
zv = zend_hash_set_bucket_key(EG(class_table), (Bucket*)zv, Z_STR_P(lcname));
if (UNEXPECTED(!zv)) {
zend_error_noreturn(E_COMPILE_ERROR, "Cannot declare %s %s, because the name is already in use", zend_get_object_type(ce), ZSTR_VAL(ce->name));
return FAILURE;
}
zend_do_link_class(ce, NULL);
return SUCCESS;
}
/* }}} */
ZEND_API int do_bind_inherited_class(zval *lcname, zend_class_entry *parent_ce) /* {{{ */
ZEND_API int do_bind_class(zval *lcname, zend_class_entry *parent_ce) /* {{{ */
{
zend_class_entry *ce;
zval *rtd_key, *zv;
@ -1192,7 +1168,7 @@ ZEND_API void zend_do_delayed_early_binding(const zend_op_array *op_array, uint3
const zend_op *opline = &op_array->opcodes[opline_num];
zval *parent_name = RT_CONSTANT(opline, opline->op2);
if ((ce = zend_lookup_class_ex(Z_STR_P(parent_name), Z_STR_P(parent_name + 1), 0)) != NULL) {
do_bind_inherited_class(RT_CONSTANT(&op_array->opcodes[opline_num], op_array->opcodes[opline_num].op1), ce);
do_bind_class(RT_CONSTANT(&op_array->opcodes[opline_num], op_array->opcodes[opline_num].op1), ce);
}
opline_num = op_array->opcodes[opline_num].result.opline_num;
}

View File

@ -750,8 +750,7 @@ zend_bool zend_handle_encoding_declaration(zend_ast *ast);
void zend_do_free(znode *op1);
ZEND_API int do_bind_function(zval *lcname);
ZEND_API int do_bind_class(zval *lcname);
ZEND_API int do_bind_inherited_class(zval *lcname, zend_class_entry *parent_ce);
ZEND_API int do_bind_class(zval *lcname, zend_class_entry *parent_ce);
ZEND_API uint32_t zend_build_delayed_early_binding_list(const zend_op_array *op_array);
ZEND_API void zend_do_delayed_early_binding(const zend_op_array *op_array, uint32_t first_early_binding_opline);

View File

@ -6613,7 +6613,7 @@ ZEND_VM_HANDLER(139, ZEND_DECLARE_CLASS, CONST, ANY)
USE_OPLINE
SAVE_OPLINE();
do_bind_class(RT_CONSTANT(opline, opline->op1));
do_bind_class(RT_CONSTANT(opline, opline->op1), NULL);
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@ -6630,7 +6630,7 @@ ZEND_VM_HANDLER(140, ZEND_DECLARE_INHERITED_CLASS, CONST, CONST)
ZEND_ASSERT(EG(exception));
HANDLE_EXCEPTION();
}
do_bind_inherited_class(RT_CONSTANT(opline, opline->op1), parent);
do_bind_class(RT_CONSTANT(opline, opline->op1), parent);
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@ -6651,7 +6651,7 @@ ZEND_VM_HANDLER(145, ZEND_DECLARE_INHERITED_CLASS_DELAYED, CONST, CONST)
ZEND_ASSERT(EG(exception));
HANDLE_EXCEPTION();
}
do_bind_inherited_class(RT_CONSTANT(opline, opline->op1), parent);
do_bind_class(RT_CONSTANT(opline, opline->op1), parent);
}
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}

View File

@ -3544,7 +3544,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_DECLARE_CLASS_SPEC_CONST_HANDL
USE_OPLINE
SAVE_OPLINE();
do_bind_class(RT_CONSTANT(opline, opline->op1));
do_bind_class(RT_CONSTANT(opline, opline->op1), NULL);
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@ -5754,7 +5754,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_DECLARE_INHERITED_CLASS_SPEC_C
ZEND_ASSERT(EG(exception));
HANDLE_EXCEPTION();
}
do_bind_inherited_class(RT_CONSTANT(opline, opline->op1), parent);
do_bind_class(RT_CONSTANT(opline, opline->op1), parent);
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@ -5775,7 +5775,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_DECLARE_INHERITED_CLASS_DELAYE
ZEND_ASSERT(EG(exception));
HANDLE_EXCEPTION();
}
do_bind_inherited_class(RT_CONSTANT(opline, opline->op1), parent);
do_bind_class(RT_CONSTANT(opline, opline->op1), parent);
}
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}