mirror of
https://github.com/boostorg/python.git
synced 2026-01-19 16:32:16 +00:00
- HeaderExporter now doesn't export names that begin with "_"
- Bug in ClassExporter, was adding an attribute to the members of base classes in GenerateVirtualMethods [SVN r18516]
This commit is contained in:
@@ -747,13 +747,14 @@ class _VirtualWrapperGenerator(object):
|
||||
This method creates the instance variable self.virtual_methods.
|
||||
'''
|
||||
def IsVirtual(m):
|
||||
return m.virtual and m.visibility != Scope.private
|
||||
return isinstance(m, Method) and m.virtual and m.visibility != Scope.private
|
||||
|
||||
all_members = self.class_.members[:]
|
||||
all_methods = [x for x in self.class_.members if IsVirtual(x)]
|
||||
for base in self.bases:
|
||||
for base_member in base.members:
|
||||
base_member.class_ = self.class_.FullName()
|
||||
all_members.append(base_member)
|
||||
base_methods = [x.Copy() for x in self.bases.members if IsVirtual(x)]
|
||||
for base_method in base_methods:
|
||||
base_method.class_ = self.class_.FullName()
|
||||
all_methods.append(base_method)
|
||||
|
||||
# extract the virtual methods, avoiding duplications. The duplication
|
||||
# must take in account the full signature without the class name, so
|
||||
@@ -771,10 +772,9 @@ class _VirtualWrapperGenerator(object):
|
||||
params = ', '.join([x.FullName() for x in method.parameters])
|
||||
return '%s %s(%s) %s' % (result, method.name, params, const)
|
||||
|
||||
all_members = [x for x in all_members if type(x) == Method]
|
||||
self.virtual_methods = []
|
||||
already_added = {}
|
||||
for member in all_members:
|
||||
for member in all_methods:
|
||||
sig = MethodSig(member)
|
||||
if IsVirtual(member) and not sig in already_added:
|
||||
self.virtual_methods.append(member)
|
||||
|
||||
@@ -25,7 +25,7 @@ class HeaderExporter(Exporter):
|
||||
def IsInternalName(name):
|
||||
'''Returns true if the given name looks like a internal compiler
|
||||
structure'''
|
||||
return name.startswith('__')
|
||||
return name.startswith('_')
|
||||
|
||||
Exporter.SetDeclarations(self, declarations)
|
||||
header = os.path.normpath(self.parser_header)
|
||||
|
||||
@@ -186,7 +186,11 @@ class Function(Declaration):
|
||||
return len(self.parameters)
|
||||
|
||||
maxArgs = property(_MaxArgs)
|
||||
|
||||
|
||||
def Copy(self):
|
||||
return self.__class__(
|
||||
self.name, self.namespace, self.result, self.params[:])
|
||||
|
||||
|
||||
class Operator(Function):
|
||||
@@ -199,7 +203,6 @@ class Operator(Function):
|
||||
return namespace + 'operator' + self.name
|
||||
|
||||
|
||||
|
||||
class Method(Function):
|
||||
'The declaration of a method.'
|
||||
|
||||
@@ -234,6 +237,19 @@ class Method(Function):
|
||||
return '(%s (%s::*)(%s) %s)&%s' %\
|
||||
(result, self.class_, params, const, self.FullName())
|
||||
|
||||
|
||||
def Copy(self):
|
||||
return self.__class__(
|
||||
self.name,
|
||||
self.class_,
|
||||
self.result,
|
||||
self.params[:],
|
||||
self.visib,
|
||||
self.virtual,
|
||||
self.abstract,
|
||||
self.static,
|
||||
self.const)
|
||||
|
||||
|
||||
class Constructor(Method):
|
||||
'A constructor of a class.'
|
||||
|
||||
@@ -34,7 +34,7 @@ from policies import *
|
||||
from CppParser import CppParser, CppParserError
|
||||
import time
|
||||
|
||||
__VERSION__ = '0.7.7'
|
||||
__VERSION__ = '0.7.9'
|
||||
|
||||
def RecursiveIncludes(include):
|
||||
'Return a list containg the include dir and all its subdirectories'
|
||||
|
||||
Reference in New Issue
Block a user