示例#1
0
文件: inline.py 项目: B-Rich/pykit
def rewrite_return(func):
    """Rewrite ret ops to assign to a variable instead, which is returned"""
    ret_normalization.run(func)
    [ret] = findallops(func, 'ret')
    [value] = ret.args
    ret.delete()
    return value
示例#2
0
def rewrite_return(func):
    """Rewrite ret ops to assign to a variable instead, which is returned"""
    ret_normalization.run(func)
    [ret] = findallops(func, 'ret')
    [value] = ret.args
    ret.delete()
    return value
示例#3
0
 def test_normalize(self):
     mod = from_c(testfunc)
     func = mod.get_function("func")
     ret.run(func, fresh_env())
     ops = opcodes(func)
     self.assertEqual(ops.count("ret"), 1, ops)