update changelog
[p5sagit/Devel-BeginLift.git] / nuffin.diff
CommitLineData
9a10ba4a 1=== lib/Devel/BeginLift.xs
2==================================================================
3--- lib/Devel/BeginLift.xs (revision 80093)
4+++ lib/Devel/BeginLift.xs (local)
5@@ -88,6 +88,12 @@
6 op_free(o);
7 if (type == OP_RV2GV)
8 return newGVOP(OP_GV, 0, (GV*)sv);
9+
10+ if (SvROK(sv) && sv_derived_from(sv, "B::OP")) {
11+ /* taken from B's typemap file, T_OP_OBJ */
12+ return INT2PTR(OP *,SvIV((SV *)SvRV(sv)));
13+ }
14+
15 return newSVOP(OP_CONST, 0, sv);
16 } else {
17 /* this bit not lifted, handles the 'sub doesn't return stuff' case
18=== t/generate.t
19==================================================================
20--- t/generate.t (revision 80093)
21+++ t/generate.t (local)
22@@ -0,0 +1,19 @@
23+use strict;
24+use warnings;
25+use Test::More;
26+
27+BEGIN {
28+ plan skip_all => "B::Generate required" unless eval { require B::Generate };
29+ plan 'no_plan';
30+}
31+
32+sub foo {
33+ return B::SVOP->new("const", 0, 42);
34+}
35+
36+use Devel::BeginLift qw(foo);
37+
38+sub bar { 7 + foo() }
39+
40+is( bar(), 49, "optree injected" );
41+