From 59e73d14817b1c721f8998785382f109833b1be3 Mon Sep 17 00:00:00 2001 From: paulklint Date: Sun, 1 Dec 2024 17:42:52 +0100 Subject: [PATCH] More robustness --- .../core/library/lang/rascalcore/check/ADTandGrammar.rsc | 5 ++++- .../core/library/lang/rascalcore/check/ATypeUtils.rsc | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/org/rascalmpl/core/library/lang/rascalcore/check/ADTandGrammar.rsc b/src/org/rascalmpl/core/library/lang/rascalcore/check/ADTandGrammar.rsc index b219a113..4c37c939 100644 --- a/src/org/rascalmpl/core/library/lang/rascalcore/check/ADTandGrammar.rsc +++ b/src/org/rascalmpl/core/library/lang/rascalcore/check/ADTandGrammar.rsc @@ -148,7 +148,10 @@ tuple[TModel, ModuleStatus] addGrammar(str qualifiedModuleName, set[str] imports } else { = getTModelForModule(m, ms); if(!found) { - throw "addGrammar: tmodel for not found"; + msg = error("Cannot add grammar, tmodel for not found", ms.moduleLocs[qualifiedModuleName] ? |unknown:///|); + ms.messages[qualifiedModuleName] ? {} += { msg }; + tm1 = tmodel(modelName=qualifiedModuleName, messages=[msg]); + return ; } } facts = tm1.facts; diff --git a/src/org/rascalmpl/core/library/lang/rascalcore/check/ATypeUtils.rsc b/src/org/rascalmpl/core/library/lang/rascalcore/check/ATypeUtils.rsc index e79f220d..9cf6de73 100644 --- a/src/org/rascalmpl/core/library/lang/rascalcore/check/ATypeUtils.rsc +++ b/src/org/rascalmpl/core/library/lang/rascalcore/check/ATypeUtils.rsc @@ -258,7 +258,7 @@ set[Production] aprods2prods(set[AType] alts) = {aprod2prod(p) | p <- alts/*, ac Production aprod2prod(aprod(AProduction prod)) = aprod2prod(prod); default Production aprod2prod(AType t) { - throw "internal error: do not know how to translate a to a production rule?!"; + throw rascalCheckerInternalError("Do not know how to translate a to a production rule"); } Production aprod2prod(p:AProduction::prod(AType lhs, list[AType] atypes, attributes=set[AAttr] as))