[vala/wip/transform: 61/124] Drop serialize_expression
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/wip/transform: 61/124] Drop serialize_expression
- Date: Wed, 2 Jan 2019 18:04:42 +0000 (UTC)
commit e5633fff0659571b99e9b0be4528e67f0da15d76
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 5677a12ee..3d3a0b0a4 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]