} else { \
Z_HASH_P(&CONSTANT(num)) = zend_hash_func(Z_STRVAL(CONSTANT(num)), Z_STRLEN(CONSTANT(num))+1); \
} \
- } while (0)
+ } while (0)
#define GET_CACHE_SLOT(literal) do { \
CG(active_op_array)->literals[literal].cache_slot = CG(active_op_array)->last_cache_slot++; \
if (variable->op_type == IS_CV) {
if (variable->u.op.var == CG(active_op_array)->this_var) {
zend_error(E_COMPILE_ERROR, "Cannot re-assign $this");
- }
+ }
} else if (variable->op_type == IS_VAR) {
int n = 0;
if (lvar->op_type == IS_CV) {
if (lvar->u.op.var == CG(active_op_array)->this_var) {
zend_error(E_COMPILE_ERROR, "Cannot re-assign $this");
- }
+ }
} else if (lvar->op_type == IS_VAR) {
int last_op_number = get_next_op_number(CG(active_op_array));
int last_op_number = get_next_op_number(CG(active_op_array));
zend_op *opline;
- if (last_op_number > 0) {
+ if (last_op_number > 0) {
zend_op *last_op = &CG(active_op_array)->opcodes[last_op_number-1];
if (last_op->opcode == ZEND_FETCH_OBJ_RW) {
variable->op_type = IS_CV;
variable->u.op.var = CG(active_op_array)->this_var;
}
- } else if (CG(active_op_array)->this_var == -1) {
+ } else if (CG(active_op_array)->this_var == -1) {
CG(active_op_array)->this_var = lookup_cv(CG(active_op_array), estrndup("this", sizeof("this")-1), sizeof("this")-1 TSRMLS_CC);
}
}
SET_UNUSED(current_op->op2);
SET_NODE(current_op->result, result);
if (is_static) {
- CG(active_op_array)->fn_flags |= ZEND_ACC_STATIC;
+ CG(active_op_array)->fn_flags |= ZEND_ACC_STATIC;
}
CG(active_op_array)->fn_flags |= ZEND_ACC_CLOSURE;
}
if (compound) {
/* This is a compound class name that contains namespace prefix */
if (Z_STRVAL(class_name->u.constant)[0] == '\\') {
- /* The STRING name has "\" prefix */
- Z_STRLEN(class_name->u.constant) -= 1;
- memmove(Z_STRVAL(class_name->u.constant), Z_STRVAL(class_name->u.constant)+1, Z_STRLEN(class_name->u.constant)+1);
+ /* The STRING name has "\" prefix */
+ Z_STRLEN(class_name->u.constant) -= 1;
+ memmove(Z_STRVAL(class_name->u.constant), Z_STRVAL(class_name->u.constant)+1, Z_STRLEN(class_name->u.constant)+1);
Z_STRVAL(class_name->u.constant) = erealloc(
- Z_STRVAL(class_name->u.constant),
- Z_STRLEN(class_name->u.constant) + 1);
+ Z_STRVAL(class_name->u.constant),
+ Z_STRLEN(class_name->u.constant) + 1);
if (ZEND_FETCH_CLASS_DEFAULT != zend_get_class_fetch_type(Z_STRVAL(class_name->u.constant), Z_STRLEN(class_name->u.constant))) {
zend_error(E_COMPILE_ERROR, "'\\%s' is an invalid class name", Z_STRVAL(class_name->u.constant));
if (CG(context).labels == NULL ||
zend_hash_find(CG(context).labels, Z_STRVAL_P(label), Z_STRLEN_P(label)+1, (void**)&dest) == FAILURE) {
- if (pass2) {
- CG(in_compilation) = 1;
- CG(active_op_array) = op_array;
- CG(zend_lineno) = opline->lineno;
- zend_error(E_COMPILE_ERROR, "'goto' to undefined label '%s'", Z_STRVAL_P(label));
- } else {
+ if (pass2) {
+ CG(in_compilation) = 1;
+ CG(active_op_array) = op_array;
+ CG(zend_lineno) = opline->lineno;
+ zend_error(E_COMPILE_ERROR, "'goto' to undefined label '%s'", Z_STRVAL_P(label));
+ } else {
/* Label is not defined. Delay to pass 2. */
INC_BPC(op_array);
return;
current = opline->extended_value;
for (distance = 0; current != dest->brk_cont; distance++) {
if (current == -1) {
- if (pass2) {
- CG(in_compilation) = 1;
- CG(active_op_array) = op_array;
- CG(zend_lineno) = opline->lineno;
- }
+ if (pass2) {
+ CG(in_compilation) = 1;
+ CG(active_op_array) = op_array;
+ CG(zend_lineno) = opline->lineno;
+ }
zend_error(E_COMPILE_ERROR, "'goto' into loop or switch statement is disallowed");
}
current = op_array->brk_cont_array[current].parent;
ZVAL_LONG(label, distance);
}
- if (pass2) {
+ if (pass2) {
DEC_BPC(op_array);
- }
+ }
}
/* }}} */
static void do_inheritance_check_on_method(zend_function *child, zend_function *parent TSRMLS_DC)
{
zend_uint child_flags;
- zend_uint parent_flags = parent->common.fn_flags;
-
+ zend_uint parent_flags = parent->common.fn_flags;
+
if (parent->common.fn_flags & ZEND_ACC_ABSTRACT
&& parent->common.scope != (child->common.prototype ? child->common.prototype->common.scope : child->common.scope)
&& child->common.fn_flags & (ZEND_ACC_ABSTRACT|ZEND_ACC_IMPLEMENTED_ABSTRACT)) {
}
}
}
-
+
for (zend_hash_internal_pointer_reset(&ce->properties_info);
- zend_hash_get_current_data(&ce->properties_info, (void *) &property_info) == SUCCESS;
- zend_hash_move_forward(&ce->properties_info)) {
+ zend_hash_get_current_data(&ce->properties_info, (void *) &property_info) == SUCCESS;
+ zend_hash_move_forward(&ce->properties_info)) {
if (property_info->ce == ce) {
if (property_info->flags & ZEND_ACC_STATIC) {
property_info->offset += parent_ce->default_static_members_count;
ALLOC_HASHTABLE(tmpHash);
zend_hash_init(tmpHash, zend_hash_num_elements(fe->op_array.static_variables), NULL, ZVAL_PTR_DTOR, 0);
zend_hash_apply_with_arguments(tmpHash TSRMLS_CC, (apply_func_args_t)zval_copy_static_var, 1, fe->op_array.static_variables);
-
+
fe->op_array.static_variables = tmpHash;
}
opcode_copy[i].op1.jmp_addr < fe->op_array.opcodes + fe->op_array.last) {
opcode_copy[i].op1.jmp_addr = opcode_copy + (fe->op_array.opcodes[i].op1.jmp_addr - fe->op_array.opcodes);
}
- }
+ }
if (opcode_copy[i].op2_type != IS_CONST) {
if (opcode_copy[i].op2.jmp_addr >= fe->op_array.opcodes &&
while (aliases[i]) {
if (!aliases[i]->trait_method->ce || (fn->common.scope == aliases[i]->trait_method->ce &&
(zend_binary_strcasecmp(aliases[i]->trait_method->method_name,
- aliases[i]->trait_method->mname_len,
- fn->common.function_name, fnname_len) == 0))) {
+ aliases[i]->trait_method->mname_len,
+ fn->common.function_name, fnname_len) == 0))) {
if (aliases[i]->alias) {
fn_copy = *fn;
zend_traits_duplicate_function(&fn_copy, estrndup(aliases[i]->alias, aliases[i]->alias_len) TSRMLS_CC);
while (aliases[i]) {
if ((!aliases[i]->trait_method->ce || fn->common.scope == aliases[i]->trait_method->ce) &&
(zend_binary_strcasecmp(aliases[i]->trait_method->method_name,
- aliases[i]->trait_method->mname_len,
- fn->common.function_name, fnname_len) == 0)) {
+ aliases[i]->trait_method->mname_len,
+ fn->common.function_name, fnname_len) == 0)) {
if (!aliases[i]->alias && aliases[i]->modifiers) { /* if it is 0, no modifieres has been changed */
fn_copy.common.fn_flags = aliases[i]->modifiers;
if (!(aliases[i]->modifiers & ZEND_ACC_PPP_MASK)) {
if (precedences[i]->exclude_from_classes[j] == trait) {
zend_uint lcname_len = precedences[i]->trait_method->mname_len;
char* lcname = zend_str_tolower_dup(precedences[i]->trait_method->method_name,
- lcname_len);
+ lcname_len);
if (zend_hash_add(exclude_table, lcname, lcname_len, NULL, 0, NULL)==FAILURE) {
zend_error(E_COMPILE_ERROR, "Failed to evaluate a trait precedence (%s). Method of trait %s was defined to be excluded multiple times", precedences[i]->trait_method->method_name, trait->name);
}
zend_hash_init_ex(function_tables[i], ce->traits[i]->function_table.nNumOfElements,
/* NULL, ZEND_FUNCTION_DTOR, 0, 0); */
NULL, NULL, 0, 0);
-
+
zend_hash_init_ex(&exclude_table, 2, /* TODO: revisit this start size, may be its not optimal */
NULL, NULL, 0, 0);
zend_traits_compile_exclude_table(&exclude_table, ce->trait_precedences, ce->traits[i]);
-
+
/* copies functions, applies defined aliasing, and excludes unused trait methods */
zend_traits_copy_trait_function_table(function_tables[i], &ce->traits[i]->function_table, ce->trait_aliases, &exclude_table TSRMLS_CC);
zend_hash_graceful_destroy(&exclude_table);
zend_hash_get_current_data(&ce->traits[i]->properties_info, (void *) &property_info) == SUCCESS;
zend_hash_move_forward(&ce->traits[i]->properties_info)) {
/* property_info now contains the property */
-
+
/* first get the unmangeld name if necessary,
then check whether the property is already there */
if ((property_info->flags & ZEND_ACC_PPP_MASK) == ZEND_ACC_PUBLIC) {
prop_name_length = strlen(prop_name);
prop_found = zend_hash_find(&ce->properties_info, prop_name, prop_name_length+1, (void **) &coliding_prop) == SUCCESS;
}
-
+
/* next: check for conflicts with current class */
if (prop_found) {
if (coliding_prop->flags & ZEND_ACC_SHADOW) {
ce->traits[i]->default_static_members_table[property_info->offset] TSRMLS_CC) == FAILURE;
} else {
not_compatible = compare_function(&compare_result,
- ce->default_properties_table[coliding_prop->offset],
- ce->traits[i]->default_properties_table[property_info->offset] TSRMLS_CC) == FAILURE;
+ ce->default_properties_table[coliding_prop->offset],
+ ce->traits[i]->default_properties_table[property_info->offset] TSRMLS_CC) == FAILURE;
}
} else {
/* the flags are not identical, thus, we assume properties are not compatible */
not_compatible = 1;
}
-
+
if (not_compatible) {
zend_error(E_COMPILE_ERROR,
"%s and %s define the same property ($%s) in the composition of %s. However, the definition differs and is considered incompatible. Class was composed",
ce->name);
}
}
-
+
/* property not found, so lets add it */
if (property_info->flags & ZEND_ACC_STATIC) {
prop_value = ce->traits[i]->default_static_members_table[property_info->offset];
if (case_list->op_type != IS_UNUSED) { /* non-empty switch */
int next_op_number = get_next_op_number(CG(active_op_array));
-
+
CG(active_op_array)->opcodes[case_list->u.op.opline_num].op1.opline_num = next_op_number;
}
/* Traits can not implement interfaces */
if ((CG(active_class_entry)->ce_flags & ZEND_ACC_TRAIT) == ZEND_ACC_TRAIT) {
zend_error(E_COMPILE_ERROR, "Cannot use '%s' as interface on '%s' since it is a Trait",
- Z_STRVAL(interface_name->u.constant),
- CG(active_class_entry)->name);
+ Z_STRVAL(interface_name->u.constant),
+ CG(active_class_entry)->name);
}
switch (zend_get_class_fetch_type(Z_STRVAL(interface_name->u.constant), Z_STRLEN(interface_name->u.constant))) {
if (object->op_type == IS_CV) {
if (object->u.op.var == CG(active_op_array)->this_var) {
object->op_type = IS_UNUSED; /* this means $this for objects */
- }
+ }
} else if (fetch_list_ptr->count == 1) {
zend_llist_element *le = fetch_list_ptr->head;
zend_op *opline_ptr = (zend_op *) le->data;
static int zend_auto_global_init(zend_auto_global *auto_global TSRMLS_DC) /* {{{ */
{
- if (auto_global->jit) {
+ if (auto_global->jit) {
auto_global->armed = 1;
- } else if (auto_global->auto_global_callback) {
- auto_global->armed = auto_global->auto_global_callback(auto_global->name, auto_global->name_len TSRMLS_CC);
+ } else if (auto_global->auto_global_callback) {
+ auto_global->armed = auto_global->auto_global_callback(auto_global->name, auto_global->name_len TSRMLS_CC);
} else {
auto_global->armed = 0;
}
if (len_adjust == len) {
return len;
}
- }
+ }
#endif
if (len == 0) {