Skip to content

Commit dc7da8c

Browse files
committed
matchcontinue -> match
1 parent d41fb97 commit dc7da8c

File tree

2 files changed

+39
-47
lines changed

2 files changed

+39
-47
lines changed

Compiler/FFrontEnd/FNode.mo

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1031,7 +1031,7 @@ public function nonImplicitRefFromScope
10311031
input Scope inScope;
10321032
output Ref outRef;
10331033
algorithm
1034-
outRef := matchcontinue(inScope)
1034+
outRef := match(inScope)
10351035
local
10361036
Ref r;
10371037
Scope rest;
@@ -1045,7 +1045,7 @@ algorithm
10451045
case (_::rest)
10461046
then
10471047
nonImplicitRefFromScope(rest);
1048-
end matchcontinue;
1048+
end match;
10491049
end nonImplicitRefFromScope;
10501050

10511051
public function namesUpToParentName

Compiler/Script/Binding.mo

Lines changed: 37 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -82,23 +82,19 @@ algorithm
8282
end inferBindings;
8383

8484
protected function inferBindingClientList
85-
input list<Client_e> client_list "list of nodes for which the binding is inferred";
86-
input Absyn.Class vmodel;
87-
input Absyn.Program env;
88-
output Absyn.Class out_vmodel;
89-
//output String bindingExpression;
90-
algorithm
91-
out_vmodel := matchcontinue(client_list)
92-
local
93-
Client_e ce;
94-
list<Client_e> rest;
95-
Absyn.Class upd_vmodel;
96-
case {} then vmodel;
97-
case ce::rest
98-
equation
99-
upd_vmodel = inferBindingClient(ce, vmodel, env);
100-
then inferBindingClientList(rest, upd_vmodel, env);
101-
end matchcontinue;
85+
input list<Client_e> client_list "list of nodes for which the binding is inferred";
86+
input Absyn.Class vmodel;
87+
input Absyn.Program env;
88+
output Absyn.Class out_vmodel = vmodel;
89+
//output String bindingExpression;
90+
protected
91+
Client_e ce;
92+
list<Client_e> rest = client_list;
93+
algorithm
94+
while not listEmpty(rest) loop
95+
ce::rest := rest;
96+
out_vmodel := inferBindingClient(ce, out_vmodel, env);
97+
end while;
10298
end inferBindingClientList;
10399

104100
protected function inferBindingClient
@@ -305,7 +301,7 @@ protected function applyModifier
305301
input String instance_name;
306302
output list<Absyn.ComponentItem> out_comps;
307303
algorithm
308-
out_comps := matchcontinue(comps)
304+
out_comps := match(comps)
309305
local
310306
list<Absyn.ComponentItem> rest;
311307
Absyn.ComponentItem cnew;
@@ -323,7 +319,7 @@ protected function applyModifier
323319
then cnew::applyModifier(rest, exp, instance_name);
324320
case _::rest
325321
then applyModifier(rest, exp, instance_name);
326-
end matchcontinue;
322+
end match;
327323
end applyModifier;
328324

329325

@@ -441,7 +437,7 @@ protected function applyTemplate
441437
input list<Absyn.Exp> in_es;
442438
output list<Absyn.Exp> out_es;
443439
algorithm
444-
out_es := matchcontinue(comps)
440+
out_es := match(comps)
445441
local
446442
list<Absyn.ComponentItem> rest;
447443
Absyn.Ident name;
@@ -451,7 +447,7 @@ protected function applyTemplate
451447
then applyTemplate(exp, rest, parseExpression(exp, name)::in_es);
452448
case _::rest
453449
then applyTemplate(exp, rest, in_es);
454-
end matchcontinue;
450+
end match;
455451
end applyTemplate;
456452

457453
protected function parseExpression
@@ -510,10 +506,10 @@ algorithm
510506
equation
511507
new_crf = updateCRF(crf, fargs);
512508
then (Absyn.CREF(new_crf));
513-
case(_)
514-
equation
515-
// print(Dump.dumpExpStr(in_eq) + "\n");
516-
then (in_eq);
509+
else
510+
equation
511+
// print(Dump.dumpExpStr(in_eq) + "\n");
512+
then (in_eq);
517513
end match;
518514
end parseExpression;
519515

@@ -535,7 +531,7 @@ protected function updateCRF
535531
new_cRef = updateCRF(cRef, name);
536532
then Absyn.CREF_QUAL(id, subscripts, new_cRef);
537533
case (Absyn.CREF_IDENT("getPath", subscripts)) then Absyn.CREF_IDENT(name, subscripts);
538-
case _ then componentRef;
534+
else componentRef;
539535
end matchcontinue;
540536
end updateCRF;
541537

@@ -682,20 +678,18 @@ output Boolean isClient;
682678
output String iname;
683679
algorithm
684680

685-
(isClient, iname) := matchcontinue(clients)
681+
(isClient, iname) := match(clients)
686682
local
687683
list<Absyn.Class> parents;
688684
Absyn.Class current_ci;
689685
String name, inst;
690686
list<Client> rest;
691687
case {} then (false, "");
692-
case CLIENT(name, inst)::rest
693-
equation
694-
true = (name == ci_name);
688+
case CLIENT(name, inst)::rest guard (name == ci_name)
695689
then (true, inst);
696690
case _::rest
697691
then isClientInMediator(ci_name, rest);
698-
end matchcontinue;
692+
end match;
699693
end isClientInMediator;
700694

701695

@@ -705,19 +699,18 @@ input Ident name;
705699
input list<Client> clients;
706700
output Boolean isM;
707701
algorithm
708-
isM := matchcontinue(clients)
709-
local
710-
String className;
711-
String instance;
712-
list<Client> rest;
702+
isM := match(clients)
703+
local
704+
String className;
705+
String instance;
706+
list<Client> rest;
713707
case {} then false;
714708
case CLIENT(className, instance)::rest
715-
equation
716-
className = name;
709+
guard stringEq(className, name)
717710
then true;
718711
case _::rest
719712
then specifiesBindingFor(name, rest);
720-
end matchcontinue;
713+
end match;
721714
end specifiesBindingFor;
722715

723716

@@ -834,19 +827,18 @@ input list<Absyn.NamedArg> argNames;
834827
input String name;
835828
output String val;
836829
algorithm
837-
val := matchcontinue(argNames)
830+
val := match(argNames)
838831
local
839832
String str, nname;
840833
list<Absyn.NamedArg> rest;
841834
case {}
842835
then "";
843836
case Absyn.NAMEDARG(nname, Absyn.STRING(str))::rest
844-
equation
845-
true = (nname == name);
837+
guard (nname == name)
846838
then str;
847839
case _::rest
848840
then getArg(rest, name);
849-
end matchcontinue;
841+
end match;
850842
end getArg;
851843

852844

@@ -855,7 +847,7 @@ input list<SCode.Element> elems;
855847
output Boolean result;
856848
output Option<SCode.Mod> mods;
857849
algorithm
858-
(result, mods) := matchcontinue(elems)
850+
(result, mods) := match(elems)
859851
local
860852
list<SCode.Element> rest;
861853
SCode.Element el;
@@ -867,7 +859,7 @@ output Option<SCode.Mod> mods;
867859
then (true, SOME(mod));
868860
case el::rest
869861
then isMediator(rest);
870-
end matchcontinue;
862+
end match;
871863
end isMediator;
872864

873865
protected function getValue

0 commit comments

Comments
 (0)