Skip to content

Commit 650a8ac

Browse files
committed
- Handle assert in new instantiation.
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@17508 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
1 parent 69492b2 commit 650a8ac

File tree

4 files changed

+12
-6
lines changed

4 files changed

+12
-6
lines changed

Compiler/FrontEnd/ModelicaBuiltin.mo

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,13 @@ annotation(__OpenModelica_Impure = true, Documentation(info="<html>
5454
</html>"));
5555
end terminal;
5656

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

6160
function assert
6261
input Boolean condition;
6362
input String message;
64-
input AssertionLevel level;
63+
input AssertionLevel level = AssertionLevel.error;
6564
external "builtin";
6665
annotation(Documentation(info="<html>
6766
See <a href=\"modelica://ModelicaReference.Operators.'assert()'\">assert()</a>

Compiler/FrontEnd/NFEnv.mo

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -864,6 +864,9 @@ algorithm
864864
case (FRAME(name = SOME(name)) :: FRAME(scopeType = TOP_SCOPE()) :: _)
865865
then Absyn.IDENT(name);
866866

867+
case (FRAME(name = SOME(name)) :: FRAME(scopeType = BUILTIN_SCOPE()) :: _)
868+
then Absyn.IDENT(name);
869+
867870
case (FRAME(scopeType = IMPLICIT_SCOPE(iterIndex = _)) :: env)
868871
then envPath(env);
869872

Compiler/FrontEnd/NFLookup.mo

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ protected constant Entry INT_TYPE_ENTRY = NFEnv.ENTRY(
6363
protected constant Entry BOOL_TYPE_ENTRY = NFEnv.ENTRY(
6464
"Boolean", NFBuiltin.BUILTIN_BOOLEAN, {NFEnv.BUILTIN_ORIGIN()});
6565
protected constant Entry STRING_TYPE_ENTRY = NFEnv.ENTRY(
66-
"String", NFBuiltin.BUILTIN_BOOLEAN, {NFEnv.BUILTIN_ORIGIN()});
66+
"String", NFBuiltin.BUILTIN_STRING, {NFEnv.BUILTIN_ORIGIN()});
6767

6868
protected uniontype LookupState
6969
"LookupState is used by the name lookup to keep track of what state it's in,

Compiler/FrontEnd/SCode.mo

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4625,9 +4625,13 @@ public function isBuiltinElement
46254625
output Boolean outIsBuiltin;
46264626
algorithm
46274627
outIsBuiltin := match(inElement)
4628+
local
4629+
Annotation ann;
4630+
46284631
case CLASS(classDef = PARTS(externalDecl =
46294632
SOME(EXTERNALDECL(lang = SOME("builtin"))))) then true;
4630-
4633+
case CLASS(cmt = COMMENT(annotation_ = SOME(ann)))
4634+
then hasBooleanNamedAnnotation({ann}, "__OpenModelica_builtin");
46314635
else false;
46324636
end match;
46334637
end isBuiltinElement;

0 commit comments

Comments
 (0)