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

« back to all changes in this revision

Viewing changes to codegen/valagtypemodule.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:
529
529
void vala_ccode_declaration_space_add_include (ValaCCodeDeclarationSpace* self, const char* filename, gboolean local);
530
530
void vala_gtype_module_generate_virtual_method_declaration (ValaGTypeModule* self, ValaMethod* m, ValaCCodeDeclarationSpace* decl_space, ValaCCodeStruct* type_struct);
531
531
char* vala_ccode_base_module_get_array_length_cname (ValaCCodeBaseModule* self, const char* array_cname, gint dim);
 
532
char* vala_ccode_base_module_get_delegate_target_cname (ValaCCodeBaseModule* self, const char* delegate_cname);
532
533
char* vala_ccode_base_module_get_array_size_cname (ValaCCodeBaseModule* self, const char* array_cname);
533
 
char* vala_ccode_base_module_get_delegate_target_cname (ValaCCodeBaseModule* self, const char* delegate_cname);
534
534
char* vala_ccode_base_module_get_delegate_target_destroy_notify_cname (ValaCCodeBaseModule* self, const char* delegate_cname);
535
535
void vala_ccode_declaration_space_add_type_definition (ValaCCodeDeclarationSpace* self, ValaCCodeNode* node);
536
536
static void vala_gtype_module_real_generate_virtual_method_declaration (ValaGTypeModule* self, ValaMethod* m, ValaCCodeDeclarationSpace* decl_space, ValaCCodeStruct* type_struct);
938
938
        ValaCCodeStruct* type_struct;
939
939
        gboolean _tmp14_ = FALSE;
940
940
        gboolean _tmp15_ = FALSE;
941
 
        gboolean _tmp74_ = FALSE;
 
941
        gboolean _tmp80_ = FALSE;
942
942
        self = (ValaGTypeModule*) base;
943
943
        g_return_if_fail (cl != NULL);
944
944
        g_return_if_fail (decl_space != NULL);
1153
1153
                                                        }
1154
1154
                                                }
1155
1155
                                        }
 
1156
                                } else {
 
1157
                                        gboolean _tmp48_ = FALSE;
 
1158
                                        if (VALA_IS_DELEGATE_TYPE (vala_property_get_property_type (prop))) {
 
1159
                                                _tmp48_ = vala_delegate_get_has_target (vala_delegate_type_get_delegate_symbol (VALA_DELEGATE_TYPE (vala_property_get_property_type (prop))));
 
1160
                                        } else {
 
1161
                                                _tmp48_ = FALSE;
 
1162
                                        }
 
1163
                                        if (_tmp48_) {
 
1164
                                                char* _tmp49_;
 
1165
                                                ValaCCodeFormalParameter* _tmp50_;
 
1166
                                                vala_ccode_function_declarator_add_parameter (vdeclarator, _tmp50_ = vala_ccode_formal_parameter_new (_tmp49_ = vala_ccode_base_module_get_delegate_target_cname ((ValaCCodeBaseModule*) self, "result"), "gpointer*"));
 
1167
                                                _vala_ccode_node_unref0 (_tmp50_);
 
1168
                                                _g_free0 (_tmp49_);
 
1169
                                        }
1156
1170
                                }
1157
1171
                                vdecl = vala_ccode_declaration_new (creturn_type);
1158
1172
                                vala_ccode_declaration_add_declarator (vdecl, (ValaCCodeDeclarator*) vdeclarator);
1164
1178
                        }
1165
1179
                        if (vala_property_get_set_accessor (prop) != NULL) {
1166
1180
                                ValaCCodeFormalParameter* cvalueparam;
1167
 
                                char* _tmp53_;
1168
 
                                ValaCCodeFunctionDeclarator* _tmp54_;
 
1181
                                char* _tmp56_;
 
1182
                                ValaCCodeFunctionDeclarator* _tmp57_;
1169
1183
                                ValaCCodeFunctionDeclarator* vdeclarator;
1170
 
                                ValaDataType* _tmp55_;
 
1184
                                ValaDataType* _tmp58_;
1171
1185
                                ValaArrayType* array_type;
1172
1186
                                ValaCCodeDeclaration* vdecl;
1173
1187
                                cvalueparam = NULL;
1174
1188
                                if (vala_data_type_is_real_non_null_struct_type (vala_property_get_property_type (prop))) {
1175
 
                                        char* _tmp48_;
1176
 
                                        char* _tmp49_;
1177
 
                                        ValaCCodeFormalParameter* _tmp50_;
1178
 
                                        cvalueparam = (_tmp50_ = vala_ccode_formal_parameter_new ("value", _tmp49_ = g_strconcat (_tmp48_ = vala_data_type_get_cname (vala_property_accessor_get_value_type (vala_property_get_set_accessor (prop))), "*", NULL)), _vala_ccode_node_unref0 (cvalueparam), _tmp50_);
1179
 
                                        _g_free0 (_tmp49_);
1180
 
                                        _g_free0 (_tmp48_);
1181
 
                                } else {
1182
1189
                                        char* _tmp51_;
1183
 
                                        ValaCCodeFormalParameter* _tmp52_;
1184
 
                                        cvalueparam = (_tmp52_ = vala_ccode_formal_parameter_new ("value", _tmp51_ = vala_data_type_get_cname (vala_property_accessor_get_value_type (vala_property_get_set_accessor (prop)))), _vala_ccode_node_unref0 (cvalueparam), _tmp52_);
 
1190
                                        char* _tmp52_;
 
1191
                                        ValaCCodeFormalParameter* _tmp53_;
 
1192
                                        cvalueparam = (_tmp53_ = vala_ccode_formal_parameter_new ("value", _tmp52_ = g_strconcat (_tmp51_ = vala_data_type_get_cname (vala_property_accessor_get_value_type (vala_property_get_set_accessor (prop))), "*", NULL)), _vala_ccode_node_unref0 (cvalueparam), _tmp53_);
 
1193
                                        _g_free0 (_tmp52_);
1185
1194
                                        _g_free0 (_tmp51_);
 
1195
                                } else {
 
1196
                                        char* _tmp54_;
 
1197
                                        ValaCCodeFormalParameter* _tmp55_;
 
1198
                                        cvalueparam = (_tmp55_ = vala_ccode_formal_parameter_new ("value", _tmp54_ = vala_data_type_get_cname (vala_property_accessor_get_value_type (vala_property_get_set_accessor (prop)))), _vala_ccode_node_unref0 (cvalueparam), _tmp55_);
 
1199
                                        _g_free0 (_tmp54_);
1186
1200
                                }
1187
 
                                vdeclarator = (_tmp54_ = vala_ccode_function_declarator_new (_tmp53_ = g_strdup_printf ("set_%s", vala_symbol_get_name ((ValaSymbol*) prop))), _g_free0 (_tmp53_), _tmp54_);
 
1201
                                vdeclarator = (_tmp57_ = vala_ccode_function_declarator_new (_tmp56_ = g_strdup_printf ("set_%s", vala_symbol_get_name ((ValaSymbol*) prop))), _g_free0 (_tmp56_), _tmp57_);
1188
1202
                                vala_ccode_function_declarator_add_parameter (vdeclarator, cselfparam);
1189
1203
                                vala_ccode_function_declarator_add_parameter (vdeclarator, cvalueparam);
1190
 
                                array_type = _vala_code_node_ref0 ((_tmp55_ = vala_property_get_property_type (prop), VALA_IS_ARRAY_TYPE (_tmp55_) ? ((ValaArrayType*) _tmp55_) : NULL));
 
1204
                                array_type = _vala_code_node_ref0 ((_tmp58_ = vala_property_get_property_type (prop), VALA_IS_ARRAY_TYPE (_tmp58_) ? ((ValaArrayType*) _tmp58_) : NULL));
1191
1205
                                if (array_type != NULL) {
1192
1206
                                        {
1193
1207
                                                gint dim;
1194
1208
                                                dim = 1;
1195
1209
                                                {
1196
 
                                                        gboolean _tmp56_;
1197
 
                                                        _tmp56_ = TRUE;
 
1210
                                                        gboolean _tmp59_;
 
1211
                                                        _tmp59_ = TRUE;
1198
1212
                                                        while (TRUE) {
1199
 
                                                                char* _tmp57_;
1200
 
                                                                ValaCCodeFormalParameter* _tmp58_;
1201
 
                                                                if (!_tmp56_) {
 
1213
                                                                char* _tmp60_;
 
1214
                                                                ValaCCodeFormalParameter* _tmp61_;
 
1215
                                                                if (!_tmp59_) {
1202
1216
                                                                        dim++;
1203
1217
                                                                }
1204
 
                                                                _tmp56_ = FALSE;
 
1218
                                                                _tmp59_ = FALSE;
1205
1219
                                                                if (!(dim <= vala_array_type_get_rank (array_type))) {
1206
1220
                                                                        break;
1207
1221
                                                                }
1208
 
                                                                vala_ccode_function_declarator_add_parameter (vdeclarator, _tmp58_ = vala_ccode_formal_parameter_new (_tmp57_ = vala_ccode_base_module_get_array_length_cname ((ValaCCodeBaseModule*) self, "value", dim), "int"));
1209
 
                                                                _vala_ccode_node_unref0 (_tmp58_);
1210
 
                                                                _g_free0 (_tmp57_);
 
1222
                                                                vala_ccode_function_declarator_add_parameter (vdeclarator, _tmp61_ = vala_ccode_formal_parameter_new (_tmp60_ = vala_ccode_base_module_get_array_length_cname ((ValaCCodeBaseModule*) self, "value", dim), "int"));
 
1223
                                                                _vala_ccode_node_unref0 (_tmp61_);
 
1224
                                                                _g_free0 (_tmp60_);
1211
1225
                                                        }
1212
1226
                                                }
1213
1227
                                        }
 
1228
                                } else {
 
1229
                                        gboolean _tmp62_ = FALSE;
 
1230
                                        if (VALA_IS_DELEGATE_TYPE (vala_property_get_property_type (prop))) {
 
1231
                                                _tmp62_ = vala_delegate_get_has_target (vala_delegate_type_get_delegate_symbol (VALA_DELEGATE_TYPE (vala_property_get_property_type (prop))));
 
1232
                                        } else {
 
1233
                                                _tmp62_ = FALSE;
 
1234
                                        }
 
1235
                                        if (_tmp62_) {
 
1236
                                                char* _tmp63_;
 
1237
                                                ValaCCodeFormalParameter* _tmp64_;
 
1238
                                                vala_ccode_function_declarator_add_parameter (vdeclarator, _tmp64_ = vala_ccode_formal_parameter_new (_tmp63_ = vala_ccode_base_module_get_delegate_target_cname ((ValaCCodeBaseModule*) self, "value"), "gpointer"));
 
1239
                                                _vala_ccode_node_unref0 (_tmp64_);
 
1240
                                                _g_free0 (_tmp63_);
 
1241
                                        }
1214
1242
                                }
1215
1243
                                vdecl = vala_ccode_declaration_new ("void");
1216
1244
                                vala_ccode_declaration_add_declarator (vdecl, (ValaCCodeDeclarator*) vdeclarator);
1228
1256
                _vala_collection_object_unref0 (_prop_it);
1229
1257
        }
1230
1258
        {
1231
 
                ValaList* _tmp59_;
1232
 
                ValaIterator* _tmp60_;
 
1259
                ValaList* _tmp65_;
 
1260
                ValaIterator* _tmp66_;
1233
1261
                ValaIterator* _f_it;
1234
 
                _f_it = (_tmp60_ = vala_iterable_iterator ((ValaIterable*) (_tmp59_ = vala_class_get_fields (cl))), _vala_collection_object_unref0 (_tmp59_), _tmp60_);
 
1262
                _f_it = (_tmp66_ = vala_iterable_iterator ((ValaIterable*) (_tmp65_ = vala_class_get_fields (cl))), _vala_collection_object_unref0 (_tmp65_), _tmp66_);
1235
1263
                while (TRUE) {
1236
1264
                        ValaField* f;
1237
1265
                        char* field_ctype;
1241
1269
                        f = (ValaField*) vala_iterator_get (_f_it);
1242
1270
                        field_ctype = vala_data_type_get_cname (vala_variable_get_variable_type ((ValaVariable*) f));
1243
1271
                        if (vala_field_get_is_volatile (f)) {
1244
 
                                char* _tmp61_;
1245
 
                                field_ctype = (_tmp61_ = g_strconcat ("volatile ", field_ctype, NULL), _g_free0 (field_ctype), _tmp61_);
 
1272
                                char* _tmp67_;
 
1273
                                field_ctype = (_tmp67_ = g_strconcat ("volatile ", field_ctype, NULL), _g_free0 (field_ctype), _tmp67_);
1246
1274
                        }
1247
1275
                        if (vala_symbol_get_access ((ValaSymbol*) f) != VALA_SYMBOL_ACCESSIBILITY_PRIVATE) {
1248
1276
                                if (vala_field_get_binding (f) == MEMBER_BINDING_INSTANCE) {
1249
 
                                        char* _tmp62_;
1250
 
                                        char* _tmp63_;
1251
 
                                        gboolean _tmp64_ = FALSE;
 
1277
                                        char* _tmp68_;
 
1278
                                        char* _tmp69_;
 
1279
                                        gboolean _tmp70_ = FALSE;
1252
1280
                                        vala_ccode_base_module_generate_type_declaration ((ValaCCodeBaseModule*) self, vala_variable_get_variable_type ((ValaVariable*) f), decl_space);
1253
 
                                        vala_ccode_struct_add_field (instance_struct, field_ctype, _tmp62_ = vala_field_get_cname (f), _tmp63_ = vala_data_type_get_cdeclarator_suffix (vala_variable_get_variable_type ((ValaVariable*) f)));
1254
 
                                        _g_free0 (_tmp63_);
1255
 
                                        _g_free0 (_tmp62_);
 
1281
                                        vala_ccode_struct_add_field (instance_struct, field_ctype, _tmp68_ = vala_field_get_cname (f), _tmp69_ = vala_data_type_get_cdeclarator_suffix (vala_variable_get_variable_type ((ValaVariable*) f)));
 
1282
                                        _g_free0 (_tmp69_);
 
1283
                                        _g_free0 (_tmp68_);
1256
1284
                                        if (VALA_IS_ARRAY_TYPE (vala_variable_get_variable_type ((ValaVariable*) f))) {
1257
 
                                                _tmp64_ = !vala_field_get_no_array_length (f);
 
1285
                                                _tmp70_ = !vala_field_get_no_array_length (f);
1258
1286
                                        } else {
1259
 
                                                _tmp64_ = FALSE;
 
1287
                                                _tmp70_ = FALSE;
1260
1288
                                        }
1261
 
                                        if (_tmp64_) {
 
1289
                                        if (_tmp70_) {
1262
1290
                                                ValaArrayType* array_type;
1263
1291
                                                array_type = _vala_code_node_ref0 (VALA_ARRAY_TYPE (vala_variable_get_variable_type ((ValaVariable*) f)));
1264
1292
                                                if (!vala_array_type_get_fixed_length (array_type)) {
1265
1293
                                                        ValaDataType* len_type;
1266
 
                                                        gboolean _tmp68_ = FALSE;
 
1294
                                                        gboolean _tmp74_ = FALSE;
1267
1295
                                                        len_type = vala_data_type_copy (((ValaCCodeBaseModule*) self)->int_type);
1268
1296
                                                        {
1269
1297
                                                                gint dim;
1270
1298
                                                                dim = 1;
1271
1299
                                                                {
1272
 
                                                                        gboolean _tmp65_;
1273
 
                                                                        _tmp65_ = TRUE;
 
1300
                                                                        gboolean _tmp71_;
 
1301
                                                                        _tmp71_ = TRUE;
1274
1302
                                                                        while (TRUE) {
1275
 
                                                                                char* _tmp66_;
1276
 
                                                                                char* _tmp67_;
1277
 
                                                                                if (!_tmp65_) {
 
1303
                                                                                char* _tmp72_;
 
1304
                                                                                char* _tmp73_;
 
1305
                                                                                if (!_tmp71_) {
1278
1306
                                                                                        dim++;
1279
1307
                                                                                }
1280
 
                                                                                _tmp65_ = FALSE;
 
1308
                                                                                _tmp71_ = FALSE;
1281
1309
                                                                                if (!(dim <= vala_array_type_get_rank (array_type))) {
1282
1310
                                                                                        break;
1283
1311
                                                                                }
1284
 
                                                                                vala_ccode_struct_add_field (instance_struct, _tmp66_ = vala_data_type_get_cname (len_type), _tmp67_ = vala_ccode_base_module_get_array_length_cname ((ValaCCodeBaseModule*) self, vala_symbol_get_name ((ValaSymbol*) f), dim), NULL);
1285
 
                                                                                _g_free0 (_tmp67_);
1286
 
                                                                                _g_free0 (_tmp66_);
 
1312
                                                                                vala_ccode_struct_add_field (instance_struct, _tmp72_ = vala_data_type_get_cname (len_type), _tmp73_ = vala_ccode_base_module_get_array_length_cname ((ValaCCodeBaseModule*) self, vala_symbol_get_name ((ValaSymbol*) f), dim), NULL);
 
1313
                                                                                _g_free0 (_tmp73_);
 
1314
                                                                                _g_free0 (_tmp72_);
1287
1315
                                                                        }
1288
1316
                                                                }
1289
1317
                                                        }
1290
1318
                                                        if (vala_array_type_get_rank (array_type) == 1) {
1291
 
                                                                _tmp68_ = vala_symbol_is_internal_symbol ((ValaSymbol*) f);
 
1319
                                                                _tmp74_ = vala_symbol_is_internal_symbol ((ValaSymbol*) f);
1292
1320
                                                        } else {
1293
 
                                                                _tmp68_ = FALSE;
 
1321
                                                                _tmp74_ = FALSE;
1294
1322
                                                        }
1295
 
                                                        if (_tmp68_) {
1296
 
                                                                char* _tmp69_;
1297
 
                                                                char* _tmp70_;
1298
 
                                                                vala_ccode_struct_add_field (instance_struct, _tmp69_ = vala_data_type_get_cname (len_type), _tmp70_ = vala_ccode_base_module_get_array_size_cname ((ValaCCodeBaseModule*) self, vala_symbol_get_name ((ValaSymbol*) f)), NULL);
1299
 
                                                                _g_free0 (_tmp70_);
1300
 
                                                                _g_free0 (_tmp69_);
 
1323
                                                        if (_tmp74_) {
 
1324
                                                                char* _tmp75_;
 
1325
                                                                char* _tmp76_;
 
1326
                                                                vala_ccode_struct_add_field (instance_struct, _tmp75_ = vala_data_type_get_cname (len_type), _tmp76_ = vala_ccode_base_module_get_array_size_cname ((ValaCCodeBaseModule*) self, vala_symbol_get_name ((ValaSymbol*) f)), NULL);
 
1327
                                                                _g_free0 (_tmp76_);
 
1328
                                                                _g_free0 (_tmp75_);
1301
1329
                                                        }
1302
1330
                                                        _vala_code_node_unref0 (len_type);
1303
1331
                                                }
1307
1335
                                                        ValaDelegateType* delegate_type;
1308
1336
                                                        delegate_type = _vala_code_node_ref0 (VALA_DELEGATE_TYPE (vala_variable_get_variable_type ((ValaVariable*) f)));
1309
1337
                                                        if (vala_delegate_get_has_target (vala_delegate_type_get_delegate_symbol (delegate_type))) {
1310
 
                                                                char* _tmp71_;
1311
 
                                                                vala_ccode_struct_add_field (instance_struct, "gpointer", _tmp71_ = vala_ccode_base_module_get_delegate_target_cname ((ValaCCodeBaseModule*) self, vala_symbol_get_name ((ValaSymbol*) f)), NULL);
1312
 
                                                                _g_free0 (_tmp71_);
 
1338
                                                                char* _tmp77_;
 
1339
                                                                vala_ccode_struct_add_field (instance_struct, "gpointer", _tmp77_ = vala_ccode_base_module_get_delegate_target_cname ((ValaCCodeBaseModule*) self, vala_symbol_get_name ((ValaSymbol*) f)), NULL);
 
1340
                                                                _g_free0 (_tmp77_);
1313
1341
                                                                if (vala_data_type_get_value_owned ((ValaDataType*) delegate_type)) {
1314
 
                                                                        char* _tmp72_;
1315
 
                                                                        vala_ccode_struct_add_field (instance_struct, "GDestroyNotify", _tmp72_ = vala_ccode_base_module_get_delegate_target_destroy_notify_cname ((ValaCCodeBaseModule*) self, vala_symbol_get_name ((ValaSymbol*) f)), NULL);
1316
 
                                                                        _g_free0 (_tmp72_);
 
1342
                                                                        char* _tmp78_;
 
1343
                                                                        vala_ccode_struct_add_field (instance_struct, "GDestroyNotify", _tmp78_ = vala_ccode_base_module_get_delegate_target_destroy_notify_cname ((ValaCCodeBaseModule*) self, vala_symbol_get_name ((ValaSymbol*) f)), NULL);
 
1344
                                                                        _g_free0 (_tmp78_);
1317
1345
                                                                }
1318
1346
                                                        }
1319
1347
                                                        _vala_code_node_unref0 (delegate_type);
1321
1349
                                        }
1322
1350
                                } else {
1323
1351
                                        if (vala_field_get_binding (f) == MEMBER_BINDING_CLASS) {
1324
 
                                                char* _tmp73_;
1325
 
                                                vala_ccode_struct_add_field (type_struct, field_ctype, _tmp73_ = vala_field_get_cname (f), NULL);
1326
 
                                                _g_free0 (_tmp73_);
 
1352
                                                char* _tmp79_;
 
1353
                                                vala_ccode_struct_add_field (type_struct, field_ctype, _tmp79_ = vala_field_get_cname (f), NULL);
 
1354
                                                _g_free0 (_tmp79_);
1327
1355
                                        }
1328
1356
                                }
1329
1357
                        }
1333
1361
                _vala_collection_object_unref0 (_f_it);
1334
1362
        }
1335
1363
        if (!vala_class_get_is_compact (cl)) {
1336
 
                _tmp74_ = TRUE;
 
1364
                _tmp80_ = TRUE;
1337
1365
        } else {
1338
 
                _tmp74_ = vala_class_get_base_class (cl) == NULL;
 
1366
                _tmp80_ = vala_class_get_base_class (cl) == NULL;
1339
1367
        }
1340
 
        if (_tmp74_) {
 
1368
        if (_tmp80_) {
1341
1369
                vala_ccode_declaration_space_add_type_definition (decl_space, (ValaCCodeNode*) instance_struct);
1342
1370
        }
1343
1371
        if (is_gtypeinstance) {
1579
1607
                }
1580
1608
                _vala_collection_object_unref0 (_f_it);
1581
1609
        }
 
1610
        {
 
1611
                ValaList* _tmp37_;
 
1612
                ValaIterator* _tmp38_;
 
1613
                ValaIterator* _prop_it;
 
1614
                _prop_it = (_tmp38_ = vala_iterable_iterator ((ValaIterable*) (_tmp37_ = vala_object_type_symbol_get_properties ((ValaObjectTypeSymbol*) cl))), _vala_collection_object_unref0 (_tmp37_), _tmp38_);
 
1615
                while (TRUE) {
 
1616
                        ValaProperty* prop;
 
1617
                        if (!vala_iterator_next (_prop_it)) {
 
1618
                                break;
 
1619
                        }
 
1620
                        prop = (ValaProperty*) vala_iterator_get (_prop_it);
 
1621
                        if (vala_property_get_binding (prop) == MEMBER_BINDING_INSTANCE) {
 
1622
                                if (vala_lockable_get_lock_used ((ValaLockable*) prop)) {
 
1623
                                        char* _tmp39_;
 
1624
                                        char* _tmp40_;
 
1625
                                        has_instance_locks = TRUE;
 
1626
                                        vala_ccode_struct_add_field (instance_priv_struct, _tmp39_ = vala_typesymbol_get_cname ((ValaTypeSymbol*) ((ValaCCodeBaseModule*) self)->mutex_type, FALSE), _tmp40_ = vala_ccode_base_module_get_symbol_lock_name ((ValaCCodeBaseModule*) self, vala_symbol_get_name ((ValaSymbol*) prop)), NULL);
 
1627
                                        _g_free0 (_tmp40_);
 
1628
                                        _g_free0 (_tmp39_);
 
1629
                                }
 
1630
                        } else {
 
1631
                                if (vala_property_get_binding (prop) == MEMBER_BINDING_CLASS) {
 
1632
                                        if (vala_lockable_get_lock_used ((ValaLockable*) prop)) {
 
1633
                                                char* _tmp41_;
 
1634
                                                char* _tmp42_;
 
1635
                                                has_class_locks = TRUE;
 
1636
                                                vala_ccode_struct_add_field (type_priv_struct, _tmp41_ = vala_typesymbol_get_cname ((ValaTypeSymbol*) ((ValaCCodeBaseModule*) self)->mutex_type, FALSE), _tmp42_ = vala_ccode_base_module_get_symbol_lock_name ((ValaCCodeBaseModule*) self, vala_symbol_get_name ((ValaSymbol*) prop)), NULL);
 
1637
                                                _g_free0 (_tmp42_);
 
1638
                                                _g_free0 (_tmp41_);
 
1639
                                        }
 
1640
                                }
 
1641
                        }
 
1642
                        _vala_code_node_unref0 (prop);
 
1643
                }
 
1644
                _vala_collection_object_unref0 (_prop_it);
 
1645
        }
1582
1646
        if (is_gtypeinstance) {
1583
 
                gboolean _tmp37_ = FALSE;
1584
 
                gboolean _tmp47_ = FALSE;
1585
 
                gboolean _tmp48_ = FALSE;
1586
 
                gboolean _tmp56_ = FALSE;
 
1647
                gboolean _tmp43_ = FALSE;
 
1648
                gboolean _tmp53_ = FALSE;
 
1649
                gboolean _tmp54_ = FALSE;
 
1650
                gboolean _tmp62_ = FALSE;
1587
1651
                if (vala_class_get_has_class_private_fields (cl)) {
1588
 
                        _tmp37_ = TRUE;
 
1652
                        _tmp43_ = TRUE;
1589
1653
                } else {
1590
 
                        _tmp37_ = has_class_locks;
 
1654
                        _tmp43_ = has_class_locks;
1591
1655
                }
1592
 
                if (_tmp37_) {
1593
 
                        char* _tmp38_;
1594
 
                        char* _tmp39_;
1595
 
                        char* _tmp40_;
1596
 
                        ValaCCodeVariableDeclarator* _tmp41_;
1597
 
                        ValaCCodeTypeDefinition* _tmp42_;
1598
 
                        vala_ccode_declaration_space_add_type_declaration (decl_space, (ValaCCodeNode*) (_tmp42_ = vala_ccode_type_definition_new (_tmp38_ = g_strdup_printf ("struct %s", vala_ccode_struct_get_name (type_priv_struct)), (ValaCCodeDeclarator*) (_tmp41_ = vala_ccode_variable_declarator_new (_tmp40_ = g_strdup_printf ("%sClassPrivate", _tmp39_ = vala_typesymbol_get_cname ((ValaTypeSymbol*) cl, FALSE)), NULL, NULL)))));
1599
 
                        _vala_ccode_node_unref0 (_tmp42_);
1600
 
                        _vala_ccode_node_unref0 (_tmp41_);
1601
 
                        _g_free0 (_tmp40_);
1602
 
                        _g_free0 (_tmp39_);
1603
 
                        _g_free0 (_tmp38_);
 
1656
                if (_tmp43_) {
 
1657
                        char* _tmp44_;
 
1658
                        char* _tmp45_;
 
1659
                        char* _tmp46_;
 
1660
                        ValaCCodeVariableDeclarator* _tmp47_;
 
1661
                        ValaCCodeTypeDefinition* _tmp48_;
 
1662
                        vala_ccode_declaration_space_add_type_declaration (decl_space, (ValaCCodeNode*) (_tmp48_ = vala_ccode_type_definition_new (_tmp44_ = g_strdup_printf ("struct %s", vala_ccode_struct_get_name (type_priv_struct)), (ValaCCodeDeclarator*) (_tmp47_ = vala_ccode_variable_declarator_new (_tmp46_ = g_strdup_printf ("%sClassPrivate", _tmp45_ = vala_typesymbol_get_cname ((ValaTypeSymbol*) cl, FALSE)), NULL, NULL)))));
 
1663
                        _vala_ccode_node_unref0 (_tmp48_);
 
1664
                        _vala_ccode_node_unref0 (_tmp47_);
 
1665
                        _g_free0 (_tmp46_);
 
1666
                        _g_free0 (_tmp45_);
 
1667
                        _g_free0 (_tmp44_);
1604
1668
                        if (!vala_code_context_require_glib_version (vala_ccode_base_module_get_context ((ValaCCodeBaseModule*) self), 2, 24)) {
1605
1669
                                ValaCCodeDeclaration* _cdecl_;
1606
 
                                char* _tmp43_;
1607
 
                                char* _tmp44_;
1608
 
                                ValaCCodeConstant* _tmp45_;
1609
 
                                ValaCCodeVariableDeclarator* _tmp46_;
 
1670
                                char* _tmp49_;
 
1671
                                char* _tmp50_;
 
1672
                                ValaCCodeConstant* _tmp51_;
 
1673
                                ValaCCodeVariableDeclarator* _tmp52_;
1610
1674
                                _cdecl_ = vala_ccode_declaration_new ("GQuark");
1611
 
                                vala_ccode_declaration_add_declarator (_cdecl_, (ValaCCodeDeclarator*) (_tmp46_ = vala_ccode_variable_declarator_new (_tmp44_ = g_strdup_printf ("_vala_%s_class_private_quark", _tmp43_ = vala_symbol_get_lower_case_cname ((ValaSymbol*) cl, NULL)), (ValaCCodeExpression*) (_tmp45_ = vala_ccode_constant_new ("0")), NULL)));
1612
 
                                _vala_ccode_node_unref0 (_tmp46_);
1613
 
                                _vala_ccode_node_unref0 (_tmp45_);
1614
 
                                _g_free0 (_tmp44_);
1615
 
                                _g_free0 (_tmp43_);
 
1675
                                vala_ccode_declaration_add_declarator (_cdecl_, (ValaCCodeDeclarator*) (_tmp52_ = vala_ccode_variable_declarator_new (_tmp50_ = g_strdup_printf ("_vala_%s_class_private_quark", _tmp49_ = vala_symbol_get_lower_case_cname ((ValaSymbol*) cl, NULL)), (ValaCCodeExpression*) (_tmp51_ = vala_ccode_constant_new ("0")), NULL)));
 
1676
                                _vala_ccode_node_unref0 (_tmp52_);
 
1677
                                _vala_ccode_node_unref0 (_tmp51_);
 
1678
                                _g_free0 (_tmp50_);
 
1679
                                _g_free0 (_tmp49_);
1616
1680
                                vala_ccode_declaration_set_modifiers (_cdecl_, VALA_CCODE_MODIFIERS_STATIC);
1617
1681
                                vala_ccode_declaration_space_add_type_declaration (decl_space, (ValaCCodeNode*) _cdecl_);
1618
1682
                                _vala_ccode_node_unref0 (_cdecl_);
1619
1683
                        }
1620
1684
                }
1621
1685
                if (vala_class_get_has_private_fields (cl)) {
1622
 
                        _tmp48_ = TRUE;
1623
 
                } else {
1624
 
                        ValaList* _tmp49_;
1625
 
                        _tmp48_ = vala_collection_get_size ((ValaCollection*) (_tmp49_ = vala_object_type_symbol_get_type_parameters ((ValaObjectTypeSymbol*) cl))) > 0;
1626
 
                        _vala_collection_object_unref0 (_tmp49_);
1627
 
                }
1628
 
                if (_tmp48_) {
1629
 
                        _tmp47_ = TRUE;
1630
 
                } else {
1631
 
                        _tmp47_ = has_instance_locks;
1632
 
                }
1633
 
                if (_tmp47_) {
1634
 
                        char* _tmp50_;
1635
 
                        char* _tmp51_;
1636
 
                        char* _tmp52_;
 
1686
                        _tmp54_ = TRUE;
 
1687
                } else {
 
1688
                        ValaList* _tmp55_;
 
1689
                        _tmp54_ = vala_collection_get_size ((ValaCollection*) (_tmp55_ = vala_object_type_symbol_get_type_parameters ((ValaObjectTypeSymbol*) cl))) > 0;
 
1690
                        _vala_collection_object_unref0 (_tmp55_);
 
1691
                }
 
1692
                if (_tmp54_) {
 
1693
                        _tmp53_ = TRUE;
 
1694
                } else {
 
1695
                        _tmp53_ = has_instance_locks;
 
1696
                }
 
1697
                if (_tmp53_) {
 
1698
                        char* _tmp56_;
 
1699
                        char* _tmp57_;
 
1700
                        char* _tmp58_;
1637
1701
                        char* macro;
1638
 
                        char* _tmp53_;
1639
 
                        char* _tmp54_;
1640
 
                        ValaCCodeMacroReplacement* _tmp55_;
 
1702
                        char* _tmp59_;
 
1703
                        char* _tmp60_;
 
1704
                        ValaCCodeMacroReplacement* _tmp61_;
1641
1705
                        vala_ccode_declaration_space_add_type_definition (decl_space, (ValaCCodeNode*) instance_priv_struct);
1642
 
                        macro = (_tmp52_ = g_strdup_printf ("(G_TYPE_INSTANCE_GET_PRIVATE ((o), %s, %sPrivate))", _tmp50_ = vala_typesymbol_get_type_id ((ValaTypeSymbol*) cl), _tmp51_ = vala_typesymbol_get_cname ((ValaTypeSymbol*) cl, FALSE)), _g_free0 (_tmp51_), _g_free0 (_tmp50_), _tmp52_);
1643
 
                        vala_ccode_declaration_space_add_type_member_declaration (decl_space, (ValaCCodeNode*) (_tmp55_ = vala_ccode_macro_replacement_new (_tmp54_ = g_strdup_printf ("%s_GET_PRIVATE(o)", _tmp53_ = vala_typesymbol_get_upper_case_cname ((ValaTypeSymbol*) cl, NULL)), macro)));
1644
 
                        _vala_ccode_node_unref0 (_tmp55_);
1645
 
                        _g_free0 (_tmp54_);
1646
 
                        _g_free0 (_tmp53_);
 
1706
                        macro = (_tmp58_ = g_strdup_printf ("(G_TYPE_INSTANCE_GET_PRIVATE ((o), %s, %sPrivate))", _tmp56_ = vala_typesymbol_get_type_id ((ValaTypeSymbol*) cl), _tmp57_ = vala_typesymbol_get_cname ((ValaTypeSymbol*) cl, FALSE)), _g_free0 (_tmp57_), _g_free0 (_tmp56_), _tmp58_);
 
1707
                        vala_ccode_declaration_space_add_type_member_declaration (decl_space, (ValaCCodeNode*) (_tmp61_ = vala_ccode_macro_replacement_new (_tmp60_ = g_strdup_printf ("%s_GET_PRIVATE(o)", _tmp59_ = vala_typesymbol_get_upper_case_cname ((ValaTypeSymbol*) cl, NULL)), macro)));
 
1708
                        _vala_ccode_node_unref0 (_tmp61_);
 
1709
                        _g_free0 (_tmp60_);
 
1710
                        _g_free0 (_tmp59_);
1647
1711
                        _g_free0 (macro);
1648
1712
                }
1649
1713
                if (vala_class_get_has_class_private_fields (cl)) {
1650
 
                        _tmp56_ = TRUE;
 
1714
                        _tmp62_ = TRUE;
1651
1715
                } else {
1652
 
                        _tmp56_ = has_class_locks;
 
1716
                        _tmp62_ = has_class_locks;
1653
1717
                }
1654
 
                if (_tmp56_) {
 
1718
                if (_tmp62_) {
1655
1719
                        char* macro;
1656
 
                        char* _tmp63_;
1657
 
                        char* _tmp64_;
1658
 
                        ValaCCodeMacroReplacement* _tmp65_;
 
1720
                        char* _tmp69_;
 
1721
                        char* _tmp70_;
 
1722
                        ValaCCodeMacroReplacement* _tmp71_;
1659
1723
                        vala_ccode_declaration_space_add_type_member_declaration (decl_space, (ValaCCodeNode*) type_priv_struct);
1660
1724
                        macro = NULL;
1661
1725
                        if (vala_code_context_require_glib_version (vala_ccode_base_module_get_context ((ValaCCodeBaseModule*) self), 2, 24)) {
1662
 
                                char* _tmp57_;
1663
 
                                char* _tmp58_;
1664
 
                                char* _tmp59_;
1665
 
                                macro = (_tmp59_ = g_strdup_printf ("(G_TYPE_CLASS_GET_PRIVATE (klass, %s, %sClassPrivate))", _tmp57_ = vala_typesymbol_get_type_id ((ValaTypeSymbol*) cl), _tmp58_ = vala_typesymbol_get_cname ((ValaTypeSymbol*) cl, FALSE)), _g_free0 (macro), _tmp59_);
1666
 
                                _g_free0 (_tmp58_);
1667
 
                                _g_free0 (_tmp57_);
 
1726
                                char* _tmp63_;
 
1727
                                char* _tmp64_;
 
1728
                                char* _tmp65_;
 
1729
                                macro = (_tmp65_ = g_strdup_printf ("(G_TYPE_CLASS_GET_PRIVATE (klass, %s, %sClassPrivate))", _tmp63_ = vala_typesymbol_get_type_id ((ValaTypeSymbol*) cl), _tmp64_ = vala_typesymbol_get_cname ((ValaTypeSymbol*) cl, FALSE)), _g_free0 (macro), _tmp65_);
 
1730
                                _g_free0 (_tmp64_);
 
1731
                                _g_free0 (_tmp63_);
1668
1732
                        } else {
1669
 
                                char* _tmp60_;
1670
 
                                char* _tmp61_;
1671
 
                                char* _tmp62_;
1672
 
                                macro = (_tmp62_ = g_strdup_printf ("((%sClassPrivate *) g_type_get_qdata (G_TYPE_FROM_CLASS (klass), _vala" \
1673
 
"_%s_class_private_quark))", _tmp60_ = vala_typesymbol_get_cname ((ValaTypeSymbol*) cl, FALSE), _tmp61_ = vala_symbol_get_lower_case_cname ((ValaSymbol*) cl, NULL)), _g_free0 (macro), _tmp62_);
1674
 
                                _g_free0 (_tmp61_);
1675
 
                                _g_free0 (_tmp60_);
 
1733
                                char* _tmp66_;
 
1734
                                char* _tmp67_;
 
1735
                                char* _tmp68_;
 
1736
                                macro = (_tmp68_ = g_strdup_printf ("((%sClassPrivate *) g_type_get_qdata (G_TYPE_FROM_CLASS (klass), _vala" \
 
1737
"_%s_class_private_quark))", _tmp66_ = vala_typesymbol_get_cname ((ValaTypeSymbol*) cl, FALSE), _tmp67_ = vala_symbol_get_lower_case_cname ((ValaSymbol*) cl, NULL)), _g_free0 (macro), _tmp68_);
 
1738
                                _g_free0 (_tmp67_);
 
1739
                                _g_free0 (_tmp66_);
1676
1740
                        }
1677
 
                        vala_ccode_declaration_space_add_type_member_declaration (decl_space, (ValaCCodeNode*) (_tmp65_ = vala_ccode_macro_replacement_new (_tmp64_ = g_strdup_printf ("%s_GET_CLASS_PRIVATE(klass)", _tmp63_ = vala_typesymbol_get_upper_case_cname ((ValaTypeSymbol*) cl, NULL)), macro)));
1678
 
                        _vala_ccode_node_unref0 (_tmp65_);
1679
 
                        _g_free0 (_tmp64_);
1680
 
                        _g_free0 (_tmp63_);
 
1741
                        vala_ccode_declaration_space_add_type_member_declaration (decl_space, (ValaCCodeNode*) (_tmp71_ = vala_ccode_macro_replacement_new (_tmp70_ = g_strdup_printf ("%s_GET_CLASS_PRIVATE(klass)", _tmp69_ = vala_typesymbol_get_upper_case_cname ((ValaTypeSymbol*) cl, NULL)), macro)));
 
1742
                        _vala_ccode_node_unref0 (_tmp71_);
 
1743
                        _g_free0 (_tmp70_);
 
1744
                        _g_free0 (_tmp69_);
1681
1745
                        _g_free0 (macro);
1682
1746
                }
1683
1747
                vala_ccode_declaration_space_add_type_member_declaration (decl_space, (ValaCCodeNode*) ((ValaCCodeBaseModule*) self)->prop_enum);
1696
1760
}
1697
1761
 
1698
1762
 
 
1763
static glong string_get_length (const char* self) {
 
1764
        glong result;
 
1765
        g_return_val_if_fail (self != NULL, 0L);
 
1766
        result = g_utf8_strlen (self, (gssize) (-1));
 
1767
        return result;
 
1768
}
 
1769
 
 
1770
 
1699
1771
static void vala_gtype_module_real_visit_class (ValaCodeVisitor* base, ValaClass* cl) {
1700
1772
        ValaGTypeModule * self;
1701
1773
        ValaCCodeBaseModuleEmitContext* _tmp0_;
1749
1821
                _tmp1_ = FALSE;
1750
1822
        }
1751
1823
        is_fundamental = _tmp1_;
1752
 
        if ((_tmp3_ = g_utf8_strlen (_tmp2_ = vala_typesymbol_get_cname ((ValaTypeSymbol*) cl, FALSE), -1) < 3, _g_free0 (_tmp2_), _tmp3_)) {
 
1824
        if ((_tmp3_ = string_get_length (_tmp2_ = vala_typesymbol_get_cname ((ValaTypeSymbol*) cl, FALSE)) < 3, _g_free0 (_tmp2_), _tmp3_)) {
1753
1825
                char* _tmp4_;
1754
1826
                char* _tmp5_;
1755
1827
                vala_code_node_set_error ((ValaCodeNode*) cl, TRUE);
2381
2453
        vala_ccode_block_add_statement (init_block, (ValaCCodeNode*) if_assert);
2382
2454
        main_else_true = vala_ccode_block_new ();
2383
2455
        main_else_if_true = vala_ccode_block_new ();
2384
 
        main_else_if_condition = (_tmp27_ = vala_ccode_binary_expression_new (VALA_CCODE_BINARY_OPERATOR_AND, (ValaCCodeExpression*) (_tmp25_ = vala_ccode_identifier_new ("collect_flags")), (ValaCCodeExpression*) (_tmp26_ = vala_ccode_identifier_new ("G_VALUE_NOCOPY_CONTENTS"))), _vala_ccode_node_unref0 (_tmp26_), _vala_ccode_node_unref0 (_tmp25_), _tmp27_);
 
2456
        main_else_if_condition = (_tmp27_ = vala_ccode_binary_expression_new (VALA_CCODE_BINARY_OPERATOR_BITWISE_AND, (ValaCCodeExpression*) (_tmp25_ = vala_ccode_identifier_new ("collect_flags")), (ValaCCodeExpression*) (_tmp26_ = vala_ccode_identifier_new ("G_VALUE_NOCOPY_CONTENTS"))), _vala_ccode_node_unref0 (_tmp26_), _vala_ccode_node_unref0 (_tmp25_), _tmp27_);
2385
2457
        main_else_if = vala_ccode_if_statement_new ((ValaCCodeExpression*) main_else_if_condition, (ValaCCodeStatement*) main_else_if_true, (ValaCCodeStatement*) main_else_true);
2386
2458
        main_true = vala_ccode_block_new ();
2387
2459
        main_condition = vala_ccode_unary_expression_new (VALA_CCODE_UNARY_OPERATOR_LOGICAL_NEGATION, (ValaCCodeExpression*) vpointer);
5265
5337
        g_return_if_fail (iface != NULL);
5266
5338
        vala_ccode_base_module_push_context ((ValaCCodeBaseModule*) self, _tmp0_ = vala_ccode_base_module_emit_context_new ((ValaSymbol*) iface));
5267
5339
        _vala_ccode_base_module_emit_context_unref0 (_tmp0_);
5268
 
        if ((_tmp2_ = g_utf8_strlen (_tmp1_ = vala_typesymbol_get_cname ((ValaTypeSymbol*) iface, FALSE), -1) < 3, _g_free0 (_tmp1_), _tmp2_)) {
 
5340
        if ((_tmp2_ = string_get_length (_tmp1_ = vala_typesymbol_get_cname ((ValaTypeSymbol*) iface, FALSE)) < 3, _g_free0 (_tmp1_), _tmp2_)) {
5269
5341
                char* _tmp3_;
5270
5342
                char* _tmp4_;
5271
5343
                vala_code_node_set_error ((ValaCodeNode*) iface, TRUE);