diff options
Diffstat (limited to 'Chalice/src/main/scala/Resolver.scala')
-rw-r--r-- | Chalice/src/main/scala/Resolver.scala | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/Chalice/src/main/scala/Resolver.scala b/Chalice/src/main/scala/Resolver.scala index e802b7e7..dda5d989 100644 --- a/Chalice/src/main/scala/Resolver.scala +++ b/Chalice/src/main/scala/Resolver.scala @@ -232,6 +232,7 @@ object Resolver { if (!e.typ.IsBool) context.Error(c.pos, "where clause requires a boolean expression (found " + e.typ.FullName + ")")
case p@Predicate(id, e) =>
var ctx = context;
+ if (ContainsWaitlevel(e)) context.Error(e.pos, "predicate body is not allowed to mention 'waitlevel'")
ResolveExpr(e, ctx, false, true)(true);
if(!e.typ.IsBool) context.Error(e.pos, "predicate requires a boolean expression (found " + e.typ.FullName + ")")
case f@Function(id, ins, out, spec, definition) =>
@@ -862,6 +863,18 @@ object Resolver { )
x
}
+
+ // does e contain 'waitlevel'?
+ def ContainsWaitlevel(expr: Expression): Boolean = {
+ var x: Boolean = false
+ AST.visit(expr,
+ e => e match {
+ case _:MaxLockLiteral => x = true
+ case _ =>
+ }
+ )
+ x
+ }
// ResolveExpr resolves all parts of an RValue, if possible, and (always) sets the RValue's typ field
def ResolveExpr(e: RValue, context: ProgramContext,
|