forked from OpenModelica/OpenModelica
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve sorting of local function variables
- Take the modifiers on local record instances into account too when computing the dependencies between local function variables. Fixes thorade/HelmholtzMedia#48
- Loading branch information
Showing
3 changed files
with
72 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
testsuite/flattening/modelica/scodeinst/FunctionCompOrder4.mo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// name: FunctionCompOrder4 | ||
// keywords: | ||
// status: correct | ||
// cflags: -d=newInst | ||
// | ||
|
||
record R | ||
Real x; | ||
end R; | ||
|
||
function f | ||
input Real x; | ||
output Real y; | ||
protected | ||
R r(x = lx); | ||
Real lx = x; | ||
algorithm | ||
y := r.x; | ||
end f; | ||
|
||
model FunctionCompOrder4 | ||
Real x = f(time); | ||
end FunctionCompOrder4; | ||
|
||
// Result: | ||
// function R "Automatically generated record constructor for R" | ||
// input Real x; | ||
// output R res; | ||
// end R; | ||
// | ||
// function f | ||
// input Real x; | ||
// output Real y; | ||
// protected Real lx = x; | ||
// protected R r; | ||
// algorithm | ||
// y := r.x; | ||
// end f; | ||
// | ||
// class FunctionCompOrder4 | ||
// Real x = f(time); | ||
// end FunctionCompOrder4; | ||
// endResult |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters