[vala/staging] WIP girwriter: Use get_full_gir_name() for non-external symbols
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/staging] WIP girwriter: Use get_full_gir_name() for non-external symbols
- Date: Mon, 6 May 2019 13:18:31 +0000 (UTC)
commit 8be2b6294b00afdb3ea92db6138c864df41e382d
Author: Rico Tzschichholz <ricotz ubuntu com>
Date: Tue Apr 30 08:36:51 2019 +0200
WIP girwriter: Use get_full_gir_name() for non-external symbols
codegen/valagirwriter.vala | 4 ++++
tests/girwriter/GirTest-1.0.gir-expected | 33 ++++++++++++++++++++++++++++++++
tests/girwriter/girtest.vala | 15 +++++++++++++++
tests/girwriter/girtest.vapi-expected | 18 +++++++++++++++++
4 files changed, 70 insertions(+)
---
diff --git a/codegen/valagirwriter.vala b/codegen/valagirwriter.vala
index 0c7c5b987..1b9a185ba 100644
--- a/codegen/valagirwriter.vala
+++ b/codegen/valagirwriter.vala
@@ -1614,6 +1614,10 @@ public class Vala.GIRWriter : CodeVisitor {
}
private string gi_type_name (TypeSymbol type_symbol) {
+ if (!type_symbol.external_package) {
+ return get_full_gir_name (type_symbol);
+ }
+
Symbol parent = type_symbol.parent_symbol;
if (parent is Namespace) {
Namespace ns = parent as Namespace;
diff --git a/tests/girwriter/GirTest-1.0.gir-expected b/tests/girwriter/GirTest-1.0.gir-expected
index 034f48418..2dd6dcf9f 100644
--- a/tests/girwriter/GirTest-1.0.gir-expected
+++ b/tests/girwriter/GirTest-1.0.gir-expected
@@ -5,6 +5,39 @@
<package name="girtest"/>
<c:include name="girtest.h"/>
<namespace name="GirTest" version="1.0" shared-library="girtest" c:prefix="GirTest">
+ <enumeration name="NestedEnum" c:type="GirTestNestedEnum" glib:type-name="GirTestNestedEnum"
glib:get-type="gir_test_nested_enum_get_type">
+ <member name="value1" c:identifier="GIR_TEST_NESTED_ENUM_VALUE1" value="0"/>
+ </enumeration>
+ <enumeration name="Error" c:type="GirTestNestedError" glib:error-domain="gir-test-nested-error-quark">
+ <member name="failed" c:identifier="GIR_TEST_NESTED_ERROR_FAILED" value="0"/>
+ </enumeration>
+ <class name="NestedClass" c:type="GirTestNestedClass" glib:type-name="GirTestNestedClass"
glib:get-type="gir_test_nested_class_get_type" glib:type-struct="NestedClassClass" glib:fundamental="1"
glib:ref-func="gir_test_nested_class_ref" glib:unref-func="gir_test_nested_class_unref"
glib:set-value-func="gir_test_nested_value_set_class" glib:get-value-func="gir_test_nested_value_get_class">
+ <field name="parent_instance">
+ <type name="GObject.TypeInstance" c:type="GTypeInstance"/>
+ </field>
+ <field name="ref_count">
+ <type name="gint" c:type="volatile int"/>
+ </field>
+ <field name="priv">
+ <type name="NestedClassPrivate" c:type="GirTestNestedClassPrivate*"/>
+ </field>
+ <constructor name="new" c:identifier="gir_test_nested_class_new">
+ <return-value transfer-ownership="full">
+ <type name="GirTest.NestedClass" c:type="GirTestNestedClass*"/>
+ </return-value>
+ </constructor>
+ </class>
+ <record name="NestedClassClass" c:type="GirTestNestedClassClass"
glib:is-gtype-struct-for="NestedClass">
+ <field name="parent_class">
+ <type name="GObject.TypeClass" c:type="GTypeClass"/>
+ </field>
+ </record>
+ <record name="NestedClassPrivate" c:type="GirTestNestedClassPrivate" disguised="1"/>
+ <record name="NestedStruct" c:type="GirTestNestedStruct" glib:type-name="GirTestNestedStruct"
glib:get-type="gir_test_nested_struct_get_type">
+ <field name="field_name">
+ <type name="gint" c:type="gint"/>
+ </field>
+ </record>
<enumeration name="EnumTest" c:type="GirTestEnumTest" glib:type-name="GirTestEnumTest"
glib:get-type="gir_test_enum_test_get_type">
<member name="value1" c:identifier="GIR_TEST_ENUM_TEST_VALUE1" value="0"/>
<member name="value2" c:identifier="GIR_TEST_ENUM_TEST_VALUE2" value="1"/>
diff --git a/tests/girwriter/girtest.vala b/tests/girwriter/girtest.vala
index 3ace08a5b..a4bb49575 100644
--- a/tests/girwriter/girtest.vala
+++ b/tests/girwriter/girtest.vala
@@ -1,5 +1,20 @@
[CCode (gir_namespace = "GirTest", gir_version = "1.0")]
namespace GirTest {
+
+ namespace Nested {
+ public struct Struct {
+ public int field_name;
+ }
+ public class Class {
+ }
+ public errordomain Error {
+ FAILED
+ }
+ public enum Enum {
+ VALUE1
+ }
+ }
+
public struct BoxedStruct {
public int field_name;
diff --git a/tests/girwriter/girtest.vapi-expected b/tests/girwriter/girtest.vapi-expected
index 52d23d16a..beeb0e4ad 100644
--- a/tests/girwriter/girtest.vapi-expected
+++ b/tests/girwriter/girtest.vapi-expected
@@ -1,5 +1,23 @@
[CCode (gir_namespace = "GirTest", gir_version = "1.0")]
namespace GirTest {
+ namespace Nested {
+ [CCode (cheader_filename = "girtest.h")]
+ public class Class {
+ public Class ();
+ }
+ [CCode (cheader_filename = "girtest.h")]
+ public struct Struct {
+ public int field_name;
+ }
+ [CCode (cheader_filename = "girtest.h")]
+ public enum Enum {
+ VALUE1
+ }
+ [CCode (cheader_filename = "girtest.h")]
+ public errordomain Error {
+ FAILED
+ }
+ }
[CCode (cheader_filename = "girtest.h")]
public abstract class AbstractObjectTest : GLib.Object {
protected AbstractObjectTest ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]