@@ -15766,9 +15766,162 @@ protected function transformPathedClassInClass
1576615766 output Absyn.Class outClass;
1576715767 end FuncType;
1576815768algorithm
15769- outClass := inClass;
15769+ outClass := match inPath
15770+ case Absyn.Path.IDENT()
15771+ then transformClassInClass(inPath.name, inFunc, inClass);
15772+
15773+ case Absyn.Path.QUALIFIED()
15774+ then transformClassInClass(inPath.name,
15775+ function transformPathedClassInClass(inPath = inPath.path, inFunc = inFunc),
15776+ inClass);
15777+
15778+ case Absyn.Path.FULLYQUALIFIED()
15779+ then transformPathedClassInClass(inPath.path, inClass, inFunc);
15780+
15781+ end match;
1577015782end transformPathedClassInClass;
1577115783
15784+ function transformClassInClass
15785+ input String name;
15786+ input FuncType func;
15787+ input output Absyn.Class cls;
15788+
15789+ partial function FuncType
15790+ input output Absyn.Class cls;
15791+ end FuncType;
15792+ protected
15793+ Absyn.ClassDef body = cls.body;
15794+ algorithm
15795+ () := match body
15796+ case Absyn.ClassDef.PARTS()
15797+ algorithm
15798+ body.classParts := List.findMap(body.classParts,
15799+ function transformClassInClassPart(name = name, func = func));
15800+ then
15801+ ();
15802+
15803+ case Absyn.ClassDef.CLASS_EXTENDS()
15804+ algorithm
15805+ body.parts := List.findMap(body.parts,
15806+ function transformClassInClassPart(name = name, func = func));
15807+ then
15808+ ();
15809+
15810+ else ();
15811+ end match;
15812+
15813+ cls.body := body;
15814+ end transformClassInClass;
15815+
15816+ function transformClassInClassPart
15817+ input String name;
15818+ input FuncType func;
15819+ input output Absyn.ClassPart part;
15820+ output Boolean found;
15821+
15822+ partial function FuncType
15823+ input output Absyn.Class cls;
15824+ end FuncType;
15825+ algorithm
15826+ found := match part
15827+ local
15828+ list<Absyn.ElementItem> items;
15829+
15830+ case Absyn.ClassPart.PUBLIC()
15831+ algorithm
15832+ (items, found) := List.findMap(part.contents,
15833+ function transformClassInElementItem(name = name, func = func));
15834+ part.contents := items;
15835+ then
15836+ found;
15837+
15838+ case Absyn.ClassPart.PROTECTED()
15839+ algorithm
15840+ (items, found) := List.findMap(part.contents,
15841+ function transformClassInElementItem(name = name, func = func));
15842+ part.contents := items;
15843+ then
15844+ found;
15845+
15846+ else false;
15847+ end match;
15848+ end transformClassInClassPart;
15849+
15850+ function transformClassInElementItem
15851+ input String name;
15852+ input FuncType func;
15853+ input output Absyn.ElementItem item;
15854+ output Boolean found;
15855+
15856+ partial function FuncType
15857+ input output Absyn.Class cls;
15858+ end FuncType;
15859+ algorithm
15860+ found := match item
15861+ local
15862+ Absyn.Element e;
15863+
15864+ case Absyn.ElementItem.ELEMENTITEM()
15865+ algorithm
15866+ (e, found) := transformClassInElement(name, func, item.element);
15867+ item.element := e;
15868+ then
15869+ found;
15870+
15871+ else false;
15872+ end match;
15873+ end transformClassInElementItem;
15874+
15875+ function transformClassInElement
15876+ input String name;
15877+ input FuncType func;
15878+ input output Absyn.Element element;
15879+ output Boolean found;
15880+
15881+ partial function FuncType
15882+ input output Absyn.Class cls;
15883+ end FuncType;
15884+ algorithm
15885+ found := match element
15886+ local
15887+ Absyn.ElementSpec spec;
15888+
15889+ case Absyn.Element.ELEMENT()
15890+ algorithm
15891+ (spec, found) := transformClassInElementSpec(name, func, element.specification);
15892+ element.specification := spec;
15893+ then
15894+ found;
15895+
15896+ else false;
15897+ end match;
15898+ end transformClassInElement;
15899+
15900+ function transformClassInElementSpec
15901+ input String name;
15902+ input FuncType func;
15903+ input output Absyn.ElementSpec spec;
15904+ output Boolean found;
15905+
15906+ partial function FuncType
15907+ input output Absyn.Class cls;
15908+ end FuncType;
15909+ algorithm
15910+ found := match spec
15911+ local
15912+ Absyn.Class cls;
15913+
15914+ case Absyn.ElementSpec.CLASSDEF(class_ = cls)
15915+ guard cls.name == name
15916+ algorithm
15917+ spec.class_ := func(cls);
15918+ then
15919+ true;
15920+
15921+ else false;
15922+ end match;
15923+ end transformClassInElementSpec;
15924+
1577215925protected function modificationToAbsyn
1577315926" This function takes a list of NamedArg and returns an Absyn.Modification option.
1577415927 It collects binding equation from the named argument binding=<expr> and creates
0 commit comments