diff --git a/prism/src/parser/ast/ASTElement.java b/prism/src/parser/ast/ASTElement.java index fdb387de..2ecfd45d 100644 --- a/prism/src/parser/ast/ASTElement.java +++ b/prism/src/parser/ast/ASTElement.java @@ -271,7 +271,9 @@ public abstract class ASTElement /** * Get all undefined constants used (i.e. in ExpressionConstant objects) recursively and return as a list. - * Recursive decent means that we find e.g. constants that are used within other constants, labels. + * Recursive descent means that we find e.g. constants that are used within other constants, labels. + * But note that we only look at/for constants in the passed in ConstantList. + * Any others discovered are ignored (and not descended into). */ public Vector getAllUndefinedConstantsRecursively(ConstantList constantList, LabelList labelList) { diff --git a/prism/src/parser/ast/PropertiesFile.java b/prism/src/parser/ast/PropertiesFile.java index ebd36208..9d36d703 100644 --- a/prism/src/parser/ast/PropertiesFile.java +++ b/prism/src/parser/ast/PropertiesFile.java @@ -366,7 +366,7 @@ public class PropertiesFile extends ASTElement /** * Get a list of undefined (properties file) constants appearing in labels of the properties file - * (undefined constants are those of form "const int x;" rather than "const int x = 1;") + * (undefined constants are those of form "const int x;" rather than "const int x = 1;") */ public Vector getUndefinedConstantsUsedInLabels() { diff --git a/prism/src/parser/visitor/GetAllUndefinedConstantsRecursively.java b/prism/src/parser/visitor/GetAllUndefinedConstantsRecursively.java index 329f599e..b76ad0cc 100644 --- a/prism/src/parser/visitor/GetAllUndefinedConstantsRecursively.java +++ b/prism/src/parser/visitor/GetAllUndefinedConstantsRecursively.java @@ -33,7 +33,9 @@ import prism.PrismLangException; /** * Get all undefined constants used (i.e. in ExpressionConstant objects) recursively and return as a list. - * Recursive decent means that we find e.g. constants that are used within other constants, labels. + * Recursive descent means that we find e.g. constants that are used within other constants, labels. + * But note that we only look at/for constants in the passed in ConstantList. + * Any others discovered are ignored (and not descended into). */ public class GetAllUndefinedConstantsRecursively extends ASTTraverse { @@ -52,8 +54,9 @@ public class GetAllUndefinedConstantsRecursively extends ASTTraverse { // Look up this constant in the constant list int i = constantList.getConstantIndex(e.getName()); + // Ignore constants not in the list if (i == -1) - throw new PrismLangException("Unknown constant \"" + e.getName() + "\""); + return; Expression expr = constantList.getConstant(i); // If constant is undefined, add to the list if (expr == null) {