diff options
author | Emmanuele Bassi <ebassi@gnome.org> | 2021-02-09 11:38:27 +0000 |
---|---|---|
committer | Emmanuele Bassi <ebassi@gnome.org> | 2021-02-09 11:38:27 +0000 |
commit | c7a9861d9cd165f7e2db78811c111b78ca8d6add (patch) | |
tree | 4ce9d2725dae029dc8109ba90d1d863fdcfa12e6 /giscanner | |
parent | 5ed5b1ed30938dbe70e50feffa56ee5ee47696d2 (diff) | |
download | gobject-introspection-ebassi/final-type.tar.gz |
Add "final" class attributeebassi/final-type
A "final" class is a leaf node in a derivable type hierarchy, and cannot
be derived any further.
This matches the changes in libgobject that introduced G_TYPE_FLAG_FINAL
to the type flags.
Diffstat (limited to 'giscanner')
-rw-r--r-- | giscanner/ast.py | 4 | ||||
-rw-r--r-- | giscanner/gdumpparser.py | 8 | ||||
-rw-r--r-- | giscanner/girparser.py | 3 | ||||
-rw-r--r-- | giscanner/girwriter.py | 2 |
4 files changed, 14 insertions, 3 deletions
diff --git a/giscanner/ast.py b/giscanner/ast.py index 593969f2..5f595280 100644 --- a/giscanner/ast.py +++ b/giscanner/ast.py @@ -1187,7 +1187,8 @@ class Class(Node, Registered): gtype_name=None, get_type=None, c_symbol_prefix=None, - is_abstract=False): + is_abstract=False, + is_final=False): Node.__init__(self, name) Registered.__init__(self, gtype_name, get_type) self.ctype = ctype @@ -1204,6 +1205,7 @@ class Class(Node, Registered): self.parent_chain = [] self.glib_type_struct = None self.is_abstract = is_abstract + self.is_final = is_final self.methods = [] self.virtual_methods = [] self.static_methods = [] diff --git a/giscanner/gdumpparser.py b/giscanner/gdumpparser.py index 3d9720d0..31147a08 100644 --- a/giscanner/gdumpparser.py +++ b/giscanner/gdumpparser.py @@ -315,6 +315,7 @@ different --identifier-prefix.""" % (xmlnode.attrib['name'], self._namespace.ide def _introspect_object(self, xmlnode): type_name = xmlnode.attrib['name'] is_abstract = bool(xmlnode.attrib.get('abstract', False)) + is_final = bool(xmlnode.attrib.get('final', False)) (get_type, c_symbol_prefix) = self._split_type_and_symbol_prefix(xmlnode) try: object_name = self._transformer.strip_identifier(type_name) @@ -324,7 +325,8 @@ different --identifier-prefix.""" % (xmlnode.attrib['name'], self._namespace.ide gtype_name=type_name, get_type=get_type, c_symbol_prefix=c_symbol_prefix, - is_abstract=is_abstract) + is_abstract=is_abstract, + is_final=is_final) self._parse_parents(xmlnode, node) self._introspect_properties(node, xmlnode) self._introspect_signals(node, xmlnode) @@ -453,6 +455,7 @@ different --identifier-prefix.""" % (xmlnode.attrib['name'], self._namespace.ide type_name = xmlnode.attrib['name'] is_abstract = bool(xmlnode.attrib.get('abstract', False)) + is_final = bool(xmlnode.attrib.get('final', False)) (get_type, c_symbol_prefix) = self._split_type_and_symbol_prefix(xmlnode) try: fundamental_name = self._transformer.strip_identifier(type_name) @@ -464,7 +467,8 @@ different --identifier-prefix.""" % (xmlnode.attrib['name'], self._namespace.ide gtype_name=type_name, get_type=get_type, c_symbol_prefix=c_symbol_prefix, - is_abstract=is_abstract) + is_abstract=is_abstract, + is_final=is_final) self._parse_parents(xmlnode, node) node.fundamental = True self._introspect_implemented_interfaces(node, xmlnode) diff --git a/giscanner/girparser.py b/giscanner/girparser.py index d229b164..adde6900 100644 --- a/giscanner/girparser.py +++ b/giscanner/girparser.py @@ -259,6 +259,9 @@ class GIRParser(object): is_abstract = node.attrib.get('abstract') is_abstract = is_abstract and is_abstract != '0' ctor_kwargs['is_abstract'] = is_abstract + is_final = node.attrib.get('final') + is_final = is_final and is_final != '0' + ctor_kwargs['is_final'] = is_final else: raise AssertionError(node) diff --git a/giscanner/girwriter.py b/giscanner/girwriter.py index 2b837362..e626385c 100644 --- a/giscanner/girwriter.py +++ b/giscanner/girwriter.py @@ -473,6 +473,8 @@ class GIRWriter(XMLWriter): self._type_to_name(node.parent_type))) if node.is_abstract: attrs.append(('abstract', '1')) + if node.is_final: + attrs.append(('final', '1')) else: assert isinstance(node, ast.Interface) tag_name = 'interface' |