summaryrefslogtreecommitdiffstats
path: root/generic/tclCompCmds.c
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2014-12-11 14:40:02 (GMT)
committerdgp <dgp@users.sourceforge.net>2014-12-11 14:40:02 (GMT)
commitc5f0eae368ab6a18f4d21796385e963adcd3cf34 (patch)
tree7c5212ffebab801b26c0d828b56d8f1b28eec876 /generic/tclCompCmds.c
parent2f98d437c6f6fe174b88cd5e65eba288e0f3128a (diff)
downloadtcl-c5f0eae368ab6a18f4d21796385e963adcd3cf34.zip
tcl-c5f0eae368ab6a18f4d21796385e963adcd3cf34.tar.gz
tcl-c5f0eae368ab6a18f4d21796385e963adcd3cf34.tar.bz2
[e711ffb458] Same conversion for [catch] compiler.
Diffstat (limited to 'generic/tclCompCmds.c')
-rw-r--r--generic/tclCompCmds.c43
1 files changed, 7 insertions, 36 deletions
diff --git a/generic/tclCompCmds.c b/generic/tclCompCmds.c
index ec22f65..10cba39 100644
--- a/generic/tclCompCmds.c
+++ b/generic/tclCompCmds.c
@@ -379,8 +379,7 @@ TclCompileCatchCmd(
{
JumpFixup jumpFixup;
Tcl_Token *cmdTokenPtr, *resultNameTokenPtr, *optsNameTokenPtr;
- const char *name;
- int resultIndex, optsIndex, nameChars, range;
+ int resultIndex, optsIndex, isSimple, isScalar, range;
int initStackDepth = envPtr->currStackDepth;
int savedStackDepth;
DefineLineInformation; /* TIP #280 */
@@ -395,15 +394,6 @@ TclCompileCatchCmd(
}
/*
- * If variables were specified and the catch command is at global level
- * (not in a procedure), don't compile it inline: the payoff is too small.
- */
-
- if ((parsePtr->numWords >= 3) && (envPtr->procPtr == NULL)) {
- return TCL_ERROR;
- }
-
- /*
* Make sure the variable names, if any, have no substitutions and just
* refer to local scalars.
*/
@@ -412,36 +402,17 @@ TclCompileCatchCmd(
cmdTokenPtr = TokenAfter(parsePtr->tokenPtr);
if (parsePtr->numWords >= 3) {
resultNameTokenPtr = TokenAfter(cmdTokenPtr);
- /* DGP */
- if (resultNameTokenPtr->type != TCL_TOKEN_SIMPLE_WORD) {
+ PushVarNameWord(interp, resultNameTokenPtr, envPtr, TCL_CREATE_VAR,
+ &resultIndex, &isSimple, &isScalar, 2);
+ if (!isScalar || resultIndex < 0) {
return TCL_ERROR;
}
- name = resultNameTokenPtr[1].start;
- nameChars = resultNameTokenPtr[1].size;
- if (!TclIsLocalScalar(name, nameChars)) {
- return TCL_ERROR;
- }
- resultIndex = TclFindCompiledLocal(resultNameTokenPtr[1].start,
- resultNameTokenPtr[1].size, /*create*/ 1, envPtr->procPtr);
- if (resultIndex < 0) {
- return TCL_ERROR;
- }
-
- /* DKF */
if (parsePtr->numWords == 4) {
optsNameTokenPtr = TokenAfter(resultNameTokenPtr);
- if (optsNameTokenPtr->type != TCL_TOKEN_SIMPLE_WORD) {
- return TCL_ERROR;
- }
- name = optsNameTokenPtr[1].start;
- nameChars = optsNameTokenPtr[1].size;
- if (!TclIsLocalScalar(name, nameChars)) {
- return TCL_ERROR;
- }
- optsIndex = TclFindCompiledLocal(optsNameTokenPtr[1].start,
- optsNameTokenPtr[1].size, /*create*/ 1, envPtr->procPtr);
- if (optsIndex < 0) {
+ PushVarNameWord(interp, optsNameTokenPtr, envPtr, TCL_CREATE_VAR,
+ &optsIndex, &isSimple, &isScalar, 2);
+ if (!isScalar || resultIndex < 0) {
return TCL_ERROR;
}
}