[gjs: 4/6] object: Use switch to introspection unsupported tags
- From: Philip Chimento <pchimento src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs: 4/6] object: Use switch to introspection unsupported tags
- Date: Sat, 19 Sep 2020 22:39:31 +0000 (UTC)
commit 0ddb68b97d21a233cbf6704323cfdcadc5df0597
Author: Marco Trevisan (TreviƱo) <mail 3v1n0 net>
Date: Tue Sep 8 17:54:37 2020 +0200
object: Use switch to introspection unsupported tags
gi/object.cpp | 27 +++++++++++++++++----------
1 file changed, 17 insertions(+), 10 deletions(-)
---
diff --git a/gi/object.cpp b/gi/object.cpp
index 1fb8c99e5..7e7ad41d2 100644
--- a/gi/object.cpp
+++ b/gi/object.cpp
@@ -426,16 +426,23 @@ bool ObjectInstance::field_getter_impl(JSContext* cx, JS::HandleString name,
GjsAutoTypeInfo type = g_field_info_get_type(field);
tag = g_type_info_get_tag(type);
- if (tag == GI_TYPE_TAG_ARRAY ||
- tag == GI_TYPE_TAG_INTERFACE ||
- tag == GI_TYPE_TAG_GLIST ||
- tag == GI_TYPE_TAG_GSLIST ||
- tag == GI_TYPE_TAG_GHASH ||
- tag == GI_TYPE_TAG_ERROR) {
- gjs_throw(cx, "Can't get field %s; GObject introspection supports only "
- "fields with simple types, not %s",
- gjs_debug_string(name).c_str(), g_type_tag_to_string(tag));
- return false;
+
+ switch (tag) {
+ case GI_TYPE_TAG_ARRAY:
+ case GI_TYPE_TAG_ERROR:
+ case GI_TYPE_TAG_GHASH:
+ case GI_TYPE_TAG_GLIST:
+ case GI_TYPE_TAG_GSLIST:
+ case GI_TYPE_TAG_INTERFACE:
+ gjs_throw(cx,
+ "Can't get field %s; GObject introspection supports only "
+ "fields with simple types, not %s",
+ gjs_debug_string(name).c_str(),
+ g_type_tag_to_string(tag));
+ return false;
+
+ default:
+ break;
}
if (!g_field_info_get_field(field, m_ptr, &arg)) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]