summaryrefslogtreecommitdiff
path: root/BCT/BytecodeTranslator/StatementTraverser.cs
diff options
context:
space:
mode:
Diffstat (limited to 'BCT/BytecodeTranslator/StatementTraverser.cs')
-rw-r--r--BCT/BytecodeTranslator/StatementTraverser.cs20
1 files changed, 9 insertions, 11 deletions
diff --git a/BCT/BytecodeTranslator/StatementTraverser.cs b/BCT/BytecodeTranslator/StatementTraverser.cs
index feca0559..9005b43a 100644
--- a/BCT/BytecodeTranslator/StatementTraverser.cs
+++ b/BCT/BytecodeTranslator/StatementTraverser.cs
@@ -53,7 +53,7 @@ namespace BytecodeTranslator
public readonly Bpl.StmtListBuilder StmtBuilder = new Bpl.StmtListBuilder();
private bool contractContext;
- internal readonly Stack<IExpression> operandStack = new Stack<IExpression>();
+ internal readonly Stack<Bpl.Expr> operandStack = new Stack<Bpl.Expr>();
private bool captureState;
private static int captureStateCounter = 0;
@@ -253,7 +253,13 @@ namespace BytecodeTranslator
/// <param name="expressionStatement"></param>
/// <remarks> TODO: might be wrong for the general case</remarks>
public override void TraverseChildren(IExpressionStatement expressionStatement) {
- ExpressionTraverser etrav = this.factory.MakeExpressionTraverser(this.sink, this, this.contractContext);
+
+ var expressionIsOpAssignStatement = false;
+ var binOp = expressionStatement.Expression as IBinaryOperation;
+ if (binOp != null && binOp.LeftOperand is ITargetExpression)
+ expressionIsOpAssignStatement = true;
+
+ ExpressionTraverser etrav = this.factory.MakeExpressionTraverser(this.sink, this, this.contractContext, expressionIsOpAssignStatement);
etrav.Traverse(expressionStatement.Expression);
}
@@ -365,13 +371,7 @@ namespace BytecodeTranslator
public override void TraverseChildren(IPushStatement pushStatement) {
var tok = pushStatement.Token();
var val = pushStatement.ValueToPush;
- var dup = val as IDupValue;
- IExpression e;
- if (dup != null) {
- e = this.operandStack.Peek();
- } else {
- e = val;
- }
+ var e = ExpressionFor(val);
this.operandStack.Push(e);
return;
}
@@ -379,8 +379,6 @@ namespace BytecodeTranslator
/// <summary>
///
/// </summary>
- /// <remarks>(mschaef) not implemented</remarks>
- /// <param name="returnStatement"></param>
public override void TraverseChildren(IReturnStatement returnStatement) {
Bpl.IToken tok = returnStatement.Token();