summaryrefslogtreecommitdiffstats
path: root/generic/tclAssembly.c
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2018-03-11 12:33:16 (GMT)
committerdgp <dgp@users.sourceforge.net>2018-03-11 12:33:16 (GMT)
commitc7e8d507d9233725a4629931bbceeea7ac23f699 (patch)
treecedf1bdd26675be6cadb2414a4057c19611f5868 /generic/tclAssembly.c
parentcb242c0d50a43eddaa567d50717b5367658eb934 (diff)
parente7be4a19a0cdf781b241095a0aba272ff7b35ffd (diff)
downloadtcl-c7e8d507d9233725a4629931bbceeea7ac23f699.zip
tcl-c7e8d507d9233725a4629931bbceeea7ac23f699.tar.gz
tcl-c7e8d507d9233725a4629931bbceeea7ac23f699.tar.bz2
merge 8.7
Diffstat (limited to 'generic/tclAssembly.c')
-rw-r--r--generic/tclAssembly.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/generic/tclAssembly.c b/generic/tclAssembly.c
index 82071b2..f990852 100644
--- a/generic/tclAssembly.c
+++ b/generic/tclAssembly.c
@@ -2244,23 +2244,24 @@ GetListIndexOperand(
Tcl_Token* tokenPtr = *tokenPtrPtr;
/* INOUT: Pointer to the next token in the
* source code */
- Tcl_Obj* intObj; /* Integer from the source code */
- int status; /* Tcl status return */
-
- /*
- * Extract the next token as a string.
- */
+ Tcl_Obj *value;
+ int status;
- if (GetNextOperand(assemEnvPtr, tokenPtrPtr, &intObj) != TCL_OK) {
+ /* General operand validity check */
+ if (GetNextOperand(assemEnvPtr, tokenPtrPtr, &value) != TCL_OK) {
return TCL_ERROR;
}
-
+
+ /* Convert to an integer, advance to the next token and return. */
/*
- * Convert to an integer, advance to the next token and return.
+ * NOTE: Indexing a list with an index before it yields the
+ * same result as indexing after it, and might be more easily portable
+ * when list size limits grow.
*/
+ status = TclIndexEncode(interp, value,
+ TCL_INDEX_BEFORE,TCL_INDEX_BEFORE, result);
- status = TclGetIntForIndex(interp, intObj, -2, result);
- Tcl_DecrRefCount(intObj);
+ Tcl_DecrRefCount(value);
*tokenPtrPtr = TokenAfter(tokenPtr);
return status;
}