Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve getClassComment API (#10215)
- Return the comment after the constrainedby clause on a replaceable class if available. Fixes #10030
- Loading branch information
Showing
5 changed files
with
149 additions
and
7 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
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
35 changes: 35 additions & 0 deletions
35
testsuite/openmodelica/interactive-API/getClassComment.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,35 @@ | ||
// name: getClassComment | ||
// keywords: | ||
// status: correct | ||
// cflags: -d=newInst | ||
|
||
loadString(" | ||
package P \"P comment\" | ||
replaceable model M1 = M constrainedby M \"After constraint\"; | ||
replaceable model M2 = M \"Before constraint\" constrainedby M; | ||
replaceable model M3 = M \"Before constraint\" constrainedby M \"After constraint\"; | ||
|
||
model M \"M comment\" | ||
end M; | ||
|
||
model extends ME \"ME comment\" | ||
end ME; | ||
end P; | ||
"); | ||
|
||
getClassComment(P); | ||
getClassComment(P.M1); | ||
getClassComment(P.M2); | ||
getClassComment(P.M3); | ||
getClassComment(P.M); | ||
getClassComment(P.ME); | ||
|
||
// Result: | ||
// true | ||
// "P comment" | ||
// "After constraint" | ||
// "Before constraint" | ||
// "After constraint" | ||
// "M comment" | ||
// "ME comment" | ||
// endResult |