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.
Preserve global context flags in Typing.typeCref2 (OpenModelica#12202)
- Preserve the global context flags such as INSTANCE_API when typing components in Typing.typeCref2 instead of starting from an empty context. Fixes OpenModelica#12188
- Loading branch information
Showing
4 changed files
with
180 additions
and
3 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
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
160 changes: 160 additions & 0 deletions
160
testsuite/openmodelica/instance-API/GetModelInstanceInnerOuter5.mos
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,160 @@ | ||
// name: GetModelInstanceInnerOuter5 | ||
// keywords: | ||
// status: correct | ||
// cflags: -d=newInst | ||
// | ||
// | ||
|
||
loadString(" | ||
model World | ||
Position p; | ||
parameter Boolean enableAnimation = true; | ||
end World; | ||
|
||
model Arrow | ||
outer World world; | ||
Real x if world.enableAnimation; | ||
end Arrow; | ||
|
||
model WorldForce | ||
Arrow arrow; | ||
end WorldForce; | ||
|
||
type Length = Real; | ||
type Position = Length; | ||
|
||
model M | ||
WorldForce force_a; | ||
inner World world; | ||
end M; | ||
"); | ||
|
||
getModelInstance(M, prettyPrint=true); | ||
|
||
// Result: | ||
// true | ||
// "{ | ||
// \"name\": \"M\", | ||
// \"restriction\": \"model\", | ||
// \"elements\": [ | ||
// { | ||
// \"$kind\": \"component\", | ||
// \"name\": \"force_a\", | ||
// \"type\": { | ||
// \"name\": \"WorldForce\", | ||
// \"restriction\": \"model\", | ||
// \"elements\": [ | ||
// { | ||
// \"$kind\": \"component\", | ||
// \"name\": \"arrow\", | ||
// \"type\": { | ||
// \"name\": \"Arrow\", | ||
// \"restriction\": \"model\", | ||
// \"elements\": [ | ||
// { | ||
// \"$kind\": \"component\", | ||
// \"name\": \"x\", | ||
// \"type\": \"Real\", | ||
// \"condition\": { | ||
// \"binding\": true | ||
// } | ||
// } | ||
// ], | ||
// \"source\": { | ||
// \"filename\": \"<interactive>\", | ||
// \"lineStart\": 7, | ||
// \"columnStart\": 3, | ||
// \"lineEnd\": 10, | ||
// \"columnEnd\": 12 | ||
// } | ||
// } | ||
// } | ||
// ], | ||
// \"source\": { | ||
// \"filename\": \"<interactive>\", | ||
// \"lineStart\": 12, | ||
// \"columnStart\": 3, | ||
// \"lineEnd\": 14, | ||
// \"columnEnd\": 17 | ||
// } | ||
// } | ||
// }, | ||
// { | ||
// \"$kind\": \"component\", | ||
// \"name\": \"world\", | ||
// \"type\": { | ||
// \"name\": \"World\", | ||
// \"restriction\": \"model\", | ||
// \"elements\": [ | ||
// { | ||
// \"$kind\": \"component\", | ||
// \"name\": \"p\", | ||
// \"type\": { | ||
// \"name\": \"Position\", | ||
// \"restriction\": \"type\", | ||
// \"elements\": [ | ||
// { | ||
// \"$kind\": \"extends\", | ||
// \"baseClass\": { | ||
// \"name\": \"Length\", | ||
// \"restriction\": \"type\", | ||
// \"elements\": [ | ||
// { | ||
// \"$kind\": \"extends\", | ||
// \"baseClass\": \"Real\" | ||
// } | ||
// ], | ||
// \"source\": { | ||
// \"filename\": \"<interactive>\", | ||
// \"lineStart\": 16, | ||
// \"columnStart\": 3, | ||
// \"lineEnd\": 16, | ||
// \"columnEnd\": 21 | ||
// } | ||
// } | ||
// } | ||
// ], | ||
// \"source\": { | ||
// \"filename\": \"<interactive>\", | ||
// \"lineStart\": 17, | ||
// \"columnStart\": 3, | ||
// \"lineEnd\": 17, | ||
// \"columnEnd\": 25 | ||
// } | ||
// } | ||
// }, | ||
// { | ||
// \"$kind\": \"component\", | ||
// \"name\": \"enableAnimation\", | ||
// \"type\": \"Boolean\", | ||
// \"modifiers\": \"true\", | ||
// \"value\": { | ||
// \"binding\": true | ||
// }, | ||
// \"prefixes\": { | ||
// \"variability\": \"parameter\" | ||
// } | ||
// } | ||
// ], | ||
// \"source\": { | ||
// \"filename\": \"<interactive>\", | ||
// \"lineStart\": 2, | ||
// \"columnStart\": 3, | ||
// \"lineEnd\": 5, | ||
// \"columnEnd\": 12 | ||
// } | ||
// }, | ||
// \"prefixes\": { | ||
// \"inner\": true | ||
// } | ||
// } | ||
// ], | ||
// \"source\": { | ||
// \"filename\": \"<interactive>\", | ||
// \"lineStart\": 19, | ||
// \"columnStart\": 3, | ||
// \"lineEnd\": 22, | ||
// \"columnEnd\": 8 | ||
// } | ||
// }" | ||
// 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