File tree Expand file tree Collapse file tree 3 files changed +56
-2
lines changed
OMCompiler/Compiler/Script
testsuite/openmodelica/instance-API Expand file tree Collapse file tree 3 files changed +56
-2
lines changed Original file line number Diff line number Diff line change @@ -1934,7 +1934,7 @@ algorithm
19341934 then
19351935 json;
19361936
1937- else JSON . makeString(Dump . printExpStr(exp));
1937+ else JSON . makeString(Dump . printExpStr(AbsynUtil . stripCommentExpressions( exp) ));
19381938 end match;
19391939end dumpJSONAbsynExpression;
19401940
@@ -2179,7 +2179,7 @@ algorithm
21792179 end if ;
21802180
21812181 if isSome(mod. binding) then
2182- binding_json := JSON . makeString(Dump . printExpStr(Util . getOption(mod. binding)));
2182+ binding_json := JSON . makeString(Dump . printExpStr(AbsynUtil . stripCommentExpressions( Util . getOption(mod. binding) )));
21832183
21842184 if JSON . isNull(json) then
21852185 json := binding_json;
Original file line number Diff line number Diff line change 1+ // name: GetModelInstanceMod6
2+ // keywords:
3+ // status: correct
4+ // cflags: -d=newInst
5+ //
6+ //
7+
8+ loadString("
9+ model M
10+ Real x(start = 1
11+ // comment
12+ );
13+
14+ Real y(start = 2 /* comment */);
15+ end M;
16+ ");
17+
18+ getModelInstance(M, prettyPrint = true);
19+ getErrorString();
20+
21+ // Result:
22+ // true
23+ // "{
24+ // \"name\": \"M\",
25+ // \"restriction\": \"model\",
26+ // \"elements\": [
27+ // {
28+ // \"$kind\": \"component\",
29+ // \"name\": \"x\",
30+ // \"type\": \"Real\",
31+ // \"modifiers\": {
32+ // \"start\": \"1\"
33+ // }
34+ // },
35+ // {
36+ // \"$kind\": \"component\",
37+ // \"name\": \"y\",
38+ // \"type\": \"Real\",
39+ // \"modifiers\": {
40+ // \"start\": \"2\"
41+ // }
42+ // }
43+ // ],
44+ // \"source\": {
45+ // \"filename\": \"<interactive>\",
46+ // \"lineStart\": 2,
47+ // \"columnStart\": 3,
48+ // \"lineEnd\": 8,
49+ // \"columnEnd\": 8
50+ // }
51+ // }"
52+ // ""
53+ // endResult
Original file line number Diff line number Diff line change @@ -70,6 +70,7 @@ GetModelInstanceMod2.mos \
7070GetModelInstanceMod3.mos \
7171GetModelInstanceMod4.mos \
7272GetModelInstanceMod5.mos \
73+ GetModelInstanceMod6.mos \
7374GetModelInstanceProtected1.mos \
7475GetModelInstanceReplaceable1.mos \
7576GetModelInstanceReplaceable2.mos \
You can’t perform that action at this time.
0 commit comments