Skip to content

Commit

Permalink
Fix for #3386:
Browse files Browse the repository at this point in the history
- Fixed spliced exp creation for crefs prefixed with a class name.
- Cleaned up Static.elabCref2 by removing dead and redundant code.
  • Loading branch information
perost committed Aug 20, 2015
1 parent 9e20c7d commit 629f329
Show file tree
Hide file tree
Showing 2 changed files with 159 additions and 306 deletions.
23 changes: 23 additions & 0 deletions Compiler/FrontEnd/Lookup.mo
Expand Up @@ -1333,6 +1333,8 @@ algorithm
then ();
end match;
(cache,p_env,attr,ty,bind,cnstForRange,splicedExpData,componentEnv,name) = lookupVarInPackages(cache,env5,cref,prevFrames,inState);
// Add the class name to the spliced exp so that the name is correct.
splicedExpData = prefixSplicedExp(ComponentReference.crefFirstCref(inComponentRef), splicedExpData);
then
(cache,p_env,attr,ty,bind,cnstForRange,splicedExpData,componentEnv,name);

Expand Down Expand Up @@ -3197,5 +3199,26 @@ algorithm
end matchcontinue;
end isFunctionCallViaComponent;

protected function prefixSplicedExp
"Prefixes a spliced exp that contains a cref with another cref."
input DAE.ComponentRef inCref;
input InstTypes.SplicedExpData inSplicedExp;
output InstTypes.SplicedExpData outSplicedExp;
algorithm
outSplicedExp := match inSplicedExp
local
DAE.Type ety, ty;
DAE.ComponentRef cref;

case InstTypes.SPLICEDEXPDATA(SOME(DAE.CREF(cref, ety)), ty)
algorithm
cref := ComponentReference.joinCrefs(inCref, cref);
then
InstTypes.SPLICEDEXPDATA(SOME(DAE.CREF(cref, ety)), ty);

else inSplicedExp;
end match;
end prefixSplicedExp;

annotation(__OpenModelica_Interface="frontend");
end Lookup;

0 comments on commit 629f329

Please sign in to comment.