Skip to content

Commit

Permalink
Hack to make block skipping work on single-statement ifs
Browse files Browse the repository at this point in the history
  • Loading branch information
ethanmoffat committed Feb 5, 2022
1 parent f9d38b6 commit 15395a2
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions EOBot/Interpreter/States/IfEvaluator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ public override async Task<(EvalResult, string, BotToken)> EvaluateAsync(Program
SkipBlock(input);
}

// hack: put the \n token back since StatementList/Statement will have consumed it
if (input.Program[input.ExecutionIndex - 1].TokenType == BotTokenType.NewLine)
input.Goto(input.ExecutionIndex - 1);

return elseIfRes;
}

Expand Down

0 comments on commit 15395a2

Please sign in to comment.