Skip to content

Commit

Permalink
Fixes for bugs:
Browse files Browse the repository at this point in the history
 Instantiation of partial models should fail:
 http://openmodelica.ida.liu.se/bugzilla/show_bug.cgi?id=174 
 Qualified Self reference should not give stack overflow:
 http://openmodelica.ida.liu.se/bugzilla/show_bug.cgi?id=179

Added new API function in Interactive.mo: 
 parseFile("file.mo") will not load the file into the 
 symbol table, it will just return the top contents of the file.
 Very useful for just looking into a file without loading.

Other small fixes, cosmetic changes and documentation.


git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@3128 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
adrpo committed Feb 5, 2008
1 parent 0580e19 commit af12bf7
Show file tree
Hide file tree
Showing 8 changed files with 316 additions and 141 deletions.
50 changes: 21 additions & 29 deletions Compiler/Env.mo
Expand Up @@ -226,13 +226,11 @@ algorithm
outFrame := FRAME(NONE,ht,httypes,{},{},({},Exp.CREF_IDENT("",{})),enc);
end newFrame;

public function openScope "function: openScope
public function openScope "function: openScope
Opening a new scope in the environment means adding a new frame on
top of the stack of frames. If the scope is not the top scope a classname
of the scope should be provided such that a name for the scope can be
derived, see name_scope.
"
derived, see name_scope."
input Env inEnv;
input Boolean inBoolean;
input Option<Ident> inIdentOption;
Expand All @@ -248,7 +246,7 @@ algorithm
case (env,encflag,SOME(id)) /* encapsulated classname */
equation
frame = newFrame(encflag);
env_1 = nameScope((frame :: env), id);
env_1 = nameScope((frame :: env), id);
then
env_1;
case (env,encflag,NONE)
Expand All @@ -260,7 +258,6 @@ algorithm
end openScope;

protected function nameScope "function: nameScope
This function names the current scope, giving it an identifier.
Scopes needs to be named for several reasons. First, it is needed for
debugging purposes, since it is easier to follow the environment if we
Expand All @@ -270,8 +267,7 @@ protected function nameScope "function: nameScope
flattening of the inheritance hiergearchy. The reason for this is that types
of inherited components needs to be expanded such that the types can be
looked up from the environment of the base class.
See also openScope, getScopeName.
"
See also openScope, getScopeName."
input Env inEnv;
input Ident inIdent;
output Env outEnv;
Expand All @@ -285,7 +281,8 @@ algorithm
tuple<list<Exp.ComponentRef>,Exp.ComponentRef> crs;
Boolean encflag;
Ident id;
case ((FRAME(list_2 = ht,list_3 = httypes,list_4 = imps,list_5 = bcframes,current6 = crs,encapsulated_7 = encflag) :: res),id) then (FRAME(SOME(id),ht,httypes,imps,bcframes,crs,encflag) :: res);
case ((FRAME(list_2 = ht,list_3 = httypes,list_4 = imps,list_5 = bcframes,current6 = crs,encapsulated_7 = encflag) :: res),id)
then (FRAME(SOME(id),ht,httypes,imps,bcframes,crs,encflag) :: res);
end matchcontinue;
end nameScope;

Expand Down Expand Up @@ -628,10 +625,9 @@ algorithm
end matchcontinue;
end getEnvPath;

public function printEnvPathStr "function: printEnvPathStr
Retrive the environment path as a string, see get_env_path.
"
public function printEnvPathStr
"function: printEnvPathStr
Retrive the environment path as a string, see getEnvPath."
input Env inEnv;
output String outString;
algorithm
Expand All @@ -651,11 +647,10 @@ algorithm
end matchcontinue;
end printEnvPathStr;

public function printEnvPath "function: printEnvPath
public function printEnvPath
"function: printEnvPath
Print the environment path to the Print buffer.
See also get_env_path
"
See also getEnvPath"
input Env inEnv;
algorithm
_:=
Expand All @@ -679,10 +674,9 @@ algorithm
end matchcontinue;
end printEnvPath;

public function printEnvStr "function: printEnvStr
Print the environment as a string.
"
public function printEnvStr
"function: printEnvStr
Print the environment as a string."
input Env inEnv;
output String outString;
algorithm
Expand All @@ -703,21 +697,19 @@ algorithm
end matchcontinue;
end printEnvStr;

public function printEnv "function: printEnv
Print the environment to the Print buffer.
"
public function printEnv
"function: printEnv
Print the environment to the Print buffer."
input Env e;
Ident s;
algorithm
s := printEnvStr(e);
Print.printBuf(s);
end printEnv;

protected function printFrameStr "function: printFrameStr
Print a Frame to a string.
"
protected function printFrameStr
"function: printFrameStr
Print a Frame to a string."
input Frame inFrame;
output String outString;
algorithm
Expand Down

0 comments on commit af12bf7

Please sign in to comment.