Skip to content

Commit

Permalink
Fixed bug in lookup of functions through unqualified imports.
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@2654 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
Peter Aronsson committed Jan 3, 2007
1 parent d8020d5 commit b9c50e2
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions Compiler/Lookup.mo
Expand Up @@ -1267,6 +1267,18 @@ algorithm
then
(cache,c1);

/* Simple name, if class with restriction function found in frame instantiate to get type. */
case (cache,f::fs ,(iid as Absyn.IDENT(name = id)))
local String id,s;
equation
(cache,(c as SCode.CLASS(id,_,encflag,restr,_)),env_1) = lookupClass2(cache,f::fs, iid, false);
true = SCode.isFunctionOrExtFunction(restr);
(cache,(env_2 as (Env.FRAME(class_1 = sid,list_2 = ht,list_3 = httypes)::_)))
= Inst.implicitFunctionTypeInstantiation(cache,env_1, c);
(cache,c1 as _::_)= lookupFunctionsInFrame(cache,ht, httypes, env_2, id);
then
(cache,c1);

/*For qualified function names, e.g. Modelica.Math.sin */
case (cache,(env as (Env.FRAME(class_1 = sid,list_2 = ht,list_3 = httypes) :: fs)),(iid as Absyn.QUALIFIED(name = pack,path = path)))
local String id,s;
Expand Down Expand Up @@ -1465,14 +1477,14 @@ algorithm
(cache,{ftype});

/* Found class that is function, instantiate to get type*/
case (cache,ht,httypes,env,id) local SCode.Restriction restr;
/* case (cache,ht,httypes,env,id) local SCode.Restriction restr;
equation
Env.CLASS((cdef as SCode.CLASS(_,_,_,restr,_)),cenv) = Env.treeGet(ht, id, Env.myhash) "If found class that is function." ;
true = SCode.isFunctionOrExtFunction(restr);
(cache,env_1) = Inst.implicitFunctionTypeInstantiation(cache,cenv, cdef);
(cache,tps) = lookupFunctionsInEnv(cache,env_1, Absyn.IDENT(id));
then
(cache,tps);
(cache,tps);*/

/* Found class that is is external object*/
case (cache,ht,httypes,env,id)
Expand Down

0 comments on commit b9c50e2

Please sign in to comment.