cmd: Fix handling of nested if-for expressions on a single line.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50641
Signed-off-by: Roman Pišl <rpisl@seznam.cz>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
(cherry picked from commit 6809e0599e
)
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
This commit is contained in:
parent
d0a38a32c7
commit
907c5a2135
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue