cvs: ZendEngine2 / zend_API.c zend_compile.c zend_compile.h zend_language_parser.y zend_opcode.c
| From: | Andi Gutmans | Date: | Fri, 01 Mar 2002 14:04:51 +0000 |
| Subject: | cvs: ZendEngine2 / zend_API.c zend_compile.c zend_compile.h zend_language_parser.y zend_opcode.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-9547@lists.php.net to get a copy of this message | ||
andi Fri Mar 1 09:04:51 2002 EDT
Modified files:
/ZendEngine2 zend_API.c zend_compile.c zend_compile.h
zend_language_parser.y zend_opcode.c
Log:
- Fix bug in nested try/catch's
- Infrastructure for implementing imports of methods.
Index: ZendEngine2/zend_API.c
diff -u ZendEngine2/zend_API.c:1.118 ZendEngine2/zend_API.c:1.119
--- ZendEngine2/zend_API.c:1.118 Thu Feb 21 06:50:41 2002
+++ ZendEngine2/zend_API.c Fri Mar 1 09:04:47 2002
@@ -1046,6 +1046,7 @@
internal_function->handler = ptr->handler;
internal_function->arg_types = ptr->func_arg_types;
internal_function->function_name = ptr->fname;
+ internal_function->scope = NULL;
if (!internal_function->handler) {
zend_error(error_type, "Null function defined as active function");
zend_unregister_functions(functions, count, target_function_table TSRMLS_CC);
Index: ZendEngine2/zend_compile.c
diff -u ZendEngine2/zend_compile.c:1.271 ZendEngine2/zend_compile.c:1.272
--- ZendEngine2/zend_compile.c:1.271 Thu Feb 21 06:50:42 2002
+++ ZendEngine2/zend_compile.c Fri Mar 1 09:04:48 2002
@@ -762,6 +762,8 @@
op_array.arg_types = NULL;
op_array.return_reference = return_reference;
+ op_array.scope = CG(active_class_entry);
+
if (is_method) {
zend_hash_update(&CG(active_class_entry)->function_table, name, name_len+1, &op_array,
sizeof(zend_op_array), (void **) &CG(active_op_array));
if ((CG(active_class_entry)->name_length == (uint) name_len) &&
(!memcmp(CG(active_class_entry)->name, name, name_len))) {
Index: ZendEngine2/zend_compile.h
diff -u ZendEngine2/zend_compile.h:1.166 ZendEngine2/zend_compile.h:1.167
--- ZendEngine2/zend_compile.h:1.166 Wed Feb 13 14:26:07 2002
+++ ZendEngine2/zend_compile.h Fri Mar 1 09:04:49 2002
@@ -78,10 +78,11 @@
struct _zend_op_array {
- zend_uchar type; /* MUST be the first element of this struct! */
+ zend_uchar type; /* MUST be the first element of this struct! */
zend_uchar *arg_types; /* MUST be the second element of this struct! */
- char *function_name; /* MUST be the third element of this struct! */
+ char *function_name; /* MUST be the third element of this struct! */
+ zend_class_entry *scope; /* MUST be the fourth element of this struct! */
zend_uint *refcount;
@@ -110,20 +111,22 @@
typedef struct _zend_internal_function {
- zend_uchar type; /* MUST be the first element of this struct! */
+ zend_uchar type; /* MUST be the first element of this struct! */
- zend_uchar *arg_types; /* MUST be the second element of this struct */
- char *function_name; /* MUST be the third element of this struct */
+ zend_uchar *arg_types; /* MUST be the second element of this struct! */
+ char *function_name; /* MUST be the third element of this struct! */
+ zend_class_entry *scope; /* MUST be the fourth element of this struct! */
void (*handler)(INTERNAL_FUNCTION_PARAMETERS);
} zend_internal_function;
typedef struct _zend_overloaded_function {
- zend_uchar type; /* MUST be the first element of this struct! */
+ zend_uchar type; /* MUST be the first element of this struct! */
- zend_uchar *arg_types; /* MUST be the second element of this struct */
- char *function_name; /* MUST be the third element of this struct */
+ zend_uchar *arg_types; /* MUST be the second element of this struct! */
+ char *function_name; /* MUST be the third element of this struct! */
+ zend_class_entry *scope; /* MUST be the fourth element of this struct! */
zend_uint var;
} zend_overloaded_function;
@@ -131,10 +134,12 @@
typedef union _zend_function {
zend_uchar type; /* MUST be the first element of this struct! */
+
struct {
zend_uchar type; /* never used */
zend_uchar *arg_types;
char *function_name;
+ zend_class_entry *scope;
} common;
zend_op_array op_array;
Index: ZendEngine2/zend_language_parser.y
diff -u ZendEngine2/zend_language_parser.y:1.48 ZendEngine2/zend_language_parser.y:1.49
--- ZendEngine2/zend_language_parser.y:1.48 Thu Feb 21 06:50:43 2002
+++ ZendEngine2/zend_language_parser.y Fri Mar 1 09:04:50 2002
@@ -207,14 +207,20 @@
| T_DECLARE { zend_do_declare_begin(TSRMLS_C); } '(' declare_list ')'
declare_statement { zend_do_declare_end(TSRMLS_C); }
| ';' /* empty statement */
| T_TRY { zend_do_try(&$1 TSRMLS_CC); } '{' inner_statement_list '}'
- catches
+ T_CATCH '(' catch_class_entry T_VARIABLE ')' { zend_do_begin_catch(&$1,
&$8, &$9, 1 TSRMLS_CC); } '{' inner_statement_list '}' {
zend_do_end_catch(&$1 TSRMLS_CC); }
+ additional_catches
| 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); }
;
-catches:
- catches T_CATCH '(' catch_class_entry T_VARIABLE ')' {
zend_do_begin_catch(&$2, &$4, &$5, 0 TSRMLS_CC); } '{' inner_statement_list
'}' { zend_do_end_catch(&$2 TSRMLS_CC); }
- | T_CATCH '(' catch_class_entry T_VARIABLE ')' { zend_do_begin_catch(&$1,
&$3, &$4, 1 TSRMLS_CC); } '{' inner_statement_list '}' {
zend_do_end_catch(&$1 TSRMLS_CC); }
+additional_catches:
+ non_empty_additional_catches
+ | /* empty */
+;
+
+non_empty_additional_catches:
+ non_empty_additional_catches T_CATCH '(' catch_class_entry T_VARIABLE ')' {
zend_do_begin_catch(&$2, &$4, &$5, 0 TSRMLS_CC); } '{' inner_statement_list
'}' { zend_do_end_catch(&$2 TSRMLS_CC); }
+ | T_CATCH '(' catch_class_entry T_VARIABLE ')' { zend_do_begin_catch(&$1,
&$3, &$4, 0 TSRMLS_CC); } '{' inner_statement_list '}' {
zend_do_end_catch(&$1 TSRMLS_CC); }
;
Index: ZendEngine2/zend_opcode.c
diff -u ZendEngine2/zend_opcode.c:1.65 ZendEngine2/zend_opcode.c:1.66
--- ZendEngine2/zend_opcode.c:1.65 Thu Feb 21 06:50:44 2002
+++ ZendEngine2/zend_opcode.c Fri Mar 1 09:04:51 2002
@@ -76,6 +76,8 @@
op_array->arg_types = NULL;
+ op_array->scope = NULL;
+
op_array->brk_cont_array = NULL;
op_array->last_brk_cont = 0;
op_array->current_brk_cont = -1;