summaryrefslogtreecommitdiffstats
path: root/Keyword.xs
diff options
context:
space:
mode:
Diffstat (limited to 'Keyword.xs')
-rw-r--r--Keyword.xs11
1 files changed, 10 insertions, 1 deletions
diff --git a/Keyword.xs b/Keyword.xs
index 4531169..f38c8cd 100644
--- a/Keyword.xs
+++ b/Keyword.xs
@@ -7,6 +7,8 @@ static OP *parser_callback(pTHX_ GV *namegv, SV *psobj, U32 *flagsp)
{
dSP;
SV *args_generator;
+ SV *statement = NULL;
+ I32 count;
// call the parser callback
// it should take no arguments and return a coderef which, when called,
@@ -16,8 +18,11 @@ static OP *parser_callback(pTHX_ GV *namegv, SV *psobj, U32 *flagsp)
// where $code is the thing returned by the parser function
PUSHMARK(SP);
- call_sv(psobj, G_SCALAR);
+ count = call_sv(psobj, G_ARRAY);
SPAGAIN;
+ if (count > 1) {
+ statement = POPs;
+ }
args_generator = SvREFCNT_inc(POPs);
PUTBACK;
@@ -26,6 +31,10 @@ static OP *parser_callback(pTHX_ GV *namegv, SV *psobj, U32 *flagsp)
GvNAME(namegv), args_generator);
}
+ if (SvTRUE(statement)) {
+ *flagsp |= CALLPARSER_STATEMENT;
+ }
+
return newUNOP(OP_ENTERSUB, OPf_STACKED,
newCVREF(0,
Perl_scalar(newSVOP(OP_CONST, 0,