From 7f7d3500a5a87794518e92e03a60c1bc0059ca96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Sj=C3=B6lund?= Date: Sun, 18 Dec 2011 09:45:50 +0000 Subject: [PATCH] - Moved evalutation of typenames from static to cevalscript git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@10761 f25d12d1-65f4-0310-ae8a-bbce733d8d8e --- Compiler/FrontEnd/Static.mo | 5 ----- Compiler/Script/CevalScript.mo | 19 +++++++++++++++++++ 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/Compiler/FrontEnd/Static.mo b/Compiler/FrontEnd/Static.mo index 1f657160be3..444312c2b03 100644 --- a/Compiler/FrontEnd/Static.mo +++ b/Compiler/FrontEnd/Static.mo @@ -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 diff --git a/Compiler/Script/CevalScript.mo b/Compiler/Script/CevalScript.mo index 92ba3719a90..f5f537b0d4d 100644 --- a/Compiler/Script/CevalScript.mo +++ b/Compiler/Script/CevalScript.mo @@ -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 @@ -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;