~ubuntu-branches/ubuntu/quantal/vala/quantal

« back to all changes in this revision

Viewing changes to codegen/valaccodecontrolflowmodule.c

  • Committer: Bazaar Package Importer
  • Author(s): Michael Terry
  • Date: 2011-01-18 09:51:15 UTC
  • mfrom: (1.5.14 upstream)
  • Revision ID: james.westby@ubuntu.com-20110118095115-r2jr7c63lr0jzj0y
Tags: 0.11.4-0ubuntu1
New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
 
4
4
/* valaccodecontrolflowmodule.vala
5
5
 *
6
 
 * Copyright (C) 2006-2009  Jürg Billeter
 
6
 * Copyright (C) 2006-2011  Jürg Billeter
7
7
 * Copyright (C) 2006-2008  Raffaele Sandrini
8
8
 *
9
9
 * This library is free software; you can redistribute it and/or
150
150
        ValaTypeSymbol* gbytearray_type;
151
151
        ValaTypeSymbol* gptrarray_type;
152
152
        ValaTypeSymbol* gthreadpool_type;
 
153
        ValaDataType* gdestroynotify_type;
153
154
        ValaDataType* gquark_type;
154
155
        ValaStruct* gvalue_type;
155
156
        ValaClass* gvariant_type;
179
180
        ValaCCodeExpression* (*get_dup_func_expression) (ValaCCodeBaseModule* self, ValaDataType* type, ValaSourceReference* source_reference, gboolean is_chainup);
180
181
        gchar* (*append_struct_array_free) (ValaCCodeBaseModule* self, ValaStruct* st);
181
182
        ValaCCodeExpression* (*destroy_value) (ValaCCodeBaseModule* self, ValaTargetValue* value, gboolean is_macro_definition);
182
 
        void (*append_local_free) (ValaCCodeBaseModule* self, ValaSymbol* sym, gboolean stop_at_loop);
 
183
        void (*append_local_free) (ValaCCodeBaseModule* self, ValaSymbol* sym, gboolean stop_at_loop, ValaCodeNode* stop_at);
183
184
        gchar* (*get_delegate_target_cname) (ValaCCodeBaseModule* self, const gchar* delegate_cname);
184
185
        ValaCCodeExpression* (*get_delegate_target_cexpression) (ValaCCodeBaseModule* self, ValaExpression* delegate_expr, ValaCCodeExpression** delegate_target_destroy_notify);
185
186
        ValaCCodeExpression* (*get_delegate_target_cvalue) (ValaCCodeBaseModule* self, ValaTargetValue* value);
190
191
        void (*generate_interface_declaration) (ValaCCodeBaseModule* self, ValaInterface* iface, ValaCCodeFile* decl_space);
191
192
        void (*generate_method_declaration) (ValaCCodeBaseModule* self, ValaMethod* m, ValaCCodeFile* decl_space);
192
193
        void (*generate_error_domain_declaration) (ValaCCodeBaseModule* self, ValaErrorDomain* edomain, ValaCCodeFile* decl_space);
193
 
        ValaCCodeExpression* (*deserialize_expression) (ValaCCodeBaseModule* self, ValaDataType* type, ValaCCodeExpression* variant_expr, ValaCCodeExpression* expr);
 
194
        ValaCCodeExpression* (*deserialize_expression) (ValaCCodeBaseModule* self, ValaDataType* type, ValaCCodeExpression* variant_expr, ValaCCodeExpression* expr, ValaCCodeExpression* error_expr, gboolean* may_fail);
194
195
        ValaCCodeExpression* (*serialize_expression) (ValaCCodeBaseModule* self, ValaDataType* type, ValaCCodeExpression* expr);
195
196
        ValaCCodeExpression* (*get_implicit_cast_expression) (ValaCCodeBaseModule* self, ValaCCodeExpression* source_cexpr, ValaDataType* expression_type, ValaDataType* target_type, ValaExpression* expr);
196
197
        gboolean (*is_gobject_property) (ValaCCodeBaseModule* self, ValaProperty* prop);
199
200
        gboolean (*method_has_wrapper) (ValaCCodeBaseModule* self, ValaMethod* method);
200
201
        ValaCCodeFunctionCall* (*get_param_spec) (ValaCCodeBaseModule* self, ValaProperty* prop);
201
202
        ValaCCodeFunctionCall* (*get_signal_creation) (ValaCCodeBaseModule* self, ValaSignal* sig, ValaTypeSymbol* type);
202
 
        void (*register_dbus_info) (ValaCCodeBaseModule* self, ValaObjectTypeSymbol* bindable);
 
203
        void (*register_dbus_info) (ValaCCodeBaseModule* self, ValaCCodeBlock* block, ValaObjectTypeSymbol* bindable);
203
204
        gchar* (*get_dynamic_property_getter_cname) (ValaCCodeBaseModule* self, ValaDynamicProperty* node);
204
205
        gchar* (*get_dynamic_property_setter_cname) (ValaCCodeBaseModule* self, ValaDynamicProperty* node);
205
206
        gchar* (*get_dynamic_signal_cname) (ValaCCodeBaseModule* self, ValaDynamicSignal* node);
286
287
gboolean vala_ccode_base_module_requires_destroy (ValaCCodeBaseModule* self, ValaDataType* type);
287
288
ValaCCodeExpression* vala_ccode_base_module_get_unref_expression (ValaCCodeBaseModule* self, ValaCCodeExpression* cvar, ValaDataType* type, ValaExpression* expr, gboolean is_macro_definition);
288
289
static void vala_ccode_control_flow_module_real_visit_break_statement (ValaCodeVisitor* base, ValaBreakStatement* stmt);
289
 
void vala_ccode_base_module_append_local_free (ValaCCodeBaseModule* self, ValaSymbol* sym, gboolean stop_at_loop);
 
290
void vala_ccode_base_module_append_local_free (ValaCCodeBaseModule* self, ValaSymbol* sym, gboolean stop_at_loop, ValaCodeNode* stop_at);
290
291
ValaSymbol* vala_ccode_base_module_get_current_symbol (ValaCCodeBaseModule* self);
291
292
static void vala_ccode_control_flow_module_real_visit_continue_statement (ValaCodeVisitor* base, ValaContinueStatement* stmt);
292
293
ValaCCodeControlFlowModule* vala_ccode_control_flow_module_construct (GType object_type);
738
739
                ValaCCodeConstant* _tmp110_ = NULL;
739
740
                ValaCCodeConstant* _tmp111_;
740
741
                ValaCCodeFunction* _tmp112_ = NULL;
741
 
                ValaCCodeFunction* _tmp113_ = NULL;
742
742
                if (n > 0) {
743
743
                        ValaCCodeFunction* _tmp108_ = NULL;
744
744
                        _tmp108_ = vala_ccode_base_module_get_ccode ((ValaCCodeBaseModule*) self);
752
752
                _tmp112_ = vala_ccode_base_module_get_ccode ((ValaCCodeBaseModule*) self);
753
753
                vala_ccode_function_add_default (_tmp112_);
754
754
                vala_code_node_emit ((ValaCodeNode*) default_section, (ValaCodeGenerator*) self);
755
 
                _tmp113_ = vala_ccode_base_module_get_ccode ((ValaCCodeBaseModule*) self);
756
 
                vala_ccode_function_close (_tmp113_);
 
755
                if (n > 0) {
 
756
                        ValaCCodeFunction* _tmp113_ = NULL;
 
757
                        _tmp113_ = vala_ccode_base_module_get_ccode ((ValaCCodeBaseModule*) self);
 
758
                        vala_ccode_function_close (_tmp113_);
 
759
                }
757
760
        }
758
761
        _tmp114_ = vala_ccode_base_module_get_ccode ((ValaCCodeBaseModule*) self);
759
762
        vala_ccode_function_close (_tmp114_);
778
781
        ValaExpression* _tmp4_ = NULL;
779
782
        ValaCCodeExpression* _tmp5_ = NULL;
780
783
        ValaCCodeExpression* _tmp6_;
781
 
        ValaCCodeFunction* _tmp12_ = NULL;
 
784
        gboolean has_default;
 
785
        ValaCCodeFunction* _tmp14_ = NULL;
782
786
        self = (ValaCCodeControlFlowModule*) base;
783
787
        g_return_if_fail (stmt != NULL);
784
788
        _tmp0_ = vala_switch_statement_get_expression (stmt);
794
798
        _tmp6_ = _tmp5_;
795
799
        vala_ccode_function_open_switch (_tmp3_, _tmp6_);
796
800
        _vala_ccode_node_unref0 (_tmp6_);
 
801
        has_default = FALSE;
797
802
        {
798
803
                ValaList* _tmp7_ = NULL;
799
804
                ValaList* _section_list;
820
825
                                ValaCCodeFunction* _tmp11_ = NULL;
821
826
                                _tmp11_ = vala_ccode_base_module_get_ccode ((ValaCCodeBaseModule*) self);
822
827
                                vala_ccode_function_add_default (_tmp11_);
 
828
                                has_default = TRUE;
823
829
                        }
824
830
                        vala_code_node_emit ((ValaCodeNode*) section, (ValaCodeGenerator*) self);
825
831
                        _vala_code_node_unref0 (section);
826
832
                }
827
833
                _vala_iterable_unref0 (_section_list);
828
834
        }
829
 
        _tmp12_ = vala_ccode_base_module_get_ccode ((ValaCCodeBaseModule*) self);
830
 
        vala_ccode_function_close (_tmp12_);
 
835
        if (!has_default) {
 
836
                ValaCCodeFunction* _tmp12_ = NULL;
 
837
                ValaCCodeFunction* _tmp13_ = NULL;
 
838
                _tmp12_ = vala_ccode_base_module_get_ccode ((ValaCCodeBaseModule*) self);
 
839
                vala_ccode_function_add_default (_tmp12_);
 
840
                _tmp13_ = vala_ccode_base_module_get_ccode ((ValaCCodeBaseModule*) self);
 
841
                vala_ccode_function_add_break (_tmp13_);
 
842
        }
 
843
        _tmp14_ = vala_ccode_base_module_get_ccode ((ValaCCodeBaseModule*) self);
 
844
        vala_ccode_function_close (_tmp14_);
831
845
}
832
846
 
833
847
 
1925
1939
        self = (ValaCCodeControlFlowModule*) base;
1926
1940
        g_return_if_fail (stmt != NULL);
1927
1941
        _tmp0_ = vala_ccode_base_module_get_current_symbol ((ValaCCodeBaseModule*) self);
1928
 
        vala_ccode_base_module_append_local_free ((ValaCCodeBaseModule*) self, _tmp0_, TRUE);
 
1942
        vala_ccode_base_module_append_local_free ((ValaCCodeBaseModule*) self, _tmp0_, TRUE, NULL);
1929
1943
        _tmp1_ = vala_ccode_base_module_get_ccode ((ValaCCodeBaseModule*) self);
1930
1944
        vala_ccode_function_add_break (_tmp1_);
1931
1945
}
1938
1952
        self = (ValaCCodeControlFlowModule*) base;
1939
1953
        g_return_if_fail (stmt != NULL);
1940
1954
        _tmp0_ = vala_ccode_base_module_get_current_symbol ((ValaCCodeBaseModule*) self);
1941
 
        vala_ccode_base_module_append_local_free ((ValaCCodeBaseModule*) self, _tmp0_, TRUE);
 
1955
        vala_ccode_base_module_append_local_free ((ValaCCodeBaseModule*) self, _tmp0_, TRUE, NULL);
1942
1956
        _tmp1_ = vala_ccode_base_module_get_ccode ((ValaCCodeBaseModule*) self);
1943
1957
        vala_ccode_function_add_continue (_tmp1_);
1944
1958
}