diff options
| author | dgp@users.sourceforge.net <dgp> | 2013-09-19 16:41:04 (GMT) |
|---|---|---|
| committer | dgp@users.sourceforge.net <dgp> | 2013-09-19 16:41:04 (GMT) |
| commit | 0d6589a89391d354922c62ebe7363f88933a4162 (patch) | |
| tree | d4c31e2e16495e07b1372e8a4d4fe71c7a17bac8 | |
| parent | 8c15c8740fe9ff14b0ed366f0813b40bfbcbcc53 (diff) | |
| parent | 2c18f7d6d25eae0bee90b9f37bda2d61b34bd7a1 (diff) | |
| download | tcl-0d6589a89391d354922c62ebe7363f88933a4162.zip tcl-0d6589a89391d354922c62ebe7363f88933a4162.tar.gz tcl-0d6589a89391d354922c62ebe7363f88933a4162.tar.bz2 | |
Line numbers wrong in compiled [global] and [variable].
| -rw-r--r-- | generic/tclCompCmdsGR.c | 10 | ||||
| -rw-r--r-- | tests/upvar.test | 10 |
2 files changed, 18 insertions, 2 deletions
diff --git a/generic/tclCompCmdsGR.c b/generic/tclCompCmdsGR.c index a61fc85..4e4a3af 100644 --- a/generic/tclCompCmdsGR.c +++ b/generic/tclCompCmdsGR.c @@ -85,14 +85,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 value can pass throug the + * IndexTailVarIfKnown() screen. Full CompileWord() + * likely does not apply here. Push known value instead. */ + CompileWord(envPtr, varTokenPtr, interp, i); TclEmitInstInt4( INST_NSUPVAR, localIndex, envPtr); } @@ -2706,6 +2709,9 @@ TclCompileVariableCmd( return TCL_ERROR; } + /* TODO: Consider what value can pass throug the + * IndexTailVarIfKnown() screen. Full CompileWord() + * likely does not apply here. Push known value instead. */ CompileWord(envPtr, varTokenPtr, interp, i); TclEmitInstInt4( INST_VARIABLE, localIndex, envPtr); diff --git a/tests/upvar.test b/tests/upvar.test index 9cbfd05..e93f58a 100644 --- a/tests/upvar.test +++ b/tests/upvar.test @@ -568,6 +568,16 @@ test upvar-NS-3.2 {CompileWord OBOE} -setup { } -cleanup { rename linenumber {} } -result 1 +test upvar-NS-3.3 {CompileWord OBOE} -setup { + proc linenumber {} {dict get [info frame -1] line} +} -body { + apply {n { + variable x {*}{ + } [return [incr n -[linenumber]]] + }} [linenumber] +} -cleanup { + rename linenumber {} +} -result 1 # cleanup |
