From: Florian Ragwitz Date: Thu, 9 Apr 2009 00:35:26 +0000 (+0000) Subject: Remember the previously compiled op. X-Git-Tag: 0.005000~15 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=3ea5094485f2c5380190ec6c28255b3d677d7b2f;p=p5sagit%2FDevel-Declare.git Remember the previously compiled op. --- diff --git a/Declare.xs b/Declare.xs index 2e5c58d..37e0bdc 100644 --- a/Declare.xs +++ b/Declare.xs @@ -36,6 +36,8 @@ static int in_declare = 0; #define DD_AM_LEXING DD_AM_LEXING_CHECK #endif +static OP *previous_op = NULL; + /* thing that decides whether we're dealing with a declarator */ int dd_is_declarator(pTHX_ char* name) { @@ -340,7 +342,15 @@ STATIC OP *dd_ck_const(pTHX_ OP *o, void *user_data) { dd_linestr_callback(aTHX_ "const", name); - return o; + return o; +} + +STATIC OP * +remember_previous_op (pTHX_ OP *o, void *user_data) +{ + PERL_UNUSED_VAR (user_data); + previous_op = o; + return o; } static int initialized = 0; @@ -351,12 +361,17 @@ PROTOTYPES: DISABLE void setup() + PREINIT: + I32 i; CODE: if (!initialized++) { hook_op_check(OP_RV2CV, dd_ck_rv2cv, NULL); hook_op_check(OP_ENTEREVAL, dd_ck_entereval, NULL); hook_op_check(OP_CONST, dd_ck_const, NULL); } + for (i = 0; i < OP_max; i++) { + (void)hook_op_check(i, remember_previous_op, NULL); + } filter_add(dd_filter_realloc, NULL); char*