@@ -130,7 +130,6 @@ end evaluateExp;
130130function evaluateExpTraverser
131131 input Expression exp;
132132 input Boolean changed;
133- input Boolean isExternalArg = false ;
134133 output Expression outExp;
135134 output Boolean outChanged;
136135protected
@@ -141,18 +140,11 @@ algorithm
141140 outExp := match exp
142141 case Expression . CREF ()
143142 algorithm
144- (outExp as Expression . CREF (cref = cref, ty = ty), outChanged) := Expression . mapFoldShallow(exp,
145- function evaluateExpTraverser(isExternalArg = false ), false );
146-
147- // Evaluate constants and structural parameters, except for arrays that
148- // are used as arguments to an external function.
149-
150- // TODO: The runtime doesn't handle array literals well when used as
151- // arguments of external functions, since it sometimes tries to
152- // write to them (e.g. when trying to pack them). Until that's
153- // fixed we keep them as they are here.
154- if ComponentRef . nodeVariability(cref) <= Variability . STRUCTURAL_PARAMETER and
155- not (isExternalArg and Type . isArray(ty)) then
143+ (outExp as Expression . CREF (cref = cref, ty = ty), outChanged) :=
144+ Expression . mapFoldShallow(exp, evaluateExpTraverser, false );
145+
146+ // Evaluate constants and structural parameters.
147+ if ComponentRef . nodeVariability(cref) <= Variability . STRUCTURAL_PARAMETER then
156148 // Evaluate all constants and structural parameters.
157149 outExp := Ceval . evalCref(cref, outExp, Ceval . EvalTarget . IGNORE_ERRORS (), evalSubscripts = false );
158150 outChanged := true ;
@@ -163,17 +155,9 @@ algorithm
163155 then
164156 outExp;
165157
166- case Expression . CALL ()
167- algorithm
168- (outExp, outChanged) := Expression . mapFoldShallow(exp,
169- function evaluateExpTraverser(isExternalArg = Call . isExternal(exp. call)), false );
170- then
171- if outChanged then Expression . retype(outExp) else outExp;
172-
173158 else
174159 algorithm
175- (outExp, outChanged) := Expression . mapFoldShallow(exp,
176- function evaluateExpTraverser(isExternalArg = false ), false );
160+ (outExp, outChanged) := Expression . mapFoldShallow(exp, evaluateExpTraverser, false );
177161 then
178162 if outChanged then Expression . retype(outExp) else outExp;
179163 end match;
0 commit comments