def execute_MAKE_FUNCTION(self, argc):
"""
Pushes a new function object on the stack. From bottom to top, the consumed stack must consist of argc & 0xFF default argument
objects in positional order (argc >> 8) & 0xFF pairs of name and default argument, with the name just below the object on the
stack, for keyword-only parameters (argc >> 16) & 0x7FFF parameter annotation objects a tuple listing the parameter names for the
annotations (only if there are ony annotation objects) the code associated with the function (at TOS1) the qualified name of the
function (at TOS)
"""
num_default_args = argc & 0xFF
num_kw_args = (argc >> 8) & 0xFF
name = self.__stack.pop()
name = name.replace(self.__class_name + ".", "")
special_func = False
if is_special_func(name):
special_func = True
code = self.__stack.pop()
defaults = self.popn(num_default_args)
fn = Function(name, defaults)
fn.code = code
if special_func == True:
self.__klass.add_special_func(fn)
else:
self.__klass.add_normal_func(fn)
self.__vm_state = VMState.BUILD_FUNC
if self.__config.show_disassembly:
draw_header("FUNCTION CODE: %s" % name)
dis.dis(code)
评论列表
文章目录