From a4c3b2ce807dec309812cfe72c91a597c8476113 Mon Sep 17 00:00:00 2001 From: Stanislav Malyshev Date: Sun, 16 Feb 2003 11:12:43 +0000 Subject: 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). --- Zend/zend_opcode.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'Zend/zend_opcode.c') 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) { -- cgit v1.2.1