summaryrefslogtreecommitdiff
path: root/Chalice/src/ChaliceToCSharp.scala
diff options
context:
space:
mode:
authorGravatar kyessenov <unknown>2010-07-30 21:29:12 +0000
committerGravatar kyessenov <unknown>2010-07-30 21:29:12 +0000
commit71d2692bc427232d71707d3b241ee90b6278b06b (patch)
tree82d88fa94f514d44c48058f426aac36c8db5e9bd /Chalice/src/ChaliceToCSharp.scala
parent62fdc7d6ae9b6edf8b4031ad0ed4068d23e82000 (diff)
Chalice:
* add sequence axiom updates from Dafny * fix a bug in pretty printer for functions and predicates * add a command line option for not checking termination; refactor options code to update syntax help string * relax resolver to allow ghost state in assume statements (we don't know how to compile them in general anyways; assume false is still a special case and is compiled into assert false)
Diffstat (limited to 'Chalice/src/ChaliceToCSharp.scala')
-rw-r--r--Chalice/src/ChaliceToCSharp.scala5
1 files changed, 4 insertions, 1 deletions
diff --git a/Chalice/src/ChaliceToCSharp.scala b/Chalice/src/ChaliceToCSharp.scala
index f759831b..0c35bd5b 100644
--- a/Chalice/src/ChaliceToCSharp.scala
+++ b/Chalice/src/ChaliceToCSharp.scala
@@ -98,7 +98,10 @@ class ChaliceToCSharp {
def convertStatement(statement: Statement): String = {
statement match {
case Assert(e) => indent + "// assert" + nl
- case Assume(e) => indent + "assert " + convertExpression(e) + ";" // todo: what if e contains old, result, ...
+ case Assume(e) => indent + {e match {
+ case BoolLiteral(false) => "assert false;" + nl // abort since we made a wrong choice...
+ case _ => // TODO: what to do with assume expressions that contain old, result, ghost variables, etc.
+ "// assume" + nl}}
case BlockStmt(ss) => indent + "{" + nl + (indentMore { rep(ss map convertStatement) }) + indent + "}" + nl
case IfStmt(guard, thn, els) => indent + "if (" + convertExpression(guard) + ")" + nl + convertStatement(thn) +
(if(els.isDefined) (indent + "else" + nl + convertStatement(els.get)) else { "" }) + nl