Skip to content

Commit

Permalink
[NB] update pre variables (OpenModelica#12274)
Browse files Browse the repository at this point in the history
- correctly apply subscripts on pre variable crefs
  • Loading branch information
kabdelhak committed Apr 18, 2024
1 parent d4909e3 commit 42b5a6f
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions OMCompiler/Compiler/NBackEnd/Modules/2_Pre/NBDetectStates.mo
Expand Up @@ -352,9 +352,12 @@ protected

case Expression.CALL(call = Call.TYPED_CALL(fn = Function.FUNCTION(path = Absyn.IDENT(name = "pre")),
arguments = {Expression.CREF(cref = state_cref)}))
algorithm
state_var := BVariable.getVarPointer(state_cref);
pre_cref := getPreVar(state_cref, state_var, acc_previous, scalarized);
algorithm
state_var := BVariable.getVarPointer(state_cref);
pre_cref := getPreVar(state_cref, state_var, acc_previous, scalarized);
if not scalarized then
pre_cref := ComponentRef.setSubscriptsList(listReverse(ComponentRef.subscriptsAll(state_cref)), pre_cref);
end if;
then Expression.fromCref(pre_cref);
// ToDo! General expressions inside pre call!
// ToDo! edge and change replacement!
Expand Down

0 comments on commit 42b5a6f

Please sign in to comment.