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

« back to all changes in this revision

Viewing changes to vala/valabinaryexpression.c

  • Committer: Bazaar Package Importer
  • Author(s): Sebastian Dröge
  • Date: 2010-07-28 07:58:01 UTC
  • mfrom: (1.5.5 upstream) (7.3.14 experimental)
  • Revision ID: james.westby@ubuntu.com-20100728075801-18u9cg5hv5oety6m
Tags: 0.9.4-1
New upstream development release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
91
91
typedef struct _ValaSymbol ValaSymbol;
92
92
typedef struct _ValaSymbolClass ValaSymbolClass;
93
93
 
 
94
#define VALA_TYPE_VARIABLE (vala_variable_get_type ())
 
95
#define VALA_VARIABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), VALA_TYPE_VARIABLE, ValaVariable))
 
96
#define VALA_VARIABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), VALA_TYPE_VARIABLE, ValaVariableClass))
 
97
#define VALA_IS_VARIABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), VALA_TYPE_VARIABLE))
 
98
#define VALA_IS_VARIABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), VALA_TYPE_VARIABLE))
 
99
#define VALA_VARIABLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), VALA_TYPE_VARIABLE, ValaVariableClass))
 
100
 
 
101
typedef struct _ValaVariable ValaVariable;
 
102
typedef struct _ValaVariableClass ValaVariableClass;
 
103
 
94
104
#define VALA_TYPE_LOCAL_VARIABLE (vala_local_variable_get_type ())
95
105
#define VALA_LOCAL_VARIABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), VALA_TYPE_LOCAL_VARIABLE, ValaLocalVariable))
96
106
#define VALA_LOCAL_VARIABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), VALA_TYPE_LOCAL_VARIABLE, ValaLocalVariableClass))
238
248
typedef struct _ValaEnum ValaEnum;
239
249
typedef struct _ValaEnumClass ValaEnumClass;
240
250
 
 
251
#define VALA_TYPE_CONSTANT (vala_constant_get_type ())
 
252
#define VALA_CONSTANT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), VALA_TYPE_CONSTANT, ValaConstant))
 
253
#define VALA_CONSTANT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), VALA_TYPE_CONSTANT, ValaConstantClass))
 
254
#define VALA_IS_CONSTANT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), VALA_TYPE_CONSTANT))
 
255
#define VALA_IS_CONSTANT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), VALA_TYPE_CONSTANT))
 
256
#define VALA_CONSTANT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), VALA_TYPE_CONSTANT, ValaConstantClass))
 
257
 
 
258
typedef struct _ValaConstant ValaConstant;
 
259
typedef struct _ValaConstantClass ValaConstantClass;
 
260
 
241
261
#define VALA_TYPE_ENUM_VALUE (vala_enum_value_get_type ())
242
262
#define VALA_ENUM_VALUE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), VALA_TYPE_ENUM_VALUE, ValaEnumValue))
243
263
#define VALA_ENUM_VALUE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), VALA_TYPE_ENUM_VALUE, ValaEnumValueClass))
278
298
typedef struct _ValaDelegate ValaDelegate;
279
299
typedef struct _ValaDelegateClass ValaDelegateClass;
280
300
 
281
 
#define VALA_TYPE_MEMBER (vala_member_get_type ())
282
 
#define VALA_MEMBER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), VALA_TYPE_MEMBER, ValaMember))
283
 
#define VALA_MEMBER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), VALA_TYPE_MEMBER, ValaMemberClass))
284
 
#define VALA_IS_MEMBER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), VALA_TYPE_MEMBER))
285
 
#define VALA_IS_MEMBER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), VALA_TYPE_MEMBER))
286
 
#define VALA_MEMBER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), VALA_TYPE_MEMBER, ValaMemberClass))
287
 
 
288
 
typedef struct _ValaMember ValaMember;
289
 
typedef struct _ValaMemberClass ValaMemberClass;
290
 
 
291
 
#define VALA_TYPE_CONSTANT (vala_constant_get_type ())
292
 
#define VALA_CONSTANT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), VALA_TYPE_CONSTANT, ValaConstant))
293
 
#define VALA_CONSTANT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), VALA_TYPE_CONSTANT, ValaConstantClass))
294
 
#define VALA_IS_CONSTANT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), VALA_TYPE_CONSTANT))
295
 
#define VALA_IS_CONSTANT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), VALA_TYPE_CONSTANT))
296
 
#define VALA_CONSTANT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), VALA_TYPE_CONSTANT, ValaConstantClass))
297
 
 
298
 
typedef struct _ValaConstant ValaConstant;
299
 
typedef struct _ValaConstantClass ValaConstantClass;
300
 
 
301
301
#define VALA_TYPE_FIELD (vala_field_get_type ())
302
302
#define VALA_FIELD(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), VALA_TYPE_FIELD, ValaField))
303
303
#define VALA_FIELD_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), VALA_TYPE_FIELD, ValaFieldClass))
1030
1030
 
1031
1031
typedef struct _ValaPointerType ValaPointerType;
1032
1032
typedef struct _ValaPointerTypeClass ValaPointerTypeClass;
 
1033
 
 
1034
#define VALA_TYPE_UNARY_OPERATOR (vala_unary_operator_get_type ())
1033
1035
#define _vala_collection_object_unref0(var) ((var == NULL) ? NULL : (var = (vala_collection_object_unref (var), NULL)))
1034
1036
 
1035
1037
struct _ValaCodeNode {
1124
1126
        void (*visit_error_domain) (ValaCodeVisitor* self, ValaErrorDomain* edomain);
1125
1127
        void (*visit_error_code) (ValaCodeVisitor* self, ValaErrorCode* ecode);
1126
1128
        void (*visit_delegate) (ValaCodeVisitor* self, ValaDelegate* d);
1127
 
        void (*visit_member) (ValaCodeVisitor* self, ValaMember* m);
1128
1129
        void (*visit_constant) (ValaCodeVisitor* self, ValaConstant* c);
1129
1130
        void (*visit_field) (ValaCodeVisitor* self, ValaField* f);
1130
1131
        void (*visit_method) (ValaCodeVisitor* self, ValaMethod* m);
1265
1266
        VALA_PROFILE_DOVA
1266
1267
} ValaProfile;
1267
1268
 
 
1269
typedef enum  {
 
1270
        VALA_UNARY_OPERATOR_NONE,
 
1271
        VALA_UNARY_OPERATOR_PLUS,
 
1272
        VALA_UNARY_OPERATOR_MINUS,
 
1273
        VALA_UNARY_OPERATOR_LOGICAL_NEGATION,
 
1274
        VALA_UNARY_OPERATOR_BITWISE_COMPLEMENT,
 
1275
        VALA_UNARY_OPERATOR_INCREMENT,
 
1276
        VALA_UNARY_OPERATOR_DECREMENT,
 
1277
        VALA_UNARY_OPERATOR_REF,
 
1278
        VALA_UNARY_OPERATOR_OUT
 
1279
} ValaUnaryOperator;
 
1280
 
1268
1281
 
1269
1282
static gpointer vala_binary_expression_parent_class = NULL;
1270
1283
 
1286
1299
GType vala_data_type_get_type (void) G_GNUC_CONST;
1287
1300
GType vala_expression_get_type (void) G_GNUC_CONST;
1288
1301
GType vala_symbol_get_type (void) G_GNUC_CONST;
 
1302
GType vala_variable_get_type (void) G_GNUC_CONST;
1289
1303
GType vala_local_variable_get_type (void) G_GNUC_CONST;
1290
1304
GType vala_attribute_get_type (void) G_GNUC_CONST;
1291
1305
GType vala_binary_expression_get_type (void) G_GNUC_CONST;
1350
1364
GType vala_struct_get_type (void) G_GNUC_CONST;
1351
1365
GType vala_interface_get_type (void) G_GNUC_CONST;
1352
1366
GType vala_enum_get_type (void) G_GNUC_CONST;
 
1367
GType vala_constant_get_type (void) G_GNUC_CONST;
1353
1368
GType vala_enum_value_get_type (void) G_GNUC_CONST;
1354
1369
GType vala_error_domain_get_type (void) G_GNUC_CONST;
1355
1370
GType vala_error_code_get_type (void) G_GNUC_CONST;
1356
1371
GType vala_delegate_get_type (void) G_GNUC_CONST;
1357
 
GType vala_member_get_type (void) G_GNUC_CONST;
1358
 
GType vala_constant_get_type (void) G_GNUC_CONST;
1359
1372
GType vala_field_get_type (void) G_GNUC_CONST;
1360
1373
GType vala_method_get_type (void) G_GNUC_CONST;
1361
1374
GType vala_creation_method_get_type (void) G_GNUC_CONST;
1484
1497
ValaDataType* vala_semantic_analyzer_get_arithmetic_result_type (ValaSemanticAnalyzer* self, ValaDataType* left_type, ValaDataType* right_type);
1485
1498
void vala_data_type_set_nullable (ValaDataType* self, gboolean value);
1486
1499
gboolean vala_data_type_get_nullable (ValaDataType* self);
 
1500
GType vala_unary_operator_get_type (void) G_GNUC_CONST;
 
1501
ValaUnaryExpression* vala_unary_expression_new (ValaUnaryOperator op, ValaExpression* _inner, ValaSourceReference* source);
 
1502
ValaUnaryExpression* vala_unary_expression_construct (GType object_type, ValaUnaryOperator op, ValaExpression* _inner, ValaSourceReference* source);
1487
1503
ValaSymbol* vala_data_type_get_member (ValaDataType* self, const char* member_name);
1488
1504
ValaList* vala_method_get_parameters (ValaMethod* self);
1489
1505
char* vala_symbol_get_full_name (ValaSymbol* self);
1498
1514
 
1499
1515
 
1500
1516
 
 
1517
/**
 
1518
 * Creates a new binary expression.
 
1519
 *
 
1520
 * @param op     binary operator
 
1521
 * @param left   left operand
 
1522
 * @param right  right operand
 
1523
 * @param source reference to source code
 
1524
 * @return       newly created binary expression
 
1525
 */
1501
1526
ValaBinaryExpression* vala_binary_expression_construct (GType object_type, ValaBinaryOperator op, ValaExpression* _left, ValaExpression* _right, ValaSourceReference* source) {
1502
1527
        ValaBinaryExpression* self;
1503
1528
        g_return_val_if_fail (_left != NULL, NULL);
2272
2297
                                                                        _tmp74_ = FALSE;
2273
2298
                                                                }
2274
2299
                                                                if (_tmp74_) {
 
2300
                                                                        if (vala_code_context_get_profile (vala_semantic_analyzer_get_context (analyzer)) == VALA_PROFILE_DOVA) {
 
2301
                                                                                ValaMemberAccess* _tmp75_;
 
2302
                                                                                ValaMethodCall* _tmp76_;
 
2303
                                                                                ValaMethodCall* equals_call;
 
2304
                                                                                equals_call = (_tmp76_ = vala_method_call_new ((ValaExpression*) (_tmp75_ = vala_member_access_new (vala_binary_expression_get_left (self), "equals", vala_code_node_get_source_reference ((ValaCodeNode*) self))), vala_code_node_get_source_reference ((ValaCodeNode*) self)), _vala_code_node_unref0 (_tmp75_), _tmp76_);
 
2305
                                                                                vala_method_call_add_argument (equals_call, vala_binary_expression_get_right (self));
 
2306
                                                                                if (self->priv->_operator == VALA_BINARY_OPERATOR_EQUALITY) {
 
2307
                                                                                        vala_code_node_replace_expression (vala_code_node_get_parent_node ((ValaCodeNode*) self), (ValaExpression*) self, (ValaExpression*) equals_call);
 
2308
                                                                                        result = vala_code_node_check ((ValaCodeNode*) equals_call, analyzer);
 
2309
                                                                                        _vala_code_node_unref0 (equals_call);
 
2310
                                                                                        return result;
 
2311
                                                                                } else {
 
2312
                                                                                        ValaUnaryExpression* not;
 
2313
                                                                                        not = vala_unary_expression_new (VALA_UNARY_OPERATOR_LOGICAL_NEGATION, (ValaExpression*) equals_call, vala_code_node_get_source_reference ((ValaCodeNode*) self));
 
2314
                                                                                        vala_code_node_replace_expression (vala_code_node_get_parent_node ((ValaCodeNode*) self), (ValaExpression*) self, (ValaExpression*) not);
 
2315
                                                                                        result = vala_code_node_check ((ValaCodeNode*) not, analyzer);
 
2316
                                                                                        _vala_code_node_unref0 (not);
 
2317
                                                                                        _vala_code_node_unref0 (equals_call);
 
2318
                                                                                        return result;
 
2319
                                                                                }
 
2320
                                                                                _vala_code_node_unref0 (equals_call);
 
2321
                                                                        }
2275
2322
                                                                }
2276
2323
                                                                vala_expression_set_value_type ((ValaExpression*) self, analyzer->bool_type);
2277
2324
                                                        } else {
2278
 
                                                                gboolean _tmp75_ = FALSE;
 
2325
                                                                gboolean _tmp77_ = FALSE;
2279
2326
                                                                if (self->priv->_operator == VALA_BINARY_OPERATOR_BITWISE_AND) {
2280
 
                                                                        _tmp75_ = TRUE;
 
2327
                                                                        _tmp77_ = TRUE;
2281
2328
                                                                } else {
2282
 
                                                                        _tmp75_ = self->priv->_operator == VALA_BINARY_OPERATOR_BITWISE_OR;
 
2329
                                                                        _tmp77_ = self->priv->_operator == VALA_BINARY_OPERATOR_BITWISE_OR;
2283
2330
                                                                }
2284
 
                                                                if (_tmp75_) {
 
2331
                                                                if (_tmp77_) {
2285
2332
                                                                        vala_expression_set_value_type ((ValaExpression*) self, vala_expression_get_value_type (vala_binary_expression_get_left (self)));
2286
2333
                                                                } else {
2287
 
                                                                        gboolean _tmp76_ = FALSE;
 
2334
                                                                        gboolean _tmp78_ = FALSE;
2288
2335
                                                                        if (self->priv->_operator == VALA_BINARY_OPERATOR_AND) {
2289
 
                                                                                _tmp76_ = TRUE;
 
2336
                                                                                _tmp78_ = TRUE;
2290
2337
                                                                        } else {
2291
 
                                                                                _tmp76_ = self->priv->_operator == VALA_BINARY_OPERATOR_OR;
 
2338
                                                                                _tmp78_ = self->priv->_operator == VALA_BINARY_OPERATOR_OR;
2292
2339
                                                                        }
2293
 
                                                                        if (_tmp76_) {
2294
 
                                                                                gboolean _tmp77_ = FALSE;
 
2340
                                                                        if (_tmp78_) {
 
2341
                                                                                gboolean _tmp79_ = FALSE;
2295
2342
                                                                                if (!vala_data_type_compatible (vala_expression_get_value_type (vala_binary_expression_get_left (self)), analyzer->bool_type)) {
2296
 
                                                                                        _tmp77_ = TRUE;
 
2343
                                                                                        _tmp79_ = TRUE;
2297
2344
                                                                                } else {
2298
 
                                                                                        _tmp77_ = !vala_data_type_compatible (vala_expression_get_value_type (vala_binary_expression_get_right (self)), analyzer->bool_type);
 
2345
                                                                                        _tmp79_ = !vala_data_type_compatible (vala_expression_get_value_type (vala_binary_expression_get_right (self)), analyzer->bool_type);
2299
2346
                                                                                }
2300
 
                                                                                if (_tmp77_) {
 
2347
                                                                                if (_tmp79_) {
2301
2348
                                                                                        vala_code_node_set_error ((ValaCodeNode*) self, TRUE);
2302
2349
                                                                                        vala_report_error (vala_code_node_get_source_reference ((ValaCodeNode*) self), "Operands must be boolean");
2303
2350
                                                                                }
2304
2351
                                                                                vala_expression_set_value_type ((ValaExpression*) self, analyzer->bool_type);
2305
2352
                                                                        } else {
2306
2353
                                                                                if (self->priv->_operator == VALA_BINARY_OPERATOR_IN) {
2307
 
                                                                                        gboolean _tmp78_ = FALSE;
 
2354
                                                                                        gboolean _tmp80_ = FALSE;
2308
2355
                                                                                        if (vala_data_type_compatible (vala_expression_get_value_type (vala_binary_expression_get_left (self)), analyzer->int_type)) {
2309
 
                                                                                                _tmp78_ = vala_data_type_compatible (vala_expression_get_value_type (vala_binary_expression_get_right (self)), analyzer->int_type);
 
2356
                                                                                                _tmp80_ = vala_data_type_compatible (vala_expression_get_value_type (vala_binary_expression_get_right (self)), analyzer->int_type);
2310
2357
                                                                                        } else {
2311
 
                                                                                                _tmp78_ = FALSE;
 
2358
                                                                                                _tmp80_ = FALSE;
2312
2359
                                                                                        }
2313
 
                                                                                        if (_tmp78_) {
 
2360
                                                                                        if (_tmp80_) {
2314
2361
                                                                                        } else {
2315
2362
                                                                                                if (VALA_IS_ARRAY_TYPE (vala_expression_get_value_type (vala_binary_expression_get_right (self)))) {
2316
2363
                                                                                                        if (!vala_data_type_compatible (vala_expression_get_value_type (vala_binary_expression_get_left (self)), vala_array_type_get_element_type (VALA_ARRAY_TYPE (vala_expression_get_value_type (vala_binary_expression_get_right (self)))))) {
 
2364
                                                                                                                char* _tmp83_;
 
2365
                                                                                                                char* _tmp82_;
2317
2366
                                                                                                                char* _tmp81_;
2318
 
                                                                                                                char* _tmp80_;
2319
 
                                                                                                                char* _tmp79_;
2320
 
                                                                                                                vala_report_error (vala_code_node_get_source_reference ((ValaCodeNode*) self), _tmp81_ = g_strdup_printf ("Cannot look for `%s' in `%s'", _tmp79_ = vala_code_node_to_string ((ValaCodeNode*) vala_expression_get_value_type (vala_binary_expression_get_left (self))), _tmp80_ = vala_code_node_to_string ((ValaCodeNode*) vala_expression_get_value_type (vala_binary_expression_get_right (self)))));
 
2367
                                                                                                                vala_report_error (vala_code_node_get_source_reference ((ValaCodeNode*) self), _tmp83_ = g_strdup_printf ("Cannot look for `%s' in `%s'", _tmp81_ = vala_code_node_to_string ((ValaCodeNode*) vala_expression_get_value_type (vala_binary_expression_get_left (self))), _tmp82_ = vala_code_node_to_string ((ValaCodeNode*) vala_expression_get_value_type (vala_binary_expression_get_right (self)))));
 
2368
                                                                                                                _g_free0 (_tmp83_);
 
2369
                                                                                                                _g_free0 (_tmp82_);
2321
2370
                                                                                                                _g_free0 (_tmp81_);
2322
 
                                                                                                                _g_free0 (_tmp80_);
2323
 
                                                                                                                _g_free0 (_tmp79_);
2324
2371
                                                                                                        }
2325
2372
                                                                                                } else {
2326
 
                                                                                                        ValaSymbol* _tmp82_;
 
2373
                                                                                                        ValaSymbol* _tmp84_;
2327
2374
                                                                                                        ValaMethod* contains_method;
2328
 
                                                                                                        ValaList* _tmp85_;
2329
 
                                                                                                        gboolean _tmp86_;
2330
 
                                                                                                        ValaMemberAccess* _tmp91_;
2331
 
                                                                                                        ValaMethodCall* _tmp92_;
 
2375
                                                                                                        ValaList* _tmp87_;
 
2376
                                                                                                        gboolean _tmp88_;
 
2377
                                                                                                        ValaMemberAccess* _tmp93_;
 
2378
                                                                                                        ValaMethodCall* _tmp94_;
2332
2379
                                                                                                        ValaMethodCall* contains_call;
2333
 
                                                                                                        contains_method = (_tmp82_ = vala_data_type_get_member (vala_expression_get_value_type (vala_binary_expression_get_right (self)), "contains"), VALA_IS_METHOD (_tmp82_) ? ((ValaMethod*) _tmp82_) : NULL);
 
2380
                                                                                                        contains_method = (_tmp84_ = vala_data_type_get_member (vala_expression_get_value_type (vala_binary_expression_get_right (self)), "contains"), VALA_IS_METHOD (_tmp84_) ? ((ValaMethod*) _tmp84_) : NULL);
2334
2381
                                                                                                        if (contains_method == NULL) {
2335
 
                                                                                                                char* _tmp84_;
2336
 
                                                                                                                char* _tmp83_;
2337
 
                                                                                                                vala_report_error (vala_code_node_get_source_reference ((ValaCodeNode*) self), _tmp84_ = g_strdup_printf ("`%s' does not have a `contains' method", _tmp83_ = vala_code_node_to_string ((ValaCodeNode*) vala_expression_get_value_type (vala_binary_expression_get_right (self)))));
2338
 
                                                                                                                _g_free0 (_tmp84_);
2339
 
                                                                                                                _g_free0 (_tmp83_);
2340
 
                                                                                                                vala_code_node_set_error ((ValaCodeNode*) self, TRUE);
2341
 
                                                                                                                result = FALSE;
2342
 
                                                                                                                _vala_code_node_unref0 (contains_method);
2343
 
                                                                                                                return result;
2344
 
                                                                                                        }
2345
 
                                                                                                        if ((_tmp86_ = vala_collection_get_size ((ValaCollection*) (_tmp85_ = vala_method_get_parameters (contains_method))) != 1, _vala_collection_object_unref0 (_tmp85_), _tmp86_)) {
2346
 
                                                                                                                char* _tmp88_;
2347
 
                                                                                                                char* _tmp87_;
2348
 
                                                                                                                vala_report_error (vala_code_node_get_source_reference ((ValaCodeNode*) self), _tmp88_ = g_strdup_printf ("`%s' must have one parameter", _tmp87_ = vala_symbol_get_full_name ((ValaSymbol*) contains_method)));
2349
 
                                                                                                                _g_free0 (_tmp88_);
2350
 
                                                                                                                _g_free0 (_tmp87_);
2351
 
                                                                                                                vala_code_node_set_error ((ValaCodeNode*) self, TRUE);
2352
 
                                                                                                                result = FALSE;
2353
 
                                                                                                                _vala_code_node_unref0 (contains_method);
2354
 
                                                                                                                return result;
2355
 
                                                                                                        }
2356
 
                                                                                                        if (!vala_data_type_compatible (vala_method_get_return_type (contains_method), analyzer->bool_type)) {
 
2382
                                                                                                                char* _tmp86_;
 
2383
                                                                                                                char* _tmp85_;
 
2384
                                                                                                                vala_report_error (vala_code_node_get_source_reference ((ValaCodeNode*) self), _tmp86_ = g_strdup_printf ("`%s' does not have a `contains' method", _tmp85_ = vala_code_node_to_string ((ValaCodeNode*) vala_expression_get_value_type (vala_binary_expression_get_right (self)))));
 
2385
                                                                                                                _g_free0 (_tmp86_);
 
2386
                                                                                                                _g_free0 (_tmp85_);
 
2387
                                                                                                                vala_code_node_set_error ((ValaCodeNode*) self, TRUE);
 
2388
                                                                                                                result = FALSE;
 
2389
                                                                                                                _vala_code_node_unref0 (contains_method);
 
2390
                                                                                                                return result;
 
2391
                                                                                                        }
 
2392
                                                                                                        if ((_tmp88_ = vala_collection_get_size ((ValaCollection*) (_tmp87_ = vala_method_get_parameters (contains_method))) != 1, _vala_collection_object_unref0 (_tmp87_), _tmp88_)) {
2357
2393
                                                                                                                char* _tmp90_;
2358
2394
                                                                                                                char* _tmp89_;
2359
 
                                                                                                                vala_report_error (vala_code_node_get_source_reference ((ValaCodeNode*) self), _tmp90_ = g_strdup_printf ("`%s' must return a boolean value", _tmp89_ = vala_symbol_get_full_name ((ValaSymbol*) contains_method)));
 
2395
                                                                                                                vala_report_error (vala_code_node_get_source_reference ((ValaCodeNode*) self), _tmp90_ = g_strdup_printf ("`%s' must have one parameter", _tmp89_ = vala_symbol_get_full_name ((ValaSymbol*) contains_method)));
2360
2396
                                                                                                                _g_free0 (_tmp90_);
2361
2397
                                                                                                                _g_free0 (_tmp89_);
2362
2398
                                                                                                                vala_code_node_set_error ((ValaCodeNode*) self, TRUE);
2364
2400
                                                                                                                _vala_code_node_unref0 (contains_method);
2365
2401
                                                                                                                return result;
2366
2402
                                                                                                        }
2367
 
                                                                                                        contains_call = (_tmp92_ = vala_method_call_new ((ValaExpression*) (_tmp91_ = vala_member_access_new (vala_binary_expression_get_right (self), "contains", NULL)), NULL), _vala_code_node_unref0 (_tmp91_), _tmp92_);
 
2403
                                                                                                        if (!vala_data_type_compatible (vala_method_get_return_type (contains_method), analyzer->bool_type)) {
 
2404
                                                                                                                char* _tmp92_;
 
2405
                                                                                                                char* _tmp91_;
 
2406
                                                                                                                vala_report_error (vala_code_node_get_source_reference ((ValaCodeNode*) self), _tmp92_ = g_strdup_printf ("`%s' must return a boolean value", _tmp91_ = vala_symbol_get_full_name ((ValaSymbol*) contains_method)));
 
2407
                                                                                                                _g_free0 (_tmp92_);
 
2408
                                                                                                                _g_free0 (_tmp91_);
 
2409
                                                                                                                vala_code_node_set_error ((ValaCodeNode*) self, TRUE);
 
2410
                                                                                                                result = FALSE;
 
2411
                                                                                                                _vala_code_node_unref0 (contains_method);
 
2412
                                                                                                                return result;
 
2413
                                                                                                        }
 
2414
                                                                                                        contains_call = (_tmp94_ = vala_method_call_new ((ValaExpression*) (_tmp93_ = vala_member_access_new (vala_binary_expression_get_right (self), "contains", NULL)), NULL), _vala_code_node_unref0 (_tmp93_), _tmp94_);
2368
2415
                                                                                                        vala_method_call_add_argument (contains_call, vala_binary_expression_get_left (self));
2369
2416
                                                                                                        vala_code_node_replace_expression (vala_code_node_get_parent_node ((ValaCodeNode*) self), (ValaExpression*) self, (ValaExpression*) contains_call);
2370
2417
                                                                                                        result = vala_code_node_check ((ValaCodeNode*) contains_call, analyzer);
2486
2533
}
2487
2534
 
2488
2535
 
 
2536
/**
 
2537
 * Represents an expression with two operands in the source code.
 
2538
 *
 
2539
 * Supports +, -, *, /, %, <<, >>, <, >, <=, >=, ==, !=, &, |, ^, &&, ||, ??.
 
2540
 */
2489
2541
GType vala_binary_expression_get_type (void) {
2490
2542
        static volatile gsize vala_binary_expression_type_id__volatile = 0;
2491
2543
        if (g_once_init_enter (&vala_binary_expression_type_id__volatile)) {