From: Father Chrysostomos Date: Sat, 14 Dec 2013 01:01:46 +0000 (-0800) Subject: op.c: Factor out two identical yyerror calls X-Git-Tag: upstream/5.20.0~1013 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=92bd82a0bbf6e4ba85031c2761f405bdddc08c82;p=platform%2Fupstream%2Fperl.git op.c: Factor out two identical yyerror calls --- diff --git a/op.c b/op.c index 4daba7a..627486d 100644 --- a/op.c +++ b/op.c @@ -2796,6 +2796,16 @@ S_move_proto_attr(pTHX_ OP **proto, OP **attrs, const GV * name) } } +static void +S_cant_declare(pTHX_ OP *o) +{ + yyerror(Perl_form(aTHX_ "Can't declare %s in \"%s\"", + OP_DESC(o), + PL_parser->in_my == KEY_our ? "our" : + PL_parser->in_my == KEY_state ? "state" : + "my")); +} + STATIC OP * S_my_kid(pTHX_ OP *o, OP *attrs, OP **imopsp) { @@ -2825,11 +2835,7 @@ S_my_kid(pTHX_ OP *o, OP *attrs, OP **imopsp) type == OP_RV2AV || type == OP_RV2HV) { /* XXX does this let anything illegal in? */ if (cUNOPo->op_first->op_type != OP_GV) { /* MJD 20011224 */ - yyerror(Perl_form(aTHX_ "Can't declare %s in \"%s\"", - OP_DESC(o), - PL_parser->in_my == KEY_our - ? "our" - : PL_parser->in_my == KEY_state ? "state" : "my")); + S_cant_declare(aTHX_ o); } else if (attrs) { GV * const gv = cGVOPx_gv(cUNOPo->op_first); PL_parser->in_my = FALSE; @@ -2848,11 +2854,7 @@ S_my_kid(pTHX_ OP *o, OP *attrs, OP **imopsp) type != OP_PADHV && type != OP_PUSHMARK) { - yyerror(Perl_form(aTHX_ "Can't declare %s in \"%s\"", - OP_DESC(o), - PL_parser->in_my == KEY_our - ? "our" - : PL_parser->in_my == KEY_state ? "state" : "my")); + S_cant_declare(aTHX_ o); return o; } else if (attrs && type != OP_PUSHMARK) {