Tcl Source Code

Check-in [31a078bec7]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Express INST_LIST_INDEX_IMM index processinig in terms of TCL_INDEX_END so that consistencies are maintained, and hardcoded values are a bit demystified.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | bug-db36fa5122
Files: files | file ages | folders
SHA3-256: 31a078bec71164384520ed806519e7ca4ae32e72ec583586b88960b030d41cad
User & Date: dgp 2018-03-07 19:55:23
Context
2018-03-07
21:02
When index parsing alone tells you a [string range] is empty, just push it. check-in: 38b72bb54b user: dgp tags: bug-db36fa5122
19:55
Express INST_LIST_INDEX_IMM index processinig in terms of TCL_INDEX_END so that consistencies are ma... check-in: 31a078bec7 user: dgp tags: bug-db36fa5122
18:39
Establish 4 symbols for categories of parsed index values: TCL_INDEX_START = 0 The start index.... check-in: 3f026007bd user: dgp tags: bug-db36fa5122
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to generic/tclExecute.c.

5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108

	if (TclListObjGetElements(interp, valuePtr, &objc, &objv) != TCL_OK) {
	    TRACE_ERROR(interp);
	    goto gotError;
	}

	/*
	 * Select the list item based on the index. Negative operand means
	 * end-based indexing (-2, ...), and -1 means out of range.
	 */

	if (opnd < -1) {
	    index = opnd+1 + objc;
	} else {
	    index = opnd;
	}
	pcAdjustment = 5;

    lindexFastPath:
	if (index >= 0 && index < objc) {
	    objResultPtr = objv[index];
	} else {
	    TclNewObj(objResultPtr);







<
|


<
<
<
|
<







5086
5087
5088
5089
5090
5091
5092

5093
5094
5095



5096

5097
5098
5099
5100
5101
5102
5103

	if (TclListObjGetElements(interp, valuePtr, &objc, &objv) != TCL_OK) {
	    TRACE_ERROR(interp);
	    goto gotError;
	}

	/*

	 * Decode end-offset index values.
	 */




	index = opnd + (opnd <= TCL_INDEX_END)*(objc - 1 - TCL_INDEX_END);

	pcAdjustment = 5;

    lindexFastPath:
	if (index >= 0 && index < objc) {
	    objResultPtr = objv[index];
	} else {
	    TclNewObj(objResultPtr);