diff options
| author | dgp <dgp@users.sourceforge.net> | 2018-03-01 20:07:29 (GMT) |
|---|---|---|
| committer | dgp <dgp@users.sourceforge.net> | 2018-03-01 20:07:29 (GMT) |
| commit | 683dada2173aaa8eb39f76d13d7e9505e77ec5b7 (patch) | |
| tree | 5a27431ecf6050acbf85c273d5258502794aa5e9 | |
| parent | 2cd8bf554e767af28e60465bb3f683399421e0f6 (diff) | |
| download | tcl-683dada2173aaa8eb39f76d13d7e9505e77ec5b7.zip tcl-683dada2173aaa8eb39f76d13d7e9505e77ec5b7.tar.gz tcl-683dada2173aaa8eb39f76d13d7e9505e77ec5b7.tar.bz2 | |
Some comments info for the next folks who come wandering in.
| -rw-r--r-- | generic/tclCompCmdsGR.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/generic/tclCompCmdsGR.c b/generic/tclCompCmdsGR.c index aa0f7bb..375653b 100644 --- a/generic/tclCompCmdsGR.c +++ b/generic/tclCompCmdsGR.c @@ -1425,7 +1425,19 @@ TclCompileLinsertCmd( } else if (idx == TCL_INDEX_END /*end*/) { TclEmitOpcode( INST_LIST_CONCAT, envPtr); } else { - if (idx < 0) { + /* + * Here we handle two ranges for idx. First when idx > 0, we + * want the first half of the split to end at index idx-1 and + * the second half to start at index idx. + * Second when idx < TCL_INDEX_END, indicating "end-N" indexing, + * we want the first half of the split to end at index end-N and + * the second half to start at index end-N+1. We accomplish this + * with a pre-adjustment of the end-N value. + * The root of this is that the commands [lrange] and [linsert] + * differ in their interpretation of the "end" index. + */ + + if (idx < TCL_INDEX_END) { idx++; } TclEmitInstInt4( INST_OVER, 1, envPtr); |
