[vala/wip/transform: 28/48] Drop serialize_expression



commit da1b8633bf072b3d21530b29b826a33defaba9d3
Author: Luca Bruno <lucabru src gnome org>
Date:   Tue Jan 3 13:27:08 2012 +0100

    Drop serialize_expression

 codegen/valagvarianttransformer.vala |   40 +++++++++++++++------------------
 1 files changed, 18 insertions(+), 22 deletions(-)
---
diff --git a/codegen/valagvarianttransformer.vala b/codegen/valagvarianttransformer.vala
index 41720c2..b9cf596 100644
--- a/codegen/valagvarianttransformer.vala
+++ b/codegen/valagvarianttransformer.vala
@@ -263,27 +263,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);
@@ -454,8 +433,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]