mirror of
https://github.com/php/php-src.git
synced 2025-08-20 01:14:28 +02:00
Merge branch 'PHP-7.1'
This commit is contained in:
commit
a499cfc9cc
1 changed files with 26 additions and 0 deletions
|
@ -3412,6 +3412,22 @@ int zend_compile_func_typecheck(znode *result, zend_ast_list *args, uint32_t typ
|
|||
}
|
||||
/* }}} */
|
||||
|
||||
int zend_compile_func_cast(znode *result, zend_ast_list *args, uint32_t type) /* {{{ */
|
||||
{
|
||||
znode arg_node;
|
||||
zend_op *opline;
|
||||
|
||||
if (args->children != 1 || args->child[0]->kind == ZEND_AST_UNPACK) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
zend_compile_expr(&arg_node, args->child[0]);
|
||||
opline = zend_emit_op_tmp(result, ZEND_CAST, &arg_node, NULL);
|
||||
opline->extended_value = type;
|
||||
return SUCCESS;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
int zend_compile_func_defined(znode *result, zend_ast_list *args) /* {{{ */
|
||||
{
|
||||
zend_string *name;
|
||||
|
@ -3677,6 +3693,16 @@ int zend_try_compile_special_func(znode *result, zend_string *lcname, zend_ast_l
|
|||
return zend_compile_func_typecheck(result, args, IS_OBJECT);
|
||||
} else if (zend_string_equals_literal(lcname, "is_resource")) {
|
||||
return zend_compile_func_typecheck(result, args, IS_RESOURCE);
|
||||
} else if (zend_string_equals_literal(lcname, "boolval")) {
|
||||
return zend_compile_func_cast(result, args, _IS_BOOL);
|
||||
} else if (zend_string_equals_literal(lcname, "intval")) {
|
||||
return zend_compile_func_cast(result, args, IS_LONG);
|
||||
} else if (zend_string_equals_literal(lcname, "floatval")
|
||||
|| zend_string_equals_literal(lcname, "doubleval")
|
||||
) {
|
||||
return zend_compile_func_cast(result, args, IS_DOUBLE);
|
||||
} else if (zend_string_equals_literal(lcname, "strval")) {
|
||||
return zend_compile_func_cast(result, args, IS_STRING);
|
||||
} else if (zend_string_equals_literal(lcname, "defined")) {
|
||||
return zend_compile_func_defined(result, args);
|
||||
} else if (zend_string_equals_literal(lcname, "chr") && type == BP_VAR_R) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue