diff options
author | Jürg Billeter <j@bitron.ch> | 2008-11-20 21:37:35 +0000 |
---|---|---|
committer | Jürg Billeter <juergbi@src.gnome.org> | 2008-11-20 21:37:35 +0000 |
commit | 8f7513fce1e090accc1e5084b86e49cd52869856 (patch) | |
tree | 7770a707b6705769c564a6042237edd9545930a8 /vala | |
parent | e662c258a3ce8a95d61fea7170f52f975c24268e (diff) | |
download | vala-8f7513fce1e090accc1e5084b86e49cd52869856.tar.gz |
Check types in property assignments, fixes bug 550088
2008-11-20 Jürg Billeter <j@bitron.ch>
* vala/valaassignment.vala:
Check types in property assignments, fixes bug 550088
svn path=/trunk/; revision=2042
Diffstat (limited to 'vala')
-rw-r--r-- | vala/valaassignment.vala | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/vala/valaassignment.vala b/vala/valaassignment.vala index f45a95e28..d3ad077f7 100644 --- a/vala/valaassignment.vala +++ b/vala/valaassignment.vala @@ -301,7 +301,9 @@ public class Vala.Assignment : Expression { Report.error (source_reference, "Assignment: Invalid callback assignment attempt"); return false; } - } else if (left.value_type != null && right.value_type != null) { + } + + if (left.value_type != null && right.value_type != null) { /* if there was an error on either side, * i.e. {left|right}.value_type == null, skip type check */ @@ -311,18 +313,20 @@ public class Vala.Assignment : Expression { return false; } - if (right.value_type.is_disposable ()) { - /* rhs transfers ownership of the expression */ - if (!(left.value_type is PointerType) && !left.value_type.value_owned) { - /* lhs doesn't own the value */ - error = true; - Report.error (source_reference, "Invalid assignment from owned expression to unowned variable"); + if (!(ma.symbol_reference is Property)) { + if (right.value_type.is_disposable ()) { + /* rhs transfers ownership of the expression */ + if (!(left.value_type is PointerType) && !left.value_type.value_owned) { + /* lhs doesn't own the value */ + error = true; + Report.error (source_reference, "Invalid assignment from owned expression to unowned variable"); + } + } else if (left.value_type.value_owned) { + /* lhs wants to own the value + * rhs doesn't transfer the ownership + * code generator needs to add reference + * increment calls */ } - } else if (left.value_type.value_owned) { - /* lhs wants to own the value - * rhs doesn't transfer the ownership - * code generator needs to add reference - * increment calls */ } } } else if (left is ElementAccess) { |