Skip to content

Commit

Permalink
The attributes of a pre-var is the same as the var
Browse files Browse the repository at this point in the history
  • Loading branch information
sjoelund authored and OpenModelica-Hudson committed Jan 5, 2018
1 parent 62d1de3 commit 67acb2d
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
9 changes: 9 additions & 0 deletions Compiler/FrontEnd/ComponentReference.mo
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion Compiler/Template/CodegenCFunctions.tpl
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions Compiler/Template/SimCodeTV.mo
Expand Up @@ -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
Expand Down

0 comments on commit 67acb2d

Please sign in to comment.