summaryrefslogtreecommitdiffstats
path: root/generic/tclOOBasic.c
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2009-03-24 10:46:03 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2009-03-24 10:46:03 (GMT)
commit0dde2f0c154556f8f812078b8eb894e2d248974e (patch)
treef2cdaf7eb9bc628eb19e39845f3b0692bb49b4fd /generic/tclOOBasic.c
parent08383aee88a03fe8cc880c10b9fc242fe3804ebd (diff)
downloadtcl-0dde2f0c154556f8f812078b8eb894e2d248974e.zip
tcl-0dde2f0c154556f8f812078b8eb894e2d248974e.tar.gz
tcl-0dde2f0c154556f8f812078b8eb894e2d248974e.tar.bz2
Fix [Bug 2704302]
Diffstat (limited to 'generic/tclOOBasic.c')
-rw-r--r--generic/tclOOBasic.c19
1 files changed, 5 insertions, 14 deletions
diff --git a/generic/tclOOBasic.c b/generic/tclOOBasic.c
index 8be8773..f70d4f9 100644
--- a/generic/tclOOBasic.c
+++ b/generic/tclOOBasic.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: tclOOBasic.c,v 1.17 2009/02/10 22:49:55 nijtmans Exp $
+ * RCS: @(#) $Id: tclOOBasic.c,v 1.18 2009/03/24 10:46:04 dkf Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -740,23 +740,14 @@ TclOOSelfObjCmd(
contextPtr->oPtr->namespacePtr->fullName,-1));
return TCL_OK;
case SELF_CLASS: {
- Method *mPtr = CurrentlyInvoked(contextPtr).mPtr;
- Object *declarerPtr;
+ Class *clsPtr = CurrentlyInvoked(contextPtr).mPtr->declaringClassPtr;
- if (mPtr->declaringClassPtr != NULL) {
- declarerPtr = mPtr->declaringClassPtr->thisPtr;
- } else if (mPtr->declaringObjectPtr != NULL) {
- declarerPtr = mPtr->declaringObjectPtr;
- } else {
- /*
- * This should be unreachable code.
- */
-
- Tcl_AppendResult(interp, "method without declarer!", NULL);
+ if (clsPtr == NULL) {
+ Tcl_AppendResult(interp, "method not defined by a class", NULL);
return TCL_ERROR;
}
- Tcl_SetObjResult(interp, TclOOObjectName(interp, declarerPtr));
+ Tcl_SetObjResult(interp, TclOOObjectName(interp, clsPtr->thisPtr));
return TCL_OK;
}
case SELF_METHOD: