Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | [3970f54c4e]: Improved fix that is more tolerant of a single variable varname. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
af5c35971a2d36cc8b92735a14548a52 |
User & Date: | dkf 2013-09-19 22:37:06 |
References
2016-12-24
| ||
23:32 | • New ticket [46a2410650] Array search does not terminate on element unset. artifact: a15ee2e6f2 user: andy | |
23:02 | Merge trunk. Test var-13.2 now fails due to [af5c35971a]. check-in: 5066c38552 user: andy tags: array-search-unset | |
23:00 | Add test var-13.2 to check that unsetting an array element terminates an array search. This behavio... check-in: e1e9542624 user: andy tags: array-search-unset | |
Context
2015-07-17
| ||
19:33 | [a3309d01db] Test the demonstrates leak in branch off checkin that starts it. check-in: 494aa96a48 user: dgp tags: bug-a3309d01db | |
2013-09-21
| ||
12:49 | merge trunk check-in: 7c19121b2e user: dgp tags: novem | |
2013-09-20
| ||
05:28 | merge release check-in: 63009ab07c user: dgp tags: trunk | |
2013-09-19
| ||
22:37 | [3970f54c4e]: Improved fix that is more tolerant of a single variable varname. check-in: af5c35971a user: dkf tags: trunk | |
19:37 | [3970f54c4e]: Corrected regression in argument order processing in [unset]. check-in: 836d61598d user: dkf tags: trunk | |
Changes
Changes to generic/tclCompCmdsSZ.c.
︙ | ︙ | |||
2811 2812 2813 2814 2815 2816 2817 | Tcl_Parse *parsePtr, /* Points to a parse structure for the command * created by Tcl_ParseCommand. */ Command *cmdPtr, /* Points to defintion of command being * compiled. */ CompileEnv *envPtr) /* Holds resulting instructions. */ { Tcl_Token *varTokenPtr; | | > | | > > | > | > > > > > > | > > > | | < | > > > > | > > | > | > > > > | < | | < | | | | < | > > | > > | > > > > > > > > | | 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 | Tcl_Parse *parsePtr, /* Points to a parse structure for the command * created by Tcl_ParseCommand. */ Command *cmdPtr, /* Points to defintion of command being * compiled. */ CompileEnv *envPtr) /* Holds resulting instructions. */ { Tcl_Token *varTokenPtr; int isScalar, localIndex, flags = 1, i, varCount = 0, haveFlags = 0; DefineLineInformation; /* TIP #280 */ /* TODO: Consider support for compiling expanded args. */ /* * Verify that all words - except the first non-option one - are known at * compile time so that we can handle them without needing to do a nasty * push/rotate. [Bug 3970f54c4e] */ for (i=1,varTokenPtr=parsePtr->tokenPtr ; i<parsePtr->numWords ; i++) { Tcl_Obj *leadingWord = Tcl_NewObj(); varTokenPtr = TokenAfter(varTokenPtr); if (!TclWordKnownAtCompileTime(varTokenPtr, leadingWord)) { TclDecrRefCount(leadingWord); /* * We can tolerate non-trivial substitutions in the first variable * to be unset. If a '--' or '-nocomplain' was present, anything * goes in that one place! (All subsequent variable names must be * constants since we don't want to have to push them all first.) */ if (varCount == 0) { if (haveFlags) { continue; } /* * In fact, we're OK as long as we're the first argument *and* * we provably don't start with a '-'. If that is true, then * even if everything else is varying, we still can't be a * flag. Otherwise we'll spill to runtime to place a limit on * the trickiness. */ if (varTokenPtr->type == TCL_TOKEN_WORD && varTokenPtr[1].type == TCL_TOKEN_TEXT && varTokenPtr[1].size > 0 && varTokenPtr[1].start[0] != '-') { continue; } } return TCL_ERROR; } if (i == 1) { const char *bytes; int len; bytes = Tcl_GetStringFromObj(leadingWord, &len); if (len == 11 && !strncmp("-nocomplain", bytes, 11)) { flags = 0; haveFlags = 1; } else if (len == 2 && !strncmp("--", bytes, 2)) { haveFlags = 1; } else { varCount++; } } else { varCount++; } TclDecrRefCount(leadingWord); } /* * Issue instructions to unset each of the named variables. */ varTokenPtr = TokenAfter(parsePtr->tokenPtr); if (haveFlags) { varTokenPtr = TokenAfter(varTokenPtr); } for (i=1+haveFlags ; i<parsePtr->numWords ; i++) { /* * Decide if we can use a frame slot for the var/array name or if we * need to emit code to compute and push the name at runtime. We use a * frame slot (entry in the array of local vars) if we are compiling a * procedure body and if the name is simple text that does not include * namespace qualifiers. */ |
︙ | ︙ |