Skip to content

Commit

Permalink
- Moved evalutation of typenames from static to cevalscript
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@10761 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
sjoelund committed Dec 18, 2011
1 parent 0f3330b commit 7f7d350
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
5 changes: 0 additions & 5 deletions Compiler/FrontEnd/Static.mo
Expand Up @@ -13965,11 +13965,6 @@ algorithm
Integer i;
DAE.Exp dexp;

// Type Name stored as Code in the environment
case (Absyn.CREF(componentRef=Absyn.CREF_IDENT(name=s1, subscripts={})),_,_,DAE.C_TYPENAME(),_)
equation
(_,_,_,DAE.VALBOUND(valBound=Values.CODE(A=Absyn.C_TYPENAME(path=path))),_,_,_,_,_) = Lookup.lookupVar(cache, env, ComponentReference.makeCrefIdent(s1, DAE.T_ANYTYPE_DEFAULT, {}));
then DAE.CODE(Absyn.C_TYPENAME(path),DAE.T_UNKNOWN_DEFAULT);
// Type Name
case (Absyn.CREF(componentRef=cr),_,_,DAE.C_TYPENAME(),_)
equation
Expand Down
19 changes: 19 additions & 0 deletions Compiler/Script/CevalScript.mo
Expand Up @@ -706,6 +706,7 @@ algorithm
case (cache,env,DAE.CALL(path=Absyn.IDENT(name),attr=DAE.CALL_ATTR(builtin=true),expLst=eLst),st,msg)
equation
(cache,valLst,stOpt) = Ceval.cevalList(cache,env,eLst,true,SOME(st),msg);
valLst = List.map2(valLst,evalCodeTypeName,cache,env);
st = Util.getOptionOrDefault(stOpt, st);
(cache,value,st) = cevalInteractiveFunctions2(cache,env,name,valLst,st,msg);
then
Expand Down Expand Up @@ -5428,4 +5429,22 @@ algorithm
end matchcontinue;
end unparseGroupImport;

protected function evalCodeTypeName
input Values.Value val;
input Env.Cache cache;
input Env.Env env;
output Values.Value res;
algorithm
res := matchcontinue (val,cache,env)
local
Absyn.Path path;
String s1;
case (Values.CODE(Absyn.C_TYPENAME(Absyn.IDENT(s1))),cache,env)
equation
(_,_,_,DAE.VALBOUND(valBound=Values.CODE(A=Absyn.C_TYPENAME(path=path))),_,_,_,_,_) = Lookup.lookupVar(cache, env, ComponentReference.makeCrefIdent(s1, DAE.T_ANYTYPE_DEFAULT, {}));
then Values.CODE(Absyn.C_TYPENAME(path));
else val;
end matchcontinue;
end evalCodeTypeName;

end CevalScript;

0 comments on commit 7f7d350

Please sign in to comment.