Skip to content
This repository has been archived by the owner on Feb 26, 2022. It is now read-only.
/ rant3 Public archive

Commit

Permalink
Remove useless second stack from main loop
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicholas Fleck committed Jul 25, 2016
1 parent 9027eda commit 897259e
Showing 1 changed file with 0 additions and 14 deletions.
14 changes: 0 additions & 14 deletions Rant/Core/Sandbox.cs
Original file line number Diff line number Diff line change
Expand Up @@ -262,12 +262,6 @@ public BlockAttribs NextAttribs(RABlock block)

public void SetYield() => shouldYield = true;

public RantOutput EvalPattern(double timeout, RantPattern pattern)
{
_outputs.Push(new OutputWriter(this));
return Run(timeout, pattern);
}

public RantOutput Run(double timeout, RantPattern pattern = null)
{
lock (_patternArgs ?? fallbackArgsLockObj)
Expand All @@ -285,12 +279,10 @@ public RantOutput Run(double timeout, RantPattern pattern = null)

_scriptObjectStack.Clear();
var callStack = new Stack<IEnumerator<RantAction>>();
var actionStack = new Stack<RantAction>();
IEnumerator<RantAction> action;

// Push the AST root
CurrentAction = pattern.Action;
actionStack.Push(CurrentAction);
callStack.Push(pattern.Action.Run(this));

top:
Expand All @@ -314,14 +306,12 @@ public RantOutput Run(double timeout, RantPattern pattern = null)

// Push child node onto stack and start over
CurrentAction = action.Current;
actionStack.Push(CurrentAction);
callStack.Push(CurrentAction.Run(this));
goto top;
}

// Remove node once finished
callStack.Pop();
actionStack.Pop();
}

if (!stopwatchAlreadyRunning) _stopwatch.Stop();
Expand All @@ -347,12 +337,10 @@ public IEnumerable<RantOutput> RunSerial(double timeout, RantPattern pattern = n

_scriptObjectStack.Clear();
var callStack = new Stack<IEnumerator<RantAction>>();
var actionStack = new Stack<RantAction>();
IEnumerator<RantAction> action;

// Push the AST root
CurrentAction = pattern.Action;
actionStack.Push(CurrentAction);
callStack.Push(pattern.Action.Run(this));

top:
Expand All @@ -376,7 +364,6 @@ public IEnumerable<RantOutput> RunSerial(double timeout, RantPattern pattern = n

// Push child node onto stack and start over
CurrentAction = action.Current;
actionStack.Push(CurrentAction);
callStack.Push(CurrentAction.Run(this));
goto top;
}
Expand All @@ -390,7 +377,6 @@ public IEnumerable<RantOutput> RunSerial(double timeout, RantPattern pattern = n

// Remove node once finished
callStack.Pop();
actionStack.Pop();
}

if (!stopwatchAlreadyRunning) _stopwatch.Stop();
Expand Down

0 comments on commit 897259e

Please sign in to comment.