Skip to content
This repository was archived by the owner on May 18, 2019. It is now read-only.

Commit 117eefb

Browse files
perostOpenModelica-Hudson
authored andcommitted
[NF] Variability fixes and other improvements.
- Replaced EquationScope, ClassScope and ExpOrigin with new ExpOrigin bitfield. - Removed Component.Attributes.DEFAULT and Class.Attributes.DEFAULT, constants work equally well to save memory and simplifies the code. - Set variables with no variability prefix and discrete type to be discrete so e.g. pre() works correctly. - Fixed variability of many builtin functions. - Fixed variability of relations with regards to noEvent. - Fixed variability of expressions in when-clauses. - Fixed typing of noEvent. - Added check that time, pre, edge and change isn't used in a function context. - Fixed handling of size on subscripted expressions. - Moved handling of end to typing of subscripts, since the old handling relied upon ExpOrigin being a uniontype with subscript information. - Improved handling of end to generate appropriate size expressions when the size of the dimension is unknown. - Adapted the parenthesization algorithm from Dump to NFExpression.toString to get rid of extraneous parentheses in error messages. - Fixed flattening of if-equations so the bodies of the branches aren't in reverse order compared with the conditions (oops...). Belonging to [master]: - #2069 - OpenModelica/OpenModelica-testsuite#801
1 parent 5cea0b5 commit 117eefb

17 files changed

+1157
-520
lines changed

Compiler/NFFrontEnd/NFBuiltinFuncs.mo

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,39 +60,39 @@ constant SCode.Element DUMMY_ELEMENT = SCode.COMPONENT("dummy",
6060

6161
// Default Integer parameter.
6262
constant Component INT_COMPONENT = Component.TYPED_COMPONENT(NFInstNode.EMPTY_NODE(),
63-
Type.INTEGER(), Binding.UNBOUND(), Binding.UNBOUND(), Component.Attributes.DEFAULT(), Absyn.dummyInfo);
63+
Type.INTEGER(), Binding.UNBOUND(), Binding.UNBOUND(), NFComponent.DEFAULT_ATTR, Absyn.dummyInfo);
6464

6565
constant InstNode INT_PARAM = InstNode.COMPONENT_NODE("i",
6666
Visibility.PUBLIC,
6767
Pointer.createImmutable(INT_COMPONENT), 0, InstNode.EMPTY_NODE());
6868

6969
// Default Real parameter.
7070
constant Component REAL_COMPONENT = Component.TYPED_COMPONENT(NFInstNode.EMPTY_NODE(),
71-
Type.REAL(), Binding.UNBOUND(), Binding.UNBOUND(), Component.Attributes.DEFAULT(), Absyn.dummyInfo);
71+
Type.REAL(), Binding.UNBOUND(), Binding.UNBOUND(), NFComponent.DEFAULT_ATTR, Absyn.dummyInfo);
7272

7373
constant InstNode REAL_PARAM = InstNode.COMPONENT_NODE("r",
7474
Visibility.PUBLIC,
7575
Pointer.createImmutable(REAL_COMPONENT), 0, InstNode.EMPTY_NODE());
7676

7777
// Default Boolean parameter.
7878
constant Component BOOL_COMPONENT = Component.TYPED_COMPONENT(NFInstNode.EMPTY_NODE(),
79-
Type.BOOLEAN(), Binding.UNBOUND(), Binding.UNBOUND(), Component.Attributes.DEFAULT(), Absyn.dummyInfo);
79+
Type.BOOLEAN(), Binding.UNBOUND(), Binding.UNBOUND(), NFComponent.DEFAULT_ATTR, Absyn.dummyInfo);
8080

8181
constant InstNode BOOL_PARAM = InstNode.COMPONENT_NODE("b",
8282
Visibility.PUBLIC,
8383
Pointer.createImmutable(BOOL_COMPONENT), 0, InstNode.EMPTY_NODE());
8484

8585
// Default String parameter.
8686
constant Component STRING_COMPONENT = Component.TYPED_COMPONENT(NFInstNode.EMPTY_NODE(),
87-
Type.STRING(), Binding.UNBOUND(), Binding.UNBOUND(), Component.Attributes.DEFAULT(), Absyn.dummyInfo);
87+
Type.STRING(), Binding.UNBOUND(), Binding.UNBOUND(), NFComponent.DEFAULT_ATTR, Absyn.dummyInfo);
8888

8989
constant InstNode STRING_PARAM = InstNode.COMPONENT_NODE("s",
9090
Visibility.PUBLIC,
9191
Pointer.createImmutable(STRING_COMPONENT), 0, InstNode.EMPTY_NODE());
9292

9393
// Default enumeration(:) parameter.
9494
constant Component ENUM_COMPONENT = Component.TYPED_COMPONENT(NFInstNode.EMPTY_NODE(),
95-
Type.ENUMERATION_ANY(), Binding.UNBOUND(), Binding.UNBOUND(), Component.Attributes.DEFAULT(), Absyn.dummyInfo);
95+
Type.ENUMERATION_ANY(), Binding.UNBOUND(), Binding.UNBOUND(), NFComponent.DEFAULT_ATTR, Absyn.dummyInfo);
9696

9797
constant InstNode ENUM_PARAM = InstNode.COMPONENT_NODE("e",
9898
Visibility.PUBLIC,

0 commit comments

Comments
 (0)