Skip to content

Commit

Permalink
Refactoring REC(_)=>REC()
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@23242 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
sjoelund committed Nov 6, 2014
1 parent 819a2ff commit d5e4477
Show file tree
Hide file tree
Showing 19 changed files with 115 additions and 90 deletions.
4 changes: 2 additions & 2 deletions Compiler/BackEnd/DAEQuery.mo
Expand Up @@ -296,7 +296,7 @@ algorithm
DAE.ElementSource source;

case ({},_) then "";
case (((BackendDAE.VAR(varName = cr, varDirection = dir)) :: {}),varno)
case (((BackendDAE.VAR(varName = cr)) :: {}),_)
equation
str1 = ComponentReference.printComponentRefStr(cr);
/*
Expand All @@ -321,7 +321,7 @@ algorithm
then
str;

case (((BackendDAE.VAR(varName = cr, varDirection = dir)) :: xs),varno)
case (((BackendDAE.VAR(varName = cr)) :: xs),varno)
equation
str1 = ComponentReference.printComponentRefStr(cr);
/*
Expand Down
2 changes: 1 addition & 1 deletion Compiler/BackEnd/StateMachineFeatures.mo
Expand Up @@ -372,7 +372,7 @@ algorithm
then (NONE(), modeTableNew);

// Remove initialState(..) statement
case (SOME(MODE(_,_,_,_,_)), _, SOME((_,INITIAL_STATE())), SOME(_))
case (SOME(MODE()), _, SOME((_,INITIAL_STATE())), SOME(_))
then (NONE(), modeTable);

// return structures without any modifications
Expand Down
26 changes: 13 additions & 13 deletions Compiler/FrontEnd/Absyn.mo
Expand Up @@ -1139,7 +1139,7 @@ algorithm
((eqilst1_1,arg_1)) = traverseEquationItemList(eqilst1,rel,arg);
((eeqitlst_1,arg_2)) = traverseExpEqItemTupleList(eeqitlst,rel,arg_1);
((eqilst2_1,arg_3)) = traverseEquationItemList(eqilst2,rel,arg_2);
((EQ_IF(_,_,_,_),arg_4)) = rel((eq,arg_3));
((EQ_IF(),arg_4)) = rel((eq,arg_3));
then
((EQ_IF(e,eqilst1_1,eeqitlst_1,eqilst2_1),arg_4));
case(eq as EQ_FOR(_,eqilst),rel,arg)
Expand All @@ -1158,7 +1158,7 @@ algorithm
case(eq as EQ_FAILURE(ei),rel,arg)
equation
((ei_1,arg_1)) = traverseEquationItem(ei,rel,arg);
((EQ_FAILURE(_),arg_2)) = rel((eq,arg_1));
((EQ_FAILURE(),arg_2)) = rel((eq,arg_1));
then
((EQ_FAILURE(ei_1),arg_2));
case(eq,rel,arg)
Expand Down Expand Up @@ -2612,8 +2612,8 @@ algorithm
Path p1,p2;
String i1,i2;
case (FULLYQUALIFIED(p1),FULLYQUALIFIED(p2)) then pathCompare(p1,p2);
case (FULLYQUALIFIED(_),_) then 1;
case (_,FULLYQUALIFIED(_)) then -1;
case (FULLYQUALIFIED(),_) then 1;
case (_,FULLYQUALIFIED()) then -1;
case (QUALIFIED(i1,p1),QUALIFIED(i2,p2))
equation
o = stringCompare(i1,i2);
Expand Down Expand Up @@ -3470,7 +3470,7 @@ algorithm
then
res;

case (CODE(_),_,_) then {};
case (CODE(),_,_) then {};

case (AS(exp = e1),_,_) then getCrefFromExp(e1,includeSubs,includeFunctions);

Expand Down Expand Up @@ -4115,7 +4115,7 @@ algorithm
ComponentRef cr2,cr_1,cr;
case (CREF_IDENT(name = id,subscripts = sub),cr2)
equation
failure(CREF_FULLYQUALIFIED(_) = cr2);
failure(CREF_FULLYQUALIFIED() = cr2);
then CREF_QUAL(id,sub,cr2);
case (CREF_QUAL(name = id,subscripts = sub,componentRef = cr),cr2)
equation
Expand Down Expand Up @@ -4368,7 +4368,7 @@ public function isFunctionRestriction "checks if restriction is a function or no
output Boolean outIsFunction;
algorithm
outIsFunction := match(inRestriction)
case R_FUNCTION(_) then true;
case R_FUNCTION() then true;
else false;
end match;
end isFunctionRestriction;
Expand Down Expand Up @@ -4865,7 +4865,7 @@ algorithm
local Path p; String n,s;
case (FULLYQUALIFIED(p),s) equation p = pathReplaceIdent(p,s); then FULLYQUALIFIED(p);
case (QUALIFIED(n,p),s) equation p = pathReplaceIdent(p,s); then QUALIFIED(n,p);
case (IDENT(_),s) then IDENT(s);
case (IDENT(),s) then IDENT(s);
end match;
end pathReplaceIdent;

Expand Down Expand Up @@ -5141,7 +5141,7 @@ algorithm
then (inExp, lst::rest);

// crefs, add to list
case (CREF(_), lst::rest) then (inExp,(inExp::lst)::rest);
case (CREF(), lst::rest) then (inExp,(inExp::lst)::rest);
// anything else, return the same!
else (inExp,inLst);

Expand Down Expand Up @@ -5337,7 +5337,7 @@ public function isCref
output Boolean b;
algorithm
b := match exp
case CREF(_) then true;
case CREF() then true;
else false;
end match;
end isCref;
Expand All @@ -5347,15 +5347,15 @@ public function isDerCref
output Boolean b;
algorithm
b := match exp
case CALL(CREF_IDENT("der",{}),FUNCTIONARGS({CREF(_)},{})) then true;
case CALL(CREF_IDENT("der",{}),FUNCTIONARGS({CREF()},{})) then true;
else false;
end match;
end isDerCref;

public function isDerCrefFail
input Exp exp;
algorithm
CALL(CREF_IDENT("der",{}),FUNCTIONARGS({CREF(_)},{})) := exp;
CALL(CREF_IDENT("der",{}),FUNCTIONARGS({CREF()},{})) := exp;
end isDerCrefFail;

public function getExpsFromArrayDim
Expand Down Expand Up @@ -5631,7 +5631,7 @@ algorithm
Path p;
String n;

case (IDENT(_), _) then inLastIdent;
case (IDENT(), _) then inLastIdent;

case (QUALIFIED(n, p), _)
equation
Expand Down
32 changes: 16 additions & 16 deletions Compiler/FrontEnd/ClassInf.mo
Expand Up @@ -219,14 +219,14 @@ algorithm
case HAS_RESTRICTIONS(hasEquations = false, hasAlgorithms = false, hasConstraints = false) then "new def";
case HAS_RESTRICTIONS(hasEquations = b1, hasAlgorithms = b2)
then "has" + (if b1 then " equations" else "") + (if b2 then " algorithms" else "") + (if b1 then " constraints" else "");
case EXTERNAL_OBJ(_) then "ExternalObject";
case META_TUPLE(_) then "tuple";
case META_LIST(_) then "list";
case META_OPTION(_) then "Option";
case META_RECORD(_) then "meta_record";
case META_POLYMORPHIC(_) then "polymorphic";
case META_ARRAY(_) then "meta_array";
case META_UNIONTYPE(_) then "uniontype";
case EXTERNAL_OBJ() then "ExternalObject";
case META_TUPLE() then "tuple";
case META_LIST() then "list";
case META_OPTION() then "Option";
case META_RECORD() then "meta_record";
case META_POLYMORPHIC() then "polymorphic";
case META_ARRAY() then "meta_array";
case META_UNIONTYPE() then "uniontype";
case _ then "#printStateStr failed#";
end matchcontinue;
end printStateStr;
Expand Down Expand Up @@ -577,7 +577,7 @@ algorithm
// BTH
case (TYPE_CLOCK(),SCode.R_CONNECTOR(_)) then ();
case (TYPE_ENUM(),SCode.R_CONNECTOR(_)) then (); // used in Modelica.Electrical.Digital where we have an enum as a connector
case (ENUMERATION(_),SCode.R_CONNECTOR(_)) then (); // used in Modelica.Electrical.Digital where we have an enum as a connector
case (ENUMERATION(),SCode.R_CONNECTOR(_)) then (); // used in Modelica.Electrical.Digital where we have an enum as a connector

case (TYPE(),SCode.R_TYPE()) then ();
case (TYPE_INTEGER(),SCode.R_TYPE()) then ();
Expand All @@ -587,19 +587,19 @@ algorithm
// BTH
case (TYPE_CLOCK(),SCode.R_TYPE()) then ();
case (TYPE_ENUM(),SCode.R_TYPE()) then ();
case (ENUMERATION(_),SCode.R_TYPE()) then ();
case (ENUMERATION(),SCode.R_TYPE()) then ();

case (PACKAGE(),SCode.R_PACKAGE()) then ();
case (HAS_RESTRICTIONS(hasEquations=false,hasConstraints=false,hasAlgorithms=false),SCode.R_PACKAGE()) then ();

case (FUNCTION(),SCode.R_FUNCTION(_)) then ();
case (HAS_RESTRICTIONS(hasEquations=false,hasConstraints=false),SCode.R_FUNCTION(_)) then ();
case (META_TUPLE(_),SCode.R_TYPE()) then ();
case (META_LIST(_),SCode.R_TYPE()) then ();
case (META_OPTION(_),SCode.R_TYPE()) then ();
case (META_RECORD(_),SCode.R_TYPE()) then ();
case (META_ARRAY(_),SCode.R_TYPE()) then ();
case (META_UNIONTYPE(_),SCode.R_TYPE()) then ();
case (META_TUPLE(),SCode.R_TYPE()) then ();
case (META_LIST(),SCode.R_TYPE()) then ();
case (META_OPTION(),SCode.R_TYPE()) then ();
case (META_RECORD(),SCode.R_TYPE()) then ();
case (META_ARRAY(),SCode.R_TYPE()) then ();
case (META_UNIONTYPE(),SCode.R_TYPE()) then ();

end match;
end valid;
Expand Down
6 changes: 3 additions & 3 deletions Compiler/FrontEnd/InnerOuter.mo
Expand Up @@ -972,13 +972,13 @@ algorithm
// no prefix, this is an error!
// disabled as this is used in Interactive.getComponents
// and makes mosfiles/interactive_api_attributes.mos to fail!
case (TOP_INSTANCE(_, _, _, _), Prefix.PREFIX(compPre = Prefix.NOCOMPPRE()), _)
case (TOP_INSTANCE(), Prefix.PREFIX(compPre = Prefix.NOCOMPPRE()), _)
then lookupInnerInIH(inTIH, Prefix.NOPRE(), inComponentIdent);

// no prefix, this is an error!
// disabled as this is used in Interactive.getComponents
// and makes mosfiles/interactive_api_attributes.mos to fail!
case (TOP_INSTANCE(_, _, _, _), Prefix.NOPRE(), name)
case (TOP_INSTANCE(), Prefix.NOPRE(), name)
equation
// fprintln(Flags.INNER_OUTER, "Error: outer component: " + name + " defined at the top level!");
// fprintln(Flags.INNER_OUTER, "InnerOuter.lookupInnerInIH : looking for: " + PrefixUtil.printPrefixStr(Prefix.NOPRE()) + "/" + name + " REACHED TOP LEVEL!");
Expand Down Expand Up @@ -1034,7 +1034,7 @@ algorithm
instInner;

// if we fail return nothing
case (TOP_INSTANCE(_, _, _, _), prefix, name)
case (TOP_INSTANCE(), prefix, name)
equation
// fprintln(Flags.INNER_OUTER, "InnerOuter.lookupInnerInIH : looking for: " + PrefixUtil.printPrefixStr(prefix) + "/" + name + " NOT FOUND!");
// dumpInstHierarchyHashTable(ht);
Expand Down
9 changes: 3 additions & 6 deletions Compiler/FrontEnd/Inst.mo
Expand Up @@ -3964,7 +3964,6 @@ algorithm

// constraining type on the component
case (cache,env,ih,(DAE.REDECL(tplSCodeElementModLst = ((( redComp as SCode.COMPONENT(name = n1,
prefixes = SCode.PREFIXES(finalPrefix = finalPrefix),
modifications = mod,
info = info
)),rmod) :: _))),
Expand Down Expand Up @@ -3999,11 +3998,9 @@ algorithm
// no constraining type on comp, throw away modifiers prior to redeclaration
case (cache,env,ih,(DAE.REDECL(tplSCodeElementModLst = (((redComp as
SCode.COMPONENT(name = n1,
prefixes = SCode.PREFIXES(
finalPrefix = finalPrefix),
modifications = mod,
info = info
)),rmod) :: _))),
modifications = mod,
info = info
)),rmod) :: _))),
// adrpo: always take the inner outer from the component, not the redeclaration!!!!
comp as SCode.COMPONENT(name = n2,
prefixes = SCode.PREFIXES(
Expand Down
4 changes: 1 addition & 3 deletions Compiler/FrontEnd/InstUtil.mo
Expand Up @@ -2804,7 +2804,6 @@ algorithm
Absyn.Direction dir;
Absyn.TypeSpec t;
SCode.Mod m;
SCode.Comment comment;
list<tuple<SCode.Element, DAE.Mod>> xs,comps;
InstDims inst_dims;
SourceInfo info;
Expand All @@ -2815,8 +2814,7 @@ algorithm
// a component
case (cache,env,ih,mods,pre,ci_state,
((comp as SCode.COMPONENT(name=n,prefixes=SCode.PREFIXES(vis,_,_,io,_),
attributes=SCode.ATTR(_,ct,prl,var,dir),
comment=comment),cmod) :: xs),
attributes=SCode.ATTR(_,ct,prl,var,dir)),cmod) :: xs),
inst_dims,impl)
equation
// compmod = Mod.getModifs(mods, n, m);
Expand Down
2 changes: 1 addition & 1 deletion Compiler/FrontEnd/NFLookup.mo
Expand Up @@ -934,7 +934,7 @@ algorithm

// An error has occured, return the entry found so far and let the caller
// handle the error reporting.
case (_, _, _, STATE_ERROR(_))
case (_, _, _, STATE_ERROR())
then (inEntry, inEnv, inState);

case (_, _, _, _)
Expand Down
18 changes: 17 additions & 1 deletion Compiler/FrontEnd/Patternm.mo
Expand Up @@ -400,6 +400,7 @@ algorithm
list<tuple<DAE.Pattern,String,DAE.Type>> namedPatterns;
Boolean knownSingleton;
FCore.Cache cache;
Boolean allWild;

case (cache,_,_,Absyn.FUNCTIONARGS(funcArgs,namedArgList),utPath2,_,_)
algorithm
Expand All @@ -420,6 +421,21 @@ algorithm
else ();
end match;
end for;
if listEmpty(namedArgList) and not listEmpty(funcArgs) then
allWild := true;
for arg in funcArgs loop
allWild := match arg
case Absyn.CREF(Absyn.WILD()) then true;
else false;
end match;
if not allWild then
break;
end if;
end for;
if allWild then
Error.addSourceMessage(Error.META_ALL_EMPTY, {Absyn.pathString(callPath)}, info);
end if;
end if;
end if;

(funcArgs,namedArgList) := checkForAllWildCall(funcArgs,namedArgList,listLength(fieldNameList));
Expand Down Expand Up @@ -505,7 +521,7 @@ protected function checkForAllWildCall "Converts a call REC(__) to REC(_,_,_,_)"
algorithm
(outArgs,outNamed) := match (args,named,numFields)
case ({Absyn.CREF(Absyn.ALLWILD())},{},_)
then (List.fill(Absyn.CREF(Absyn.WILD()),numFields),{});
then ({},{});
else (args,named);
end match;
end checkForAllWildCall;
Expand Down

0 comments on commit d5e4477

Please sign in to comment.