summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authordgp <dgp@noemail.net>2014-08-01 17:18:21 (GMT)
committerdgp <dgp@noemail.net>2014-08-01 17:18:21 (GMT)
commit9e9dda59bfc203d6ba0ec35eb2d02d9f052f87b7 (patch)
treef2ff6b57e1858192110fc87fd7fa9ecf26769e0c /generic
parentf2832262bd606cec6a64776c1b076f1983802807 (diff)
parent604ce339610360b1ea3042e694c74a0ec89e1a3a (diff)
downloadtcl-9e9dda59bfc203d6ba0ec35eb2d02d9f052f87b7.zip
tcl-9e9dda59bfc203d6ba0ec35eb2d02d9f052f87b7.tar.gz
tcl-9e9dda59bfc203d6ba0ec35eb2d02d9f052f87b7.tar.bz2
merge trunk
FossilOrigin-Name: 4f6076a7d93cc25874aa6f10a884fb1279ebb64e
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 "