Skip to content

Commit

Permalink
use simpler if instead of matchcontinue
Browse files Browse the repository at this point in the history
  • Loading branch information
hkiel authored and OpenModelica-Hudson committed Jun 14, 2017
1 parent ba78dc7 commit 9663605
Showing 1 changed file with 14 additions and 26 deletions.
40 changes: 14 additions & 26 deletions Compiler/Main/Main.mo
Expand Up @@ -211,36 +211,25 @@ public function handleCommand
input GlobalScript.SymbolTable inSymbolTable;
output Boolean outContinue;
output String outResult;
output GlobalScript.SymbolTable outSymbolTable;
output GlobalScript.SymbolTable outSymbolTable = inSymbolTable;
protected
Option<GlobalScript.Statements> stmts;
Option<Absyn.Program> prog;
GlobalScript.SymbolTable st;
algorithm
Print.clearBuf();

(outContinue, outResult, outSymbolTable) :=
matchcontinue(inCommand, inSymbolTable)
local
Option<GlobalScript.Statements> stmts;
Option<Absyn.Program> prog;
GlobalScript.SymbolTable st;
String result;

case (_, _)
equation
true = Util.strncmp("quit()", inCommand, 6);
then
(false, "Ok\n", inSymbolTable);

else
equation
(stmts, prog) = parseCommand(inCommand);
(result, st) = handleCommand2(stmts, prog, inCommand, inSymbolTable);
result = makeDebugResult(Flags.DUMP, result);
result = makeDebugResult(Flags.DUMP_GRAPHVIZ, result);
then
(true, result, st);

end matchcontinue;
if Util.strncmp("quit()", inCommand, 6) then
outContinue := false;
outResult := "Ok\n";
else
outContinue := true;

(stmts, prog) := parseCommand(inCommand);
(outResult, outSymbolTable) := handleCommand2(stmts, prog, inCommand, outSymbolTable);
outResult := makeDebugResult(Flags.DUMP, outResult);
outResult := makeDebugResult(Flags.DUMP_GRAPHVIZ, outResult);
end if;
end handleCommand;

protected function handleCommand2
Expand Down Expand Up @@ -945,4 +934,3 @@ end main2;

annotation(__OpenModelica_Interface="backend");
end Main;

0 comments on commit 9663605

Please sign in to comment.