Skip to content

Commit 81066b9

Browse files
authored
More System.unquoteIdentifier to get rid of undefined loop varables $i1 (#7610)
1 parent b2341d1 commit 81066b9

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

OMCompiler/Compiler/Template/CodegenCppCommon.tpl

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -65,20 +65,20 @@ template crefToCStrForArray(ComponentRef cr, Text& dims)
6565
match cr
6666
case CREF_IDENT(__) then
6767
let &dims+=listLength(subscriptLst)
68-
'<%ident%>_'
68+
'<%System.unquoteIdentifier(ident)%>_'
6969
case CREF_QUAL(__) then
7070
let subs = if Flags.isSet(Flags.NF_SCALARIZE) then subscriptsToCStrForArray(subscriptLst)
71-
'<%ident%><%subs%>_P_<%crefToCStrForArray(componentRef,dims)%>'
71+
'<%System.unquoteIdentifier(ident)%><%subs%>_P_<%crefToCStrForArray(componentRef,dims)%>'
7272
case WILD(__) then ' '
7373
else "CREF_NOT_IDENT_OR_QUAL"
7474
end crefToCStrForArray;
7575

7676
template crefToCStr1(ComponentRef cr, Boolean useFlatArrayNotation)
7777
::=
7878
match cr
79-
case CREF_IDENT(__) then '<%ident%>_'
79+
case CREF_IDENT(__) then '<%System.unquoteIdentifier(ident)%>_'
8080
case CREF_QUAL(__) then
81-
'<%ident%><%subscriptsToCStrForArray(subscriptLst)%>_P_<%crefToCStr1(componentRef,useFlatArrayNotation)%>'
81+
'<%System.unquoteIdentifier(ident)%><%subscriptsToCStrForArray(subscriptLst)%>_P_<%crefToCStr1(componentRef,useFlatArrayNotation)%>'
8282
case WILD(__) then ' '
8383
else "CREF_NOT_IDENT_OR_QUAL"
8484
end crefToCStr1;
@@ -95,10 +95,10 @@ template crefStrForWriteOutput(ComponentRef cr)
9595
match cr
9696
case CREF_IDENT(ident = "xloc") then '__xd<%subscriptsStrForWriteOutput(subscriptLst)%>'
9797
case CREF_IDENT(ident = "time") then "_simTime"
98-
case CREF_IDENT(__) then '<%ident%><%subscriptsStrForWriteOutput(subscriptLst)%>'
98+
case CREF_IDENT(__) then '<%System.unquoteIdentifier(ident)%><%subscriptsStrForWriteOutput(subscriptLst)%>'
9999
case CREF_QUAL(ident = "$DER") then 'der(<%crefStrForWriteOutput(componentRef)%>)'
100100
case CREF_QUAL(ident = "$CLKPRE") then 'previous(<%crefStrForWriteOutput(componentRef)%>)'
101-
case CREF_QUAL(__) then '<%ident%><%subscriptsStrForWriteOutput(subscriptLst)%>.<%crefStrForWriteOutput(componentRef)%>'
101+
case CREF_QUAL(__) then '<%System.unquoteIdentifier(ident)%><%subscriptsStrForWriteOutput(subscriptLst)%>.<%crefStrForWriteOutput(componentRef)%>'
102102
else "CREF_NOT_IDENT_OR_QUAL"
103103
end crefStrForWriteOutput;
104104

@@ -198,7 +198,7 @@ template crefToCStrWithIndex(ComponentRef cr, Context context, Text &varDecls, S
198198
let tmp = ""
199199
match cr
200200
case CREF_QUAL(__) then
201-
let identTmp = '<%ident%>'
201+
let identTmp = '<%System.unquoteIdentifier(ident)%>'
202202
match listHead(subscriptLst)
203203
case INDEX(__) then
204204
match exp case e as CREF(__) then
@@ -296,10 +296,10 @@ template crefToCStr(ComponentRef cr, Boolean useFlatArrayNotation)
296296
match cr
297297
case CREF_IDENT(__) then
298298
let subs = if Flags.isSet(Flags.NF_SCALARIZE) then subscriptsToCStr(subscriptLst, useFlatArrayNotation)
299-
'<%ident%>_<%subs%>'
299+
'<%System.unquoteIdentifier(ident)%>_<%subs%>'
300300
case CREF_QUAL(__) then
301301
let subs = if Flags.isSet(Flags.NF_SCALARIZE) then subscriptsToCStrForArray(subscriptLst)
302-
'<%ident%><%subs%>_P_<%crefToCStr(componentRef, useFlatArrayNotation)%>'
302+
'<%System.unquoteIdentifier(ident)%><%subs%>_P_<%crefToCStr(componentRef, useFlatArrayNotation)%>'
303303
case WILD(__) then ''
304304
else "CREF_NOT_IDENT_OR_QUAL"
305305
end crefToCStr;
@@ -514,8 +514,8 @@ template arrayCrefStr(ComponentRef cr)
514514
::=
515515
match cr
516516
case CREF_IDENT(ident = "time") then "_simTime"
517-
case CREF_IDENT(__) then '<%ident%>_'
518-
case CREF_QUAL(__) then '<%ident%>_.<%arrayCrefStr(componentRef)%>'
517+
case CREF_IDENT(__) then '<%System.unquoteIdentifier(ident)%>_'
518+
case CREF_QUAL(__) then '<%System.unquoteIdentifier(ident)%>_.<%arrayCrefStr(componentRef)%>'
519519
else "CREF_NOT_IDENT_OR_QUAL"
520520
end arrayCrefStr;
521521

@@ -1372,9 +1372,9 @@ template daeExpMatrixName2(ComponentRef cr)
13721372

13731373
match cr
13741374
case CREF_IDENT(__) then
1375-
'<%ident%>'
1376-
case CREF_QUAL(__) then '<%ident%><%subscriptsToCStrForArray(subscriptLst)%>_P_<%daeExpMatrixName2(componentRef)%>'
1377-
1375+
'<%System.unquoteIdentifier(ident)%>'
1376+
case CREF_QUAL(__) then
1377+
'<%System.unquoteIdentifier(ident)%><%subscriptsToCStrForArray(subscriptLst)%>_P_<%daeExpMatrixName2(componentRef)%>'
13781378
case WILD(__) then ' '
13791379
else "CREF_NOT_IDENT_OR_QUAL"
13801380
end daeExpMatrixName2;

0 commit comments

Comments
 (0)