summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2014-08-01 17:18:21 (GMT)
committerdgp <dgp@users.sourceforge.net>2014-08-01 17:18:21 (GMT)
commit1b69ea0743abc137b40161caf7290fa4d9a3d8d0 (patch)
tree3338f77bf7fb236e28225d6f3aa17202345755cc /generic
parentff30cedb97a7408223c44f6168153f2185169f6b (diff)
parentd6128e2e73aa4d49417ff9beddd89216f0df77db (diff)
downloadtcl-1b69ea0743abc137b40161caf7290fa4d9a3d8d0.zip
tcl-1b69ea0743abc137b40161caf7290fa4d9a3d8d0.tar.gz
tcl-1b69ea0743abc137b40161caf7290fa4d9a3d8d0.tar.bz2
merge trunk
Diffstat (limited to 'generic')
-rw-r--r--generic/tclEnsemble.c36
-rw-r--r--generic/tclLoadNone.c4
2 files changed, 38 insertions, 2 deletions
diff --git a/generic/tclEnsemble.c b/generic/tclEnsemble.c
index 022dafa..473c4bb 100644
--- a/generic/tclEnsemble.c
+++ b/generic/tclEnsemble.c
@@ -2749,6 +2749,7 @@ TclCompileEnsemble(
int ourResult = TCL_ERROR;
unsigned numBytes;
const char *word;
+ DefineLineInformation;
Tcl_IncrRefCount(replaced);
if (parsePtr->numWords < depth + 1) {
@@ -3008,6 +3009,23 @@ TclCompileEnsemble(
}
/*
+ * 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;
+ }
+
+ /*
+ * Reset the index of next command. Toss out any from failed nested
+ * partial compiles.
+ */
+
+ envPtr->numCommands = mapPtr->nuloc;
+
+ /*
* Failed to do a full compile for some reason. Try to do a direct invoke
* instead of going through the ensemble lookup process again.
*/
@@ -3019,8 +3037,24 @@ TclCompileEnsemble(
cmdPtr = oldCmdPtr;
depth--;
}
- (void) Tcl_ListObjReplace(NULL, replaced, depth, 2, 0, NULL);
}
+ /*
+ * The length of the "replaced" list must be depth-1. Trim back
+ * any extra elements that might have been appended by failing
+ * pathways above.
+ */
+ (void) Tcl_ListObjReplace(NULL, replaced, depth-1, INT_MAX, 0, NULL);
+
+ /*
+ * TODO: Reconsider whether we ought to call CompileToInvokedCommand()
+ * when depth==1. In that case we are choosing to emit the
+ * INST_INVOKE_REPLACE bytecode when there is in fact no replacing
+ * to be done. It would be equally functional and presumably more
+ * performant to fall through to cleanup below, return TCL_ERROR,
+ * and let the compiler harness emit the INST_INVOKE_STK
+ * implementation for us.
+ */
+
CompileToInvokedCommand(interp, parsePtr, replaced, cmdPtr, envPtr);
ourResult = TCL_OK;
}
diff --git a/generic/tclLoadNone.c b/generic/tclLoadNone.c
index c22c4c4..6cb4378 100644
--- a/generic/tclLoadNone.c
+++ b/generic/tclLoadNone.c
@@ -104,7 +104,9 @@ TclpLoadMemory(
int size, /* Dummy: unused by this implementation */
int codeSize, /* Dummy: unused by this implementation */
Tcl_LoadHandle *loadHandle, /* Dummy: unused by this implementation */
- Tcl_FSUnloadFileProc **unloadProcPtr)
+ Tcl_FSUnloadFileProc **unloadProcPtr,
+ /* Dummy: unused by this implementation */
+ int flags)
/* Dummy: unused by this implementation */
{
Tcl_SetObjResult(interp, Tcl_NewStringObj("dynamic loading from memory "