felipe                                   Sat, 17 Jul 2010 17:47:06 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=301350

Log:
- Lets avoid unnecessary zend_verify_namespace() calls

Changed paths:
    U   php/php-src/branches/LEMON/Zend/zend_language_parser.y

Modified: php/php-src/branches/LEMON/Zend/zend_language_parser.y
===================================================================
--- php/php-src/branches/LEMON/Zend/zend_language_parser.y      2010-07-17 
14:45:06 UTC (rev 301349)
+++ php/php-src/branches/LEMON/Zend/zend_language_parser.y      2010-07-17 
17:47:06 UTC (rev 301350)
@@ -37,6 +37,11 @@
        if (Z_LVAL(CG(declarables).ticks)) { \
                zend_do_ticks(TSRMLS_C); \
        }
+
+#define ZEND_VERIFY_NS() \
+       if (CG(has_bracketed_namespaces) && !CG(in_namespace)) { \
+               zend_verify_namespace(TSRMLS_C); \
+       }
 }

 %name zend_lang_parse
@@ -147,15 +152,15 @@
 namespace_start2 ::= NAMESPACE namespace_name(B). { 
zend_do_begin_namespace(&B, 1 TSRMLS_CC); }

 top_statement ::= SEMICOLON.                                 { 
ZEND_DO_TICKS(); }
-top_statement ::= statement.                                 { 
zend_verify_namespace(TSRMLS_C); }
-top_statement ::= function_declaration_statement.            { 
zend_verify_namespace(TSRMLS_C); zend_do_early_binding(TSRMLS_C); }
-top_statement ::= class_declaration_statement.               { 
zend_verify_namespace(TSRMLS_C); zend_do_early_binding(TSRMLS_C); }
+top_statement ::= statement.                                 { 
ZEND_VERIFY_NS(); }
+top_statement ::= function_declaration_statement.            { 
ZEND_VERIFY_NS(); zend_do_early_binding(TSRMLS_C); }
+top_statement ::= class_declaration_statement.               { 
ZEND_VERIFY_NS(); zend_do_early_binding(TSRMLS_C); }
 top_statement ::= HALT_COMPILER LPAREN RPAREN SEMICOLON.     { 
zend_do_halt_compiler_register(TSRMLS_C); }
 top_statement ::= NAMESPACE namespace_name(B) SEMICOLON.     { 
zend_do_begin_namespace(&B, 0 TSRMLS_CC); }
 top_statement ::= namespace_start2 LBRACE top_statement_list RBRACE. { 
zend_do_end_namespace(TSRMLS_C); }
 top_statement ::= namespace_start  LBRACE top_statement_list RBRACE.   { 
zend_do_end_namespace(TSRMLS_C); }
-top_statement ::= USE use_declarations SEMICOLON.            { 
zend_verify_namespace(TSRMLS_C); }
-top_statement ::= constant_declaration SEMICOLON.            { 
zend_verify_namespace(TSRMLS_C); }
+top_statement ::= USE use_declarations SEMICOLON.            { 
ZEND_VERIFY_NS(); }
+top_statement ::= constant_declaration SEMICOLON.            { 
ZEND_VERIFY_NS(); }

 use_declarations ::= use_declarations COMMA use_declaration.
 use_declarations ::= use_declaration.

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to