为什么不调用回调? [英] Why callback is not called?

查看:122
本文介绍了为什么不调用回调?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有来自 B :: OPCheck 模块的示例脚本,其中修改了PL_op_name padsv

I have the example script from B::OPCheck module with modified PL_op_name to padsv

use B::Generate;

use B::OPCheck padsv => check => sub {
    my $op = shift;
    print "HERE";
};

my $x;
1;

但是不调用回调.

在删除该程序时,我可以看到此OP:

When deparsing this program I can see this OP:

$perl -Ilib -Iblib/arch -MO=Terse ~/tmp/xs.pl

LISTOP (0x19828f0) leave [1] 
    OP (0x1c27ef0) enter 
    COP (0x1982938) nextstate 
    OP (0x1982998) padsv [1]           <<<< HERE IT IS
    COP (0x1c27f38) nextstate 
    OP (0x1c27f98) null [5] 

为什么不调用回调?

UPD
似乎此处是答案:

UPD
It seems here is the answer:

对于大多数(但不是全部)类型的op,一旦最初构建op并使用子op填充,它将通过此​​数组的相应元素所引用的检查函数进行过滤

For most (but not all) types of op, once the op has been initially built and populated with child ops it will be filtered through the check function referenced by the appropriate element of this array

但是在哪里可以找到将通过检查功能过滤的操作列表呢?

But where to find the list of ops which will be filtered through the check function?

推荐答案

我发现了下一件事.我应该做

I have find out next thing. I should do

wrap_op_checker(OP_PADANY, my_check, &old_checker);

代替:

wrap_op_checker(OP_PADSV, my_check, &old_checker);

因为未创建此类型的OP .在该步骤中,它是OP_PADANY并将转换Perl_newSVREF处的OP_PADSV中,该位置在

Because OP of this type is not created. At that step it is OP_PADANY and is transformed into OP_PADSV at Perl_newSVREF which is called somewhere from Perl_yyparse+0x1834.

因此,由于这种转换,我们无法钩住OP_PADSV

So because of this transformation we can not hook OP_PADSV

UPD
此行为不符合
DOC

UPD
This behavior do not correspond to the DOC

当节点完全构建后,将调用检查例程

A check routine is called when the node is fully constructed

这篇关于为什么不调用回调?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆