@@ -639,25 +639,21 @@ function makeComponentBinding
639639 input EvalTarget target;
640640 output Binding binding;
641641protected
642- ClassTree tree;
643- array< InstNode > comps;
644- list< Expression > fields;
645- Type ty, exp_ty;
642+ Type ty;
646643 InstNode rec_node;
647644 Expression exp;
648- ComponentRef rest_cr;
649645algorithm
650- binding := matchcontinue ( component, cref)
646+ binding := matchcontinue component
651647 // A record field without an explicit binding, evaluate the parent's binding
652648 // if it has one and fetch the binding from it instead.
653- case (_, _)
649+ case _
654650 algorithm
655651 exp := makeRecordFieldBindingFromParent(cref, target);
656652 then
657653 Binding . CEVAL_BINDING (exp);
658654
659655 // A record component without an explicit binding, create one from its children.
660- case ( Component . TYPED_COMPONENT (ty = Type . COMPLEX (complexTy = ComplexType . RECORD (rec_node))), _ )
656+ case Component . TYPED_COMPONENT (ty = Type . COMPLEX (complexTy = ComplexType . RECORD (rec_node)))
661657 algorithm
662658 exp := makeRecordBindingExp(component. classInst, rec_node, component. ty, cref);
663659 binding := Binding . CEVAL_BINDING (exp);
@@ -669,11 +665,13 @@ algorithm
669665 binding;
670666
671667 // A record array component without an explicit binding, create one from its children.
672- case ( Component . TYPED_COMPONENT (ty = ty as Type . ARRAY (elementType =
673- Type . COMPLEX (complexTy = ComplexType . RECORD (rec_node)))), _ )
668+ case Component . TYPED_COMPONENT (ty = Type . ARRAY (elementType = ty as
669+ Type . COMPLEX (complexTy = ComplexType . RECORD (rec_node))))
674670 algorithm
675- exp := makeRecordBindingExp(component. classInst, rec_node, component. ty, cref);
676- exp := splitRecordArrayExp(exp);
671+ exp := Expression . mapCrefScalars(Expression . fromCref(cref),
672+ function makeRecordBindingExp(typeNode = component. classInst,
673+ recordNode = rec_node, recordType = ty));
674+
677675 binding := Binding . CEVAL_BINDING (exp);
678676
679677 if not ComponentRef . hasSubscripts(cref) then
@@ -696,7 +694,6 @@ protected
696694 InstContext . Type exp_context;
697695 Binding binding;
698696 Component comp;
699- list< Subscript > subs;
700697algorithm
701698 parent_cr := ComponentRef . rest(cref);
702699 parent := ComponentRef . node(parent_cr);
@@ -732,7 +729,6 @@ protected
732729 ClassTree tree;
733730 array< InstNode > comps;
734731 list< Expression > args;
735- list< Record . Field > fields;
736732 Type ty;
737733 InstNode c;
738734 ComponentRef cr;
@@ -758,18 +754,6 @@ algorithm
758754 exp := Expression . makeRecord(InstNode . scopePath(recordNode, includeRoot = true ), recordType, args);
759755end makeRecordBindingExp;
760756
761- function splitRecordArrayExp
762- input output Expression exp;
763- protected
764- Absyn . Path path;
765- Type ty;
766- list< Expression > expl;
767- algorithm
768- Expression . RECORD (path, ty, expl) := exp;
769- exp := Expression . makeRecord(path, Type . arrayElementType(ty), expl);
770- exp := Expression . fillType(ty, exp);
771- end splitRecordArrayExp;
772-
773757function evalTypename
774758 input Type ty;
775759 input Expression originExp;
0 commit comments