Fixed a problem with accidentally running the first case in a switch when

running in skip mode.
Bug report #71


git-svn-id: http://picoc.googlecode.com/svn/trunk@407 21eae674-98b7-11dd-bd71-f92a316d2d60
This commit is contained in:
zik.saleeba 2010-02-25 21:25:05 +00:00
parent a4f2345811
commit 57ce5fd4c6

View file

@ -307,7 +307,7 @@ enum RunMode ParseBlock(struct ParseState *Parser, int AbsorbOpenBrace, int Cond
if (AbsorbOpenBrace && LexGetToken(Parser, NULL, TRUE) != TokenLeftBrace)
ProgramFail(Parser, "'{' expected");
if (Parser->Mode != RunModeSkip && !Condition)
if (Parser->Mode == RunModeSkip || !Condition)
{
/* condition failed - skip this block instead */
enum RunMode OldMode = Parser->Mode;
@ -494,7 +494,7 @@ enum ParseResult ParseStatement(struct ParseState *Parser, int CheckTrailingSemi
Parser->Mode = RunModeCaseSearch;
Parser->SearchLabel = Condition;
ParseBlock(Parser, TRUE, TRUE);
ParseBlock(Parser, TRUE, OldMode != RunModeSkip);
Parser->Mode = OldMode;
Parser->SearchLabel = OldSearchLabel;