Commit 7553dce0 authored by Raffaele Sandrini's avatar Raffaele Sandrini Committed by Raffaele Sandrini
Browse files

enclose prefix increment and decrement unary expressions transformend to

2007-08-20  Raffaele Sandrini  <raffaele@sandrini.ch>

	* vala/valasemanticanalyzer.vala: enclose prefix increment and decrement unary
	  expressions transformend to binary expressions into parenthesis

svn path=/trunk/; revision=485
parent 426d1905
2007-08-20 Raffaele Sandrini <raffaele@sandrini.ch>
* vala/valasemanticanalyzer.vala: enclose prefix increment and decrement unary
expressions transformend to binary expressions into parenthesis
2007-08-20 Jürg Billeter <j@bitron.ch>
* vala/valasemanticanalyzer.vala: report error and fix critical to
......
......@@ -1932,12 +1932,13 @@ public class Vala.SemanticAnalyzer : CodeVisitor {
return;
}
var old_value = new MemberAccess (ma.inner, ma.member_name);
var bin = new BinaryExpression (expr.operator == UnaryOperator.INCREMENT ? BinaryOperator.PLUS : BinaryOperator.MINUS, old_value, new LiteralExpression (new IntegerLiteral ("1")));
var old_value = new MemberAccess (ma.inner, ma.member_name, expr.inner.source_reference);
var bin = new BinaryExpression (expr.operator == UnaryOperator.INCREMENT ? BinaryOperator.PLUS : BinaryOperator.MINUS, old_value, new LiteralExpression (new IntegerLiteral ("1")), expr.source_reference);
var assignment = new Assignment (ma, bin);
expr.parent_node.replace (expr, assignment);
assignment.accept (this);
var assignment = new Assignment (ma, bin, AssignmentOperator.SIMPLE, expr.source_reference);
var parenthexp = new ParenthesizedExpression (assignment, expr.source_reference);
expr.parent_node.replace (expr, parenthexp);
parenthexp.accept (this);
return;
} else if (expr.operator == UnaryOperator.REF) {
// value type
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment