Vincent: This fixes things, but I don't know why.
This fixes RT #83806 and RT #83839.
t/46-stress.t
t/47-stress-use.t
t/50-external.t
t/46-stress.t
t/47-stress-use.t
t/50-external.t
t/91-pod.t
t/92-pod-coverage.t
t/93-pod-spelling.t
t/91-pod.t
t/92-pod-coverage.t
t/93-pod-spelling.t
/* --- Check functions ----------------------------------------------------- */
/* --- Check functions ----------------------------------------------------- */
-STATIC STRLEN indirect_nextline(const char *s, STRLEN len) {
- STRLEN i;
-
- for (i = 0; i < len; ++i) {
- if (s[i] == '\n') {
- ++i;
- while (i < len && s[i] == '\r')
- ++i;
- break;
- }
- }
-
- return i;
-}
-
STATIC int indirect_find(pTHX_ SV *name_sv, const char *line_bufptr, STRLEN *name_pos) {
#define indirect_find(NSV, LBP, NP) indirect_find(aTHX_ (NSV), (LBP), (NP))
STRLEN name_len, line_len;
const char *name, *name_end;
const char *line, *line_end;
STATIC int indirect_find(pTHX_ SV *name_sv, const char *line_bufptr, STRLEN *name_pos) {
#define indirect_find(NSV, LBP, NP) indirect_find(aTHX_ (NSV), (LBP), (NP))
STRLEN name_len, line_len;
const char *name, *name_end;
const char *line, *line_end;
line = SvPV_const(PL_linestr, line_len);
line_end = line + line_len;
line = SvPV_const(PL_linestr, line_len);
line_end = line + line_len;
- t = line;
- u = t;
-
- /* If we're inside a string-like environment, we don't need to be smart for
- * finding the positions of the tokens : as the line number will always be
- * the line where the string began (or at least I hope so), and the line
- * buffer points to the beginning of the string (likewise), we can just take
- * the offset in this string as the position. */
- if (!PL_lex_inwhat) {
- while (t <= p) {
- STRLEN i = indirect_nextline(t, line_len);
- if (i >= line_len)
- break;
- u = t;
- t += i;
- line_len -= i;
- }
- }
-
- *name_pos = p - u;
use strict;
use warnings;
use strict;
use warnings;
-use Test::More tests => 109 * 8 + 10;
+use Test::More tests => 112 * 8 + 10;
BEGIN { delete $ENV{PERL_INDIRECT_PM_DISABLE} }
BEGIN { delete $ENV{PERL_INDIRECT_PM_DISABLE} }
####
my @stuff = sort Hlagh
->new;
####
my @stuff = sort Hlagh
->new;
+####
+sub {
+ my $self = shift;
+ return $self->new ? $self : undef;
+}
+####
+sub {
+ my $self = shift;
+ return $self ? $self->new : undef;
+}
+####
+sub {
+ my $self = shift;
+ return $_[0] ? undef : $self->new;
+}
--- /dev/null
+#!perl
+
+use lib 't/lib';
+use VPIT::TestHelpers;
+
+BEGIN {
+ load_or_skip_all("Devel::Declare", 0.006007, undef);
+}
+
+use Test::More tests => 1;
+
+sub foo { }
+
+sub foo_magic {
+ my($declarator, $offset) = @_;
+ $offset += Devel::Declare::toke_move_past_token($offset);
+ my $linestr = Devel::Declare::get_linestr();
+ substr $linestr, $offset, 0, "\n\n";
+ Devel::Declare::set_linestr($linestr);
+}
+
+BEGIN {
+ Devel::Declare->setup_for("main", { foo => { const => \&foo_magic } });
+}
+
+no indirect ":fatal";
+
+sub bar {
+ my $x;
+ foo; $x->m;
+}
+
+ok 1;