Skip to content

Commit

Permalink
Fixed bug with infinite recursion when instanitating Modelica.Blocks.
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@1009 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
Peter Aronsson committed Oct 15, 2003
1 parent ac0f73e commit ec4af22
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions modeq/lookup.rml
Expand Up @@ -212,6 +212,17 @@ relation lookup_class: (Env.Env, Absyn.Path, bool) => (SCode.Class, Env.Env) =
----------------------------------------------------------
lookup_class(env, path, _) => (c, env')

rule (* If we search for A1.A2....An.x while in scope A1.A2...An
, just search for x. Must do like this to ensure finite recursion *)
Env.get_env_path(env) => SOME(ep) &
Absyn.strip_last(p) => packp &
ModUtil.path_equal(ep,packp) => true &
Absyn.path_last_ident(p) => id &
lookup_class(env,Absyn.IDENT(id),msgflag) => (c,env')
--------------------------------------
lookup_class(env, p as Absyn.QUALIFIED(_,_),msgflag)
=> (c, env)

rule Debug.fprint ("lotr","TRIES lookup_class(4)\n") &
lookup_class(env,Absyn.IDENT(pack),msgflag) => (c as SCode.CLASS(id,_,encflag,restr,_),env') &
Env.open_scope(env',encflag) => env2 &
Expand Down

0 comments on commit ec4af22

Please sign in to comment.