From 76d70390603ce68082b80e221569eb45f3a0e12d Mon Sep 17 00:00:00 2001 From: Dave Parker Date: Sun, 9 Jan 2011 16:02:22 +0000 Subject: [PATCH] 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 --- prism/src/parser/ast/ASTElement.java | 9 +++++---- prism/src/parser/visitor/ExpandFormulas.java | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/prism/src/parser/ast/ASTElement.java b/prism/src/parser/ast/ASTElement.java index becbc733..4f59bc7b 100644 --- a/prism/src/parser/ast/ASTElement.java +++ b/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 * 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() { @@ -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() diff --git a/prism/src/parser/visitor/ExpandFormulas.java b/prism/src/parser/visitor/ExpandFormulas.java index 3ecff782..d7a6caa0 100644 --- a/prism/src/parser/visitor/ExpandFormulas.java +++ b/prism/src/parser/visitor/ExpandFormulas.java @@ -67,7 +67,7 @@ public class ExpandFormulas extends ASTTraverseModify expr = Expression.Parenth(expr); // This is probably being done before type-checking so // don't really need to preserve type, but do so just in case - t = expr.getType(); + t = expr.getTypeIfDefined(); expr = Expression.Parenth(expr); expr.setType(t); // Return replacement expression