Skip to content

Commit

Permalink
- Fixed some illegal code in the compiler
Browse files Browse the repository at this point in the history
  • Loading branch information
sjoelund committed Oct 23, 2010
1 parent f42a324 commit 4762a25
Show file tree
Hide file tree
Showing 9 changed files with 674 additions and 695 deletions.
4 changes: 2 additions & 2 deletions Compiler/Error.mo
Expand Up @@ -510,9 +510,9 @@ protected constant list<tuple<Integer, MessageType, Severity, String>> errorTabl
"Duplicate class definitions (due to inheritance) not equivalent, first definiton is: %s, second definition is: %s"),
(PACKAGE_VARIABLE_NOT_CONSTANT, TRANSLATION(),ERROR(),"Variable %s in package %s is not constant"),
(RECURSIVE_DEFINITION,TRANSLATION(),ERROR(),"Class %s has a recursive definition, i.e. contains an instance of itself"),
(NON_STREAM_OPERAND_IN_STREAM_OPERATOR(), TRANSLATION(), ERROR(),
(NON_STREAM_OPERAND_IN_STREAM_OPERATOR, TRANSLATION(), ERROR(),
"Operand %s to operator %s in component %s is not a stream variable."),
(UNBALANCED_CONNECTOR(), TRANSLATION(), WARNING(),
(UNBALANCED_CONNECTOR, TRANSLATION(), WARNING(),
"Connector %s is not balanced: %s"),
(UNBOUND_PARAMETER_WARNING,TRANSLATION(),WARNING(),
"Parameter %s has neither value nor start value, and is fixed during initialization (fixed=true)"),
Expand Down
51 changes: 24 additions & 27 deletions Compiler/InnerOuter.mo
Expand Up @@ -65,19 +65,16 @@ protected import ErrorExt;

public
type Cache = Env.Cache;
type Env = Env.Env;
type Frame = Env.Frame;
type AvlTree = Env.AvlTree;
type Item = Env.Item;
type Ident = Env.Ident;
type CSetsType = Env.CSetsType;
type Prefix = Prefix.Prefix;
type Mod = DAE.Mod;

uniontype InstResult
record INST_RESULT
Cache outCache;
Env outEnv;
Env.Env outEnv;
UnitAbsyn.InstStore outStore;
DAE.DAElist outDae;
Connect.Sets outSets;
Expand All @@ -88,7 +85,7 @@ end InstResult;

uniontype InstInner
record INST_INNER
Prefix innerPrefix "the prefix of the inner. we need it to prefix the outer variables with it!";
Prefix.Prefix innerPrefix "the prefix of the inner. we need it to prefix the outer variables with it!";
SCode.Ident name;
Absyn.InnerOuter io;
String fullName "full inner component name";
Expand Down Expand Up @@ -629,9 +626,9 @@ public function retrieveOuterConnections
If not, they are kept in the outerConnects for use higher up in the instance
hierarchy."
input Env.Cache cache;
input Env env;
input Env.Env env;
input InstHierarchy inIH;
input Prefix pre;
input Prefix.Prefix pre;
input Connect.Sets csets;
input Boolean topCall;
output Connect.Sets outCsets;
Expand Down Expand Up @@ -693,9 +690,9 @@ end removeInnerPrefixFromCref;
protected function retrieveOuterConnections2
"help function to retrieveOuterConnections"
input Env.Cache cache;
input Env env;
input Env.Env env;
input InstHierarchy inIH;
input Prefix pre;
input Prefix.Prefix pre;
input list<Connect.OuterConnect> outerConnects;
input list<Connect.Set> setLst;
input list<DAE.ComponentRef> crs;
Expand Down Expand Up @@ -818,9 +815,9 @@ protected function addOuterConnectIfEmpty
connection (from inside sub-components) forms
a connection set of their own."
input Env.Cache cache;
input Env env;
input Env.Env env;
input InstHierarchy inIH;
input Prefix pre;
input Prefix.Prefix pre;
input list<Connect.Set> setLst;
input Boolean added "if true, this function does nothing";
input DAE.ComponentRef cr1;
Expand Down Expand Up @@ -881,9 +878,9 @@ protected function addOuterConnectIfEmptyNoEnv
with the difference that we only need to find
one variable in the enviroment."
input Env.Cache cache;
input Env env;
input Env.Env env;
input InstHierarchy inIH;
input Prefix pre;
input Prefix.Prefix pre;
input list<Connect.Set> setLst;
input Boolean added "if true, this function does nothing";
input DAE.ComponentRef cr1;
Expand Down Expand Up @@ -964,7 +961,7 @@ protected function lookupVarInnerOuterAttr
its inner and outer attributes in form of booleans.
adrpo: Make sure that there are no error messages displayed!"
input Env.Cache cache;
input Env env;
input Env.Env env;
input InstHierarchy inIH;
input DAE.ComponentRef cr1;
input DAE.ComponentRef cr2;
Expand Down Expand Up @@ -1278,12 +1275,12 @@ public function modificationOnOuter "
Author BZ, 2008-11
According to specification modifiers on outer elements is not allowed."
input Env.Cache cache;
input Env env;
input Env.Env env;
input InstHierarchy ih;
input Prefix.Prefix prefix;
input String componentName;
input DAE.ComponentRef cr;
input Mod inMod;
input DAE.Mod inMod;
input Absyn.InnerOuter io;
input Boolean impl;
output Boolean modd;
Expand Down Expand Up @@ -1454,13 +1451,13 @@ end prefixOuterDaeVars;
public function switchInnerToOuterInEnv "
function switchInnerToOuterInEnv
switches the inner to outer attributes of a component in the Env."
input Env inEnv;
input Env.Env inEnv;
input DAE.ComponentRef inCr;
output Env outEnv;
output Env.Env outEnv;
algorithm
outEnv := matchcontinue(inEnv,inCr)
local
Env envIn, envOut, envRest;
Env.Env envIn, envOut, envRest;
DAE.ComponentRef cr;
Frame f;
// handle nothingness
Expand Down Expand Up @@ -1568,7 +1565,7 @@ algorithm
DAE.Var instantiated "instantiated component";
Option<tuple<SCode.Element, DAE.Mod>> declaration "declaration if not fully instantiated.";
Env.InstStatus instStatus "if it untyped, typed or fully instantiated (dae)";
Env env "The environment of the instantiated component. Contains e.g. all sub components";
Env.Env env "The environment of the instantiated component. Contains e.g. all sub components";

Boolean flowPrefix "flow" ;
Boolean streamPrefix "stream" ;
Expand Down Expand Up @@ -1607,7 +1604,7 @@ end switchInnerToOuterInAvlTreeValue;


public function emptyInstInner
input Prefix innerPrefix;
input Prefix.Prefix innerPrefix;
input String name;
output InstInner outInstInner;
algorithm
Expand All @@ -1619,7 +1616,7 @@ public function lookupInnerVar
This function lookups the result of instatiation of the inner
component given an instance hierarchy a prefix and a component name."
input Cache inCache;
input Env inEnv;
input Env.Env inEnv;
input InstHierarchy inIH;
input Prefix.Prefix inPrefix;
input SCode.Ident inIdent;
Expand All @@ -1631,7 +1628,7 @@ algorithm
Cache cache;
String n;
Absyn.InnerOuter io;
Env env;
Env.Env env;
Prefix.Prefix pre;
InstHierarchy ih;
TopInstance tih;
Expand Down Expand Up @@ -1681,7 +1678,7 @@ algorithm
Option<Absyn.Path> pathOpt;
SCode.Element c;
DAE.DAElist dae;
Env innerComponentEnv;
Env.Env innerComponentEnv;
OuterPrefixes outerPrefixes;

/* only add inner elements
Expand Down Expand Up @@ -1749,7 +1746,7 @@ algorithm
Option<Absyn.Path> pathOpt;
SCode.Element c;
DAE.DAElist dae;
Env innerComponentEnv;
Env.Env innerComponentEnv;
OuterPrefixes outerPrefixes;

// no hashtable, create one!
Expand Down Expand Up @@ -1789,7 +1786,7 @@ public function prefixOuterCrefWithTheInnerPrefix
This function searches for outer crefs and prefixes them with the inner prefix"
input InstHierarchy inIH;
input DAE.ComponentRef inOuterComponentRef;
input Prefix inPrefix;
input Prefix.Prefix inPrefix;
output DAE.ComponentRef outInnerComponentRef;
algorithm
outInnerComponentRef := matchcontinue(inIH, inOuterComponentRef, inPrefix)
Expand Down Expand Up @@ -1903,7 +1900,7 @@ public function printInnerDefStr
algorithm
outStr := matchcontinue(inInstInner)
local
Prefix innerPrefix;
Prefix.Prefix innerPrefix;
SCode.Ident name;
Absyn.InnerOuter io;
Option<InstResult> instResult;
Expand Down

0 comments on commit 4762a25

Please sign in to comment.