1713
1735
_vala_code_node_unref0 (ma);
1738
if (self->priv->_operator == VALA_BINARY_OPERATOR_COALESCE) {
1740
ValaLocalVariable* _tmp14_;
1741
ValaLocalVariable* local;
1742
ValaDeclarationStatement* decl;
1743
ValaAssignment* _tmp16_;
1744
ValaMemberAccess* _tmp15_;
1745
ValaExpressionStatement* _tmp17_;
1746
ValaExpressionStatement* right_stmt;
1747
ValaBlock* true_block;
1748
ValaNullLiteral* _tmp19_;
1749
ValaMemberAccess* _tmp18_;
1750
ValaBinaryExpression* _tmp20_;
1751
ValaBinaryExpression* cond;
1752
ValaIfStatement* if_stmt;
1753
ValaMemberAccess* ma;
1754
local = (_tmp14_ = vala_local_variable_new (NULL, _tmp13_ = vala_code_node_get_temp_name ((ValaCodeNode*) self), vala_binary_expression_get_left (self), vala_code_node_get_source_reference ((ValaCodeNode*) self)), _g_free0 (_tmp13_), _tmp14_);
1755
decl = vala_declaration_statement_new ((ValaSymbol*) local, vala_code_node_get_source_reference ((ValaCodeNode*) self));
1756
vala_code_node_check ((ValaCodeNode*) decl, analyzer);
1757
right_stmt = (_tmp17_ = vala_expression_statement_new ((ValaExpression*) (_tmp16_ = vala_assignment_new ((ValaExpression*) (_tmp15_ = vala_member_access_new_simple (vala_symbol_get_name ((ValaSymbol*) local), vala_code_node_get_source_reference ((ValaCodeNode*) vala_binary_expression_get_right (self)))), vala_binary_expression_get_right (self), VALA_ASSIGNMENT_OPERATOR_SIMPLE, vala_code_node_get_source_reference ((ValaCodeNode*) vala_binary_expression_get_right (self)))), vala_code_node_get_source_reference ((ValaCodeNode*) vala_binary_expression_get_right (self))), _vala_code_node_unref0 (_tmp16_), _vala_code_node_unref0 (_tmp15_), _tmp17_);
1758
true_block = vala_block_new (vala_code_node_get_source_reference ((ValaCodeNode*) self));
1759
vala_block_add_statement (true_block, (ValaStatement*) right_stmt);
1760
cond = (_tmp20_ = vala_binary_expression_new (VALA_BINARY_OPERATOR_EQUALITY, (ValaExpression*) (_tmp18_ = vala_member_access_new_simple (vala_symbol_get_name ((ValaSymbol*) local), vala_code_node_get_source_reference ((ValaCodeNode*) vala_binary_expression_get_left (self)))), (ValaExpression*) (_tmp19_ = vala_null_literal_new (vala_code_node_get_source_reference ((ValaCodeNode*) self))), vala_code_node_get_source_reference ((ValaCodeNode*) self)), _vala_code_node_unref0 (_tmp19_), _vala_code_node_unref0 (_tmp18_), _tmp20_);
1761
if_stmt = vala_if_statement_new ((ValaExpression*) cond, true_block, NULL, vala_code_node_get_source_reference ((ValaCodeNode*) self));
1762
vala_expression_insert_statement ((ValaExpression*) self, analyzer->insert_block, (ValaStatement*) decl);
1763
vala_expression_insert_statement ((ValaExpression*) self, analyzer->insert_block, (ValaStatement*) if_stmt);
1764
if (!vala_code_node_check ((ValaCodeNode*) if_stmt, analyzer)) {
1765
vala_code_node_set_error ((ValaCodeNode*) self, TRUE);
1767
_vala_code_node_unref0 (local);
1768
_vala_code_node_unref0 (decl);
1769
_vala_code_node_unref0 (right_stmt);
1770
_vala_code_node_unref0 (true_block);
1771
_vala_code_node_unref0 (cond);
1772
_vala_code_node_unref0 (if_stmt);
1775
ma = vala_member_access_new_simple (vala_symbol_get_name ((ValaSymbol*) local), vala_code_node_get_source_reference ((ValaCodeNode*) self));
1776
vala_expression_set_target_type ((ValaExpression*) ma, vala_expression_get_target_type ((ValaExpression*) self));
1777
vala_code_node_check ((ValaCodeNode*) ma, analyzer);
1778
vala_code_node_replace_expression (vala_code_node_get_parent_node ((ValaCodeNode*) self), (ValaExpression*) self, (ValaExpression*) ma);
1780
_vala_code_node_unref0 (local);
1781
_vala_code_node_unref0 (decl);
1782
_vala_code_node_unref0 (right_stmt);
1783
_vala_code_node_unref0 (true_block);
1784
_vala_code_node_unref0 (cond);
1785
_vala_code_node_unref0 (if_stmt);
1786
_vala_code_node_unref0 (ma);
1716
1789
if (!vala_code_node_check ((ValaCodeNode*) vala_binary_expression_get_left (self), analyzer)) {
1719
_tmp13_ = !vala_code_node_check ((ValaCodeNode*) vala_binary_expression_get_right (self), analyzer);
1792
_tmp21_ = !vala_code_node_check ((ValaCodeNode*) vala_binary_expression_get_right (self), analyzer);
1722
1795
vala_code_node_set_error ((ValaCodeNode*) self, TRUE);
1723
1796
result = FALSE;
1732
1805
if (self->priv->_operator != VALA_BINARY_OPERATOR_IN) {
1733
_tmp14_ = vala_expression_get_value_type (vala_binary_expression_get_right (self)) == NULL;
1806
_tmp22_ = vala_expression_get_value_type (vala_binary_expression_get_right (self)) == NULL;
1738
1811
vala_report_error (vala_code_node_get_source_reference ((ValaCodeNode*) vala_binary_expression_get_right (self)), "invalid right operand");
1739
1812
vala_code_node_set_error ((ValaCodeNode*) self, TRUE);
1740
1813
result = FALSE;
1743
1816
if (vala_data_type_get_data_type (vala_expression_get_value_type (vala_binary_expression_get_left (self))) == vala_data_type_get_data_type (analyzer->string_type)) {
1744
_tmp15_ = self->priv->_operator == VALA_BINARY_OPERATOR_PLUS;
1817
_tmp23_ = self->priv->_operator == VALA_BINARY_OPERATOR_PLUS;
1749
gboolean _tmp16_ = FALSE;
1750
ValaDataType* _tmp17_;
1751
gboolean _tmp18_ = FALSE;
1822
gboolean _tmp24_ = FALSE;
1823
ValaDataType* _tmp25_;
1824
gboolean _tmp26_ = FALSE;
1752
1825
if (vala_expression_get_value_type (vala_binary_expression_get_right (self)) == NULL) {
1755
_tmp16_ = vala_data_type_get_data_type (vala_expression_get_value_type (vala_binary_expression_get_right (self))) != vala_data_type_get_data_type (analyzer->string_type);
1828
_tmp24_ = vala_data_type_get_data_type (vala_expression_get_value_type (vala_binary_expression_get_right (self))) != vala_data_type_get_data_type (analyzer->string_type);
1758
1831
vala_code_node_set_error ((ValaCodeNode*) self, TRUE);
1759
1832
vala_report_error (vala_code_node_get_source_reference ((ValaCodeNode*) self), "Operands must be strings");
1760
1833
result = FALSE;
1763
vala_expression_set_value_type ((ValaExpression*) self, _tmp17_ = vala_data_type_copy (analyzer->string_type));
1764
_vala_code_node_unref0 (_tmp17_);
1836
vala_expression_set_value_type ((ValaExpression*) self, _tmp25_ = vala_data_type_copy (analyzer->string_type));
1837
_vala_code_node_unref0 (_tmp25_);
1765
1838
if (vala_expression_is_constant (vala_binary_expression_get_left (self))) {
1766
_tmp18_ = vala_expression_is_constant (vala_binary_expression_get_right (self));
1839
_tmp26_ = vala_expression_is_constant (vala_binary_expression_get_right (self));
1771
1844
vala_data_type_set_value_owned (vala_expression_get_value_type ((ValaExpression*) self), FALSE);
1773
1846
vala_data_type_set_value_owned (vala_expression_get_value_type ((ValaExpression*) self), TRUE);
1776
gboolean _tmp19_ = FALSE;
1849
gboolean _tmp27_ = FALSE;
1777
1850
if (VALA_IS_ARRAY_TYPE (vala_expression_get_value_type (vala_binary_expression_get_left (self)))) {
1778
_tmp19_ = self->priv->_operator == VALA_BINARY_OPERATOR_PLUS;
1851
_tmp27_ = self->priv->_operator == VALA_BINARY_OPERATOR_PLUS;
1783
1856
ValaArrayType* array_type;
1784
gboolean _tmp20_ = FALSE;
1785
ValaDataType* _tmp21_;
1857
gboolean _tmp28_ = FALSE;
1858
ValaDataType* _tmp29_;
1786
1859
array_type = _vala_code_node_ref0 (VALA_ARRAY_TYPE (vala_expression_get_value_type (vala_binary_expression_get_left (self))));
1787
1860
if (vala_expression_get_value_type (vala_binary_expression_get_right (self)) == NULL) {
1790
_tmp20_ = !vala_data_type_compatible (vala_expression_get_value_type (vala_binary_expression_get_right (self)), vala_array_type_get_element_type (array_type));
1863
_tmp28_ = !vala_data_type_compatible (vala_expression_get_value_type (vala_binary_expression_get_right (self)), vala_array_type_get_element_type (array_type));
1793
1866
vala_code_node_set_error ((ValaCodeNode*) self, TRUE);
1794
1867
vala_report_error (vala_code_node_get_source_reference ((ValaCodeNode*) self), "Incompatible operand");
1795
1868
result = FALSE;
1796
1869
_vala_code_node_unref0 (array_type);
1799
vala_expression_set_value_type ((ValaExpression*) self, _tmp21_ = vala_data_type_copy ((ValaDataType*) array_type));
1800
_vala_code_node_unref0 (_tmp21_);
1872
vala_expression_set_value_type ((ValaExpression*) self, _tmp29_ = vala_data_type_copy ((ValaDataType*) array_type));
1873
_vala_code_node_unref0 (_tmp29_);
1801
1874
vala_data_type_set_value_owned (vala_expression_get_value_type ((ValaExpression*) self), TRUE);
1802
1875
_vala_code_node_unref0 (array_type);
1804
gboolean _tmp22_ = FALSE;
1805
gboolean _tmp23_ = FALSE;
1806
gboolean _tmp24_ = FALSE;
1877
gboolean _tmp30_ = FALSE;
1878
gboolean _tmp31_ = FALSE;
1879
gboolean _tmp32_ = FALSE;
1807
1880
if (self->priv->_operator == VALA_BINARY_OPERATOR_PLUS) {
1810
_tmp24_ = self->priv->_operator == VALA_BINARY_OPERATOR_MINUS;
1815
_tmp23_ = self->priv->_operator == VALA_BINARY_OPERATOR_MUL;
1820
_tmp22_ = self->priv->_operator == VALA_BINARY_OPERATOR_DIV;
1883
_tmp32_ = self->priv->_operator == VALA_BINARY_OPERATOR_MINUS;
1888
_tmp31_ = self->priv->_operator == VALA_BINARY_OPERATOR_MUL;
1893
_tmp30_ = self->priv->_operator == VALA_BINARY_OPERATOR_DIV;
1823
1896
if (VALA_IS_POINTER_TYPE (vala_expression_get_value_type (vala_binary_expression_get_left (self)))) {
1824
ValaTypeSymbol* _tmp25_;
1897
ValaTypeSymbol* _tmp33_;
1825
1898
ValaStruct* offset_type;
1826
gboolean _tmp26_ = FALSE;
1827
offset_type = _vala_code_node_ref0 ((_tmp25_ = vala_data_type_get_data_type (vala_expression_get_value_type (vala_binary_expression_get_right (self))), VALA_IS_STRUCT (_tmp25_) ? ((ValaStruct*) _tmp25_) : NULL));
1899
gboolean _tmp34_ = FALSE;
1900
offset_type = _vala_code_node_ref0 ((_tmp33_ = vala_data_type_get_data_type (vala_expression_get_value_type (vala_binary_expression_get_right (self))), VALA_IS_STRUCT (_tmp33_) ? ((ValaStruct*) _tmp33_) : NULL));
1828
1901
if (offset_type != NULL) {
1829
_tmp26_ = vala_struct_is_integer_type (offset_type);
1902
_tmp34_ = vala_struct_is_integer_type (offset_type);
1834
gboolean _tmp27_ = FALSE;
1907
gboolean _tmp35_ = FALSE;
1835
1908
if (self->priv->_operator == VALA_BINARY_OPERATOR_PLUS) {
1838
_tmp27_ = self->priv->_operator == VALA_BINARY_OPERATOR_MINUS;
1911
_tmp35_ = self->priv->_operator == VALA_BINARY_OPERATOR_MINUS;
1841
ValaDataType* _tmp28_;
1842
vala_expression_set_value_type ((ValaExpression*) self, _tmp28_ = vala_data_type_copy (vala_expression_get_value_type (vala_binary_expression_get_left (self))));
1843
_vala_code_node_unref0 (_tmp28_);
1914
ValaDataType* _tmp36_;
1915
vala_expression_set_value_type ((ValaExpression*) self, _tmp36_ = vala_data_type_copy (vala_expression_get_value_type (vala_binary_expression_get_left (self))));
1916
_vala_code_node_unref0 (_tmp36_);
1846
1919
if (VALA_IS_POINTER_TYPE (vala_expression_get_value_type (vala_binary_expression_get_right (self)))) {
1850
1923
_vala_code_node_unref0 (offset_type);
1852
1925
if (vala_expression_get_value_type ((ValaExpression*) self) == NULL) {
1853
ValaDataType* _tmp29_;
1854
vala_expression_set_value_type ((ValaExpression*) self, _tmp29_ = vala_semantic_analyzer_get_arithmetic_result_type (analyzer, vala_expression_get_value_type (vala_binary_expression_get_left (self)), vala_expression_get_value_type (vala_binary_expression_get_right (self))));
1855
_vala_code_node_unref0 (_tmp29_);
1926
ValaDataType* _tmp37_;
1927
vala_expression_set_value_type ((ValaExpression*) self, _tmp37_ = vala_semantic_analyzer_get_arithmetic_result_type (analyzer, vala_expression_get_value_type (vala_binary_expression_get_left (self)), vala_expression_get_value_type (vala_binary_expression_get_right (self))));
1928
_vala_code_node_unref0 (_tmp37_);
1857
1930
if (vala_expression_get_value_type ((ValaExpression*) self) == NULL) {
1861
1934
vala_code_node_set_error ((ValaCodeNode*) self, TRUE);
1862
vala_report_error (vala_code_node_get_source_reference ((ValaCodeNode*) self), _tmp32_ = g_strdup_printf ("Arithmetic operation not supported for types `%s' and `%s'", _tmp30_ = vala_code_node_to_string ((ValaCodeNode*) vala_expression_get_value_type (vala_binary_expression_get_left (self))), _tmp31_ = vala_code_node_to_string ((ValaCodeNode*) vala_expression_get_value_type (vala_binary_expression_get_right (self)))));
1935
vala_report_error (vala_code_node_get_source_reference ((ValaCodeNode*) self), _tmp40_ = g_strdup_printf ("Arithmetic operation not supported for types `%s' and `%s'", _tmp38_ = vala_code_node_to_string ((ValaCodeNode*) vala_expression_get_value_type (vala_binary_expression_get_left (self))), _tmp39_ = vala_code_node_to_string ((ValaCodeNode*) vala_expression_get_value_type (vala_binary_expression_get_right (self)))));
1866
1939
result = FALSE;
1870
gboolean _tmp33_ = FALSE;
1871
gboolean _tmp34_ = FALSE;
1872
gboolean _tmp35_ = FALSE;
1943
gboolean _tmp41_ = FALSE;
1944
gboolean _tmp42_ = FALSE;
1945
gboolean _tmp43_ = FALSE;
1873
1946
if (self->priv->_operator == VALA_BINARY_OPERATOR_MOD) {
1876
_tmp35_ = self->priv->_operator == VALA_BINARY_OPERATOR_SHIFT_LEFT;
1881
_tmp34_ = self->priv->_operator == VALA_BINARY_OPERATOR_SHIFT_RIGHT;
1886
_tmp33_ = self->priv->_operator == VALA_BINARY_OPERATOR_BITWISE_XOR;
1889
ValaDataType* _tmp36_;
1890
vala_expression_set_value_type ((ValaExpression*) self, _tmp36_ = vala_semantic_analyzer_get_arithmetic_result_type (analyzer, vala_expression_get_value_type (vala_binary_expression_get_left (self)), vala_expression_get_value_type (vala_binary_expression_get_right (self))));
1891
_vala_code_node_unref0 (_tmp36_);
1949
_tmp43_ = self->priv->_operator == VALA_BINARY_OPERATOR_SHIFT_LEFT;
1954
_tmp42_ = self->priv->_operator == VALA_BINARY_OPERATOR_SHIFT_RIGHT;
1959
_tmp41_ = self->priv->_operator == VALA_BINARY_OPERATOR_BITWISE_XOR;
1962
ValaDataType* _tmp44_;
1963
vala_expression_set_value_type ((ValaExpression*) self, _tmp44_ = vala_semantic_analyzer_get_arithmetic_result_type (analyzer, vala_expression_get_value_type (vala_binary_expression_get_left (self)), vala_expression_get_value_type (vala_binary_expression_get_right (self))));
1964
_vala_code_node_unref0 (_tmp44_);
1892
1965
if (vala_expression_get_value_type ((ValaExpression*) self) == NULL) {
1896
1969
vala_code_node_set_error ((ValaCodeNode*) self, TRUE);
1897
vala_report_error (vala_code_node_get_source_reference ((ValaCodeNode*) self), _tmp39_ = g_strdup_printf ("Arithmetic operation not supported for types `%s' and `%s'", _tmp37_ = vala_code_node_to_string ((ValaCodeNode*) vala_expression_get_value_type (vala_binary_expression_get_left (self))), _tmp38_ = vala_code_node_to_string ((ValaCodeNode*) vala_expression_get_value_type (vala_binary_expression_get_right (self)))));
1970
vala_report_error (vala_code_node_get_source_reference ((ValaCodeNode*) self), _tmp47_ = g_strdup_printf ("Arithmetic operation not supported for types `%s' and `%s'", _tmp45_ = vala_code_node_to_string ((ValaCodeNode*) vala_expression_get_value_type (vala_binary_expression_get_left (self))), _tmp46_ = vala_code_node_to_string ((ValaCodeNode*) vala_expression_get_value_type (vala_binary_expression_get_right (self)))));
1901
1974
result = FALSE;
1905
gboolean _tmp40_ = FALSE;
1906
gboolean _tmp41_ = FALSE;
1907
gboolean _tmp42_ = FALSE;
1978
gboolean _tmp48_ = FALSE;
1979
gboolean _tmp49_ = FALSE;
1980
gboolean _tmp50_ = FALSE;
1908
1981
if (self->priv->_operator == VALA_BINARY_OPERATOR_LESS_THAN) {
1911
_tmp42_ = self->priv->_operator == VALA_BINARY_OPERATOR_GREATER_THAN;
1916
_tmp41_ = self->priv->_operator == VALA_BINARY_OPERATOR_LESS_THAN_OR_EQUAL;
1921
_tmp40_ = self->priv->_operator == VALA_BINARY_OPERATOR_GREATER_THAN_OR_EQUAL;
1924
gboolean _tmp43_ = FALSE;
1984
_tmp50_ = self->priv->_operator == VALA_BINARY_OPERATOR_GREATER_THAN;
1989
_tmp49_ = self->priv->_operator == VALA_BINARY_OPERATOR_LESS_THAN_OR_EQUAL;
1994
_tmp48_ = self->priv->_operator == VALA_BINARY_OPERATOR_GREATER_THAN_OR_EQUAL;
1997
gboolean _tmp51_ = FALSE;
1925
1998
if (vala_data_type_compatible (vala_expression_get_value_type (vala_binary_expression_get_left (self)), analyzer->string_type)) {
1926
_tmp43_ = vala_data_type_compatible (vala_expression_get_value_type (vala_binary_expression_get_right (self)), analyzer->string_type);
1999
_tmp51_ = vala_data_type_compatible (vala_expression_get_value_type (vala_binary_expression_get_right (self)), analyzer->string_type);
1932
gboolean _tmp44_ = FALSE;
2005
gboolean _tmp52_ = FALSE;
1933
2006
if (VALA_IS_POINTER_TYPE (vala_expression_get_value_type (vala_binary_expression_get_left (self)))) {
1934
_tmp44_ = VALA_IS_POINTER_TYPE (vala_expression_get_value_type (vala_binary_expression_get_right (self)));
2007
_tmp52_ = VALA_IS_POINTER_TYPE (vala_expression_get_value_type (vala_binary_expression_get_right (self)));
1940
2013
ValaDataType* resulting_type;
2014
ValaDataType* _tmp56_;
2015
ValaDataType* _tmp57_;
1941
2016
resulting_type = vala_semantic_analyzer_get_arithmetic_result_type (analyzer, vala_expression_get_value_type (vala_binary_expression_get_left (self)), vala_expression_get_value_type (vala_binary_expression_get_right (self)));
1942
2017
if (resulting_type == NULL) {
1946
2021
vala_code_node_set_error ((ValaCodeNode*) self, TRUE);
1947
vala_report_error (vala_code_node_get_source_reference ((ValaCodeNode*) self), _tmp47_ = g_strdup_printf ("Relational operation not supported for types `%s' and `%s'", _tmp45_ = vala_code_node_to_string ((ValaCodeNode*) vala_expression_get_value_type (vala_binary_expression_get_left (self))), _tmp46_ = vala_code_node_to_string ((ValaCodeNode*) vala_expression_get_value_type (vala_binary_expression_get_right (self)))));
2022
vala_report_error (vala_code_node_get_source_reference ((ValaCodeNode*) self), _tmp55_ = g_strdup_printf ("Relational operation not supported for types `%s' and `%s'", _tmp53_ = vala_code_node_to_string ((ValaCodeNode*) vala_expression_get_value_type (vala_binary_expression_get_left (self))), _tmp54_ = vala_code_node_to_string ((ValaCodeNode*) vala_expression_get_value_type (vala_binary_expression_get_right (self)))));
1951
2026
result = FALSE;
1952
2027
_vala_code_node_unref0 (resulting_type);
2030
vala_expression_set_target_type (vala_binary_expression_get_left (self), _tmp56_ = vala_data_type_copy (vala_expression_get_value_type (vala_binary_expression_get_left (self))));
2031
_vala_code_node_unref0 (_tmp56_);
2032
vala_data_type_set_nullable (vala_expression_get_target_type (vala_binary_expression_get_left (self)), FALSE);
2033
vala_data_type_set_value_owned (vala_expression_get_target_type (vala_binary_expression_get_left (self)), FALSE);
2034
vala_expression_set_target_type (vala_binary_expression_get_right (self), _tmp57_ = vala_data_type_copy (vala_expression_get_value_type (vala_binary_expression_get_right (self))));
2035
_vala_code_node_unref0 (_tmp57_);
2036
vala_data_type_set_nullable (vala_expression_get_target_type (vala_binary_expression_get_right (self)), FALSE);
2037
vala_data_type_set_value_owned (vala_expression_get_target_type (vala_binary_expression_get_right (self)), FALSE);
1955
2038
_vala_code_node_unref0 (resulting_type);
1958
2041
vala_expression_set_value_type ((ValaExpression*) self, analyzer->bool_type);
1960
gboolean _tmp48_ = FALSE;
2043
gboolean _tmp58_ = FALSE;
1961
2044
if (self->priv->_operator == VALA_BINARY_OPERATOR_EQUALITY) {
1964
_tmp48_ = self->priv->_operator == VALA_BINARY_OPERATOR_INEQUALITY;
2047
_tmp58_ = self->priv->_operator == VALA_BINARY_OPERATOR_INEQUALITY;
1967
gboolean _tmp49_ = FALSE;
1968
gboolean _tmp53_ = FALSE;
2050
gboolean _tmp59_ = FALSE;
2051
ValaDataType* _tmp63_;
2052
ValaDataType* _tmp64_;
2053
gboolean _tmp65_ = FALSE;
1969
2054
if (!vala_data_type_compatible (vala_expression_get_value_type (vala_binary_expression_get_right (self)), vala_expression_get_value_type (vala_binary_expression_get_left (self)))) {
1970
_tmp49_ = !vala_data_type_compatible (vala_expression_get_value_type (vala_binary_expression_get_left (self)), vala_expression_get_value_type (vala_binary_expression_get_right (self)));
2055
_tmp59_ = !vala_data_type_compatible (vala_expression_get_value_type (vala_binary_expression_get_left (self)), vala_expression_get_value_type (vala_binary_expression_get_right (self)));
1978
vala_report_error (vala_code_node_get_source_reference ((ValaCodeNode*) self), _tmp52_ = g_strdup_printf ("Equality operation: `%s' and `%s' are incompatible", _tmp50_ = vala_code_node_to_string ((ValaCodeNode*) vala_expression_get_value_type (vala_binary_expression_get_right (self))), _tmp51_ = vala_code_node_to_string ((ValaCodeNode*) vala_expression_get_value_type (vala_binary_expression_get_left (self)))));
2063
vala_report_error (vala_code_node_get_source_reference ((ValaCodeNode*) self), _tmp62_ = g_strdup_printf ("Equality operation: `%s' and `%s' are incompatible", _tmp60_ = vala_code_node_to_string ((ValaCodeNode*) vala_expression_get_value_type (vala_binary_expression_get_right (self))), _tmp61_ = vala_code_node_to_string ((ValaCodeNode*) vala_expression_get_value_type (vala_binary_expression_get_left (self)))));
1982
2067
vala_code_node_set_error ((ValaCodeNode*) self, TRUE);
1983
2068
result = FALSE;
2071
vala_expression_set_target_type (vala_binary_expression_get_left (self), _tmp63_ = vala_data_type_copy (vala_expression_get_value_type (vala_binary_expression_get_left (self))));
2072
_vala_code_node_unref0 (_tmp63_);
2073
vala_data_type_set_value_owned (vala_expression_get_target_type (vala_binary_expression_get_left (self)), FALSE);
2074
vala_expression_set_target_type (vala_binary_expression_get_right (self), _tmp64_ = vala_data_type_copy (vala_expression_get_value_type (vala_binary_expression_get_right (self))));
2075
_vala_code_node_unref0 (_tmp64_);
2076
vala_data_type_set_value_owned (vala_expression_get_target_type (vala_binary_expression_get_right (self)), FALSE);
2077
if (vala_data_type_get_nullable (vala_expression_get_value_type (vala_binary_expression_get_left (self))) != vala_data_type_get_nullable (vala_expression_get_value_type (vala_binary_expression_get_right (self)))) {
2078
if (!vala_data_type_get_nullable (vala_expression_get_value_type (vala_binary_expression_get_left (self)))) {
2079
vala_data_type_set_nullable (vala_expression_get_target_type (vala_binary_expression_get_left (self)), TRUE);
2081
if (!vala_data_type_get_nullable (vala_expression_get_value_type (vala_binary_expression_get_right (self)))) {
2082
vala_data_type_set_nullable (vala_expression_get_target_type (vala_binary_expression_get_right (self)), TRUE);
1986
2086
if (vala_data_type_compatible (vala_expression_get_value_type (vala_binary_expression_get_left (self)), analyzer->string_type)) {
1987
_tmp53_ = vala_data_type_compatible (vala_expression_get_value_type (vala_binary_expression_get_right (self)), analyzer->string_type);
2087
_tmp65_ = vala_data_type_compatible (vala_expression_get_value_type (vala_binary_expression_get_right (self)), analyzer->string_type);
1993
2093
vala_expression_set_value_type ((ValaExpression*) self, analyzer->bool_type);
1995
gboolean _tmp54_ = FALSE;
2095
gboolean _tmp66_ = FALSE;
1996
2096
if (self->priv->_operator == VALA_BINARY_OPERATOR_BITWISE_AND) {
1999
_tmp54_ = self->priv->_operator == VALA_BINARY_OPERATOR_BITWISE_OR;
2099
_tmp66_ = self->priv->_operator == VALA_BINARY_OPERATOR_BITWISE_OR;
2002
2102
vala_expression_set_value_type ((ValaExpression*) self, vala_expression_get_value_type (vala_binary_expression_get_left (self)));
2004
gboolean _tmp55_ = FALSE;
2104
gboolean _tmp67_ = FALSE;
2005
2105
if (self->priv->_operator == VALA_BINARY_OPERATOR_AND) {
2008
_tmp55_ = self->priv->_operator == VALA_BINARY_OPERATOR_OR;
2108
_tmp67_ = self->priv->_operator == VALA_BINARY_OPERATOR_OR;
2011
gboolean _tmp56_ = FALSE;
2111
gboolean _tmp68_ = FALSE;
2012
2112
if (!vala_data_type_compatible (vala_expression_get_value_type (vala_binary_expression_get_left (self)), analyzer->bool_type)) {
2015
_tmp56_ = !vala_data_type_compatible (vala_expression_get_value_type (vala_binary_expression_get_right (self)), analyzer->bool_type);
2115
_tmp68_ = !vala_data_type_compatible (vala_expression_get_value_type (vala_binary_expression_get_right (self)), analyzer->bool_type);
2018
2118
vala_code_node_set_error ((ValaCodeNode*) self, TRUE);
2019
2119
vala_report_error (vala_code_node_get_source_reference ((ValaCodeNode*) self), "Operands must be boolean");
2021
2121
vala_expression_set_value_type ((ValaExpression*) self, analyzer->bool_type);
2023
2123
if (self->priv->_operator == VALA_BINARY_OPERATOR_IN) {
2024
gboolean _tmp57_ = FALSE;
2124
gboolean _tmp69_ = FALSE;
2025
2125
if (vala_data_type_compatible (vala_expression_get_value_type (vala_binary_expression_get_left (self)), analyzer->int_type)) {
2026
_tmp57_ = vala_data_type_compatible (vala_expression_get_value_type (vala_binary_expression_get_right (self)), analyzer->int_type);
2126
_tmp69_ = vala_data_type_compatible (vala_expression_get_value_type (vala_binary_expression_get_right (self)), analyzer->int_type);
2032
ValaSymbol* _tmp58_;
2132
ValaSymbol* _tmp70_;
2033
2133
ValaMethod* contains_method;
2036
ValaMemberAccess* _tmp67_;
2037
ValaMethodCall* _tmp68_;
2136
ValaMemberAccess* _tmp79_;
2137
ValaMethodCall* _tmp80_;
2038
2138
ValaMethodCall* contains_call;
2039
contains_method = (_tmp58_ = vala_data_type_get_member (vala_expression_get_value_type (vala_binary_expression_get_right (self)), "contains"), VALA_IS_METHOD (_tmp58_) ? ((ValaMethod*) _tmp58_) : NULL);
2139
contains_method = (_tmp70_ = vala_data_type_get_member (vala_expression_get_value_type (vala_binary_expression_get_right (self)), "contains"), VALA_IS_METHOD (_tmp70_) ? ((ValaMethod*) _tmp70_) : NULL);
2040
2140
if (contains_method == NULL) {
2043
vala_report_error (vala_code_node_get_source_reference ((ValaCodeNode*) self), _tmp60_ = g_strdup_printf ("`%s' does not have a `contains' method", _tmp59_ = vala_code_node_to_string ((ValaCodeNode*) vala_expression_get_value_type (vala_binary_expression_get_right (self)))));
2143
vala_report_error (vala_code_node_get_source_reference ((ValaCodeNode*) self), _tmp72_ = g_strdup_printf ("`%s' does not have a `contains' method", _tmp71_ = vala_code_node_to_string ((ValaCodeNode*) vala_expression_get_value_type (vala_binary_expression_get_right (self)))));
2046
2146
vala_code_node_set_error ((ValaCodeNode*) self, TRUE);
2047
2147
result = FALSE;
2048
2148
_vala_code_node_unref0 (contains_method);
2051
if ((_tmp62_ = vala_collection_get_size ((ValaCollection*) (_tmp61_ = vala_method_get_parameters (contains_method))) != 1, _vala_collection_object_unref0 (_tmp61_), _tmp62_)) {
2054
vala_report_error (vala_code_node_get_source_reference ((ValaCodeNode*) self), _tmp64_ = g_strdup_printf ("`%s' must have one parameter", _tmp63_ = vala_symbol_get_full_name ((ValaSymbol*) contains_method)));
2151
if ((_tmp74_ = vala_collection_get_size ((ValaCollection*) (_tmp73_ = vala_method_get_parameters (contains_method))) != 1, _vala_collection_object_unref0 (_tmp73_), _tmp74_)) {
2154
vala_report_error (vala_code_node_get_source_reference ((ValaCodeNode*) self), _tmp76_ = g_strdup_printf ("`%s' must have one parameter", _tmp75_ = vala_symbol_get_full_name ((ValaSymbol*) contains_method)));
2057
2157
vala_code_node_set_error ((ValaCodeNode*) self, TRUE);
2058
2158
result = FALSE;
2059
2159
_vala_code_node_unref0 (contains_method);
2062
2162
if (!vala_data_type_compatible (vala_method_get_return_type (contains_method), analyzer->bool_type)) {
2065
vala_report_error (vala_code_node_get_source_reference ((ValaCodeNode*) self), _tmp66_ = g_strdup_printf ("`%s' must return a boolean value", _tmp65_ = vala_symbol_get_full_name ((ValaSymbol*) contains_method)));
2165
vala_report_error (vala_code_node_get_source_reference ((ValaCodeNode*) self), _tmp78_ = g_strdup_printf ("`%s' must return a boolean value", _tmp77_ = vala_symbol_get_full_name ((ValaSymbol*) contains_method)));
2068
2168
vala_code_node_set_error ((ValaCodeNode*) self, TRUE);
2069
2169
result = FALSE;
2070
2170
_vala_code_node_unref0 (contains_method);
2073
contains_call = (_tmp68_ = vala_method_call_new ((ValaExpression*) (_tmp67_ = vala_member_access_new (vala_binary_expression_get_right (self), "contains", NULL)), NULL), _vala_code_node_unref0 (_tmp67_), _tmp68_);
2173
contains_call = (_tmp80_ = vala_method_call_new ((ValaExpression*) (_tmp79_ = vala_member_access_new (vala_binary_expression_get_right (self), "contains", NULL)), NULL), _vala_code_node_unref0 (_tmp79_), _tmp80_);
2074
2174
vala_method_call_add_argument (contains_call, vala_binary_expression_get_left (self));
2075
2175
vala_code_node_replace_expression (vala_code_node_get_parent_node ((ValaCodeNode*) self), (ValaExpression*) self, (ValaExpression*) contains_call);
2076
2176
result = vala_code_node_check ((ValaCodeNode*) contains_call, analyzer);
2204
2304
GType vala_binary_operator_get_type (void) {
2205
2305
static GType vala_binary_operator_type_id = 0;
2206
2306
if (G_UNLIKELY (vala_binary_operator_type_id == 0)) {
2207
static const GEnumValue values[] = {{VALA_BINARY_OPERATOR_NONE, "VALA_BINARY_OPERATOR_NONE", "none"}, {VALA_BINARY_OPERATOR_PLUS, "VALA_BINARY_OPERATOR_PLUS", "plus"}, {VALA_BINARY_OPERATOR_MINUS, "VALA_BINARY_OPERATOR_MINUS", "minus"}, {VALA_BINARY_OPERATOR_MUL, "VALA_BINARY_OPERATOR_MUL", "mul"}, {VALA_BINARY_OPERATOR_DIV, "VALA_BINARY_OPERATOR_DIV", "div"}, {VALA_BINARY_OPERATOR_MOD, "VALA_BINARY_OPERATOR_MOD", "mod"}, {VALA_BINARY_OPERATOR_SHIFT_LEFT, "VALA_BINARY_OPERATOR_SHIFT_LEFT", "shift-left"}, {VALA_BINARY_OPERATOR_SHIFT_RIGHT, "VALA_BINARY_OPERATOR_SHIFT_RIGHT", "shift-right"}, {VALA_BINARY_OPERATOR_LESS_THAN, "VALA_BINARY_OPERATOR_LESS_THAN", "less-than"}, {VALA_BINARY_OPERATOR_GREATER_THAN, "VALA_BINARY_OPERATOR_GREATER_THAN", "greater-than"}, {VALA_BINARY_OPERATOR_LESS_THAN_OR_EQUAL, "VALA_BINARY_OPERATOR_LESS_THAN_OR_EQUAL", "less-than-or-equal"}, {VALA_BINARY_OPERATOR_GREATER_THAN_OR_EQUAL, "VALA_BINARY_OPERATOR_GREATER_THAN_OR_EQUAL", "greater-than-or-equal"}, {VALA_BINARY_OPERATOR_EQUALITY, "VALA_BINARY_OPERATOR_EQUALITY", "equality"}, {VALA_BINARY_OPERATOR_INEQUALITY, "VALA_BINARY_OPERATOR_INEQUALITY", "inequality"}, {VALA_BINARY_OPERATOR_BITWISE_AND, "VALA_BINARY_OPERATOR_BITWISE_AND", "bitwise-and"}, {VALA_BINARY_OPERATOR_BITWISE_OR, "VALA_BINARY_OPERATOR_BITWISE_OR", "bitwise-or"}, {VALA_BINARY_OPERATOR_BITWISE_XOR, "VALA_BINARY_OPERATOR_BITWISE_XOR", "bitwise-xor"}, {VALA_BINARY_OPERATOR_AND, "VALA_BINARY_OPERATOR_AND", "and"}, {VALA_BINARY_OPERATOR_OR, "VALA_BINARY_OPERATOR_OR", "or"}, {VALA_BINARY_OPERATOR_IN, "VALA_BINARY_OPERATOR_IN", "in"}, {0, NULL, NULL}};
2307
static const GEnumValue values[] = {{VALA_BINARY_OPERATOR_NONE, "VALA_BINARY_OPERATOR_NONE", "none"}, {VALA_BINARY_OPERATOR_PLUS, "VALA_BINARY_OPERATOR_PLUS", "plus"}, {VALA_BINARY_OPERATOR_MINUS, "VALA_BINARY_OPERATOR_MINUS", "minus"}, {VALA_BINARY_OPERATOR_MUL, "VALA_BINARY_OPERATOR_MUL", "mul"}, {VALA_BINARY_OPERATOR_DIV, "VALA_BINARY_OPERATOR_DIV", "div"}, {VALA_BINARY_OPERATOR_MOD, "VALA_BINARY_OPERATOR_MOD", "mod"}, {VALA_BINARY_OPERATOR_SHIFT_LEFT, "VALA_BINARY_OPERATOR_SHIFT_LEFT", "shift-left"}, {VALA_BINARY_OPERATOR_SHIFT_RIGHT, "VALA_BINARY_OPERATOR_SHIFT_RIGHT", "shift-right"}, {VALA_BINARY_OPERATOR_LESS_THAN, "VALA_BINARY_OPERATOR_LESS_THAN", "less-than"}, {VALA_BINARY_OPERATOR_GREATER_THAN, "VALA_BINARY_OPERATOR_GREATER_THAN", "greater-than"}, {VALA_BINARY_OPERATOR_LESS_THAN_OR_EQUAL, "VALA_BINARY_OPERATOR_LESS_THAN_OR_EQUAL", "less-than-or-equal"}, {VALA_BINARY_OPERATOR_GREATER_THAN_OR_EQUAL, "VALA_BINARY_OPERATOR_GREATER_THAN_OR_EQUAL", "greater-than-or-equal"}, {VALA_BINARY_OPERATOR_EQUALITY, "VALA_BINARY_OPERATOR_EQUALITY", "equality"}, {VALA_BINARY_OPERATOR_INEQUALITY, "VALA_BINARY_OPERATOR_INEQUALITY", "inequality"}, {VALA_BINARY_OPERATOR_BITWISE_AND, "VALA_BINARY_OPERATOR_BITWISE_AND", "bitwise-and"}, {VALA_BINARY_OPERATOR_BITWISE_OR, "VALA_BINARY_OPERATOR_BITWISE_OR", "bitwise-or"}, {VALA_BINARY_OPERATOR_BITWISE_XOR, "VALA_BINARY_OPERATOR_BITWISE_XOR", "bitwise-xor"}, {VALA_BINARY_OPERATOR_AND, "VALA_BINARY_OPERATOR_AND", "and"}, {VALA_BINARY_OPERATOR_OR, "VALA_BINARY_OPERATOR_OR", "or"}, {VALA_BINARY_OPERATOR_IN, "VALA_BINARY_OPERATOR_IN", "in"}, {VALA_BINARY_OPERATOR_COALESCE, "VALA_BINARY_OPERATOR_COALESCE", "coalesce"}, {0, NULL, NULL}};
2208
2308
vala_binary_operator_type_id = g_enum_register_static ("ValaBinaryOperator", values);
2210
2310
return vala_binary_operator_type_id;