Changes for Devel-Declare
+ - clean up checks for whether we're lexing and whether lex_stuff exists
+ to handle the PL_parser factor-out in 5.10
+
0.002000
- rewrite guts into perl, add tests for new declaration style
static int in_declare = 0;
+/* in 5.10, PL_parser will be NULL if we aren't parsing, and PL_lex_stuff
+ is a lookup into it - so if anything else we can use to tell, so we
+ need to be a bit more careful if PL_parser exists */
+
+#define DD_AM_LEXING_CHECK (PL_lex_state == LEX_NORMAL || PL_lex_state == LEX_INTERPNORMAL)
+
+#ifdef PL_parser
+#define DD_HAVE_PARSER PL_parser
+#define DD_HAVE_LEX_STUFF (PL_parser && PL_lex_stuff)
+#define DD_AM_LEXING (PL_parser && DD_AM_LEXING_CHECK)
+#else
+#define DD_HAVE_PARSER 1
+#define DD_HAVE_LEX_STUFF PL_lex_stuff
+#define DD_AM_LEXING DD_AM_LEXING_CHECK
+#endif
+
/* thing that decides whether we're dealing with a declarator */
int dd_is_declarator(pTHX_ char* name) {
}
char* dd_get_lex_stuff(pTHX) {
- return (PL_lex_stuff ? SvPVX(PL_lex_stuff) : "");
+ return (DD_HAVE_LEX_STUFF ? SvPVX(PL_lex_stuff) : "");
}
char* dd_clear_lex_stuff(pTHX) {
- PL_lex_stuff = Nullsv;
+ if (DD_HAVE_PARSER)
+ PL_lex_stuff = Nullsv;
}
char* dd_get_curstash_name(pTHX) {
if (kid->op_type != OP_GV) /* not a GV so ignore */
return o;
- if (PL_lex_state != LEX_NORMAL && PL_lex_state != LEX_INTERPNORMAL)
+ if (!DD_AM_LEXING)
return o; /* not lexing? */
#ifdef DD_DEBUG