summaryrefslogtreecommitdiff
path: root/Source/Dafny/Compiler.cs
diff options
context:
space:
mode:
authorGravatar qadeer <qadeer@microsoft.com>2011-06-20 21:06:43 -0700
committerGravatar qadeer <qadeer@microsoft.com>2011-06-20 21:06:43 -0700
commitda900fd75d17b681eb5895daeceec3a0f35d90ce (patch)
treeac34a4ff5625c53c6bf23fc9d228997fee57ee53 /Source/Dafny/Compiler.cs
parent819189e68af2e3190c9528d567ed8cc92e3814ab (diff)
parentaf320026248b5c5b3f466a0bde56d26076d8666d (diff)
Merge
Diffstat (limited to 'Source/Dafny/Compiler.cs')
-rw-r--r--Source/Dafny/Compiler.cs31
1 files changed, 10 insertions, 21 deletions
diff --git a/Source/Dafny/Compiler.cs b/Source/Dafny/Compiler.cs
index b2dda7de..35f81605 100644
--- a/Source/Dafny/Compiler.cs
+++ b/Source/Dafny/Compiler.cs
@@ -653,36 +653,25 @@ namespace Microsoft.Dafny {
Contract.Assert(s.Lhss.Count == resolved.Count);
Contract.Assert(s.Rhss.Count == resolved.Count);
var lvalues = new List<string>();
- int i = 0;
- foreach (var lhs in s.Lhss) {
- if (!resolved[i].IsGhost) {
- lvalues.Add(CreateLvalue(lhs, indent));
- }
- i++;
- }
- int N = i;
var rhss = new List<string>();
- i = 0;
- foreach (var rhs in s.Rhss) {
+ for (int i = 0; i < resolved.Count; i++) {
if (!resolved[i].IsGhost) {
- if (rhs is HavocRhs) {
- rhss.Add(null);
- } else {
+ var lhs = s.Lhss[i];
+ var rhs = s.Rhss[i];
+ if (!(rhs is HavocRhs)) {
+ lvalues.Add(CreateLvalue(lhs, indent));
+
string target = "_rhs" + tmpVarCount;
tmpVarCount++;
rhss.Add(target);
TrRhs("var " + target, null, rhs, indent);
}
}
- i++;
}
- Contract.Assert(lvalues.Count == N);
- Contract.Assert(rhss.Count == N);
- for (i = 0; i < N; i++) {
- if (rhss[i] != null) {
- Indent(indent);
- wr.WriteLine("{0} = {1};", lvalues[i], rhss[i]);
- }
+ Contract.Assert(lvalues.Count == rhss.Count);
+ for (int i = 0; i < lvalues.Count; i++) {
+ Indent(indent);
+ wr.WriteLine("{0} = {1};", lvalues[i], rhss[i]);
}
}