Skip to content

Commit c64f4e7

Browse files
committed
Add functions declarations, use tabs
1 parent 5bf4c5f commit c64f4e7

File tree

5 files changed

+822
-824
lines changed

5 files changed

+822
-824
lines changed

Zend/zend_compile.c

Lines changed: 17 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2722,7 +2722,7 @@ void zend_do_try(znode *try_token TSRMLS_DC) /* {{{ */
27222722
/* }}} */
27232723

27242724
void zend_do_finally(znode *finally_token TSRMLS_DC) /* {{{ */ {
2725-
finally_token->u.op.opline_num = get_next_op_number(CG(active_op_array));
2725+
finally_token->u.op.opline_num = get_next_op_number(CG(active_op_array));
27262726
} /* }}} */
27272727

27282728
void zend_do_begin_catch(znode *catch_token, znode *class_name, znode *catch_var, znode *first_catch TSRMLS_DC) /* {{{ */
@@ -2776,34 +2776,30 @@ void zend_do_end_catch(znode *catch_token TSRMLS_DC) /* {{{ */
27762776
/* }}} */
27772777

27782778
void zend_do_bind_catch(znode *try_token, znode *catch_token TSRMLS_DC) /* {{{ */ {
2779-
if (catch_token->op_type != IS_UNUSED) {
2780-
zend_add_catch_element(try_token->u.op.opline_num, catch_token->EA TSRMLS_CC);
2781-
}
2779+
if (catch_token->op_type != IS_UNUSED) {
2780+
zend_add_catch_element(try_token->u.op.opline_num, catch_token->EA TSRMLS_CC);
2781+
}
27822782
}
27832783
/* }}} */
27842784

2785-
27862785
void zend_do_end_finally(znode *try_token, znode* catch_token, znode *finally_token TSRMLS_DC) /* {{{ */
27872786
{
27882787
zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
27892788

2790-
if (catch_token->op_type == IS_UNUSED && finally_token->op_type == IS_UNUSED) {
2791-
zend_error(E_COMPILE_ERROR, "Cannot use try without catch or finally");
2792-
}
2793-
if (finally_token->op_type != IS_UNUSED) {
2794-
CG(active_op_array)->try_catch_array[try_token->u.op.opline_num].finally_op = finally_token->u.op.opline_num;
2795-
//try_token->u.op.opline_num = catch_token->u.op.opline_num;
2796-
2797-
opline->opcode = ZEND_LEAVE;
2798-
SET_UNUSED(opline->op1);
2799-
SET_UNUSED(opline->op2);
2800-
}
2801-
if (catch_token->op_type == IS_UNUSED) {
2802-
CG(active_op_array)->try_catch_array[try_token->u.op.opline_num].catch_op = 0;
2803-
} //else {
2804-
// try_token->u.op.opline_num = catch_token->u.op.opline_num;
2805-
//}
2789+
if (catch_token->op_type == IS_UNUSED && finally_token->op_type == IS_UNUSED) {
2790+
zend_error(E_COMPILE_ERROR, "Cannot use try without catch or finally");
2791+
}
2792+
if (finally_token->op_type != IS_UNUSED) {
2793+
CG(active_op_array)->try_catch_array[try_token->u.op.opline_num].finally_op = finally_token->u.op.opline_num;
2794+
//try_token->u.op.opline_num = catch_token->u.op.opline_num;
28062795

2796+
opline->opcode = ZEND_LEAVE;
2797+
SET_UNUSED(opline->op1);
2798+
SET_UNUSED(opline->op2);
2799+
}
2800+
if (catch_token->op_type == IS_UNUSED) {
2801+
CG(active_op_array)->try_catch_array[try_token->u.op.opline_num].catch_op = 0;
2802+
}
28072803
}
28082804
/* }}} */
28092805

Zend/zend_compile.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -499,6 +499,8 @@ void zend_do_fetch_lexical_variable(znode *varname, zend_bool is_ref TSRMLS_DC);
499499
void zend_do_try(znode *try_token TSRMLS_DC);
500500
void zend_do_begin_catch(znode *try_token, znode *catch_class, znode *catch_var, znode *first_catch TSRMLS_DC);
501501
void zend_do_end_catch(znode *catch_token TSRMLS_DC);
502+
void zend_do_finally(znode *finally_token TSRMLS_DC);
503+
void zend_do_end_finally(znode *try_token, znode* catch_token, znode *finally_token TSRMLS_DC);
502504
void zend_do_throw(const znode *expr TSRMLS_DC);
503505

504506
ZEND_API int do_bind_function(const zend_op_array *op_array, zend_op *opline, HashTable *function_table, zend_bool compile_time);

Zend/zend_language_parser.y

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -315,23 +315,23 @@ unticked_statement:
315315
| T_DECLARE { $1.u.op.opline_num = get_next_op_number(CG(active_op_array)); zend_do_declare_begin(TSRMLS_C); } '(' declare_list ')' declare_statement { zend_do_declare_end(&$1 TSRMLS_CC); }
316316
| ';' /* empty statement */
317317
| T_TRY { zend_do_try(&$1 TSRMLS_CC); } '{' inner_statement_list '}'
318-
catch_statement { zend_do_bind_catch(&$1, &$6 TSRMLS_CC); }
319-
finally_statement { zend_do_end_finally(&$1, &$6, &$8 TSRMLS_CC); }
318+
catch_statement { zend_do_bind_catch(&$1, &$6 TSRMLS_CC); }
319+
finally_statement { zend_do_end_finally(&$1, &$6, &$8 TSRMLS_CC); }
320320
| T_THROW expr ';' { zend_do_throw(&$2 TSRMLS_CC); }
321321
| T_GOTO T_STRING ';' { zend_do_goto(&$2 TSRMLS_CC); }
322322
;
323323

324324
catch_statement:
325-
/* empty */ { $$.op_type = IS_UNUSED; }
326-
| T_CATCH '(' { zend_initialize_try_catch_element(&$1 TSRMLS_CC); }
327-
fully_qualified_class_name { zend_do_first_catch(&$2 TSRMLS_CC); }
328-
T_VARIABLE ')' { zend_do_begin_catch(&$1, &$4, &$6, &$2 TSRMLS_CC); }
325+
/* empty */ { $$.op_type = IS_UNUSED; }
326+
| T_CATCH '(' { zend_initialize_try_catch_element(&$1 TSRMLS_CC); }
327+
fully_qualified_class_name { zend_do_first_catch(&$2 TSRMLS_CC); }
328+
T_VARIABLE ')' { zend_do_begin_catch(&$1, &$4, &$6, &$2 TSRMLS_CC); }
329329
'{' inner_statement_list '}' { zend_do_end_catch(&$1 TSRMLS_CC); }
330330
additional_catches { zend_do_mark_last_catch(&$2, &$13 TSRMLS_CC); $$ = $1;}
331331

332332
finally_statement:
333-
/* empty */ { $$.op_type = IS_UNUSED; }
334-
| T_FINALLY { zend_do_finally(&$1 TSRMLS_CC); } '{' inner_statement_list '}' { $$ = $1; }
333+
/* empty */ { $$.op_type = IS_UNUSED; }
334+
| T_FINALLY { zend_do_finally(&$1 TSRMLS_CC); } '{' inner_statement_list '}' { $$ = $1; }
335335
;
336336

337337
additional_catches:

0 commit comments

Comments
 (0)