Skip to content

Commit

Permalink
- Analyse derived type dimensions in SCodeDependency.
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@17577 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
perost committed Oct 7, 2013
1 parent ee395b8 commit a32a7c8
Showing 1 changed file with 42 additions and 2 deletions.
44 changes: 42 additions & 2 deletions Compiler/FrontEnd/NFSCodeDependency.mo
Expand Up @@ -562,7 +562,6 @@ algorithm
redecls = NFSCodeFlattenRedeclare.extractRedeclaresFromModifier(mods);
(ty_item, ty_env, repls) = NFSCodeFlattenRedeclare.replaceRedeclaredElementsInEnv(redecls, ty_item, ty_env, inEnv, NFInstTypes.EMPTY_PREFIX(NONE()));
analyseItemIfRedeclares(repls, ty_item, ty_env);
// TODO! Analyse array dimensions from attributes!
analyseModifier(mods, inEnv, ty_env, inInfo);
then
();
Expand Down Expand Up @@ -1295,11 +1294,13 @@ algorithm
local
Absyn.Path type_path;
list<Absyn.TypeSpec> tys;
Option<Absyn.ArrayDim> ad;

// A normal type.
case (Absyn.TPATH(path = type_path), _, _)
case (Absyn.TPATH(path = type_path, arrayDim = ad), _, _)
equation
analyseClass(type_path, inEnv, inInfo);
analyseTypeSpecDims(ad, inEnv, inInfo);
then
();

Expand All @@ -1317,6 +1318,45 @@ algorithm
end match;
end analyseTypeSpec;

protected function analyseTypeSpecDims
input Option<Absyn.ArrayDim> inDims;
input Env inEnv;
input Absyn.Info inInfo;
algorithm
_ := match(inDims, inEnv, inInfo)
local
Absyn.ArrayDim dims;

case (SOME(dims), _, _)
equation
List.map2_0(dims, analyseTypeSpecDim, inEnv, inInfo);
then
();

else ();
end match;
end analyseTypeSpecDims;

protected function analyseTypeSpecDim
input Absyn.Subscript inDim;
input Env inEnv;
input Absyn.Info inInfo;
algorithm
_ := match(inDim, inEnv, inInfo)
local
Absyn.Exp dim;

case (Absyn.NOSUB(), _, _) then ();

case (Absyn.SUBSCRIPT(subscript = dim), _, _)
equation
analyseExp(dim, inEnv, inInfo);
then
();

end match;
end analyseTypeSpecDim;

protected function analyseExternalDecl
"Analyses an external declaration."
input Option<SCode.ExternalDecl> inExtDecl;
Expand Down

0 comments on commit a32a7c8

Please sign in to comment.