diff options
author | Jesse Luehrs <doy@tozt.net> | 2013-07-23 03:04:36 -0400 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2013-07-23 03:04:36 -0400 |
commit | 9e4b587dca809519106f004df09f5aa01b721e9a (patch) | |
tree | 281670afec866e3838b8cc7f357dba2a1bf7daae /Keyword.xs | |
parent | 4be323863ef8e84d05d1f6dc74f0dff2e9fc0bb1 (diff) | |
download | parse-keyword-9e4b587dca809519106f004df09f5aa01b721e9a.tar.gz parse-keyword-9e4b587dca809519106f004df09f5aa01b721e9a.zip |
don't return a coderef if there was a parse error
it won't be a valid coderef, you'll just get an error if you try to call
it
Diffstat (limited to 'Keyword.xs')
-rw-r--r-- | Keyword.xs | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -22,12 +22,17 @@ static SV *parser_fn(OP *(fn)(pTHX_ U32), bool named) { I32 floor; + OP *parsed; CV *code; REENTER_PARSER; floor = start_subparse(0, named ? 0 : CVf_ANON); - code = newATTRSUB(floor, NULL, NULL, NULL, fn(aTHX_ 0)); + parsed = fn(aTHX_ 0); + if (PL_parser->error_count) { + return newSV(0); + } + code = newATTRSUB(floor, NULL, NULL, NULL, parsed); LEAVE_PARSER; |