summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2013-09-19 16:33:36 (GMT)
committerdgp <dgp@users.sourceforge.net>2013-09-19 16:33:36 (GMT)
commit44d124101c6297b356f7de3917c4d0666b8a0e31 (patch)
treef49caee0b0f406649f1cc264fbb507d72a762bb8 /generic
parentc057be2da7fa9708565dfbf205fede984267ea30 (diff)
downloadtcl-44d124101c6297b356f7de3917c4d0666b8a0e31.zip
tcl-44d124101c6297b356f7de3917c4d0666b8a0e31.tar.gz
tcl-44d124101c6297b356f7de3917c4d0666b8a0e31.tar.bz2
Line numbers wrong in compiled [global] and [variable].
Diffstat (limited to 'generic')
-rw-r--r--generic/tclCompCmds.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/generic/tclCompCmds.c b/generic/tclCompCmds.c
index 8e26a30..809a6c6 100644
--- a/generic/tclCompCmds.c
+++ b/generic/tclCompCmds.c
@@ -6007,14 +6007,17 @@ TclCompileGlobalCmd(
*/
varTokenPtr = TokenAfter(parsePtr->tokenPtr);
- for(i=2; i<=numWords; varTokenPtr = TokenAfter(varTokenPtr),i++) {
+ for(i=1; i<numWords; varTokenPtr = TokenAfter(varTokenPtr),i++) {
localIndex = IndexTailVarIfKnown(interp, varTokenPtr, envPtr);
if(localIndex < 0) {
return TCL_ERROR;
}
- CompileWord(envPtr, varTokenPtr, interp, 1);
+ /* TODO: Consider what values can pass through the
+ * IndexTailVarIfKnown() screen. Full CompileWord()
+ * likely does not apply here. Push known value instead. */
+ CompileWord(envPtr, varTokenPtr, interp, i);
TclEmitInstInt4(INST_NSUPVAR, localIndex, envPtr);
}
@@ -6076,7 +6079,7 @@ TclCompileVariableCmd(
*/
valueTokenPtr = parsePtr->tokenPtr;
- for(i=2; i<=numWords; i+=2) {
+ for(i=1; i<numWords; i+=2) {
varTokenPtr = TokenAfter(valueTokenPtr);
valueTokenPtr = TokenAfter(varTokenPtr);
@@ -6086,15 +6089,18 @@ TclCompileVariableCmd(
return TCL_ERROR;
}
- CompileWord(envPtr, varTokenPtr, interp, 1);
+ /* TODO: Consider what values can pass through the
+ * IndexTailVarIfKnown() screen. Full CompileWord()
+ * likely does not apply here. Push known value instead. */
+ CompileWord(envPtr, varTokenPtr, interp, i);
TclEmitInstInt4(INST_VARIABLE, localIndex, envPtr);
- if (i != numWords) {
+ if (i != numWords-1) {
/*
* A value has been given: set the variable, pop the value
*/
- CompileWord(envPtr, valueTokenPtr, interp, 1);
+ CompileWord(envPtr, valueTokenPtr, interp, i+1);
TclEmitInstInt4(INST_STORE_SCALAR4, localIndex, envPtr);
TclEmitOpcode(INST_POP, envPtr);
}