Skip to content

Commit

Permalink
[NF] Variability fixes and other improvements.
Browse files Browse the repository at this point in the history
- 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]:
  - OpenModelica/OMCompiler#2069
  - OpenModelica/OpenModelica-testsuite#801
  • Loading branch information
perost authored and OpenModelica-Hudson committed Dec 8, 2017
1 parent 5cea0b5 commit 117eefb
Show file tree
Hide file tree
Showing 17 changed files with 1,157 additions and 520 deletions.
10 changes: 5 additions & 5 deletions Compiler/NFFrontEnd/NFBuiltinFuncs.mo
Expand Up @@ -60,39 +60,39 @@ constant SCode.Element DUMMY_ELEMENT = SCode.COMPONENT("dummy",

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

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

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

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

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

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

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

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

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

constant InstNode ENUM_PARAM = InstNode.COMPONENT_NODE("e",
Visibility.PUBLIC,
Expand Down

0 comments on commit 117eefb

Please sign in to comment.