Skip to content
Tcl Source Code Attachment Details
Login

Attachment Details

Overview

Artifact ID: 1bf7daf48d3499ec1c2b10dad524c95cd6d46e0b
Ticket: 231259ffffffffffffffffffffffffffffffffff
Date: 2001-05-11 05:54:42
User: msofer
Artifact Attached: b4898cfde60da21be942383ed29ace6f8427e450
Filename:231259.txt
Description:patch
Content:
     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
? 231259.txt
Index: generic/tclInt.h
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclInt.h,v
retrieving revision 1.52
diff -r1.52 tclInt.h
187,191c187,193
<     int resolverEpoch;		 /* Incremented whenever the name resolution
< 				  * rules change for this namespace; this
< 				  * invalidates all byte codes compiled in
< 				  * the namespace, causing the code to be
< 				  * recompiled under the new rules. */
---
>     int resolverEpoch;		 /* Incremented whenever (a) the name resolution
> 				  * rules change for this namespace or (b) a 
> 				  * newly added command shadows a command that
> 				  * is compiled to bytecodes.
> 				  * This invalidates all byte codes compiled
> 				  * in the namespace, causing the code to be
> 				  * recompiled under the new rules.*/
Index: generic/tclNamesp.c
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclNamesp.c,v
retrieving revision 1.22
diff -r1.22 tclNamesp.c
2285a2286,2296
> 
> 		/* 
> 		 * If the shadowed command was compiled to bytecodes, we
> 		 * invalidate all the bytecodes in nsPtr, to force a new
> 		 * compilation. We use the resolverEpoch to signal the need
> 		 * for a fresh compilation of every bytecode.
> 		 */
> 
> 		if ((((Command *) hPtr)->compileProc) != NULL) {
> 		    nsPtr->resolverEpoch++;
> 		}
Index: tests/namespace.test
===================================================================
RCS file: /cvsroot/tcl/tcl/tests/namespace.test,v
retrieving revision 1.15
diff -r1.15 namespace.test
1138a1139,1152
> test namespace-41.1 {Shadowing byte-compiled commands} {
>     namespace eval ns {
> 	proc test {} {
> 	    set ::g 0
> 	}  
> 	lappend ::res [test]
> 	proc set {a b} {
> 	    ::set a [incr b]
> 	}
> 	lappend ::res [test]
>     }
>     set res
> } {0 1}
>