Skip to content

Commit

Permalink
Fixed expansion of array constructors on the form 'r[i] for i in 1:n'.
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@4761 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
perost committed Jan 10, 2010
1 parent cbb570c commit f7c14b9
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions Compiler/Static.mo
Expand Up @@ -1304,12 +1304,18 @@ protected function addForLoopScopeConst "function: addForLoopScopeConst
input Ident i;
input DAE.Type typ;
output Env.Env env_2;
list<Env.Frame> env_1,env_2;
list<Env.Frame> env_1,env_2; // Two env_2?
algorithm
env_1 := Env.openScope(env, false, SOME("$for loop scope$")) "encapsulated?" ;
env_2 := Env.extendFrameV(env_1,
// Defining the iterator as a parameter causes it to be constant evaluated in
// cases such as 'r[i] for i in 1:n' => 'r[1]', so it should probably be a
// variable instead.
/*env_2 := Env.extendFrameV(env_1,
DAE.TYPES_VAR(i,DAE.ATTR(false,false,SCode.RW(),SCode.PARAM(),Absyn.BIDIR(),Absyn.UNSPECIFIED()),
false,typ,DAE.VALBOUND(Values.INTEGER(1))), NONE, Env.VAR_UNTYPED(), {});
false,typ,DAE.VALBOUND(Values.INTEGER(1))), NONE, Env.VAR_UNTYPED(), {});*/
env_2 := Env.extendFrameV(env_1,
DAE.TYPES_VAR(i,DAE.ATTR(false,false,SCode.RW(),SCode.VAR(),Absyn.BIDIR(),Absyn.UNSPECIFIED()),
false,typ,DAE.UNBOUND()), NONE, Env.VAR_UNTYPED(), {});
end addForLoopScopeConst;

protected function elabCallReduction
Expand Down

0 comments on commit f7c14b9

Please sign in to comment.