[vala/staging] Revert "vala: Don't replace assignments for local variables with non-null simple-types"



commit e84cb6f632abb190ca2335daaf6330bc30ce131f
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Thu Feb 21 08:34:30 2019 +0100

    Revert "vala: Don't replace assignments for local variables with non-null simple-types"
    
    This reverts commit e701142da4601ece5ca71cc4484728b08969c74e.
    
    Fixes https://gitlab.gnome.org/GNOME/vala/issues/755

 vala/valaassignment.vala | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
---
diff --git a/vala/valaassignment.vala b/vala/valaassignment.vala
index 1c449ed74..414edd017 100644
--- a/vala/valaassignment.vala
+++ b/vala/valaassignment.vala
@@ -224,13 +224,13 @@ public class Vala.Assignment : Expression {
                        return false;
                }
 
-               unowned MemberAccess? ma = left as MemberAccess;
-               if (operator != AssignmentOperator.SIMPLE && ma != null
-                   && !(left.value_type.is_non_null_simple_type () && ma.symbol_reference is LocalVariable)) 
{
+               if (operator != AssignmentOperator.SIMPLE && left is MemberAccess) {
                        // transform into simple assignment
                        // FIXME: only do this if the backend doesn't support
                        // the assignment natively
 
+                       var ma = (MemberAccess) left;
+
                        var old_value = new MemberAccess (ma.inner, ma.member_name);
 
                        BinaryOperator bop;
@@ -260,7 +260,9 @@ public class Vala.Assignment : Expression {
                        operator = AssignmentOperator.SIMPLE;
                }
 
-               if (ma != null) {
+               if (left is MemberAccess) {
+                       var ma = (MemberAccess) left;
+
                        if (ma.symbol_reference is Property) {
                                var prop = (Property) ma.symbol_reference;
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]