[vala/wip/transform: 35/102] Drop serialize_expression
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/wip/transform: 35/102] Drop serialize_expression
- Date: Tue, 23 Oct 2018 20:44:56 +0000 (UTC)
commit 3c3eda87b14e1be1cf5e736e40493150b6dd3980
Author: Luca Bruno <lucabru src gnome org>
Date: Tue Jan 3 13:27:08 2012 +0100
Drop serialize_expression
codegen/valagvarianttransformer.vala | 40 ++++++++++++++++--------------------
1 file changed, 18 insertions(+), 22 deletions(-)
---
diff --git a/codegen/valagvarianttransformer.vala b/codegen/valagvarianttransformer.vala
index 0be3c0d1b..593c23b3d 100644
--- a/codegen/valagvarianttransformer.vala
+++ b/codegen/valagvarianttransformer.vala
@@ -265,27 +265,6 @@ public class Vala.GVariantTransformer : CodeTransformer {
return call;
}
- Expression? serialize_expression (DataType type, Expression expr) {
- BasicTypeInfo basic_type;
- Expression result = null;
- if (get_basic_type_info (get_type_signature (type), out basic_type)) {
- result = serialize_basic (basic_type, expr);
- } else if (type is ArrayType) {
- result = serialize_array ((ArrayType) type, expr);
- } else if (type.data_type is Struct) {
- result = serialize_struct ((Struct) type.data_type, expr);
- } else if (type is ObjectType) {
- if (type.data_type == context.analyzer.gvariant_type.data_type) {
- var variant_new = (ObjectCreationExpression) expression ("new
GLib.Variant.variant ()");
- variant_new.add_argument (expr);
- result = variant_new;
- } else if (type.data_type.get_full_name () == "GLib.HashTable") {
- result = serialize_hash_table ((ObjectType) type, expr);
- }
- }
- return result;
- }
-
Expression deserialize_basic (BasicTypeInfo basic_type, Expression expr) {
if (basic_type.is_string) {
var call = new MethodCall (new MemberAccess (expr, "get_string", b.source_reference),
b.source_reference);
@@ -456,8 +435,25 @@ public class Vala.GVariantTransformer : CodeTransformer {
b = new CodeBuilder (context, expr.parent_statement, expr.source_reference);
var old_parent_node = expr.parent_node;
var target_type = expr.target_type.copy ();
+ var type = expr.value_type;
- Expression result = serialize_expression (expr.value_type, expr);
+ BasicTypeInfo basic_type;
+ Expression result = null;
+ if (get_basic_type_info (get_type_signature (type), out basic_type)) {
+ result = serialize_basic (basic_type, expr);
+ } else if (type is ArrayType) {
+ result = serialize_array ((ArrayType) type, expr);
+ } else if (type.data_type is Struct) {
+ result = serialize_struct ((Struct) type.data_type, expr);
+ } else if (type is ObjectType) {
+ if (type.data_type == context.analyzer.gvariant_type.data_type) {
+ var variant_new = (ObjectCreationExpression) expression ("new
GLib.Variant.variant ()");
+ variant_new.add_argument (expr);
+ result = variant_new;
+ } else if (type.data_type.get_full_name () == "GLib.HashTable") {
+ result = serialize_hash_table ((ObjectType) type, expr);
+ }
+ }
result.target_type = target_type;
context.analyzer.replaced_nodes.add (expr);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]