summaryrefslogtreecommitdiff
path: root/Zend/zend_opcode.c
diff options
context:
space:
mode:
authorStanislav Malyshev <stas@php.net>2003-02-16 11:12:43 +0000
committerStanislav Malyshev <stas@php.net>2003-02-16 11:12:43 +0000
commita4c3b2ce807dec309812cfe72c91a597c8476113 (patch)
treedf2e8a0aa85b595abf66f0c7b476471c3749fc11 /Zend/zend_opcode.c
parent0a18a9d744afb9d97d46bad1f40c11a047bad5df (diff)
downloadphp-git-a4c3b2ce807dec309812cfe72c91a597c8476113.tar.gz
Namespace patch. Big changes:
1. Nested classes are gone. 2. New syntax for namespaces: namespace foo { class X { ... } function bar { ... } var x = 1; const ZZ = 2; } 3. Namespaced symbol access: $x = new foo::X; - etc. For now, namespaces are case insensitive, just like classes. Also, there can be no global class and namespace with the same name (to avoid ambiguities in :: resolution).
Diffstat (limited to 'Zend/zend_opcode.c')
-rw-r--r--Zend/zend_opcode.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/Zend/zend_opcode.c b/Zend/zend_opcode.c
index 619c79168e..32bc402269 100644
--- a/Zend/zend_opcode.c
+++ b/Zend/zend_opcode.c
@@ -78,6 +78,7 @@ void init_op_array(zend_op_array *op_array, zend_uchar type, int initial_ops_siz
op_array->arg_types = NULL;
op_array->scope = NULL;
+ op_array->namespace = NULL;
op_array->brk_cont_array = NULL;
op_array->last_brk_cont = 0;
@@ -166,9 +167,25 @@ ZEND_API void destroy_zend_class(zend_class_entry **pce)
zend_hash_destroy(&ce->class_table);
free(ce);
break;
+ case ZEND_NAMESPACE:
+ destroy_zend_namespace(pce);
+ break;
}
}
+ZEND_API void destroy_zend_namespace(zend_namespace **pns)
+{
+ zend_namespace *ns = *pns;
+ zend_hash_destroy(&ns->function_table);
+ zend_hash_destroy(&ns->class_table);
+ zend_hash_destroy(&ns->constants_table);
+ zend_hash_destroy(ns->static_members);
+ FREE_HASHTABLE(ns->static_members);
+ destroy_op_array(ns->constructor);
+ efree(ns->constructor);
+ efree(ns->name);
+ efree(ns);
+}
void zend_class_add_ref(zend_class_entry **ce)
{