diff options
author | dgp <dgp@users.sourceforge.net> | 2013-06-27 20:10:41 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2013-06-27 20:10:41 (GMT) |
commit | 7924f4a694c43ca8fe4260041d090795b0791a96 (patch) | |
tree | 82699e23c1e4be781989104cb532b5d991bf2a8e /generic/tclAssembly.c | |
parent | 59dda187056234f42857543990b47682bb686732 (diff) | |
download | tcl-7924f4a694c43ca8fe4260041d090795b0791a96.zip tcl-7924f4a694c43ca8fe4260041d090795b0791a96.tar.gz tcl-7924f4a694c43ca8fe4260041d090795b0791a96.tar.bz2 |
Stop the compileProc routines leaving behind error messages in interp.
(Nicer way to solve [Bug 20a81392ec].) Make simplifications in
TclCompileScript() make possible by the new structure. Still a work
in progress.
Diffstat (limited to 'generic/tclAssembly.c')
-rw-r--r-- | generic/tclAssembly.c | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/generic/tclAssembly.c b/generic/tclAssembly.c index 62641e6..1a061f0 100644 --- a/generic/tclAssembly.c +++ b/generic/tclAssembly.c @@ -930,6 +930,12 @@ TclCompileAssembleCmd( { Tcl_Token *tokenPtr; /* Token in the input script */ +#if 0 + int numCommands = envPtr->numCommands; + int offset = envPtr->codeNext - envPtr->codeStart; + int depth = envPtr->currStackDepth; +#endif + /* * Make sure that the command has a single arg that is a simple word. */ @@ -943,10 +949,32 @@ TclCompileAssembleCmd( } /* - * Compile the code and return any error from the compilation. + * Compile the code and convert any error from the compilation into + * bytecode reporting the error; */ - return TclAssembleCode(envPtr, tokenPtr[1].start, tokenPtr[1].size, 0); + if (TCL_ERROR == TclAssembleCode(envPtr, tokenPtr[1].start, + tokenPtr[1].size, TCL_EVAL_DIRECT)) { + + /* + * TODO: Finish working out how to capture syntax errors captured + * during compile and make them bytecode reporting the error. + */ +#if 0 + Tcl_AppendObjToErrorInfo(interp, Tcl_ObjPrintf( + "\n (\"%.*s\" body, line %d)", + parsePtr->tokenPtr->size, parsePtr->tokenPtr->start, + Tcl_GetErrorLine(interp))); + envPtr->numCommands = numCommands; + envPtr->codeNext = envPtr->codeStart + offset; + envPtr->currStackDepth = depth; + TclCompileSyntaxError(interp, envPtr); +#else + Tcl_ResetResult(interp); + return TCL_ERROR; +#endif + } + return TCL_OK; } /* |