Browse Source

Redefining built-in labels is an error.

git-svn-id: https://www.prismmodelchecker.org/svn/prism/prism/trunk@550 bbc10eb1-c90d-0410-af57-cb519fbb1720
master
Dave Parker 18 years ago
parent
commit
7e348b6052
  1. 7
      prism/src/parser/LabelList.java

7
prism/src/parser/LabelList.java

@ -141,13 +141,18 @@ public class LabelList
public void check() throws PrismException public void check() throws PrismException
{ {
int i, n; int i, n;
String s;
Expression e; Expression e;
// go thru all labels // go thru all labels
n = labels.size(); n = labels.size();
for (i = 0; i < n; i++) { for (i = 0; i < n; i++) {
e = getLabel(i);
// make sure name doesn't clash with a built-in one
s = getLabelName(i);
if ("deadlock".equals(s)) throw new PrismException("Cannot define a label called \"deadlock\" - this is a built-in label");
if ("init".equals(s)) throw new PrismException("Cannot define a label called \"init\" - this is a built-in label");
// is expression ok? // is expression ok?
e = getLabel(i);
e.check(); e.check();
// and does it type check ok? // and does it type check ok?
if (e.getType() != Expression.BOOLEAN) { if (e.getType() != Expression.BOOLEAN) {

Loading…
Cancel
Save