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 | a47b03577bd612657a8cc1c7844231c00bc6d313 (patch) | |
tree | 82699e23c1e4be781989104cb532b5d991bf2a8e /generic/tclAssembly.c | |
parent | fda71d6d4c938b74bb2884adfce17427a7534e51 (diff) | |
download | tcl-a47b03577bd612657a8cc1c7844231c00bc6d313.zip tcl-a47b03577bd612657a8cc1c7844231c00bc6d313.tar.gz tcl-a47b03577bd612657a8cc1c7844231c00bc6d313.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; } /* |