コード例 #1
0
    def visit_member_function(self):
        self.__types_db.update(self.curr_decl)
        self.__dependencies_manager.add_exported(self.curr_decl)

        if self.__fc_manager.is_fake_constructor(self.curr_decl):
            return

        fwrapper = None
        if None is self.curr_decl.call_policies:
            self.curr_decl.call_policies = self.__call_policies_resolver(
                self.curr_decl)

        maker_cls, fwrapper_cls = creators_wizard.find_out_mem_fun_creator_classes(
            self.curr_decl)

        maker = None
        fwrapper = None
        if fwrapper_cls:
            fwrapper = fwrapper_cls(function=self.curr_decl)
            if fwrapper_cls is code_creators.mem_fun_transformed_wrapper_t:
                if self.curr_code_creator.wrapper:
                    class_wrapper = self.curr_code_creator.wrapper
                    class_wrapper.adopt_creator(fwrapper)
                else:
                    self.__extmodule.adopt_declaration_creator(fwrapper)
                    self.curr_code_creator.associated_decl_creators.append(
                        fwrapper)
            else:
                class_wrapper = self.curr_code_creator.wrapper
                class_wrapper.adopt_creator(fwrapper)

        if maker_cls:
            if fwrapper:
                maker = maker_cls(function=self.curr_decl, wrapper=fwrapper)
            else:
                maker = maker_cls(function=self.curr_decl)
            self.curr_code_creator.adopt_creator(maker)
            self.__opaque_types_manager.register_opaque(maker, self.curr_decl)

        if self.curr_decl.has_static:
            #static_method should be created only once.
            found = [
                creator for creator in self.curr_code_creator.creators
                if isinstance(creator, code_creators.static_method_t)
                and creator.declaration.name == self.curr_decl.name
            ]
            if not found:
                static_method = code_creators.static_method_t(
                    function=self.curr_decl, function_code_creator=maker)
                self.curr_code_creator.adopt_creator(static_method)
コード例 #2
0
    def visit_member_function(self):
        self.__types_db.update(self.curr_decl)
        self.__dependencies_manager.add_exported(self.curr_decl)

        if self.__fc_manager.is_fake_constructor(self.curr_decl):
            return

        fwrapper = None
        if None is self.curr_decl.call_policies:
            self.curr_decl.call_policies = self.__call_policies_resolver(self.curr_decl)

        maker_cls, fwrapper_cls = creators_wizard.find_out_mem_fun_creator_classes(self.curr_decl)

        maker = None
        fwrapper = None
        if fwrapper_cls:
            fwrapper = fwrapper_cls(function=self.curr_decl)
            if fwrapper_cls is code_creators.mem_fun_transformed_wrapper_t:
                if self.curr_code_creator.wrapper:
                    class_wrapper = self.curr_code_creator.wrapper
                    class_wrapper.adopt_creator(fwrapper)
                else:
                    self.__extmodule.adopt_declaration_creator(fwrapper)
                    self.curr_code_creator.associated_decl_creators.append(fwrapper)
            else:
                class_wrapper = self.curr_code_creator.wrapper
                class_wrapper.adopt_creator(fwrapper)

        if maker_cls:
            if fwrapper:
                maker = maker_cls(function=self.curr_decl, wrapper=fwrapper)
            else:
                maker = maker_cls(function=self.curr_decl)
            self.curr_code_creator.adopt_creator(maker)
            self.__opaque_types_manager.register_opaque(maker, self.curr_decl)

        if self.curr_decl.has_static:
            # static_method should be created only once.
            found = filter(
                lambda creator: isinstance(creator, code_creators.static_method_t)
                and creator.declaration.name == self.curr_decl.name,
                self.curr_code_creator.creators,
            )
            if not found:
                static_method = code_creators.static_method_t(function=self.curr_decl, function_code_creator=maker)
                self.curr_code_creator.adopt_creator(static_method)