Skip to content

Commit

Permalink
Merge pull request #528 from thelfer/524-mfront-prevent-importing-a-m…
Browse files Browse the repository at this point in the history
…odel-not-implemented-using-the-model-dsl-in-behaviors

Fix Issue #524
  • Loading branch information
thelfer authored Mar 19, 2024
2 parents 9a10553 + 6b474fd commit 65c2e9e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
4 changes: 4 additions & 0 deletions docs/web/release-notes-4.0.3.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ eqnPrefixTemplate: "($$i$$)"

# Issues fixed

## Issue 524: [mfront] prevent importing a model not implemented using the Model DSL in behaviors

For more details, see <https://github.com/thelfer/tfel/issues/524>

## Issue 522: [mfront] Visual Studio 2022 compiler intrinsic type traits error C2139

For more details, see <https://github.com/thelfer/tfel/issues/522>
Expand Down
12 changes: 11 additions & 1 deletion mfront/src/BehaviourDSLCommon.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -883,9 +883,19 @@ namespace mfront {
getLogStream() << "BehaviourDSLCommon::getModelDescription: "
<< "treating file '" << f << "'\n";
}
//
const auto path = SearchPathsHandler::search(f);
// a simple test to fix Issue #524
const auto adsl = MFrontBase::getDSL(path);
if (adsl->getTargetType() != AbstractDSL::MODELDSL) {
this->throwRuntimeError("BehaviourDSLCommon::getModelDescription",
"error while treating file '" + f +
"'.\n"
"This file is not handled by the Model DSL");
}
//
const auto& global_options =
GlobalDomainSpecificLanguageOptionsManager::get();
const auto path = SearchPathsHandler::search(f);
auto dsl = ModelDSL{tfel::utilities::merge(
global_options.getModelDSLOptions(), this->buildDSLOptions(), true)};
// getting informations the source files
Expand Down

0 comments on commit 65c2e9e

Please sign in to comment.