summaryrefslogtreecommitdiffstats
path: root/generic/tclCompile.c
diff options
context:
space:
mode:
Diffstat (limited to 'generic/tclCompile.c')
-rw-r--r--generic/tclCompile.c39
1 files changed, 29 insertions, 10 deletions
diff --git a/generic/tclCompile.c b/generic/tclCompile.c
index afe34b0..777c03e 100644
--- a/generic/tclCompile.c
+++ b/generic/tclCompile.c
@@ -1787,7 +1787,8 @@ CompileInvocation(
CompileEnv *envPtr)
{
int isnew, wordIdx = 0;
- ExtCmdLoc *eclPtr = envPtr->extCmdMapPtr;
+// ExtCmdLoc *eclPtr = envPtr->extCmdMapPtr;
+ DefineLineInformation;
if (cmdObj) {
CompileCmdLiteral(interp, cmdObj, envPtr);
@@ -1798,8 +1799,9 @@ CompileInvocation(
for (; wordIdx < numWords; wordIdx++, tokenPtr = TokenAfter(tokenPtr)) {
int objIdx;
- envPtr->line = eclPtr->loc[wlineat].line[wordIdx];
- envPtr->clNext = eclPtr->loc[wlineat].next[wordIdx];
+// envPtr->line = eclPtr->loc[wlineat].line[wordIdx];
+// envPtr->clNext = eclPtr->loc[wlineat].next[wordIdx];
+ SetLineInformation(wordIdx);
if (tokenPtr->type != TCL_TOKEN_SIMPLE_WORD) {
CompileTokens(envPtr, tokenPtr, interp);
@@ -1811,7 +1813,8 @@ CompileInvocation(
if (envPtr->clNext) {
TclContinuationsEnterDerived(TclFetchLiteral(envPtr, objIdx),
tokenPtr[1].start - envPtr->source,
- eclPtr->loc[wlineat].next[wordIdx]);
+// eclPtr->loc[wlineat].next[wordIdx]);
+ mapPtr->loc[eclIndex].next[wordIdx]);
}
TclEmitPush(objIdx, envPtr);
}
@@ -1820,9 +1823,11 @@ CompileInvocation(
* Save PC -> command map for the TclArgumentBC* functions.
*/
- Tcl_SetHashValue(Tcl_CreateHashEntry(&eclPtr->litInfo,
+// Tcl_SetHashValue(Tcl_CreateHashEntry(&eclPtr->litInfo,
+ Tcl_SetHashValue(Tcl_CreateHashEntry(&mapPtr->litInfo,
INT2PTR(envPtr->codeNext - envPtr->codeStart), &isnew),
- INT2PTR(wlineat));
+// INT2PTR(wlineat));
+ INT2PTR(eclIndex));
if (wordIdx <= 255) {
TclEmitInstInt1(INST_INVOKE_STK1, wordIdx, envPtr);
@@ -1841,7 +1846,9 @@ CompileExpanded(
CompileEnv *envPtr)
{
int wordIdx = 0;
- ExtCmdLoc *eclPtr = envPtr->extCmdMapPtr;
+ DefineLineInformation;
+// ExtCmdLoc *eclPtr = envPtr->extCmdMapPtr;
+
StartExpanding(envPtr);
if (cmdObj) {
@@ -1853,8 +1860,9 @@ CompileExpanded(
for (; wordIdx < numWords; wordIdx++, tokenPtr = TokenAfter(tokenPtr)) {
int objIdx;
- envPtr->line = eclPtr->loc[wlineat].line[wordIdx];
- envPtr->clNext = eclPtr->loc[wlineat].next[wordIdx];
+ SetLineInformation(wordIdx);
+// envPtr->line = eclPtr->loc[wlineat].line[wordIdx];
+// envPtr->clNext = eclPtr->loc[wlineat].next[wordIdx];
if (tokenPtr->type != TCL_TOKEN_SIMPLE_WORD) {
CompileTokens(envPtr, tokenPtr, interp);
@@ -1870,7 +1878,8 @@ CompileExpanded(
if (envPtr->clNext) {
TclContinuationsEnterDerived(TclFetchLiteral(envPtr, objIdx),
tokenPtr[1].start - envPtr->source,
- eclPtr->loc[wlineat].next[wordIdx]);
+// eclPtr->loc[wlineat].next[wordIdx]);
+ mapPtr->loc[eclIndex].next[wordIdx]);
}
TclEmitPush(objIdx, envPtr);
}
@@ -1998,6 +2007,16 @@ CompileCmdCompileProc(
envPtr->codeNext = envPtr->codeStart + startCodeOffset;
envPtr->currStackDepth = startStackDepth;
+ /*
+ * Throw out any line information generated by the failed
+ * compile attempt.
+ */
+ while (mapPtr->nuloc - 1 > eclIndex) {
+ mapPtr->nuloc--;
+ ckfree(mapPtr->loc[mapPtr->nuloc].line);
+ mapPtr->loc[mapPtr->nuloc].line = NULL;
+ }
+
SetLineInformation(0);
return TCL_ERROR;
}