aboutsummaryrefslogtreecommitdiffstats
path: root/misc
diff options
context:
space:
mode:
authorStefan Biereigel <stefan@biereigel.de>2020-02-03 20:21:02 +0100
committerStefan Biereigel <stefan@biereigel.de>2020-02-03 20:21:02 +0100
commit362e3aa40fe4137e8658100d80808ff9ca221ef8 (patch)
tree0a479321879d1ab1b172495bec962bf9b3b5cde5 /misc
parent3c9371589d19cb8618ec9aef6d8de5d83450386c (diff)
downloadyosys-362e3aa40fe4137e8658100d80808ff9ca221ef8.tar.gz
yosys-362e3aa40fe4137e8658100d80808ff9ca221ef8.tar.bz2
yosys-362e3aa40fe4137e8658100d80808ff9ca221ef8.zip
expose polymorphism through python wrappers
Diffstat (limited to 'misc')
-rw-r--r--misc/py_wrap_generator.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/misc/py_wrap_generator.py b/misc/py_wrap_generator.py
index c60a1f268..d5bbecf00 100644
--- a/misc/py_wrap_generator.py
+++ b/misc/py_wrap_generator.py
@@ -806,6 +806,8 @@ class WClass:
for con in self.found_constrs:
text += con.gen_decl()
+ if self.base_class is not None:
+ text += "\n\t\tvirtual ~" + self.name + "() { };"
for var in self.found_vars:
text += var.gen_decl()
for fun in self.found_funs:
@@ -910,15 +912,19 @@ class WClass:
def gen_boost_py(self):
body = self.gen_boost_py_body()
+ base_info = ""
+ if self.base_class is not None:
+ base_info = ", bases<%s::%s>" % (self.base_class.namespace, self.base_class.name)
+
if self.link_type == link_types.derive:
- text = "\n\t\tclass_<" + self.name + ">(\"Cpp" + self.name + "\""
+ text = "\n\t\tclass_<" + self.name + base_info + ">(\"Cpp" + self.name + "\""
text += body
text += "\n\t\tclass_<" + self.name
text += "Wrap, boost::noncopyable"
text += ">(\"" + self.name + "\""
text += body
else:
- text = "\n\t\tclass_<" + self.name + ">(\"" + self.name + "\""
+ text = "\n\t\tclass_<" + self.name + base_info + ">(\"" + self.name + "\""
text += body
return text