~ubuntu-branches/ubuntu/vivid/vala/vivid

« back to all changes in this revision

Viewing changes to codegen/valagobjectmodule.c

  • Committer: Bazaar Package Importer
  • Author(s): Sebastian Dröge
  • Date: 2010-09-05 10:32:13 UTC
  • mfrom: (1.5.9 upstream) (28.1.2 experimental)
  • Revision ID: james.westby@ubuntu.com-20100905103213-8nn88erk20o4wgm3
Tags: 0.9.8-1
New upstream development release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2310
2310
                        _tmp2_ = FALSE;
2311
2311
                }
2312
2312
                if (_tmp2_) {
2313
 
                        _tmp1_ = _vala_strcmp0 (vala_member_access_get_member_name (ma), "new") == 0;
 
2313
                        gboolean _tmp3_ = FALSE;
 
2314
                        if (_vala_strcmp0 (vala_member_access_get_member_name (ma), "new") == 0) {
 
2315
                                _tmp3_ = TRUE;
 
2316
                        } else {
 
2317
                                _tmp3_ = _vala_strcmp0 (vala_member_access_get_member_name (ma), "newv") == 0;
 
2318
                        }
 
2319
                        _tmp1_ = _tmp3_;
2314
2320
                } else {
2315
2321
                        _tmp1_ = FALSE;
2316
2322
                }
2317
2323
                if (_tmp1_) {
2318
2324
                        ValaCCodeCommaExpression* ccomma;
2319
2325
                        ValaLocalVariable* temp_var;
2320
 
                        ValaCCodeExpression* _tmp3_;
2321
 
                        ValaCCodeAssignment* _tmp4_;
2322
 
                        ValaCCodeIdentifier* _tmp5_;
2323
 
                        ValaCCodeFunctionCall* _tmp6_;
2324
 
                        ValaCCodeFunctionCall* is_floating_ccall;
2325
 
                        ValaCCodeExpression* _tmp7_;
2326
 
                        ValaCCodeIdentifier* _tmp8_;
2327
 
                        ValaCCodeFunctionCall* _tmp9_;
 
2326
                        ValaCCodeExpression* _tmp4_;
 
2327
                        ValaCCodeAssignment* _tmp5_;
 
2328
                        ValaCCodeIdentifier* _tmp6_;
 
2329
                        ValaCCodeFunctionCall* _tmp7_;
 
2330
                        ValaCCodeFunctionCall* initiallyunowned_ccall;
 
2331
                        ValaCCodeExpression* _tmp8_;
 
2332
                        ValaCCodeIdentifier* _tmp9_;
 
2333
                        ValaCCodeFunctionCall* _tmp10_;
2328
2334
                        ValaCCodeFunctionCall* sink_ref_ccall;
2329
 
                        ValaCCodeExpression* _tmp10_;
2330
2335
                        ValaCCodeExpression* _tmp11_;
2331
 
                        ValaCCodeConditionalExpression* _tmp12_;
 
2336
                        ValaCCodeExpression* _tmp12_;
 
2337
                        ValaCCodeConditionalExpression* _tmp13_;
2332
2338
                        VALA_CODE_VISITOR_CLASS (vala_gobject_module_parent_class)->visit_method_call ((ValaCodeVisitor*) VALA_GTYPE_MODULE (self), expr);
2333
2339
                        ccomma = vala_ccode_comma_expression_new ();
2334
2340
                        temp_var = vala_ccode_base_module_get_temp_variable ((ValaCCodeBaseModule*) self, vala_expression_get_value_type ((ValaExpression*) expr), FALSE, (ValaCodeNode*) expr, FALSE);
2335
2341
                        vala_collection_add ((ValaCollection*) vala_ccode_base_module_get_temp_vars ((ValaCCodeBaseModule*) self), temp_var);
2336
 
                        vala_ccode_comma_expression_append_expression (ccomma, (ValaCCodeExpression*) (_tmp4_ = vala_ccode_assignment_new (_tmp3_ = vala_ccode_base_module_get_variable_cexpression ((ValaCCodeBaseModule*) self, vala_symbol_get_name ((ValaSymbol*) temp_var)), VALA_CCODE_EXPRESSION (vala_code_node_get_ccodenode ((ValaCodeNode*) expr)), VALA_CCODE_ASSIGNMENT_OPERATOR_SIMPLE)));
 
2342
                        vala_ccode_comma_expression_append_expression (ccomma, (ValaCCodeExpression*) (_tmp5_ = vala_ccode_assignment_new (_tmp4_ = vala_ccode_base_module_get_variable_cexpression ((ValaCCodeBaseModule*) self, vala_symbol_get_name ((ValaSymbol*) temp_var)), VALA_CCODE_EXPRESSION (vala_code_node_get_ccodenode ((ValaCodeNode*) expr)), VALA_CCODE_ASSIGNMENT_OPERATOR_SIMPLE)));
 
2343
                        _vala_ccode_node_unref0 (_tmp5_);
2337
2344
                        _vala_ccode_node_unref0 (_tmp4_);
2338
 
                        _vala_ccode_node_unref0 (_tmp3_);
2339
 
                        is_floating_ccall = (_tmp6_ = vala_ccode_function_call_new ((ValaCCodeExpression*) (_tmp5_ = vala_ccode_identifier_new ("g_object_is_floating"))), _vala_ccode_node_unref0 (_tmp5_), _tmp6_);
2340
 
                        vala_ccode_function_call_add_argument (is_floating_ccall, _tmp7_ = vala_ccode_base_module_get_variable_cexpression ((ValaCCodeBaseModule*) self, vala_symbol_get_name ((ValaSymbol*) temp_var)));
2341
 
                        _vala_ccode_node_unref0 (_tmp7_);
2342
 
                        sink_ref_ccall = (_tmp9_ = vala_ccode_function_call_new ((ValaCCodeExpression*) (_tmp8_ = vala_ccode_identifier_new ("g_object_ref_sink"))), _vala_ccode_node_unref0 (_tmp8_), _tmp9_);
2343
 
                        vala_ccode_function_call_add_argument (sink_ref_ccall, _tmp10_ = vala_ccode_base_module_get_variable_cexpression ((ValaCCodeBaseModule*) self, vala_symbol_get_name ((ValaSymbol*) temp_var)));
2344
 
                        _vala_ccode_node_unref0 (_tmp10_);
2345
 
                        vala_ccode_comma_expression_append_expression (ccomma, (ValaCCodeExpression*) (_tmp12_ = vala_ccode_conditional_expression_new ((ValaCCodeExpression*) is_floating_ccall, (ValaCCodeExpression*) sink_ref_ccall, _tmp11_ = vala_ccode_base_module_get_variable_cexpression ((ValaCCodeBaseModule*) self, vala_symbol_get_name ((ValaSymbol*) temp_var)))));
 
2345
                        initiallyunowned_ccall = (_tmp7_ = vala_ccode_function_call_new ((ValaCCodeExpression*) (_tmp6_ = vala_ccode_identifier_new ("G_IS_INITIALLY_UNOWNED"))), _vala_ccode_node_unref0 (_tmp6_), _tmp7_);
 
2346
                        vala_ccode_function_call_add_argument (initiallyunowned_ccall, _tmp8_ = vala_ccode_base_module_get_variable_cexpression ((ValaCCodeBaseModule*) self, vala_symbol_get_name ((ValaSymbol*) temp_var)));
 
2347
                        _vala_ccode_node_unref0 (_tmp8_);
 
2348
                        sink_ref_ccall = (_tmp10_ = vala_ccode_function_call_new ((ValaCCodeExpression*) (_tmp9_ = vala_ccode_identifier_new ("g_object_ref_sink"))), _vala_ccode_node_unref0 (_tmp9_), _tmp10_);
 
2349
                        vala_ccode_function_call_add_argument (sink_ref_ccall, _tmp11_ = vala_ccode_base_module_get_variable_cexpression ((ValaCCodeBaseModule*) self, vala_symbol_get_name ((ValaSymbol*) temp_var)));
 
2350
                        _vala_ccode_node_unref0 (_tmp11_);
 
2351
                        vala_ccode_comma_expression_append_expression (ccomma, (ValaCCodeExpression*) (_tmp13_ = vala_ccode_conditional_expression_new ((ValaCCodeExpression*) initiallyunowned_ccall, (ValaCCodeExpression*) sink_ref_ccall, _tmp12_ = vala_ccode_base_module_get_variable_cexpression ((ValaCCodeBaseModule*) self, vala_symbol_get_name ((ValaSymbol*) temp_var)))));
 
2352
                        _vala_ccode_node_unref0 (_tmp13_);
2346
2353
                        _vala_ccode_node_unref0 (_tmp12_);
2347
 
                        _vala_ccode_node_unref0 (_tmp11_);
2348
2354
                        vala_code_node_set_ccodenode ((ValaCodeNode*) expr, (ValaCCodeNode*) ccomma);
2349
2355
                        _vala_ccode_node_unref0 (sink_ref_ccall);
2350
 
                        _vala_ccode_node_unref0 (is_floating_ccall);
 
2356
                        _vala_ccode_node_unref0 (initiallyunowned_ccall);
2351
2357
                        _vala_code_node_unref0 (temp_var);
2352
2358
                        _vala_ccode_node_unref0 (ccomma);
2353
2359
                        _vala_code_node_unref0 (ma);
2355
2361
                } else {
2356
2362
                        if (vala_expression_get_symbol_reference ((ValaExpression*) ma) == VALA_SYMBOL (((ValaCCodeBaseModule*) self)->gobject_type)) {
2357
2363
                                {
2358
 
                                        ValaList* _tmp13_;
2359
 
                                        ValaIterator* _tmp14_;
 
2364
                                        ValaList* _tmp14_;
 
2365
                                        ValaIterator* _tmp15_;
2360
2366
                                        ValaIterator* _arg_it;
2361
 
                                        _arg_it = (_tmp14_ = vala_iterable_iterator ((ValaIterable*) (_tmp13_ = vala_method_call_get_argument_list (expr))), _vala_collection_object_unref0 (_tmp13_), _tmp14_);
 
2367
                                        _arg_it = (_tmp15_ = vala_iterable_iterator ((ValaIterable*) (_tmp14_ = vala_method_call_get_argument_list (expr))), _vala_collection_object_unref0 (_tmp14_), _tmp15_);
2362
2368
                                        while (TRUE) {
2363
2369
                                                ValaExpression* arg;
2364
 
                                                ValaExpression* _tmp15_;
 
2370
                                                ValaExpression* _tmp16_;
2365
2371
                                                ValaNamedArgument* named_argument;
2366
 
                                                ValaSymbol* _tmp16_;
 
2372
                                                ValaSymbol* _tmp17_;
2367
2373
                                                ValaProperty* prop;
2368
2374
                                                if (!vala_iterator_next (_arg_it)) {
2369
2375
                                                        break;
2370
2376
                                                }
2371
2377
                                                arg = (ValaExpression*) vala_iterator_get (_arg_it);
2372
 
                                                named_argument = _vala_code_node_ref0 ((_tmp15_ = arg, VALA_IS_NAMED_ARGUMENT (_tmp15_) ? ((ValaNamedArgument*) _tmp15_) : NULL));
 
2378
                                                named_argument = _vala_code_node_ref0 ((_tmp16_ = arg, VALA_IS_NAMED_ARGUMENT (_tmp16_) ? ((ValaNamedArgument*) _tmp16_) : NULL));
2373
2379
                                                if (named_argument == NULL) {
2374
2380
                                                        vala_report_error (vala_code_node_get_source_reference ((ValaCodeNode*) arg), "Named argument expected");
2375
2381
                                                        _vala_code_node_unref0 (named_argument);
2376
2382
                                                        _vala_code_node_unref0 (arg);
2377
2383
                                                        break;
2378
2384
                                                }
2379
 
                                                prop = (_tmp16_ = vala_semantic_analyzer_symbol_lookup_inherited ((ValaSymbol*) vala_ccode_base_module_get_current_class ((ValaCCodeBaseModule*) self), vala_named_argument_get_name (named_argument)), VALA_IS_PROPERTY (_tmp16_) ? ((ValaProperty*) _tmp16_) : NULL);
 
2385
                                                prop = (_tmp17_ = vala_semantic_analyzer_symbol_lookup_inherited ((ValaSymbol*) vala_ccode_base_module_get_current_class ((ValaCCodeBaseModule*) self), vala_named_argument_get_name (named_argument)), VALA_IS_PROPERTY (_tmp17_) ? ((ValaProperty*) _tmp17_) : NULL);
2380
2386
                                                if (prop == NULL) {
2381
 
                                                        char* _tmp17_;
2382
2387
                                                        char* _tmp18_;
2383
 
                                                        vala_report_error (vala_code_node_get_source_reference ((ValaCodeNode*) arg), _tmp18_ = g_strdup_printf ("Property `%s' not found in `%s'", vala_named_argument_get_name (named_argument), _tmp17_ = vala_symbol_get_full_name ((ValaSymbol*) vala_ccode_base_module_get_current_class ((ValaCCodeBaseModule*) self))));
 
2388
                                                        char* _tmp19_;
 
2389
                                                        vala_report_error (vala_code_node_get_source_reference ((ValaCodeNode*) arg), _tmp19_ = g_strdup_printf ("Property `%s' not found in `%s'", vala_named_argument_get_name (named_argument), _tmp18_ = vala_symbol_get_full_name ((ValaSymbol*) vala_ccode_base_module_get_current_class ((ValaCCodeBaseModule*) self))));
 
2390
                                                        _g_free0 (_tmp19_);
2384
2391
                                                        _g_free0 (_tmp18_);
2385
 
                                                        _g_free0 (_tmp17_);
2386
2392
                                                        _vala_code_node_unref0 (prop);
2387
2393
                                                        _vala_code_node_unref0 (named_argument);
2388
2394
                                                        _vala_code_node_unref0 (arg);
2389
2395
                                                        break;
2390
2396
                                                }
2391
2397
                                                if (!vala_data_type_compatible (vala_expression_get_value_type (arg), vala_property_get_property_type (prop))) {
2392
 
                                                        char* _tmp19_;
2393
2398
                                                        char* _tmp20_;
2394
2399
                                                        char* _tmp21_;
2395
 
                                                        vala_report_error (vala_code_node_get_source_reference ((ValaCodeNode*) arg), _tmp21_ = g_strdup_printf ("Cannot convert from `%s' to `%s'", _tmp19_ = vala_code_node_to_string ((ValaCodeNode*) vala_expression_get_value_type (arg)), _tmp20_ = vala_code_node_to_string ((ValaCodeNode*) vala_property_get_property_type (prop))));
 
2400
                                                        char* _tmp22_;
 
2401
                                                        vala_report_error (vala_code_node_get_source_reference ((ValaCodeNode*) arg), _tmp22_ = g_strdup_printf ("Cannot convert from `%s' to `%s'", _tmp20_ = vala_code_node_to_string ((ValaCodeNode*) vala_expression_get_value_type (arg)), _tmp21_ = vala_code_node_to_string ((ValaCodeNode*) vala_property_get_property_type (prop))));
 
2402
                                                        _g_free0 (_tmp22_);
2396
2403
                                                        _g_free0 (_tmp21_);
2397
2404
                                                        _g_free0 (_tmp20_);
2398
 
                                                        _g_free0 (_tmp19_);
2399
2405
                                                        _vala_code_node_unref0 (prop);
2400
2406
                                                        _vala_code_node_unref0 (named_argument);
2401
2407
                                                        _vala_code_node_unref0 (arg);