diff options
author | dgp <dgp@users.sourceforge.net> | 2018-03-11 12:33:16 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2018-03-11 12:33:16 (GMT) |
commit | c7e8d507d9233725a4629931bbceeea7ac23f699 (patch) | |
tree | cedf1bdd26675be6cadb2414a4057c19611f5868 /generic/tclAssembly.c | |
parent | cb242c0d50a43eddaa567d50717b5367658eb934 (diff) | |
parent | e7be4a19a0cdf781b241095a0aba272ff7b35ffd (diff) | |
download | tcl-c7e8d507d9233725a4629931bbceeea7ac23f699.zip tcl-c7e8d507d9233725a4629931bbceeea7ac23f699.tar.gz tcl-c7e8d507d9233725a4629931bbceeea7ac23f699.tar.bz2 |
merge 8.7
Diffstat (limited to 'generic/tclAssembly.c')
-rw-r--r-- | generic/tclAssembly.c | 23 |
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; } |