Commit 6809e059 authored by Roman Pišl's avatar Roman Pišl Committed by Alexandre Julliard

cmd: Fix handling of nested if-for expressions on a single line.

parent 7ac196aa
......@@ -1599,8 +1599,14 @@ static void WCMD_part_execute(CMD_LIST **cmdList, const WCHAR *firstcmd,
the same bracket depth as the IF, then the IF statement is over. This is required
to handle nested ifs properly */
} else if (isIF && (*cmdList)->bracketDepth == myDepth) {
static const WCHAR doW[] = {'d','o'};
if (WCMD_keyword_ws_found(doW, ARRAY_SIZE(doW), (*cmdList)->command)) {
WINE_TRACE("Still inside FOR-loop, not an end of IF statement\n");
*cmdList = (*cmdList)->nextcommand;
} else {
WINE_TRACE("Found end of this nested IF statement, ending this if\n");
break;
}
} else if (!processThese) {
if (curPosition == *cmdList) *cmdList = (*cmdList)->nextcommand;
WINE_TRACE("Skipping this command, as in not process mode (next = %p)\n", *cmdList);
......
......@@ -1242,6 +1242,10 @@ goto :eof
set WINE_STR_PARMS=
set WINE_INT_PARMS=
echo ------------ Testing if/for ------------
if ""=="" for %%i in (A) DO (echo %%i)
if not ""=="" for %%i in (B) DO (echo %%i)
echo ------------ Testing for ------------
echo --- plain FOR
for %%i in (A B C) do echo %%i
......
......@@ -914,6 +914,8 @@ x@space@
---
x@space@
---
------------ Testing if/for ------------
A
------------ Testing for ------------
--- plain FOR
A
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment