From 013ca8a95da3cc8a9bcdf37f9627d9676527fc76 Mon Sep 17 00:00:00 2001 From: dkf Date: Thu, 19 Jun 2008 20:57:22 +0000 Subject: Fix [Bug 1998221] --- ChangeLog | 111 ++++++++++++++++++++++++++++------------------------ generic/tclOOCall.c | 15 ++++--- tests/oo.test | 19 ++++++++- 3 files changed, 86 insertions(+), 59 deletions(-) diff --git a/ChangeLog b/ChangeLog index a09f486..9f2639d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2008-06-19 Donal K. Fellows + + * generic/tclOOCall.c (AddSimpleClassChainToCallContext): Make sure + * tests/oo.test (oo-14.8): that class mixins are processed in the + documented order. + 2008-06-19 Don Porter * changes: Updates for 8.6a1 release. @@ -21,38 +27,37 @@ 2008-06-17 Andreas Kupries * doc/tm.n: Followup to changelog entry 2008-03-18 regarding - ::tcl::tm::Defaults. Updated the documentation to not only mention - the new (underscored) form of environment variable names, but make - it the encouraged form as well. See [Bug 1914604]. - + ::tcl::tm::Defaults. Updated the documentation to not only mention the + new (underscored) form of environment variable names, but make it the + encouraged form as well. [Bug 1914604] + 2006-06-17 Kevin Kenny * generic/tclClock.c (ConvertLocalToUTC): - * tests/clock.test (clock-63.1): Fixed a bug where the - internal ConvertLocalToUTC command segfaulted if passed a - dictionary without the 'localSeconds' key. To the best of - my knowledge, the bug was not observable in the [clock] - command itself. - + * tests/clock.test (clock-63.1): Fixed a bug where the internal + ConvertLocalToUTC command segfaulted if passed a dictionary without + the 'localSeconds' key. To the best of my knowledge, the bug was not + observable in the [clock] command itself. + 2008-06-16 Andreas Kupries * generic/tclCmdIL.c (TclInfoFrame): Moved the code looking up the * tests/info.test: information for key 'proc' out of the TCL_LOCATION_BC branch to after the switch, this is common to all - frame types. Updated the testsuite to match. This was exposed by - the 2008-06-08 commit (Miguel), switching uplevel from direct eval - to compilation. Fixes [Bug 1987851]. + frame types. Updated the testsuite to match. This was exposed by the + 2008-06-08 commit (Miguel), switching uplevel from direct eval to + compilation. [Bug 1987851] 2008-06-16 Andreas Kupries * tests/ioTrans.test (iortrans-11.*): Fixed same issue as for - iortrans.tf-11.*, cleanup of temp file, making this a followup to - the entry on 2008-06-10 by myself. + iortrans.tf-11.*, cleanup of temp file, making this a followup to the + entry on 2008-06-10 by myself. 2008-06-13 David Gravereaux - * win/rules.vc: SYMBOLS macro is now being set to zero when $(OPTS) - is not available. + * win/rules.vc: SYMBOLS macro is now being set to zero when $(OPTS) is + not available. * win/makefile.vc: The Stubs source files (tclStubLib.c and tclOOStubLib.c) should not be compiled with the -GL flag. @@ -60,58 +65,60 @@ TIP #285 IMPLEMENTATION - * doc/Eval.3: Added documentation for the Tcl_CancelEval and Tcl_Canceled - functions and the TCL_CANCEL_UNWIND flag bit. - * doc/after.n: Corrected the spelling of 'canceled' in the documentation. + * doc/Eval.3: Added documentation for the Tcl_CancelEval and + Tcl_Canceled functions and the TCL_CANCEL_UNWIND flag bit. + * doc/after.n: Corrected the spelling of 'canceled' in the + documentation. * doc/interp.n: Added documentation for [interp cancel]. - * generic/tcl.decls: Added the Tcl_CancelEval and Tcl_Canceled functions - to the stubs table. + * generic/tcl.decls: Added the Tcl_CancelEval and Tcl_Canceled + functions to the stubs table. * generic/tcl.h: Added the TCL_CANCEL_UNWIND flag bit. - * generic/tclBasic.c: The bulk of the script cancellation functionality - is defined here. Added code to initialize and manage the script - cancellation hash table in a thread-safe manner. Reset script - cancellation flags prior to increasing the nesting level (if the nesting - level is currently zero) and always cooperatively check for script - cancellation near the start of TclEvalObjvInternal and after invoking - async handlers. + * generic/tclBasic.c: The bulk of the script cancellation + functionality is defined here. Added code to initialize and manage the + script cancellation hash table in a thread-safe manner. Reset script + cancellation flags prior to increasing the nesting level (if the + nesting level is currently zero) and always cooperatively check for + script cancellation near the start of TclEvalObjvInternal and after + invoking async handlers. * generic/tclDecls.h: Regenerated. * generic/tclEvent.c: Call TclFinalizeEvaluation during finalization to cleanup the script cancellation hash table. During [vwait], always cooperatively check for script cancellation. Corrected the spelling of 'canceled' in comments to be consistent with the documentation. * generic/tclExecute.c: Reset script cancellation flags prior to - increasing the nesting level (if the nesting level is currently zero) and - always cooperatively check for script cancellation after invoking async - handlers. Prevent [catch] from catching script cancellation when the - TCL_CANCEL_UNWIND flag is set (similar to the manner used by TIP 143 when - a limit has been exceeded). - * generic/tclInt.decls: Added TclResetCancellation to the internal stubs - table. + increasing the nesting level (if the nesting level is currently zero) + and always cooperatively check for script cancellation after invoking + async handlers. Prevent [catch] from catching script cancellation when + the TCL_CANCEL_UNWIND flag is set (similar to the manner used by TIP + 143 when a limit has been exceeded). + * generic/tclInt.decls: Added TclResetCancellation to the internal + stubs table. * generic/tclInt.h: Added asyncCancel and asyncCancelMsg fields to the private Interp structure. Added private interp flag value CANCELED to help control script cancellation. * generic/tclIntDecls.h: Regenerated. * generic/tclInterp.c (Tcl_InterpObjCmd): Added [interp cancel] subcommand. - * generic/tclNotify.c (Tcl_DeleteEventSource): Corrected the spelling of - 'canceled' in comments to be consistent with the documentation. - * generic/tclParse.c: Reset script cancellation flags prior to increasing - * generic/tclProc.c: the nesting level (if the nesting level is currently - zero) and cooperatively check for script cancellation prior to evaluating - commands. + * generic/tclNotify.c (Tcl_DeleteEventSource): Corrected the spelling + of 'canceled' in comments to be consistent with the documentation. + * generic/tclParse.c: Reset script cancellation flags prior to + * generic/tclProc.c: increasing the nesting level (if the nesting + level is currently zero) and cooperatively check for script + cancellation prior to evaluating commands. * generic/tclStubInit.c: Regenerated. * generic/tclThreadTest.c (Tcl_ThreadObjCmd): Added script cancellation support ([testthread cancel]). Modified [testthread id] to allow querying of the 'main' thread ID. - Corrected comments to reflect the actual command syntax. Made [testthread - wait] cooperatively check for script cancellation. Added [testthread - event] to allow for processing one pending event without blocking. - * generic/tclTimer.c: Delay for a maximum of 500 milliseconds prior - to checking for async handlers and script cancellation. + Corrected comments to reflect the actual command syntax. Made + [testthread wait] cooperatively check for script cancellation. Added + [testthread event] to allow for processing one pending event without + blocking. + * generic/tclTimer.c: Delay for a maximum of 500 milliseconds prior to + checking for async handlers and script cancellation. * tests/cmdAH.test: Changed [interp c] to [interp create]. * tests/interp.test: Added and fixed tests for [interp cancel]. - * tests/thread.test: Added tests for script cancellation via [testthread - cancel]. + * tests/thread.test: Added tests for script cancellation via + [testthread cancel]. * tools/man2help2.tcl: Fixed problems with WinHelp target (see * tools/man2tcl.c: [Bug 1934200], [Bug 1934265], and [Bug 1934272]). * win/makefile.vc: Added 'pdbs' option for Windows build rules to allow @@ -145,9 +152,9 @@ 2008-06-10 Joe English - * generic/tclEncoding.c(UtfToUtfProc): Avoid unwanted sign extension - when converting incomplete UTF-8 sequences. See [Bug 1908443] - for details. + * generic/tclEncoding.c(UtfToUtfProc): Avoid unwanted sign extension + when converting incomplete UTF-8 sequences. See [Bug 1908443] for + details. 2008-06-10 Andreas Kupries diff --git a/generic/tclOOCall.c b/generic/tclOOCall.c index c5c9418..bc90d09 100644 --- a/generic/tclOOCall.c +++ b/generic/tclOOCall.c @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclOOCall.c,v 1.6 2008/06/08 23:13:09 dkf Exp $ + * RCS: @(#) $Id: tclOOCall.c,v 1.7 2008/06/19 20:57:23 dkf Exp $ */ #ifdef HAVE_CONFIG_H @@ -1163,9 +1163,17 @@ AddSimpleClassChainToCallContext( /* * We hard-code the tail-recursive form. It's by far the most common case * *and* it is much more gentle on the stack. + * + * Note that mixins must be processed before the main class hierarchy. + * [Bug 1998221] */ tailRecurse: + FOREACH(superPtr, classPtr->mixins) { + AddSimpleClassChainToCallContext(superPtr, methodNameObj, cbPtr, + doneFilters, flags, filterDecl); + } + if (flags & CONSTRUCTOR) { AddMethodToCallChain(classPtr->constructorPtr, cbPtr, doneFilters, filterDecl); @@ -1195,11 +1203,6 @@ AddSimpleClassChainToCallContext( } } - FOREACH(superPtr, classPtr->mixins) { - AddSimpleClassChainToCallContext(superPtr, methodNameObj, cbPtr, - doneFilters, flags, filterDecl); - } - switch (classPtr->superclasses.num) { case 1: classPtr = classPtr->superclasses.list[0]; diff --git a/tests/oo.test b/tests/oo.test index a569b77..0362647 100644 --- a/tests/oo.test +++ b/tests/oo.test @@ -7,7 +7,7 @@ # See the file "license.terms" for information on usage and redistribution of # this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: oo.test,v 1.5 2008/05/31 22:29:46 dkf Exp $ +# RCS: @(#) $Id: oo.test,v 1.6 2008/06/19 20:57:23 dkf Exp $ package require TclOO 0.4 ;# Must match value in configure.in if {[lsearch [namespace children] ::tcltest] == -1} { @@ -1039,6 +1039,23 @@ test oo-14.7 {OO and filters from mixins of mixins} -setup { } [C new] foo } -result {(foo) (bar) (egg) chicken (egg) (bar) (foo)} +test oo-14.8 {OO: class mixin order - Bug 1998221} -setup { + set ::result {} + oo::class create master +} -cleanup { + master destroy +} -body { + oo::class create mix { + superclass master + method test {} {lappend ::result mix; next; return $::result} + } + oo::class create cls { + superclass master + mixin mix + method test {} {lappend ::result cls; next; return $::result} + } + [cls new] test +} -result {mix cls} test oo-15.1 {OO: object cloning} { oo::class create Aclass -- cgit v0.12