Skip to content

Commit

Permalink
Merge pull request #607 from utwente-fmt/standardize-function-to-pred…
Browse files Browse the repository at this point in the history
…icate

Standardize "resource functions" to predicates
  • Loading branch information
petravandenbos-utwente authored Mar 19, 2021
2 parents e913e51 + d7088ce commit 682855b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
7 changes: 7 additions & 0 deletions examples/basic/predicate.pvl
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
//:: case OnlyPredicate
//:: verdict Pass
//:: tools silicon carbon

class Pred {
resource f() = true;
}
14 changes: 10 additions & 4 deletions src/main/java/vct/col/features/FeatureRainbow.scala
Original file line number Diff line number Diff line change
Expand Up @@ -170,10 +170,16 @@ class RainbowVisitor(source: ProgramUnit) extends RecursiveVisitor(source, true)
}
}

if(isPure(m) && isInline(m))
addFeature(InlinePredicate, m)
if(isPure(m) && m.getBody.isInstanceOf[BlockStatement])
addFeature(PureImperativeMethods, m)
if(isPure(m)) {
if(isInline(m))
addFeature(InlinePredicate, m)
if(m.getBody.isInstanceOf[BlockStatement])
addFeature(PureImperativeMethods, m)
}

if(m.kind == Method.Kind.Pure && m.getReturnType.isPrimitive(PrimitiveSort.Resource))
addFeature(NotStandardized, m)

if(m.kind == Method.Kind.Constructor)
addFeature(Constructors, m)
if(!m.getReturnType.isPrimitive(PrimitiveSort.Void) && !isPure(m))
Expand Down

0 comments on commit 682855b

Please sign in to comment.