[vala/staging] codegen: Cache type_symbol in get_param_spec()
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/staging] codegen: Cache type_symbol in get_param_spec()
- Date: Thu, 2 Jul 2020 20:44:21 +0000 (UTC)
commit 01bf777e49d54886ec892db0bca683e0a12e047e
Author: Rico Tzschichholz <ricotz ubuntu com>
Date: Thu Jul 2 19:50:48 2020 +0200
codegen: Cache type_symbol in get_param_spec()
codegen/valagtypemodule.vala | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
---
diff --git a/codegen/valagtypemodule.vala b/codegen/valagtypemodule.vala
index 4757b0165..3aba4b96d 100644
--- a/codegen/valagtypemodule.vala
+++ b/codegen/valagtypemodule.vala
@@ -1832,20 +1832,20 @@ public class Vala.GTypeModule : GErrorModule {
cspec.add_argument (new CCodeConstant ("\"%s\"".printf (prop.nick)));
cspec.add_argument (new CCodeConstant ("\"%s\"".printf (prop.blurb)));
-
- if (prop.property_type.type_symbol is Class || prop.property_type.type_symbol is Interface) {
- string param_spec_name = get_ccode_param_spec_function
(prop.property_type.type_symbol);
+ unowned TypeSymbol? type_symbol = prop.property_type.type_symbol;
+ if (type_symbol is Class || type_symbol is Interface) {
+ string param_spec_name = get_ccode_param_spec_function (type_symbol);
cspec.call = new CCodeIdentifier (param_spec_name);
if (param_spec_name == "g_param_spec_string") {
cspec.add_argument (new CCodeConstant ("NULL"));
} else if (param_spec_name == "g_param_spec_variant") {
cspec.add_argument (new CCodeConstant ("G_VARIANT_TYPE_ANY"));
cspec.add_argument (new CCodeConstant ("NULL"));
- } else if (get_ccode_type_id (prop.property_type.type_symbol) != "G_TYPE_POINTER") {
- cspec.add_argument (new CCodeIdentifier (get_ccode_type_id
(prop.property_type.type_symbol)));
+ } else if (get_ccode_type_id (type_symbol) != "G_TYPE_POINTER") {
+ cspec.add_argument (new CCodeIdentifier (get_ccode_type_id (type_symbol)));
}
- } else if (prop.property_type.type_symbol is Enum) {
- unowned Enum e = (Enum) prop.property_type.type_symbol;
+ } else if (type_symbol is Enum) {
+ unowned Enum e = (Enum) type_symbol;
if (get_ccode_has_type_id (e)) {
if (e.is_flags) {
cspec.call = new CCodeIdentifier ("g_param_spec_flags");
@@ -1868,10 +1868,10 @@ public class Vala.GTypeModule : GErrorModule {
if (prop.initializer != null) {
cspec.add_argument ((CCodeExpression) get_ccodenode (prop.initializer));
} else {
- cspec.add_argument (new CCodeConstant (get_ccode_default_value
(prop.property_type.type_symbol)));
+ cspec.add_argument (new CCodeConstant (get_ccode_default_value
(type_symbol)));
}
- } else if (prop.property_type.type_symbol is Struct) {
- unowned Struct st = (Struct) prop.property_type.type_symbol;
+ } else if (type_symbol is Struct) {
+ unowned Struct st = (Struct) type_symbol;
var type_id = get_ccode_type_id (st);
if (type_id == "G_TYPE_INT") {
cspec.call = new CCodeIdentifier ("g_param_spec_int");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]