summaryrefslogtreecommitdiff
path: root/Zend
diff options
context:
space:
mode:
authorAndi Gutmans <andi@php.net>2001-12-06 17:23:08 +0000
committerAndi Gutmans <andi@php.net>2001-12-06 17:23:08 +0000
commitfe94f594272f797c6bb66c3c5a4ad64bbb1d7c73 (patch)
tree63643d7996a5682433680120c6c36ec922d9e0fc /Zend
parent75b47ad14238a71e32e4dcba3af954a4ed0f46f7 (diff)
downloadphp-git-fe94f594272f797c6bb66c3c5a4ad64bbb1d7c73.tar.gz
- Nuke the namespace work I did. It'll be redone differently.
Diffstat (limited to 'Zend')
-rw-r--r--Zend/zend.c18
-rw-r--r--Zend/zend_compile.c30
-rw-r--r--Zend/zend_execute.c7
-rw-r--r--Zend/zend_execute_API.c1
-rw-r--r--Zend/zend_globals.h2
-rw-r--r--Zend/zend_language_parser.y7
6 files changed, 6 insertions, 59 deletions
diff --git a/Zend/zend.c b/Zend/zend.c
index 67b269c7cc..1bfb53079c 100644
--- a/Zend/zend.c
+++ b/Zend/zend.c
@@ -32,13 +32,11 @@
# define GLOBAL_CLASS_TABLE global_class_table
# define GLOBAL_CONSTANTS_TABLE global_constants_table
# define GLOBAL_AUTO_GLOBALS_TABLE global_auto_globals_table
-# define GLOBAL_NAMESPACES_TABLE global_namespaces_table
#else
# define GLOBAL_FUNCTION_TABLE CG(function_table)
# define GLOBAL_CLASS_TABLE CG(class_table)
# define GLOBAL_CONSTANTS_TABLE CG(zend_constants)
# define GLOBAL_AUTO_GLOBALS_TABLE CG(auto_globals)
-# define GLOBAL_NAMESPACES_TABLE CG(namespaces)
#endif
#if defined(ZEND_WIN32) && ZEND_DEBUG
@@ -67,7 +65,6 @@ HashTable *global_function_table;
HashTable *global_class_table;
HashTable *global_constants_table;
HashTable *global_auto_globals_table;
-HashTable *global_namespaces_table;
#endif
zend_utility_values zend_uv;
@@ -434,21 +431,9 @@ int zend_startup(zend_utility_functions *utility_functions, char **extensions, i
GLOBAL_FUNCTION_TABLE = (HashTable *) malloc(sizeof(HashTable));
GLOBAL_CLASS_TABLE = (HashTable *) malloc(sizeof(HashTable));
GLOBAL_AUTO_GLOBALS_TABLE = (HashTable *) malloc(sizeof(HashTable));
- GLOBAL_NAMESPACES_TABLE = (HashTable *) malloc(sizeof(HashTable));
zend_hash_init_ex(GLOBAL_FUNCTION_TABLE, 100, NULL, ZEND_FUNCTION_DTOR, 1, 0);
zend_hash_init_ex(GLOBAL_CLASS_TABLE, 10, NULL, ZEND_CLASS_DTOR, 1, 0);
zend_hash_init_ex(GLOBAL_AUTO_GLOBALS_TABLE, 8, NULL, NULL, 1, 0);
- zend_hash_init_ex(GLOBAL_NAMESPACES_TABLE, 8, NULL, NULL, 1, 0);
-
- {
- zend_namespace main_namespace;
-
- main_namespace.type = INTERNAL_NAMESPACE;
- main_namespace.class_table = GLOBAL_CLASS_TABLE;
- main_namespace.function_table = GLOBAL_FUNCTION_TABLE;
-
- zend_hash_update(GLOBAL_NAMESPACES_TABLE, "", sizeof(""), &main_namespace, sizeof(zend_namespace), NULL);
- }
register_standard_class();
zend_hash_init_ex(&module_registry, 50, NULL, ZEND_MODULE_DTOR, 1, 0);
@@ -472,7 +457,6 @@ int zend_startup(zend_utility_functions *utility_functions, char **extensions, i
compiler_globals->function_table = GLOBAL_FUNCTION_TABLE;
compiler_globals->class_table = GLOBAL_CLASS_TABLE;
compiler_globals->auto_globals = GLOBAL_AUTO_GLOBALS_TABLE;
- compiler_globals->namespaces = GLOBAL_NAMESPACES_TABLE;
zend_startup_constants(tsrm_ls);
GLOBAL_CONSTANTS_TABLE = EG(zend_constants);
#else
@@ -519,8 +503,6 @@ void zend_shutdown(TSRMLS_D)
free(GLOBAL_CLASS_TABLE);
zend_hash_destroy(GLOBAL_AUTO_GLOBALS_TABLE);
free(GLOBAL_AUTO_GLOBALS_TABLE);
- zend_hash_destroy(GLOBAL_NAMESPACES_TABLE);
- free(GLOBAL_NAMESPACES_TABLE);
zend_shutdown_extensions(TSRMLS_C);
free(zend_version_info);
#ifndef ZTS
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c
index 5c6b4a9144..5ed36855ef 100644
--- a/Zend/zend_compile.c
+++ b/Zend/zend_compile.c
@@ -2445,41 +2445,11 @@ void zend_do_end_heredoc(TSRMLS_D)
void do_namespace(znode *namespace TSRMLS_DC)
{
- zend_namespace *namespace_ptr;
-
zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
- if (CG(namespace)) {
- efree(CG(namespace));
- }
- CG(namespace) = namespace->u.constant.value.str.val;
- CG(namespace_len) = namespace->u.constant.value.str.len;
-
opline->opcode = ZEND_NAMESPACE;
- zval_copy_ctor(&namespace->u.constant);
opline->op1 = *namespace;
SET_UNUSED(opline->op2);
-
- if (zend_hash_find(CG(namespaces), CG(namespace), CG(namespace_len)+1, (void **) &namespace_ptr) == FAILURE) {
- zend_namespace new_namespace;
- HashTable *new_function_table;
- HashTable *new_class_table;
-
- new_function_table = (HashTable *) malloc(sizeof(HashTable));
- new_class_table = (HashTable *) malloc(sizeof(HashTable));
- zend_hash_init_ex(new_function_table, 100, NULL, ZEND_FUNCTION_DTOR, 1, 0);
- zend_hash_init_ex(new_class_table, 10, NULL, ZEND_CLASS_DTOR, 1, 0);
- new_namespace.type = USER_NAMESPACE;
- new_namespace.function_table = new_function_table;
- new_namespace.class_table = new_class_table;
-
- zend_hash_update(CG(namespaces), CG(namespace), CG(namespace_len)+1, &new_namespace, sizeof(zend_namespace), NULL);
- CG(function_table) = new_function_table;
- CG(class_table) = new_class_table;
- } else {
- CG(function_table) = namespace_ptr->function_table;
- CG(class_table) = namespace_ptr->class_table;
- }
}
diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c
index cb6b569fce..b0a4a685ba 100644
--- a/Zend/zend_execute.c
+++ b/Zend/zend_execute.c
@@ -1806,13 +1806,6 @@ do_fcall_common:
NEXT_OPCODE();
case ZEND_NAMESPACE:
{
- zend_namespace *namespace_ptr;
-
- if (zend_hash_find(EG(namespaces), EX(opline)->op1.u.constant.value.str.val, EX(opline)->op1.u.constant.value.str.len + 1, (void **) &namespace_ptr) == FAILURE) {
- zend_error(E_ERROR, "Internal namespaces error. Please report this!");
- }
- EG(function_table) = namespace_ptr->function_table;
- EG(class_table) = namespace_ptr->class_table;
NEXT_OPCODE();
}
case ZEND_SEND_VAL:
diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c
index a6790aa357..b82ed02802 100644
--- a/Zend/zend_execute_API.c
+++ b/Zend/zend_execute_API.c
@@ -129,7 +129,6 @@ void init_executor(TSRMLS_D)
EG(function_table) = CG(function_table);
EG(class_table) = CG(class_table);
- EG(namespaces) = CG(namespaces);
EG(in_execution) = 0;
diff --git a/Zend/zend_globals.h b/Zend/zend_globals.h
index 10694bd2c9..163c83419e 100644
--- a/Zend/zend_globals.h
+++ b/Zend/zend_globals.h
@@ -87,7 +87,6 @@ struct _zend_compiler_globals {
HashTable *function_table; /* function symbol table */
HashTable *class_table; /* class table */
- HashTable *namespaces;
HashTable filenames_table;
@@ -158,7 +157,6 @@ struct _zend_executor_globals {
HashTable *function_table; /* function symbol table */
HashTable *class_table; /* class table */
HashTable *zend_constants; /* constants table */
- HashTable *namespaces;
long precision;
diff --git a/Zend/zend_language_parser.y b/Zend/zend_language_parser.y
index 6740f44111..aefa1d62a6 100644
--- a/Zend/zend_language_parser.y
+++ b/Zend/zend_language_parser.y
@@ -209,7 +209,7 @@ unticked_statement:
T_CATCH '(' T_VARIABLE ')' { zend_do_begin_catch(&$1, &$8 TSRMLS_CC); } '{' inner_statement_list '}' { zend_do_end_catch(&$1 TSRMLS_CC); }
| T_THROW expr ';' { zend_do_throw(&$2 TSRMLS_CC); }
| T_DELETE cvar ';' { zend_do_end_variable_parse(BP_VAR_UNSET, 0 TSRMLS_CC); zend_do_unset(&$1, ZEND_UNSET_OBJ TSRMLS_CC); }
- | T_NAMESPACE T_STRING { do_namespace(&$2 TSRMLS_CC); }
+ | T_NAMESPACE namespace_class_entry { do_namespace(&$2 TSRMLS_CC); }
;
unset_variables:
@@ -526,6 +526,11 @@ parse_class_name_entry:
| T_STRING T_PAAMAYIM_NEKUDOTAYIM { $$ = $1; }
;
+namespace_class_entry:
+ parse_class_entry T_STRING { do_fetch_class(&$$, &$1, &$2 TSRMLS_CC); }
+ | T_STRING { do_fetch_class(&$$, NULL, &$1 TSRMLS_CC); }
+;
+
new_class_entry:
parse_class_entry static_or_variable_string { do_fetch_class(&$$, &$1, &$2 TSRMLS_CC); }
| static_or_variable_string { do_fetch_class(&$$, NULL, &$1 TSRMLS_CC); }