diff --git a/Compiler/FrontEnd/ComponentReference.mo b/Compiler/FrontEnd/ComponentReference.mo index 78010ddca64..723912886e2 100644 --- a/Compiler/FrontEnd/ComponentReference.mo +++ b/Compiler/FrontEnd/ComponentReference.mo @@ -2078,6 +2078,15 @@ algorithm outCref := makeCrefQual(DAE.previousNamePrefix, DAE.T_UNKNOWN_DEFAULT, {}, inCref); end crefPrefixPrevious; +public function crefRemovePrePrefix + input output DAE.ComponentRef cref; +algorithm + cref := match cref + case DAE.CREF_QUAL(ident=DAE.preNamePrefix) then cref.componentRef; + else cref; + end match; +end crefRemovePrePrefix; + public function crefPrefixStart "public function crefPrefixStart Appends $START to a cref, so a => $START.a" input DAE.ComponentRef inCref; diff --git a/Compiler/Template/CodegenCFunctions.tpl b/Compiler/Template/CodegenCFunctions.tpl index 425915c2f16..59901558faa 100644 --- a/Compiler/Template/CodegenCFunctions.tpl +++ b/Compiler/Template/CodegenCFunctions.tpl @@ -6984,7 +6984,7 @@ end varAttributes; template crefAttributes(ComponentRef cr) ::= - match cref2simvar(cr, getSimCode()) + match cref2simvar(crefRemovePrePrefix(cr), getSimCode()) case var as SIMVAR(index=-1, varKind=JAC_VAR()) then "dummyREAL_ATTRIBUTE" case var as SIMVAR(__) then if intLt(index,0) then error(sourceInfo(), 'varAttributes got negative index=<%index%> for <%crefStr(name)%>') else diff --git a/Compiler/Template/SimCodeTV.mo b/Compiler/Template/SimCodeTV.mo index 8fd33118cab..c6c2cdf4e49 100644 --- a/Compiler/Template/SimCodeTV.mo +++ b/Compiler/Template/SimCodeTV.mo @@ -3244,6 +3244,10 @@ package ComponentReference output DAE.ComponentRef outCR; end popCref; + function crefRemovePrePrefix + input DAE.ComponentRef inCR; + output DAE.ComponentRef outCR; + end crefRemovePrePrefix; end ComponentReference; package Expression