[gobject-introspection/wip/transformer] Implement clone() correctly for subtypes
- From: Colin Walters <walters src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gobject-introspection/wip/transformer] Implement clone() correctly for subtypes
- Date: Fri, 30 Jul 2010 00:11:06 +0000 (UTC)
commit 3d7e5539e4888f4a3ca28a015570feb45bf2b1cf
Author: Colin Walters <walters verbum org>
Date: Thu Jul 29 19:07:11 2010 -0400
Implement clone() correctly for subtypes
Calling .clone() on an Array was broken before.
giscanner/ast.py | 19 +++++++++++++++++++
1 files changed, 19 insertions(+), 0 deletions(-)
---
diff --git a/giscanner/ast.py b/giscanner/ast.py
index 3b38235..f9e9084 100755
--- a/giscanner/ast.py
+++ b/giscanner/ast.py
@@ -524,6 +524,14 @@ class Array(Type):
self.length_param_name = None
self.size = None
+ def clone(self):
+ arr = Array(self.array_type, self.element_type)
+ arr.element_type = self.element_type
+ arr.zeroterminated = self.zeroterminated
+ arr.length_param_index = self.length_param_index
+ arr.length_param_name = self.length_param_name
+ arr.size = self.size
+ return arr
class List(Type):
@@ -534,6 +542,14 @@ class List(Type):
assert isinstance(element_type, Type)
self.element_type = element_type
+ def clone(self):
+ l = List(self.name, self.element_type)
+ l.element_type = self.element_type
+ l.zeroterminated = self.zeroterminated
+ l.length_param_index = self.length_param_index
+ l.length_param_name = self.length_param_name
+ l.size = self.size
+ return l
class Map(Type):
@@ -544,6 +560,9 @@ class Map(Type):
assert isinstance(value_type, Type)
self.value_type = value_type
+ def clone(self):
+ m = Map(self.ctype, self.key_type, self.value_type)
+ return m
class Alias(Node):
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]