Skip to content

Commit

Permalink
Remove some unused calls, removed _ from some that are used
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@23263 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
sjoelund committed Nov 7, 2014
1 parent 2dd6c85 commit ad5de84
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 72 deletions.
6 changes: 3 additions & 3 deletions Compiler/FrontEnd/Inline.mo
Expand Up @@ -1380,7 +1380,7 @@ algorithm

case (e as DAE.CREF(componentRef = cref),(argmap,checkcr,true))
equation
_ = BaseHashTable.get(cref,checkcr);
true = BaseHashTable.hasKey(cref,checkcr);
then (e,(argmap,checkcr,false));

case (DAE.UNBOX(DAE.CALL(path,expLst,DAE.CALL_ATTR(_,tuple_,false,isImpure,_,inlineType,tc)),ty),(argmap,checkcr,true))
Expand All @@ -1398,7 +1398,7 @@ algorithm
case (e as DAE.UNBOX(DAE.CALL(path,_,DAE.CALL_ATTR(builtin=false)),_),(argmap,checkcr,true))
equation
cref = ComponentReference.pathToCref(path);
_ = BaseHashTable.get(cref,checkcr);
true = BaseHashTable.hasKey(cref,checkcr);
then (e,(argmap,checkcr,false));

// TODO: Use the inlineType of the function reference!
Expand All @@ -1419,7 +1419,7 @@ algorithm
case (e as DAE.CALL(path,_,DAE.CALL_ATTR(ty=DAE.T_METATYPE(),builtin=false)),(argmap,checkcr,true))
equation
cref = ComponentReference.pathToCref(path);
_ = BaseHashTable.get(cref,checkcr);
true = BaseHashTable.hasKey(cref,checkcr);
then (e,(argmap,checkcr,false));

case (e,(argmap,checkcr,replacedfailed)) then (e,(argmap,checkcr,replacedfailed));
Expand Down
14 changes: 6 additions & 8 deletions Compiler/FrontEnd/Patternm.mo
Expand Up @@ -247,7 +247,7 @@ algorithm

case (cache,_,Absyn.CALL(Absyn.CREF_IDENT("NONE",{}),Absyn.FUNCTIONARGS({},{})),_,_,_)
equation
_ = validPatternType(ty,DAE.T_NONE_DEFAULT,inLhs,info);
validPatternType(ty,DAE.T_NONE_DEFAULT,inLhs,info);
then (cache,DAE.PAT_CONSTANT(NONE(),DAE.META_OPTION(NONE())));

case (cache,_,Absyn.CALL(Absyn.CREF_IDENT("SOME",{}),Absyn.FUNCTIONARGS({exp},{})),DAE.T_METAOPTION(ty = ty2),_,_)
Expand Down Expand Up @@ -1022,12 +1022,12 @@ algorithm
tuple<HashTableStringToPath.HashTable,SourceInfo> tpl;
case ((DAE.PAT_AS(id=id,pat=pat),tpl as (ht,info)))
equation
_ = BaseHashTable.get(id, ht);
true = BaseHashTable.hasKey(id, ht);
Error.assertionOrAddSourceMessage(not Flags.isSet(Flags.PATTERNM_ALL_INFO),Error.META_UNUSED_AS_BINDING, {id}, info);
then ((pat,tpl));
case ((DAE.PAT_AS_FUNC_PTR(id=id,pat=pat),tpl as (ht,_)))
equation
_ = BaseHashTable.get(id, ht);
true = BaseHashTable.hasKey(id, ht);
then ((pat,tpl));
else simplifyPattern(inTpl);
end matchcontinue;
Expand Down Expand Up @@ -1143,7 +1143,7 @@ algorithm
equation
name = ComponentReference.crefFirstIdent(cr);
// TODO: Can skip matchcontinue and failure if there was an AvlTree.exists(key)
_ = AvlTreeString.avlTreeGet(localsTree,name);
AvlTreeString.avlTreeGet(localsTree,name);
failure(_ = AvlTreeString.avlTreeGet(useTree,name));
Error.assertionOrAddSourceMessage(not Flags.isSet(Flags.PATTERNM_ALL_INFO),Error.META_UNUSED_ASSIGNMENT,{name},info);
then (DAE.CREF(DAE.WILD(),ty),extra);
Expand Down Expand Up @@ -1171,14 +1171,14 @@ algorithm
case ((DAE.PAT_AS(id=name,pat=pat),extra as (localsTree,useTree,info)))
equation
// TODO: Can skip matchcontinue and failure if there was an AvlTree.exists(key)
_ = AvlTreeString.avlTreeGet(localsTree,name);
AvlTreeString.avlTreeGet(localsTree,name);
failure(_ = AvlTreeString.avlTreeGet(useTree,name));
Error.assertionOrAddSourceMessage(not Flags.isSet(Flags.PATTERNM_ALL_INFO),Error.META_UNUSED_AS_BINDING,{name},info);
then ((pat,extra));
case ((DAE.PAT_AS_FUNC_PTR(id=name,pat=pat),extra as (localsTree,useTree,info)))
equation
// TODO: Can skip matchcontinue and failure if there was an AvlTree.exists(key)
_ = AvlTreeString.avlTreeGet(localsTree,name);
AvlTreeString.avlTreeGet(localsTree,name);
failure(_ = AvlTreeString.avlTreeGet(useTree,name));
Error.assertionOrAddSourceMessage(not Flags.isSet(Flags.PATTERNM_ALL_INFO),Error.META_UNUSED_AS_BINDING,{name},info);
then ((pat,extra));
Expand Down Expand Up @@ -2335,8 +2335,6 @@ algorithm

case (cache,env,ld,_,_,_)
equation
_ = FGraph.openScope(env, SCode.NOT_ENCAPSULATED(), SOME(scopeName),NONE());

// Tranform declarations such as Real x,y; to Real x; Real y;
ld2 = SCodeUtil.translateEitemlist(ld, SCode.PROTECTED());

Expand Down
67 changes: 27 additions & 40 deletions Compiler/Script/Interactive.mo
Expand Up @@ -217,7 +217,7 @@ algorithm
equation
setGlobalRoot(Global.instOnlyForcedFunctions, NONE()); // thread-local root that has to be set!
statements = Parser.parseexp(mosfile);
_ = evaluateToStdOut(statements,GlobalScript.SYMBOLTABLE(ast,explodedAst,{},{},{},{}),true);
evaluateToStdOut(statements,GlobalScript.SYMBOLTABLE(ast,explodedAst,{},{},{},{}),true);
print(Error.printMessagesStr(false));
then true;
else
Expand Down Expand Up @@ -981,8 +981,8 @@ algorithm
(outString,outSymbolTable) = evaluateGraphicalApi_dispatch(inStatements,inSymbolTable);
// reset the flags!
System.setPartialInstantiation(isPartialInst);
_ = Flags.set(Flags.GEN, flagGen);
_ = Flags.set(Flags.EVAL_FUNC, flagEvalFunc);
Flags.set(Flags.GEN, flagGen);
Flags.set(Flags.EVAL_FUNC, flagEvalFunc);
Flags.setConfigBool(Flags.KEEP_ARRAYS, flagKeepArrays);
then
(outString,outSymbolTable);
Expand All @@ -991,8 +991,8 @@ algorithm
equation
// reset the flags!
System.setPartialInstantiation(isPartialInst);
_ = Flags.set(Flags.GEN, flagGen);
_ = Flags.set(Flags.EVAL_FUNC, flagEvalFunc);
Flags.set(Flags.GEN, flagGen);
Flags.set(Flags.EVAL_FUNC, flagEvalFunc);
Flags.setConfigBool(Flags.KEEP_ARRAYS, flagKeepArrays);
then
fail();
Expand Down Expand Up @@ -1154,7 +1154,7 @@ algorithm
Absyn.CREF(componentRef = model_)} = getApiFunctionArgs(istmts);
nargs = getApiFunctionNamedArgs(istmts);
(newp,_) = addComponent(name, tp, model_, nargs, p);
_ = Print.getString();
Print.clearBuf();
//resstr_1 = stringAppend(resstr, str);
st = GlobalScriptUtil.setSymbolTableAST(st, newp);
then
Expand All @@ -1177,9 +1177,9 @@ algorithm
matchApiFunction(istmts, "deleteComponent");
{Absyn.CREF(componentRef = Absyn.CREF_IDENT(name = name)),
Absyn.CREF(componentRef = model_)} = getApiFunctionArgs(istmts);
_ = getApiFunctionNamedArgs(istmts);
{} = getApiFunctionNamedArgs(istmts);
(newp,_) = deleteComponent(name, model_, p);
_ = Print.getString();
Print.clearBuf();
//resstr_1 = stringAppend(resstr, str);
st = GlobalScriptUtil.setSymbolTableAST(st, newp);
then
Expand Down Expand Up @@ -1748,16 +1748,6 @@ algorithm
then
(resstr,st);

case (istmts, st as GlobalScript.SYMBOLTABLE())
equation
matchApiFunction(istmts, "setOption");
{Absyn.CREF(componentRef = Absyn.CREF_IDENT(str, _)), Absyn.BOOL()} =
getApiFunctionArgs(istmts);
str = "--" + str;
_ = Flags.readArgs({str});
then
("true",st);

case (istmts, st as GlobalScript.SYMBOLTABLE(ast = p))
equation
matchApiFunction(istmts, "setExtendsModifierValue");
Expand Down Expand Up @@ -2057,7 +2047,6 @@ algorithm

case (p,class_,old_comp,new_comp)
equation
_ = Absyn.crefToPath(class_) "class in package" ;
comp_reps = extractAllComponentreplacements(p, class_, old_comp, new_comp);
p_1 = renameComponentFromComponentreplacements(p, comp_reps);
paths = extractRenamedClassesAsStringList(comp_reps);
Expand Down Expand Up @@ -2868,7 +2857,7 @@ algorithm
Absyn.BINARY(exp1_1,op,exp2_1);
case (Absyn.UNARY(op = op,exp = exp),old_comp,new_comp)
equation
_ = renameComponentInExp(exp, old_comp, new_comp);
exp = renameComponentInExp(exp, old_comp, new_comp); // TODO: Update the expression?
then
Absyn.UNARY(op,exp);
case (Absyn.LBINARY(exp1 = exp1,op = op,exp2 = exp2),old_comp,new_comp)
Expand All @@ -2879,7 +2868,7 @@ algorithm
Absyn.LBINARY(exp1_1,op,exp2_1);
case (Absyn.LUNARY(op = op,exp = exp),old_comp,new_comp)
equation
_ = renameComponentInExp(exp, old_comp, new_comp);
exp = renameComponentInExp(exp, old_comp, new_comp); // TODO: Update the expression?
then
Absyn.LUNARY(op,exp);
case (Absyn.RELATION(exp1 = exp1,op = op,exp2 = exp2),old_comp,new_comp)
Expand Down Expand Up @@ -3928,7 +3917,7 @@ algorithm
comps_2;
case (pa,(_ :: res),comps,env)
equation
_ = extractComponentsFromElements(pa, res, comps, env);
comps = extractComponentsFromElements(pa, res, comps, env);
then
comps;
end matchcontinue;
Expand Down Expand Up @@ -4679,7 +4668,7 @@ algorithm
specification = (spec as Absyn.COMPONENTS(components = ellst)),info = info,constrainClass = constr),
cr,finalPrefix,flowPrefix,streamPrefix,repl,prl,va,dr,cau)
equation
_ = getCompitemNamed(Absyn.CREF_IDENT(cr,{}), ellst);
getCompitemNamed(Absyn.CREF_IDENT(cr,{}), ellst);
redeclkw_1 = setReplaceableKeywordAttributes(redeclkw, repl);
inout_1 = setInnerOuterAttributes(dr);
spec_1 = setComponentPropertiesInElementspec(spec, cr, flowPrefix, streamPrefix, prl, va, cau);
Expand Down Expand Up @@ -6588,7 +6577,6 @@ algorithm
equation
p_class = Absyn.crefToPath(class_);
Absyn.IDENT(_) = Absyn.crefToPath(name);
_ = buildWithin(p_class);
failure(_ = getPathedClassInProgram(p_class, p));
str = "Error: class: " + Absyn.pathString(p_class) + " not found.";
then
Expand Down Expand Up @@ -6805,7 +6793,7 @@ public function buildWithin
input Absyn.Path inPath;
output Absyn.Within outWithin;
algorithm
outWithin := matchcontinue (inPath)
outWithin := match inPath
local Absyn.Path w_path,path;
case (Absyn.IDENT()) then Absyn.TOP();
case (Absyn.FULLYQUALIFIED(path)) // handle fully qual also!
Expand All @@ -6816,7 +6804,7 @@ algorithm
w_path = Absyn.stripLast(path);
then
Absyn.WITHIN(w_path);
end matchcontinue;
end match;
end buildWithin;

protected function componentitemNamed
Expand Down Expand Up @@ -8138,15 +8126,15 @@ algorithm
path = Absyn.crefToPath(classname);
Absyn.CLASS(body = Absyn.PARTS(classParts=parts)) = getPathedClassInProgram(path, p);
publst = getPublicList(parts);
_ = getComponentsContainsName(cr, publst);
getComponentsContainsName(cr, publst);
then
false;
case (cr,classname,_)
equation
path = Absyn.crefToPath(classname);
Absyn.CLASS(body = Absyn.PARTS(classParts=parts)) = getPathedClassInProgram(path, p);
protlst = getProtectedList(parts);
_ = getComponentsContainsName(cr, protlst);
getComponentsContainsName(cr, protlst);
then
true;
/* an extended class with parts: model extends M end M; */
Expand All @@ -8155,15 +8143,15 @@ algorithm
path = Absyn.crefToPath(classname);
Absyn.CLASS(body = Absyn.CLASS_EXTENDS(parts=parts)) = getPathedClassInProgram(path, p);
publst = getPublicList(parts);
_ = getComponentsContainsName(cr, publst);
getComponentsContainsName(cr, publst);
then
false;
case (cr,classname,_)
equation
path = Absyn.crefToPath(classname);
Absyn.CLASS(body = Absyn.CLASS_EXTENDS(parts=parts)) = getPathedClassInProgram(path, p);
protlst = getProtectedList(parts);
_ = getComponentsContainsName(cr, protlst);
getComponentsContainsName(cr, protlst);
then
true;
/* otherwise return false */
Expand Down Expand Up @@ -8437,7 +8425,7 @@ algorithm
list<Absyn.ElementItem> rest;
case (cr,(elt :: _))
equation
_ = getComponentsContainsName(cr, {elt});
getComponentsContainsName(cr, {elt});
then
elt;
case (cr,(_ :: rest))
Expand Down Expand Up @@ -8465,7 +8453,7 @@ algorithm
Absyn.ElementItem x;
case (cr,(Absyn.ELEMENTITEM(element = Absyn.ELEMENT(specification = (res as Absyn.COMPONENTS(components = ellst)))) :: _))
equation
_ = getCompitemNamed(cr, ellst);
getCompitemNamed(cr, ellst);
then
res;
case (cr,(_ :: xs))
Expand Down Expand Up @@ -8493,7 +8481,7 @@ algorithm
Absyn.ElementItem x;
case (cr,(Absyn.ELEMENTITEM(element = (res as Absyn.ELEMENT(specification = Absyn.COMPONENTS(components = ellst)))) :: _))
equation
_ = getCompitemNamed(cr, ellst);
getCompitemNamed(cr, ellst);
then
res;
case (cr,(_ :: xs))
Expand Down Expand Up @@ -8548,7 +8536,7 @@ algorithm
case (cr,p)
equation
path = Absyn.crefToPath(cr);
_ = getPathedClassInProgram(path, p);
getPathedClassInProgram(path, p);
then
true;

Expand Down Expand Up @@ -11925,7 +11913,6 @@ algorithm
SOME(envpath) = FGraph.getScopePath(cenv);
p1 = Absyn.joinPaths(envpath, Absyn.IDENT(baseClassName));
cref = Absyn.pathToCref(p1);
_ = Absyn.pathString(p1);
res = getBaseClassesFromParts(parts, env);
then cref::res;

Expand Down Expand Up @@ -15298,17 +15285,19 @@ algorithm
then
c1;

/* Does nothing
case (c as Absyn.CLASS(),name)
equation
handle = Print.saveAndClearBuf();
Print.printBuf("Interactive.getInnerClass failed, c:");
Dump.dump(Absyn.PROGRAM({c},Absyn.TOP()));
Print.printBuf("name :");
Print.printBuf(name);
_ = Print.getString();
Print.clear(); // Print.getString();
Print.restoreBuf(handle);
then
fail();
*/
end matchcontinue;
end getInnerClass;

Expand Down Expand Up @@ -17746,12 +17735,11 @@ algorithm
equation
typename_str = getElementTypeName(elementSpec);
varname_str = getElementName(elementSpec);
tmp = Util.stringSplitAtChar(varname_str, ",");
_ = List.first(tmp);
(tmp as _::_) = Util.stringSplitAtChar(varname_str, ",");
str = getDescIfVis(typename_str, inElementItem,prog);
then
str;
case (_,_) then ""; /* for annotations we don\'t care */
else ""; /* for annotations we don\'t care */
end matchcontinue;
end getNameFromElementIfVisType;

Expand All @@ -17772,7 +17760,6 @@ algorithm
case ({}, _)
equation
s1 = "";
_ = List.create(s1);
then
{};
case ((current :: {}),p) /* deal with the last element */
Expand Down
2 changes: 1 addition & 1 deletion Compiler/Util/BaseHashSet.mo
Expand Up @@ -285,7 +285,7 @@ algorithm
false;
case(_,_)
equation
_ = get(key,hashSet);
get(key,hashSet);
then
true;
else
Expand Down

0 comments on commit ad5de84

Please sign in to comment.