}
/* }}} */
-void zend_resolve_non_class_name(znode *element_name, zend_bool *check_namespace, zend_bool case_sensitive, HashTable *current_import_sub TSRMLS_DC) /* {{{ */
+static zend_op *zend_emit_op_tmp(znode *result, zend_uchar opcode, znode *op1, znode *op2) /* {{{ */
{
- znode tmp;
- int len;
- zval **ns;
- char *lookup_name, *compound = memchr(Z_STRVAL(element_name->u.constant), '\\', Z_STRLEN(element_name->u.constant));
+ zend_op *opline = get_next_op(CG(active_op_array));
+ opline->opcode = opcode;
- if (Z_STRVAL(element_name->u.constant)[0] == '\\') {
- /* name starts with \ so it is known and unambiguos, nothing to do here but shorten it */
- memmove(Z_STRVAL(element_name->u.constant), Z_STRVAL(element_name->u.constant)+1, Z_STRLEN(element_name->u.constant));
- --Z_STRLEN(element_name->u.constant);
- return;
+ if (op1 == NULL) {
+ SET_UNUSED(opline->op1);
+ } else {
+ SET_NODE(opline->op1, op1);
}
- if(!*check_namespace) {
- return;
+ if (op2 == NULL) {
+ SET_UNUSED(opline->op2);
+ } else {
+ SET_NODE(opline->op2, op2);
}
- if (current_import_sub) {
- len = Z_STRLEN(element_name->u.constant)+1;
- if (case_sensitive) {
- lookup_name = estrndup(Z_STRVAL(element_name->u.constant), len);
- } else {
- lookup_name = zend_str_tolower_dup(Z_STRVAL(element_name->u.constant), len);
- }
- /* Check if function/const matches imported name */
- if (zend_hash_find(current_import_sub, lookup_name, len, (void**)&ns) == SUCCESS) {
- zval_dtor(&element_name->u.constant);
- element_name->u.constant = **ns;
- zval_copy_ctor(&element_name->u.constant);
- efree(lookup_name);
- *check_namespace = 0;
- return;
- }
- efree(lookup_name);
- }
-
- if (compound && CG(current_import)) {
- len = compound - Z_STRVAL(element_name->u.constant);
- /* namespace is always lowercase */
- lookup_name = zend_str_tolower_dup(Z_STRVAL(element_name->u.constant), len);
- /* Check if first part of compound name is an import name */
- if (zend_hash_find(CG(current_import), lookup_name, len+1, (void**)&ns) == SUCCESS) {
- /* Substitute import name */
- tmp.op_type = IS_CONST;
- tmp.u.constant = **ns;
- zval_copy_ctor(&tmp.u.constant);
- len += 1;
- Z_STRLEN(element_name->u.constant) -= len;
- memmove(Z_STRVAL(element_name->u.constant), Z_STRVAL(element_name->u.constant)+len, Z_STRLEN(element_name->u.constant)+1);
- zend_do_build_namespace_name(&tmp, &tmp, element_name TSRMLS_CC);
- *element_name = tmp;
- efree(lookup_name);
- *check_namespace = 0;
- return;
- }
- efree(lookup_name);
+ if (result) {
+ zend_make_tmp_result(result, opline);
}
- if (CG(current_namespace)) {
- tmp = *element_name;
- Z_STRLEN(tmp.u.constant) = sizeof("\\")-1 + Z_STRLEN(element_name->u.constant) + Z_STRLEN_P(CG(current_namespace));
- Z_STRVAL(tmp.u.constant) = (char *) emalloc(Z_STRLEN(tmp.u.constant)+1);
- memcpy(Z_STRVAL(tmp.u.constant), Z_STRVAL_P(CG(current_namespace)), Z_STRLEN_P(CG(current_namespace)));
- memcpy(&(Z_STRVAL(tmp.u.constant)[Z_STRLEN_P(CG(current_namespace))]), "\\", sizeof("\\")-1);
- memcpy(&(Z_STRVAL(tmp.u.constant)[Z_STRLEN_P(CG(current_namespace)) + sizeof("\\")-1]), Z_STRVAL(element_name->u.constant), Z_STRLEN(element_name->u.constant)+1);
- str_efree(Z_STRVAL(element_name->u.constant));
- *element_name = tmp;
+ return opline;
+}
+/* }}} */
+
+static void zend_emit_tick(void) /* {{{ */
+{
++ /* This prevents a double TICK generated by the parser statement of "declare()" */
++ if (CG(active_op_array)->last && CG(active_op_array)->opcodes[CG(active_op_array)->last - 1].opcode == ZEND_TICKS) {
++ return;
+ }
++
+ zend_op *opline = get_next_op(CG(active_op_array));
+
+ opline->opcode = ZEND_TICKS;
+ SET_UNUSED(opline->op1);
+ SET_UNUSED(opline->op2);
+ opline->extended_value = FC(declarables).ticks;
}
/* }}} */