@@ -1809,7 +1809,7 @@ algorithm
18091809 inst_cls := Class . INSTANCED_CLASS (ty, cls. elements, sections, cls. restriction);
18101810 InstNode . updateClass(inst_cls, node);
18111811
1812- instRecordConstructor(cls . restriction, node );
1812+ instComplexType(ty );
18131813 then
18141814 ();
18151815
@@ -1824,7 +1824,9 @@ algorithm
18241824 dims[i] := instDimension(dims[i], dim_scope, info);
18251825 end for ;
18261826
1827- instRecordConstructor(cls. restriction, node);
1827+ if Restriction . isRecord(cls. restriction) then
1828+ instRecordConstructor(node);
1829+ end if ;
18281830 then
18291831 ();
18301832
@@ -1872,44 +1874,54 @@ protected
18721874 InstNode cls_node;
18731875 list< String > fields;
18741876algorithm
1875- cls_node := InstNode . classScope(InstNode . getDerivedNode(node));
1877+ cls_node := if SCode . isOperatorRecord(InstNode . definition(node))
1878+ then InstNode . classScope(node) else InstNode . classScope(InstNode . getDerivedNode(node));
18761879 fields := list(InstNode . name(c) for c guard not InstNode . isEmpty(c) in
18771880 ClassTree . getComponents(Class . classTree(cls)));
18781881 ty := ComplexType . RECORD (cls_node, fields);
18791882end makeRecordComplexType;
18801883
1884+ function instComplexType
1885+ input Type ty;
1886+ algorithm
1887+ () := match ty
1888+ local
1889+ InstNode node;
1890+ CachedData cache;
1891+
1892+ case Type . COMPLEX (complexTy = ComplexType . RECORD (node))
1893+ algorithm
1894+ instRecordConstructor(node);
1895+ then
1896+ ();
1897+
1898+ else ();
1899+ end match;
1900+ end instComplexType;
1901+
18811902function instRecordConstructor
1882- input Restriction restriction;
18831903 input InstNode node;
18841904protected
18851905 CachedData cache;
1886- Absyn . Path path;
18871906algorithm
1888- () := match restriction
1889- case Restriction . RECORD ()
1890- algorithm
1891- cache := InstNode . getFuncCache(node);
1907+ cache := InstNode . getFuncCache(node);
18921908
1893- () := match cache
1894- case CachedData . FUNCTION () then ();
1895- else
1896- algorithm
1897- InstNode . cacheInitFunc(node);
1898- path := InstNode . scopePath(node, includeRoot = true );
1899-
1900- if SCode . isOperatorRecord(InstNode . definition(node)) then
1901- OperatorOverloading . instConstructor(path, node, InstNode . info(node));
1902- else
1903- Record . instDefaultConstructor(path, node, InstNode . info(node));
1904- end if ;
1905- then
1906- ();
1909+ () := match cache
1910+ case CachedData . FUNCTION () then ();
1911+ else
1912+ algorithm
1913+ InstNode . cacheInitFunc(node);
19071914
1908- end match;
1915+ if SCode . isOperatorRecord(InstNode . definition(node)) then
1916+ OperatorOverloading . instConstructor(
1917+ InstNode . scopePath(node, includeRoot = true ), node, InstNode . info(node));
1918+ else
1919+ Record . instDefaultConstructor(
1920+ InstNode . scopePath(node, includeRoot = true ), node, InstNode . info(node));
1921+ end if ;
19091922 then
19101923 ();
19111924
1912- else ();
19131925 end match;
19141926end instRecordConstructor;
19151927
0 commit comments