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:
parent
a4f2345811
commit
57ce5fd4c6
4
parse.c
4
parse.c
|
@ -307,7 +307,7 @@ enum RunMode ParseBlock(struct ParseState *Parser, int AbsorbOpenBrace, int Cond
|
||||||
if (AbsorbOpenBrace && LexGetToken(Parser, NULL, TRUE) != TokenLeftBrace)
|
if (AbsorbOpenBrace && LexGetToken(Parser, NULL, TRUE) != TokenLeftBrace)
|
||||||
ProgramFail(Parser, "'{' expected");
|
ProgramFail(Parser, "'{' expected");
|
||||||
|
|
||||||
if (Parser->Mode != RunModeSkip && !Condition)
|
if (Parser->Mode == RunModeSkip || !Condition)
|
||||||
{
|
{
|
||||||
/* condition failed - skip this block instead */
|
/* condition failed - skip this block instead */
|
||||||
enum RunMode OldMode = Parser->Mode;
|
enum RunMode OldMode = Parser->Mode;
|
||||||
|
@ -494,7 +494,7 @@ enum ParseResult ParseStatement(struct ParseState *Parser, int CheckTrailingSemi
|
||||||
Parser->Mode = RunModeCaseSearch;
|
Parser->Mode = RunModeCaseSearch;
|
||||||
Parser->SearchLabel = Condition;
|
Parser->SearchLabel = Condition;
|
||||||
|
|
||||||
ParseBlock(Parser, TRUE, TRUE);
|
ParseBlock(Parser, TRUE, OldMode != RunModeSkip);
|
||||||
|
|
||||||
Parser->Mode = OldMode;
|
Parser->Mode = OldMode;
|
||||||
Parser->SearchLabel = OldSearchLabel;
|
Parser->SearchLabel = OldSearchLabel;
|
||||||
|
|
Loading…
Reference in a new issue