Changeset a489e50 in OpenModelica
- Timestamp:
- 2021-02-15T12:30:31+01:00 (3 years ago)
- Branches:
- Added-citation-metadata, maintenance/v1.18, maintenance/v1.19, maintenance/v1.20, maintenance/v1.21, maintenance/v1.22, maintenance/v1.23, master, omlib-staging
- Children:
- 423386c, c5f65dbc
- Parents:
- 3de3ab4
- git-author:
- perost <perost86@…> (02/15/21 12:30:31)
- git-committer:
- GitHub <noreply@…> (02/15/21 12:30:31)
- Files:
-
- 1 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
OMCompiler/Compiler/NFFrontEnd/NFFlatten.mo
r9220249b ra489e50 93 93 import ArrayConnections = NFArrayConnections; 94 94 import UnorderedMap; 95 import Inline = NFInline; 95 96 96 97 public … … 592 593 binding_exp := Expression.stripBindingInfo(Ceval.evalExp(binding_exp)); 593 594 elseif binding_var == Variability.PARAMETER and Component.isFinal(comp) then 595 // Try to use inlining first. 594 596 try 595 binding_exp_eval := Expression.stripBindingInfo(Ceval.evalExp(binding_exp)); 596 // Throw away the evaluated binding if the number of dimensions no 597 // longer match after evaluation, in case Ceval fails to apply the 598 // subscripts correctly. 599 // TODO: Fix this, it shouldn't be needed. 600 0 := Type.dimensionDiff(ty, Expression.typeOf(binding_exp_eval)); 601 binding_exp := binding_exp_eval; 597 binding_exp := Inline.inlineRecordConstructorCall(binding_exp); 602 598 else 603 599 end try; 600 601 // If inlining fails, try to evaluate the binding instead. 602 if not Expression.isRecord(binding_exp) then 603 try 604 binding_exp_eval := Expression.stripBindingInfo(Ceval.evalExp(binding_exp)); 605 606 // Throw away the evaluated binding if the number of dimensions no 607 // longer match after evaluation, in case Ceval fails to apply the 608 // subscripts correctly. 609 // TODO: Fix this, it shouldn't be needed. 610 0 := Type.dimensionDiff(ty, Expression.typeOf(binding_exp_eval)); 611 binding_exp := binding_exp_eval; 612 else 613 end try; 614 end if; 604 615 else 605 616 binding_exp := SimplifyExp.simplify(binding_exp); -
OMCompiler/Compiler/NFFrontEnd/NFInline.mo
r918333e ra489e50 32 32 encapsulated package NFInline 33 33 34 import Call = NFCall; 35 import Expression = NFExpression; 36 37 protected 38 import Binding = NFBinding; 39 import Class = NFClass; 40 import Component = NFComponent; 34 41 import ComponentRef = NFComponentRef; 35 42 import DAE.InlineType; 36 43 import Dimension = NFDimension; 37 import Expression = NFExpression;38 44 import Flags; 39 import Call = NFCall;40 45 import NFFunction.Function; 41 46 import NFInstNode.InstNode; … … 44 49 import Type = NFType; 45 50 51 public 46 52 function inlineCallExp 47 53 input Expression callExp; … … 114 120 end inlineCall; 115 121 122 function inlineRecordConstructorCall 123 input Expression exp; 124 output Expression outExp; 125 protected 126 Function fn; 127 Expression arg; 128 list<Expression> args; 129 list<Statement> body; 130 Binding binding; 131 algorithm 132 outExp := match exp 133 case Expression.CALL(call = Call.TYPED_CALL(fn = fn, arguments = args)) 134 guard InstNode.name(InstNode.parentScope(fn.node)) == "'constructor'" 135 algorithm 136 body := Function.getBody(fn); 137 true := listEmpty(body); 138 true := listEmpty(fn.locals); 139 140 binding := Component.getBinding(InstNode.component(listHead(fn.outputs))); 141 142 if Binding.hasExp(binding) then 143 outExp := Binding.getExp(binding); 144 true := Expression.isRecord(outExp); 145 else 146 outExp := Class.makeRecordExp(listHead(fn.outputs)); 147 end if; 148 149 for i in fn.inputs loop 150 arg :: args := args; 151 outExp := Expression.map(outExp, func = function replaceCrefNode(node = i, value = arg)); 152 end for; 153 then 154 outExp; 155 end match; 156 end inlineRecordConstructorCall; 157 116 158 protected 117 159 function replaceCrefNode -
testsuite/flattening/modelica/scodeinst/Makefile
r63e15e6 ra489e50 610 610 ImpureCall1.mo \ 611 611 Inline1.mo \ 612 Inline2.mo \ 612 613 InnerOuter1.mo \ 613 614 InnerOuter2.mo \
Note: See TracChangeset
for help on using the changeset viewer.