Commit f606183a authored by Tomasz Miąsko's avatar Tomasz Miąsko

Restore original meaning of disguised attribute.

> Certain types like GIConv and GdkAtom are pointers internally but don't
> look like pointers when referenced. They have the form.
>  typedef struct _X *X;
> Parse these as structures/records but mark them in the gir with a 'disguised'
> attribute so that we know that they need special handling.

Additionally, stop relaying on disguised attribute when deciding whether
to render a page. Check number of fields instead, so as to avoid
introducing large regression in the docs.

Fixes #101.
parent 0b6bca5d
Pipeline #50640 passed with stages
in 7 minutes and 47 seconds
......@@ -861,7 +861,7 @@ class DocFormatterGjs(DocFormatterIntrospectableBase):
if isinstance(node, (ast.Compound, ast.Boxed)):
if isinstance(node, ast.Compound) and node.disguised and \
if isinstance(node, ast.Compound) and len(node.fields) == 0 and \
len(node.methods) == len(node.static_methods) == len(node.constructors) == 0:
return False
......@@ -230,7 +230,6 @@ blob containing data gleaned from GObject's primitive introspection."""
elif == '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
......@@ -510,9 +509,6 @@ 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
return False
......@@ -822,13 +822,7 @@ 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 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
if not tag_name:
# 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
......@@ -844,10 +838,6 @@ raise ValueError."""
compound = self._tag_ns[symbol.ident]
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)
......@@ -11,10 +11,10 @@ and/or use gtk-doc annotations. -->
<record name="Context" c:type="identfilter_t" disguised="1">
<record name="Context" c:type="identfilter_t">
<source-position filename="identfilter.h" line="4"/>
<record name="Object" c:type="identfilter_object_t" disguised="1">
<record name="Object" c:type="identfilter_object_t">
<source-position filename="identfilter.h" line="5"/>
<method name="foo_method" c:identifier="identfilter_object_foo_method">
<source-position filename="identfilter.h" line="8"/>
......@@ -1411,7 +1411,6 @@ it says it's pointer but it's actually a string.</doc>
<record name="FooBufferClass"
<source-position filename="foo.h" line="52"/>
......@@ -2096,7 +2095,6 @@ uses a C sugar return type.</doc>
<record name="FooOtherObjectClass"
<source-position filename="foo.h" line="54"/>
......@@ -2221,9 +2219,7 @@ exposed to language bindings.</doc>
<type name="gint" c:type="int"/>
<record name="FooStructPrivate"
<record name="FooStructPrivate" c:type="RegressFooStructPrivate">
<source-position filename="foo.h" line="325"/>
<interface name="FooSubInterface"
......@@ -2487,7 +2483,7 @@ exposed to language bindings.</doc>
<source-position filename="regress.h" line="520"/>
<type name="gint" c:type="gint"/>
<record name="Intset" c:type="RegressIntset" disguised="1">
<record name="Intset" c:type="RegressIntset">
<doc xml:space="preserve"
line="1337">Like telepathy-glib's TpIntset.</doc>
......@@ -2818,9 +2814,7 @@ use it should be.</doc>
<record name="TestBoxedPrivate"
<record name="TestBoxedPrivate" c:type="RegressTestBoxedPrivate">
<source-position filename="regress.h" line="666"/>
<callback name="TestCallback" c:type="RegressTestCallback">
......@@ -11,7 +11,7 @@ and/or use gtk-doc annotations. -->
<record name="Object" c:type="SymbolfilterObject" disguised="1">
<record name="Object" c:type="SymbolfilterObject">
<source-position filename="symbolfilter.h" line="4"/>
<method name="filterObjectFooMethod"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment