summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Reiter <reiter.christoph@gmail.com>2019-01-16 19:03:21 +0100
committerChristoph Reiter <reiter.christoph@gmail.com>2019-01-16 19:03:27 +0100
commit0e0ee273e7dcb6f08b4e433fdbdf11e3cffd66d1 (patch)
tree300b4bab7fdfac2c62674cdf020787a55fe52c1e
parent361aa17c5302d5d9501b71ec352b39452dea6d23 (diff)
downloadgobject-introspection-0e0ee273e7dcb6f08b4e433fdbdf11e3cffd66d1.tar.gz
Revert "Restore original meaning of disguised attribute."
This reverts commit f606183a010fbec4382acb728882cc0eddbaf7f7. See https://gitlab.gnome.org/GNOME/gobject-introspection/merge_requests/9#note_409979
-rw-r--r--giscanner/docwriter.py2
-rw-r--r--giscanner/gdumpparser.py4
-rw-r--r--giscanner/transformer.py12
-rw-r--r--tests/scanner/Identfilter-1.0-expected.gir4
-rw-r--r--tests/scanner/Regress-1.0-expected.gir12
-rw-r--r--tests/scanner/Symbolfilter-1.0-expected.gir2
6 files changed, 28 insertions, 8 deletions
diff --git a/giscanner/docwriter.py b/giscanner/docwriter.py
index e09427f9..aa8b993c 100644
--- a/giscanner/docwriter.py
+++ b/giscanner/docwriter.py
@@ -861,7 +861,7 @@ class DocFormatterGjs(DocFormatterIntrospectableBase):
if isinstance(node, (ast.Compound, ast.Boxed)):
self.resolve_gboxed_constructor(node)
- if isinstance(node, ast.Compound) and len(node.fields) == 0 and \
+ if isinstance(node, ast.Compound) and node.disguised and \
len(node.methods) == len(node.static_methods) == len(node.constructors) == 0:
return False
diff --git a/giscanner/gdumpparser.py b/giscanner/gdumpparser.py
index 9082cbe7..1730fee5 100644
--- a/giscanner/gdumpparser.py
+++ b/giscanner/gdumpparser.py
@@ -230,6 +230,7 @@ blob containing data gleaned from GObject's primitive introspection."""
c_symbol_prefix='variant')
elif record.name == 'InitiallyUnownedClass':
record.fields = self._namespace.get('ObjectClass').fields
+ record.disguised = False
# Introspection over the data we get from the dynamic
# GObject/GType system out of the binary
@@ -509,6 +510,9 @@ different --identifier-prefix.""" % (xmlnode.attrib['name'], self._namespace.ide
pair_node.add_gtype(boxed.gtype_name, boxed.get_type)
assert boxed.c_symbol_prefix is not None
pair_node.c_symbol_prefix = boxed.c_symbol_prefix
+ # Quick hack - reset the disguised flag; we're setting it
+ # incorrectly in the scanner
+ pair_node.disguised = False
else:
return False
diff --git a/giscanner/transformer.py b/giscanner/transformer.py
index 4f3abcf4..9911de70 100644
--- a/giscanner/transformer.py
+++ b/giscanner/transformer.py
@@ -822,7 +822,13 @@ raise ValueError."""
# by it being returned to the "parse" function and are also added to
# the tag namespace if it has a tag_name set.
compound = compound_class(name, symbol.ident, disguised=disguised, tag_name=tag_name)
- if not tag_name:
+ if tag_name:
+ # Force the struct as disguised for now since we do not yet know
+ # if it has fields that will be parsed. Note that this is using
+ # an erroneous definition of disguised and we should eventually
+ # only look at the field count when needed.
+ compound.disguised = True
+ else:
# Case where we have an anonymous struct which is typedef'd:
# typedef struct {...} Struct;
# we need to parse the fields because we never get a struct
@@ -838,6 +844,10 @@ raise ValueError."""
compound = self._tag_ns[symbol.ident]
else:
compound = compound_class(None, symbol.ident, tag_name=symbol.ident)
+
+ # Make sure disguised is False as we are now about to parse the
+ # fields of the real struct.
+ compound.disguised = False
# Fields may need to be parsed in either of the above cases because the
# Record can be created with a typedef prior to the struct definition.
self._parse_fields(symbol, compound)
diff --git a/tests/scanner/Identfilter-1.0-expected.gir b/tests/scanner/Identfilter-1.0-expected.gir
index c36da9f9..15cd408a 100644
--- a/tests/scanner/Identfilter-1.0-expected.gir
+++ b/tests/scanner/Identfilter-1.0-expected.gir
@@ -11,10 +11,10 @@ and/or use gtk-doc annotations. -->
shared-library=""
c:identifier-prefixes="Identfilter"
c:symbol-prefixes="identfilter">
- <record name="Context" c:type="identfilter_t">
+ <record name="Context" c:type="identfilter_t" disguised="1">
<source-position filename="identfilter.h" line="4"/>
</record>
- <record name="Object" c:type="identfilter_object_t">
+ <record name="Object" c:type="identfilter_object_t" disguised="1">
<source-position filename="identfilter.h" line="5"/>
<method name="foo_method" c:identifier="identfilter_object_foo_method">
<source-position filename="identfilter.h" line="8"/>
diff --git a/tests/scanner/Regress-1.0-expected.gir b/tests/scanner/Regress-1.0-expected.gir
index 37ef3109..3053b907 100644
--- a/tests/scanner/Regress-1.0-expected.gir
+++ b/tests/scanner/Regress-1.0-expected.gir
@@ -1411,6 +1411,7 @@ it says it's pointer but it's actually a string.</doc>
</class>
<record name="FooBufferClass"
c:type="RegressFooBufferClass"
+ disguised="1"
glib:is-gtype-struct-for="FooBuffer">
<source-position filename="foo.h" line="52"/>
</record>
@@ -2095,6 +2096,7 @@ uses a C sugar return type.</doc>
</class>
<record name="FooOtherObjectClass"
c:type="RegressFooOtherObjectClass"
+ disguised="1"
glib:is-gtype-struct-for="FooOtherObject">
<source-position filename="foo.h" line="54"/>
</record>
@@ -2219,7 +2221,9 @@ exposed to language bindings.</doc>
<type name="gint" c:type="int"/>
</field>
</record>
- <record name="FooStructPrivate" c:type="RegressFooStructPrivate">
+ <record name="FooStructPrivate"
+ c:type="RegressFooStructPrivate"
+ disguised="1">
<source-position filename="foo.h" line="325"/>
</record>
<interface name="FooSubInterface"
@@ -2483,7 +2487,7 @@ exposed to language bindings.</doc>
<source-position filename="regress.h" line="520"/>
<type name="gint" c:type="gint"/>
</constant>
- <record name="Intset" c:type="RegressIntset">
+ <record name="Intset" c:type="RegressIntset" disguised="1">
<doc xml:space="preserve"
filename="regress.h"
line="1337">Like telepathy-glib's TpIntset.</doc>
@@ -2814,7 +2818,9 @@ use it should be.</doc>
</parameters>
</method>
</record>
- <record name="TestBoxedPrivate" c:type="RegressTestBoxedPrivate">
+ <record name="TestBoxedPrivate"
+ c:type="RegressTestBoxedPrivate"
+ disguised="1">
<source-position filename="regress.h" line="666"/>
</record>
<callback name="TestCallback" c:type="RegressTestCallback">
diff --git a/tests/scanner/Symbolfilter-1.0-expected.gir b/tests/scanner/Symbolfilter-1.0-expected.gir
index 96c2231b..80fe0d4b 100644
--- a/tests/scanner/Symbolfilter-1.0-expected.gir
+++ b/tests/scanner/Symbolfilter-1.0-expected.gir
@@ -11,7 +11,7 @@ and/or use gtk-doc annotations. -->
shared-library=""
c:identifier-prefixes="Symbolfilter"
c:symbol-prefixes="symbolfilter">
- <record name="Object" c:type="SymbolfilterObject">
+ <record name="Object" c:type="SymbolfilterObject" disguised="1">
<source-position filename="symbolfilter.h" line="4"/>
<method name="filterObjectFooMethod"
c:identifier="SymbolfilterObjectFooMethod">