Browse Source

Added fallback type computation to getType().

git-svn-id: https://www.prismmodelchecker.org/svn/prism/prism/trunk@718 bbc10eb1-c90d-0410-af57-cb519fbb1720
master
Dave Parker 18 years ago
parent
commit
91a7d8455f
  1. 14
      prism/src/parser/ast/ASTElement.java

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

@ -108,8 +108,22 @@ public abstract class ASTElement
// Get methods
/**
* Get the type for this element. It should have already been computed
* by calling typeCheck(). If not, it will be computed first but, in
* the case of error, you will get "unknown" type, not the error.
*/
public int getType()
{
if (type != 0) return type;
try {
typeCheck();
}
catch (PrismLangException e) {
// Returns 0 (unknown) in case of error.
// If you want to check for errors, use typeCheck().
return 0;
}
return type;
}

Loading…
Cancel
Save