Browse Source

Code tidy: stop PrismExceptions on formula expansion (eases debugging) and remove an unused method.

git-svn-id: https://www.prismmodelchecker.org/svn/prism/prism/trunk@2379 bbc10eb1-c90d-0410-af57-cb519fbb1720
master
Dave Parker 15 years ago
parent
commit
76d7039060
  1. 9
      prism/src/parser/ast/ASTElement.java
  2. 2
      prism/src/parser/visitor/ExpandFormulas.java

9
prism/src/parser/ast/ASTElement.java

@ -111,7 +111,7 @@ public abstract class ASTElement
/** /**
* Get the type for this element. It should have already been computed * Get the type for this element. It should have already been computed
* by calling typeCheck(). If not, it will be computed first but, in * by calling typeCheck(). If not, it will be computed first but, in
* the case of error, you will get "unknown" type, not the error.
* the case of error, you will get "unknown" (null) type, not the error.
*/ */
public Type getType() public Type getType()
{ {
@ -128,11 +128,12 @@ public abstract class ASTElement
} }
/** /**
* Get the type for this element, as a string.
* Get the type for this element but, unlike getType(), don't call typeCheck()
* if it has not been computed yet - just return null instead.
*/ */
public String getTypeString()
public Type getTypeIfDefined()
{ {
return type.getTypeString();
return type;
} }
public boolean hasPosition() public boolean hasPosition()

2
prism/src/parser/visitor/ExpandFormulas.java

@ -67,7 +67,7 @@ public class ExpandFormulas extends ASTTraverseModify
expr = Expression.Parenth(expr); expr = Expression.Parenth(expr);
// This is probably being done before type-checking so // This is probably being done before type-checking so
// don't really need to preserve type, but do so just in case // don't really need to preserve type, but do so just in case
t = expr.getType();
t = expr.getTypeIfDefined();
expr = Expression.Parenth(expr); expr = Expression.Parenth(expr);
expr.setType(t); expr.setType(t);
// Return replacement expression // Return replacement expression

Loading…
Cancel
Save