diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2009-03-24 10:46:03 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2009-03-24 10:46:03 (GMT) |
commit | 0dde2f0c154556f8f812078b8eb894e2d248974e (patch) | |
tree | f2cdaf7eb9bc628eb19e39845f3b0692bb49b4fd /generic | |
parent | 08383aee88a03fe8cc880c10b9fc242fe3804ebd (diff) | |
download | tcl-0dde2f0c154556f8f812078b8eb894e2d248974e.zip tcl-0dde2f0c154556f8f812078b8eb894e2d248974e.tar.gz tcl-0dde2f0c154556f8f812078b8eb894e2d248974e.tar.bz2 |
Fix [Bug 2704302]
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tclOOBasic.c | 19 |
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: |