Skip to content

Commit

Permalink
- Handle assert in new instantiation.
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@17508 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
perost committed Oct 3, 2013
1 parent 69492b2 commit 650a8ac
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 6 deletions.
7 changes: 3 additions & 4 deletions Compiler/FrontEnd/ModelicaBuiltin.mo
Expand Up @@ -54,14 +54,13 @@ annotation(__OpenModelica_Impure = true, Documentation(info="<html>
</html>"));
end terminal;

type AssertionLevel = enumeration(error, warning) annotation(Documentation(info="<html>
Used by <a href=\"modelica://assert\">assert()</a>
</html>"));
type AssertionLevel = enumeration(error, warning) annotation(__OpenModelica_builtin=true,
Documentation(info="<html>Used by <a href=\"modelica://assert\">assert()</a></html>"));

function assert
input Boolean condition;
input String message;
input AssertionLevel level;
input AssertionLevel level = AssertionLevel.error;
external "builtin";
annotation(Documentation(info="<html>
See <a href=\"modelica://ModelicaReference.Operators.'assert()'\">assert()</a>
Expand Down
3 changes: 3 additions & 0 deletions Compiler/FrontEnd/NFEnv.mo
Expand Up @@ -864,6 +864,9 @@ algorithm
case (FRAME(name = SOME(name)) :: FRAME(scopeType = TOP_SCOPE()) :: _)
then Absyn.IDENT(name);

case (FRAME(name = SOME(name)) :: FRAME(scopeType = BUILTIN_SCOPE()) :: _)
then Absyn.IDENT(name);

case (FRAME(scopeType = IMPLICIT_SCOPE(iterIndex = _)) :: env)
then envPath(env);

Expand Down
2 changes: 1 addition & 1 deletion Compiler/FrontEnd/NFLookup.mo
Expand Up @@ -63,7 +63,7 @@ protected constant Entry INT_TYPE_ENTRY = NFEnv.ENTRY(
protected constant Entry BOOL_TYPE_ENTRY = NFEnv.ENTRY(
"Boolean", NFBuiltin.BUILTIN_BOOLEAN, {NFEnv.BUILTIN_ORIGIN()});
protected constant Entry STRING_TYPE_ENTRY = NFEnv.ENTRY(
"String", NFBuiltin.BUILTIN_BOOLEAN, {NFEnv.BUILTIN_ORIGIN()});
"String", NFBuiltin.BUILTIN_STRING, {NFEnv.BUILTIN_ORIGIN()});

protected uniontype LookupState
"LookupState is used by the name lookup to keep track of what state it's in,
Expand Down
6 changes: 5 additions & 1 deletion Compiler/FrontEnd/SCode.mo
Expand Up @@ -4625,9 +4625,13 @@ public function isBuiltinElement
output Boolean outIsBuiltin;
algorithm
outIsBuiltin := match(inElement)
local
Annotation ann;

case CLASS(classDef = PARTS(externalDecl =
SOME(EXTERNALDECL(lang = SOME("builtin"))))) then true;

case CLASS(cmt = COMMENT(annotation_ = SOME(ann)))
then hasBooleanNamedAnnotation({ann}, "__OpenModelica_builtin");
else false;
end match;
end isBuiltinElement;
Expand Down

0 comments on commit 650a8ac

Please sign in to comment.