Skip to content

Commit

Permalink
- Fixed getInstanceName() to work for packages and top-level models
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@11858 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
sjoelund committed May 7, 2012
1 parent 9a20172 commit f54f7f1
Showing 1 changed file with 28 additions and 11 deletions.
39 changes: 28 additions & 11 deletions Compiler/FrontEnd/Static.mo
Expand Up @@ -5690,17 +5690,34 @@ protected function elabBuiltinGetInstanceName
output Env.Cache outCache;
output DAE.Exp outExp;
output DAE.Properties outProperties;
protected
String str;
Absyn.Path name;
algorithm
{} := inAbsynExpLst;
{} := inNamedArg;
Env.CACHE(modelName=name) := inCache;
outCache := inCache;
str := Absyn.pathLastIdent(name) +& "." +& PrefixUtil.printPrefixStr(inPrefix);
outExp := DAE.SCONST(str);
outProperties := DAE.PROP(DAE.T_STRING_DEFAULT,DAE.C_CONST());
algorithm
(outCache,outExp,outProperties) := matchcontinue (inCache,inEnv,inAbsynExpLst,inNamedArg,inBoolean,inPrefix,info)
local
String str;
Absyn.Path name,envName;
case (Env.CACHE(modelName=name),inEnv,{},{},_,Prefix.NOPRE(),_)
equation
envName = Env.getEnvName(inEnv);
true = Absyn.pathEqual(envName,name);
str = Absyn.pathLastIdent(name);
outExp = DAE.SCONST(str);
outProperties = DAE.PROP(DAE.T_STRING_DEFAULT,DAE.C_CONST());
then (inCache,outExp,outProperties);
case (Env.CACHE(modelName=name),inEnv,{},{},_,Prefix.NOPRE(),_)
equation
envName = Env.getEnvName(inEnv);
false = Absyn.pathEqual(envName,name);
str = Absyn.pathString(envName);
outExp = DAE.SCONST(str);
outProperties = DAE.PROP(DAE.T_STRING_DEFAULT,DAE.C_CONST());
then (inCache,outExp,outProperties);
case (Env.CACHE(modelName=name),inEnv,{},{},_,inPrefix,_)
equation
str = Absyn.pathLastIdent(name) +& "." +& PrefixUtil.printPrefixStr(inPrefix);
outExp = DAE.SCONST(str);
outProperties = DAE.PROP(DAE.T_STRING_DEFAULT,DAE.C_CONST());
then (inCache,outExp,outProperties);
end matchcontinue;
end elabBuiltinGetInstanceName;

protected function elabBuiltinVector "function: elabBuiltinVector
Expand Down

0 comments on commit f54f7f1

Please sign in to comment.