WrappedMethod.st
author Stefan Vogel <sv@exept.de>
Tue, 28 Jul 2009 17:44:21 +0200
changeset 2101 a9c9794266b8
parent 2012 cb8630ac1ed4
child 2182 36769d2ca946
permissions -rw-r--r--
Redirect #source to the original method

"
 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.
"
"{ Package: 'stx:libbasic3' }"

Method variableSubclass:#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"
!

category:newCategory
    super category:newCategory.
    self originalMethod category:newCategory
!

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"
!

package:aSymbol
    super package:aSymbol.
    self originalMethod package:aSymbol
!

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"
!

privacy:aSymbol
    "set the wrapped methods privacy"

    ^ self originalMethod privacy:aSymbol
!

restricted:aBoolean
    ^ self originalMethod restricted:aBoolean
!

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 source of the method"

    ^ self originalMethod source
! !

!WrappedMethod methodsFor:'queries'!

argSignature
    ^ self originalMethod argSignature

    "Created: / 27.1.1999 / 20:23:17 / cg"
!

hasResource
    "return the wrapped methods hasResource"

    ^ self originalMethod hasResource
!

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
!

messagesSent
    "return a collection of message selectors sent by this method"

    ^ self originalMethod messagesSent 
!

messagesSentToSelf
    "return a collection of message selectors sent to self by this method"

    ^ self originalMethod messagesSentToSelf 
!

messagesSentToSuper
    "return a collection of message selectors sent to super by this method"

    ^ self originalMethod messagesSentToSuper 
!

resources
    "return the wrapped methods resources"

    ^ self originalMethod resources
!

signature
    ^ self originalMethod signature

    "Created: / 14.11.1998 / 00:01:50 / cg"
!

signatureNameWithoutReturnType
    ^ self originalMethod signatureNameWithoutReturnType

    "Created: / 27.1.1999 / 20:52:25 / cg"
! !

!WrappedMethod class methodsFor:'documentation'!

version
    ^ '$Header: /cvs/stx/stx/libbasic3/WrappedMethod.st,v 1.26 2009-07-28 15:44:21 stefan Exp $'
! !