Ejemplo n.º 1
0
    def visit_class(self):
        self.__link_members()
        # GCC-XML sometimes generates constructors with names that does not
        # match class name. I think this is because those constructors are
        # compiler generated. I need to find out more about this and to talk
        # with Brad

        new_name = self.__inst._name
        if declarations.templates.is_instantiation(new_name):
            new_name = declarations.templates.name(new_name)

        for decl in self.__inst.declarations:
            if not isinstance(decl, declarations.constructor_t):
                continue
            if '.' in decl._name or '$' in decl._name:
                decl._name = new_name

        bases = self.__inst.bases.split()
        self.__inst.bases = []
        for base in bases:
            # it could be "_5" or "protected:_5"
            data = base.split(':')
            base_decl = self.__decls[data[-1]]
            access = declarations.ACCESS_TYPES.PUBLIC
            if len(data) == 2:
                access = data[0]
            self.__inst.bases.append(
                declarations.hierarchy_info_t(base_decl, access))
            base_decl.derived.append(
                declarations.hierarchy_info_t(self.__inst, access))
Ejemplo n.º 2
0
    def visit_class(self):
        self.__link_members()
        # GCC-XML sometimes generates constructors with names that does not
        # match class name. I think this is because those constructors are
        # compiler generated. I need to find out more about this and to talk
        # with Brad

        new_name = self.__inst._name
        if declarations.templates.is_instantiation(new_name):
            new_name = declarations.templates.name(new_name)

        for decl in self.__inst.declarations:
            if not isinstance(decl, declarations.constructor_t):
                continue
            if '.' in decl._name or '$' in decl._name:
                decl._name = new_name

        bases = self.__inst.bases.split()
        self.__inst.bases = []
        for base in bases:
            # it could be "_5" or "protected:_5"
            data = base.split(':')
            base_decl = self.__decls[data[-1]]
            access = declarations.ACCESS_TYPES.PUBLIC
            if 2 == len(data):
                access = data[0]
            self.__inst.bases.append(
                declarations.hierarchy_info_t(base_decl, access))
            base_decl.derived.append(
                declarations.hierarchy_info_t(self.__inst, access))
Ejemplo n.º 3
0
    def _test_is_based_and_derived(self, base, derived, access):
        dhi_v = declarations.hierarchy_info_t(derived, access, True)
        dhi_not_v = declarations.hierarchy_info_t(derived, access, False)
        self.failUnless(
            dhi_v in base.derived or dhi_not_v in base.derived,
            "base class '%s' doesn't has derived class '%s'" %
            (base.name, derived.name))

        bhi_v = declarations.hierarchy_info_t(base, access, True)
        bhi_not_v = declarations.hierarchy_info_t(base, access, False)

        self.failUnless(
            bhi_v in derived.bases or bhi_not_v in derived.bases,
            "derive class '%s' doesn't has base class '%s'" %
            (derived.name, base.name))
Ejemplo n.º 4
0
    def _test_is_based_and_derived(self, base, derived, access):
        dhi_v = declarations.hierarchy_info_t(derived, access, True)
        dhi_not_v = declarations.hierarchy_info_t(derived, access, False)
        self.assertTrue(
            dhi_v in base.derived or dhi_not_v in base.derived,
            "base class '%s' doesn't has derived class '%s'" %
            (base.name, derived.name))

        bhi_v = declarations.hierarchy_info_t(base, access, True)
        bhi_not_v = declarations.hierarchy_info_t(base, access, False)

        self.assertTrue(
            bhi_v in derived.bases or bhi_not_v in derived.bases,
            "derive class '%s' doesn't has base class '%s'" %
            (derived.name, base.name))