private static IEnumerable <ProofState> UpdateLocalValue(UpdateStmt us, ProofState state) { Contract.Requires <ArgumentNullException>(us != null, "stmt"); Contract.Requires <ArgumentNullException>(state != null, "state"); Contract.Requires <ArgumentException>(state.IsLocalAssignment(us), "stmt"); foreach (var item in us.Rhss) { int index = us.Rhss.IndexOf(item); Contract.Assert(us.Lhss.ElementAtOrDefault(index) != null, "register var err"); var exprRhs = item as ExprRhs; if (exprRhs?.Expr is ApplySuffix) { var aps = (ApplySuffix)exprRhs.Expr; foreach (var result in EvaluateTacnyExpression(state, aps)) { state.UpdateLocal(((NameSegment)us.Lhss[index]).Name, result); } } else if (exprRhs?.Expr is Dafny.LiteralExpr) { state.UpdateLocal(((NameSegment)us.Lhss[index]).Name, (Dafny.LiteralExpr)exprRhs?.Expr); } else { state.UpdateLocal(((NameSegment)us.Lhss[index]).Name, exprRhs?.Expr); } } yield return(state.Copy()); }
private static IEnumerable<ProofState> UpdateLocalValue(UpdateStmt us, ProofState state) { Contract.Requires<ArgumentNullException>(us != null, "stmt"); Contract.Requires<ArgumentNullException>(state != null, "state"); Contract.Requires<ArgumentException>(state.IsLocalAssignment(us), "stmt"); foreach (var item in us.Rhss) { int index = us.Rhss.IndexOf(item); Contract.Assert(us.Lhss.ElementAtOrDefault(index) != null, "register var err"); var exprRhs = item as ExprRhs; if (exprRhs?.Expr is ApplySuffix) { var aps = (ApplySuffix)exprRhs.Expr; foreach (var result in EvaluateTacnyExpression(state, aps)) { state.UpdateLocal(((NameSegment)us.Lhss[index]).Name, result); } } else if (exprRhs?.Expr is Dafny.LiteralExpr) { state.UpdateLocal(((NameSegment)us.Lhss[index]).Name, (Dafny.LiteralExpr)exprRhs?.Expr); } else { state.UpdateLocal(((NameSegment)us.Lhss[index]).Name, exprRhs?.Expr); } } yield return state.Copy(); }