summaryrefslogtreecommitdiffstats
path: root/generic/tclCompCmds.c
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2013-06-03 09:37:14 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2013-06-03 09:37:14 (GMT)
commitae411458670d6ca50c9516ed742f9b06855637a9 (patch)
treed80bc0f5102c3fc108c590e5e6011d1a5dcd7c07 /generic/tclCompCmds.c
parentc72504b5e8f17039d8438be6e3f41d5b8e2928eb (diff)
downloadtcl-ae411458670d6ca50c9516ed742f9b06855637a9.zip
tcl-ae411458670d6ca50c9516ed742f9b06855637a9.tar.gz
tcl-ae411458670d6ca50c9516ed742f9b06855637a9.tar.bz2
Generate [continue] optimally in [for] next clauses. Add tests for Bug 3614226.
Diffstat (limited to 'generic/tclCompCmds.c')
-rw-r--r--generic/tclCompCmds.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/generic/tclCompCmds.c b/generic/tclCompCmds.c
index f2d2963..3046841 100644
--- a/generic/tclCompCmds.c
+++ b/generic/tclCompCmds.c
@@ -491,7 +491,7 @@ TclCompileBreakCmd(
* Find the innermost exception range that contains this command.
*/
- rangePtr = TclGetInnermostExceptionRange(envPtr, &auxPtr);
+ rangePtr = TclGetInnermostExceptionRange(envPtr, TCL_BREAK, &auxPtr);
if (rangePtr && rangePtr->type == LOOP_EXCEPTION_RANGE) {
int toPop = envPtr->currStackDepth - auxPtr->stackDepth;
@@ -505,14 +505,13 @@ TclCompileBreakCmd(
toPop--;
}
- if (envPtr->expandCount == 0) {
+ if (envPtr->expandCount == auxPtr->expandTarget) {
/*
* Found the target! Also, no built-up expansion stack. No need
* for a nasty INST_BREAK here.
*/
TclAddLoopBreakFixup(envPtr, auxPtr);
- TclEmitInstInt4(INST_JUMP4, 0, envPtr);
goto done;
}
}
@@ -839,7 +838,7 @@ TclCompileContinueCmd(
* innermost containing exception range.
*/
- rangePtr = TclGetInnermostExceptionRange(envPtr, &auxPtr);
+ rangePtr = TclGetInnermostExceptionRange(envPtr, TCL_CONTINUE, &auxPtr);
if (rangePtr && rangePtr->type == LOOP_EXCEPTION_RANGE) {
int toPop = envPtr->currStackDepth - auxPtr->stackDepth;
@@ -853,14 +852,13 @@ TclCompileContinueCmd(
toPop--;
}
- if (envPtr->expandCount == 0) {
+ if (envPtr->expandCount == auxPtr->expandTarget) {
/*
* Found the target! Also, no built-up expansion stack. No need
* for a nasty INST_CONTINUE here.
*/
TclAddLoopContinueFixup(envPtr, auxPtr);
- TclEmitInstInt4(INST_JUMP4, 0, envPtr);
goto done;
}
}
@@ -2467,6 +2465,7 @@ TclCompileForCmd(
*/
nextRange = TclCreateExceptRange(LOOP_EXCEPTION_RANGE, envPtr);
+ envPtr->exceptAuxArrayPtr[nextRange].supportsContinue = 0;
envPtr->currStackDepth = savedStackDepth;
nextCodeOffset = ExceptionRangeStarts(envPtr, nextRange);
SetLineInformation(3);