WrappedMethod.st
author Stefan Vogel <sv@exept.de>
Fri, 23 Jan 1998 18:50:56 +0100
changeset 644 ffba6b23cc6d
parent 580 8810e941bcfb
child 729 65df4874f0a6
permissions -rw-r--r--
Redirect privacy and more literal sends to originalMethod

"
 COPYRIGHT (c) 1994 by Claus Gittinger
	      All Rights Reserved

 This software is furnished under a license and may be used
 only in accordance with the terms of that license and with the
 inclusion of the above copyright notice.   This software may not
 be provided or otherwise made available to, or used by, any
 other person.  No title to or ownership of the software is
 hereby transferred.
"

Method subclass:#WrappedMethod
	instanceVariableNames:''
	classVariableNames:''
	poolDictionaries:''
	category:'Kernel-Methods'
!

!WrappedMethod class methodsFor:'documentation'!

copyright
"
 COPYRIGHT (c) 1994 by Claus Gittinger
	      All Rights Reserved

 This software is furnished under a license and may be used
 only in accordance with the terms of that license and with the
 inclusion of the above copyright notice.   This software may not
 be provided or otherwise made available to, or used by, any
 other person.  No title to or ownership of the software is
 hereby transferred.
"
!

documentation
"
    support for MessageTracer

    [author:]
        Claus Gittinger

    [see also:]
        MessageTracer
"
! !

!WrappedMethod methodsFor:'accessing'!

basicLiterals
    "return my literals"

    ^ super literals

    "Modified: 24.6.1996 / 14:10:34 / stefan"
!

literals
    "return the wrapped methods literals"

    ^ self originalMethod literals
!

literalsDetect:aBlock ifNone:exceptionBlock
    "access the wrapped methods literals"

    ^ self originalMethod literalsDetect:aBlock ifNone:exceptionBlock

    "Created: / 23.1.1998 / 13:23:15 / stefan"
!

literalsDo:aBlock
    "access the wrapped methods literals"

    ^ self originalMethod literalsDo:aBlock

    "Created: / 23.1.1998 / 13:09:36 / stefan"
    "Modified: / 23.1.1998 / 13:22:38 / stefan"
!

methodArgAndVarNames
    "return the names of the args and locals of the wrapped method."

    ^ self originalMethod methodArgAndVarNames
!

methodVarNames
    "return the names of the locals of the wrapped method."

    ^ self originalMethod methodVarNames 
!

numVars
    "return the number of locals in the wrapped method."

    ^ self originalMethod numVars

    "Created: 4.11.1996 / 21:40:10 / cg"
!

originalMethod
    "return the method the receiver is wrapping"

    "a kludge: it must be in my literal array somewhere"
    super literalsDo:[:aLiteral |
        aLiteral isMethod ifTrue:[
            ^ aLiteral
        ]
    ].
    ^ nil

    "Modified: / 23.1.1998 / 13:08:25 / stefan"
!

privacy
    "return the wrapped methods privacy"

    ^ self originalMethod privacy

    "Created: / 23.1.1998 / 13:09:17 / stefan"
    "Modified: / 23.1.1998 / 13:20:59 / stefan"
!

setPrivacy:aSymbol
    "set the wrapped methods privacy"

    ^ self originalMethod setPrivacy:aSymbol

    "Modified: / 23.1.1998 / 13:21:26 / stefan"
    "Created: / 23.1.1998 / 15:26:26 / stefan"
!

source
    "return the wrapped methods source"

    |m|

    (m := self originalMethod) notNil ifTrue:[
        ^ m source
    ].
    ^ nil
! !

!WrappedMethod methodsFor:'queries'!

isBreakpointed
    "return true, if the receiver is a wrapped method for a breakpoint.
     Ask the messageTracer, since I dont know if its a break or trace"

    ^ (MessageTracer isTrapped:self)

    "Created: 7.4.1997 / 17:25:40 / cg"
!

isTimed
    "return true, if the receiver is a wrapped method for a time measurement.
     Ask the messageTracer, since I dont know if its a break or trace"

    ^ (MessageTracer isTiming:self)

    "Created: 11.4.1997 / 17:06:14 / cg"
!

isTraced
    "return true, if the receiver is a wrapped method for a trace point.
     Ask the messageTracer, since I dont know if its a break or trace"

    ^ (MessageTracer isTrapped:self) not

    "Created: 7.4.1997 / 17:25:54 / cg"
!

isWrapped
    "return true, if the receiver is a wrapped method.
     True is returned here, since the receiver is always a wrapped one"

    ^ true
! !

!WrappedMethod class methodsFor:'documentation'!

version
    ^ '$Header: /cvs/stx/stx/libbasic3/WrappedMethod.st,v 1.17 1998-01-23 17:50:56 stefan Exp $'
! !