Skip to content

Commit

Permalink
Check if parameter is redeclared but not is replaceable (#11341)
Browse files Browse the repository at this point in the history
Fixes #11311
  • Loading branch information
adeas31 committed Oct 8, 2023
1 parent 7fdfe5c commit cdae530
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion OMEdit/OMEditLIB/Element/ElementProperties.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1167,7 +1167,7 @@ void ElementParameters::applyFinalStartFixedAndDisplayUnitModifiers(Parameter *p
/* Ticket #2531
* Check if parameter is marked final.
*/
if (modifier.isFinal() || modifier.isRedeclare()) {
if (modifier.isFinal() || (modifier.isRedeclare() && !modifier.isReplaceable())) {
mParametersList.removeOne(pParameter);
delete pParameter;
} else {
Expand Down
2 changes: 2 additions & 0 deletions OMEdit/OMEditLIB/Modeling/Model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -718,6 +718,8 @@ namespace ModelInstance
mEach = true;
} else if (modifierKey.compare(QStringLiteral("redeclare")) == 0) {
mRedeclare = true;
} else if (modifierKey.compare(QStringLiteral("replaceable")) == 0) {
mReplaceable = true;
} else {
Modifier modifier;
modifier.setName(modifierKey);
Expand Down
2 changes: 2 additions & 0 deletions OMEdit/OMEditLIB/Modeling/Model.h
Original file line number Diff line number Diff line change
Expand Up @@ -469,13 +469,15 @@ namespace ModelInstance
bool isFinal() const {return mFinal;}
bool isEach() const {return mEach;}
bool isRedeclare() const {return mRedeclare;}
bool isReplaceable() const {return mReplaceable;}
QString getModifierValue(QStringList qualifiedModifierName) const;
private:
QString mName;
QString mValue;
bool mFinal = false;
bool mEach = false;
bool mRedeclare = false;
bool mReplaceable = false;
QList<Modifier> mModifiers;

static QString getModifierValue(const Modifier &modifier, const QString &modifierName, QStringList qualifiedModifierName);
Expand Down

0 comments on commit cdae530

Please sign in to comment.