|
|
Class: Method
Object
|
+--ExecutableFunction
|
+--CompiledCode
|
+--Method
|
+--InstrumentedMethod
|
+--JavaScriptFunction
|
+--LazyMethod
|
+--SmalltalkShareClient::RemoteMethod
|
+--Tools::MethodCategoryList::MissingMethod
|
+--WrappedMethod
- Package:
- stx:libbasic
- Category:
- Kernel-Methods
- Version:
- rev:
1.349
date: 2010/04/27 12:27:33
- user: cg
- file: Method.st directory: libbasic
- module: stx stc-classLibrary: libbasic
- Author:
- Claus Gittinger
this class defines protocol for executable methods;
both compiled and interpreted methods are represented by this class.
Compiled methods have a non-nil code field, while interpreted methods have
a nil code field and non-nil byteCode field.
If there are both non-nil code and bytecode fields, the VM will execute
the machine-code of a method. If both are nil when executed, a noByteCode
message is sent by the VM to the method where a signal is raised.
The methods sourcecode is represented by source and sourcePosition:
- if sourcePosition is a Number, the source-field is the fileName and
sourcePosition is the character offset of the source-chunk in this source file.
- If sourcePosition is nil, the source is the string in the source field.
(an old version used ExternalString instances here, but that lead to
10000 additional little objects ...)
The flags field defines things like the number of method-locals,
method arguments and stack requirements (for interpreted methods).
Do not depend on any value in the flags field - it may change without
notice.
Notice, that in ST/X, method can be subclassed; executable code is
identified not by being an instance of Block or Method, but instead by
having the executable flag bit set in the class. The VM can execute anything
which is identified as executable (assuming that the first instance variable
is the machine-code address) - this allows for easy future extension.
[Instance variables:]
source <String> the source itself (if sourcePosition isNil)
or the fileName where the source is found
sourcePosition <Integer> the position of the methods chunk in the file
category <Symbol> the methods category
package <Symbol> the package, in which the methods was defined
mclass <Class> the class in which I am defined
indexed slots literals
[Class variables:]
PrivateMethodSignal raised on privacy violation (see docu)
LastFileReference weak reference to the last sourceFile
LastSourceFileName to speedup source access via NFS
WARNING: layout known by compiler and runtime system - dont change
Signal constants
-
privateMethodSignal
-
return the signal raised when a private/protected method is called
by some other object (i.e. not a self- or super send)
binary storage
-
binaryDefinitionFrom: stream manager: manager
-
read my definition from stream.
-
binaryFullDefinitionFrom: stream manager: manager
-
retrieve a full bytecoded-method.
initialization
-
initialize
-
create signals
-
lastMethodSourcesLock
-
queries
-
isBuiltInClass
-
return true if this class is known by the run-time-system.
Here, true is returned for myself, false for subclasses.
-
methodDefinitionTemplateForSelector: aSelector
-
given a selector, return a prototype definition string
-
methodDefinitionTemplateForSelector: aSelector andArgumentNames: argNames
-
given a selector, return a prototype definition string
-
methodPrivacySupported
-
return true, if the system was compiled to support methodPrivacy.
You should not depend on that feature being available.
-
resourceTypes
-
get the types of resources for which a spec definition and corresponding editor exist
special
-
flushSourceStreamCache
-
Compatibility-VW
-
classIsMeta
-
return true, if this method is a class method
-
sendsSelector: aSelectorSymbol
-
return true, if this method contains a message-send
with aSelectorSymbol as selector.
accessing
-
category
-
return the methods category or nil
-
category: aStringOrSymbol
-
set the methods category
-
comment
-
return the methods comment.
This is done by searching for and returning the first comment
from the methods source (excluding any double-quotes).
Returns nil if there is no comment (or source is not available).
-
getPackage
-
return the package-ID of the method
-
getSource
-
low-level access to the source instance-variable.
For internal (compiler) use only.
This is NOT always the methods source string
-
getSourcePosition
-
low-level access to the sourcePosition instance-variable.
For internal (compiler) use only.
This is NOT always the methods sourcePosition
-
localSourceFilename: aFileName position: aNumber
-
set the methods sourcefile/position indicating, that
this is a local file.
-
makeLocalStringSource
-
assure that the methods source code is stored locally as a string
within the method (as opposed to an external string, which is accessed
by reading the source code file).
This is required, when a methods package is changed, to assure that its
sourceCode is not lost.
-
mclass: aClass
-
set the method's class
-
package
-
return the package-ID of the method (nil is translated to noProject here)
-
package: aSymbol
-
set the package-symbol
-
setCategory: aStringOrSymbol
-
set the methods category (without change notification)
-
setPackage: aSymbol
-
set the package-symbol (low level - use package:)
-
source
-
return the sourcestring for the receiver
-
source: aString
-
set the methods sourcestring
-
sourceFilename
-
return the sourcefilename if source is extern; nil otherwise
-
sourceFilename: aFileName position: aNumber
-
set the methods sourcefile/position
-
sourceLineNumber
-
return the lineNumber of my source within the returned
source sourcestring.
For ST methods, the returned sourceString is always the
methods pure source; therefore, the lineNumber is always 1.
-
sourcePosition
-
return the sourceposition if source is extern; nil otherwise
accessing-visibility
-
isIgnored
-
return true, if this is an ignored method.
Ignored methods are physically present in the source file,
but no code is generated for it by stc, and the VM does not see
it in its message lookup.
(i.e. setting a method to #ignored, and sending that selector,
leads to either the superclasses implementation to be called,
or a doesNotUnderstand exception to be raised)
Notice: this is a nonstandard feature, not supported
by other smalltalk implementations and not specified in the ANSI spec.
This is EXPERIMENTAL - and being evaluated for usability.
It may change or even vanish (if it shows to be not useful).
-
isPrivate
-
return true, if this is a private method.
Execution of private methods is only allowed via self sends
from superclasses or the class itself.
If a private method is called by some other class, a runtime
error (PrivateMethodSignal) is raised.
Notice: method privacy is a nonstandard feature, not supported
by other smalltalk implementations and not specified in the ANSI spec.
This is EXPERIMENTAL - and being evaluated for usability.
It may change or even vanish (if it shows to be not useful).
-
isProtected
-
return true, if this is a protected method.
Execution of protected methods is only allowed via self/super sends
from superclasses, the class itself or subclasse.
If a protected method is called by some other class, a runtime
error (PrivateMethodSignal) is raised.
Notice: method privacy is a nonstandard feature, not supported
by other smalltalk implementations and not specified in the ANSI spec.
This is EXPERIMENTAL - and being evaluated for usability.
It may change or even vanish (if it shows to be not useful).
-
isPublic
-
return true, if this is a public method - I.e. can be executed via any send.
This is the default and how other smalltalk implementations treat all methods.
Notice: method privacy is a nonstandard feature, not supported
by other smalltalk implementations and not specified in the ANSI spec.
This is EXPERIMENTAL - and being evaluated for usability.
It may change or even vanish (if it shows to be not useful).
-
isRestricted
-
return the flag bit stating that this method is restricted.
Execution of the receiver will only be allowed if the system is not in
'trap restricted mode' (-->ObjectMemory) otherise a runtime
error (PrivateMethodSignal) is raised.
Notice: method restriction is a nonstandard feature, not supported
by other smalltalk implementations and not specified in the ANSI spec.
This is EXPERIMENTAL - and being evaluated for usability.
It may change or even vanish (if it shows to be not useful).
-
private primSetPrivacy: aSymbol
-
set the methods access rights (privacy) from a symbol;
Currently, this must be one of #private, #protected, #public or #ignored.
#setPrivacy: simply sets the attribute. When changing methods, that
have already been called, #privacy: should be used.
Notice: method privacy is a nonstandard feature, not supported
by other smalltalk implementations and not specified in the ANSI spec.
If at all, use it for debugging purposes, to catch messagesends
which are not supposed to be sent by others.
(especially, if working in a team, while integrating other peoples work)
This is EXPERIMENTAL - and being evaluated for usability.
It may change or even vanish (if it shows to be not useful).
-
privacy
-
return a symbol describing the methods access rights (privacy);
Currently, this is one of #private, #protected, #public or #ignored.
Notice: method privacy is a nonstandard feature, not supported
by other smalltalk implementations and not specified in the ANSI spec.
If at all, use it for debugging purposes, to catch messagesends
which are not supposed to be sent by others.
(especially, if working in a team, while integrating other peoples work)
This is EXPERIMENTAL - and being evaluated for usability.
It may change or even vanish (if it shows to be not useful).
-
privacy: aSymbol
-
set the methods access rights (privacy) from a symbol;
Currently, this must be one of #private, #protected, #public or #ignored.
Notice: method privacy is a nonstandard feature, not supported
by other smalltalk implementations and not specified in the ANSI spec.
If at all, use it for debugging purposes, to catch message sends
which are not supposed to be sent by others.
(especially, if working in a team, while integrating other peoples work)
This is EXPERIMENTAL - and being evaluated for usability.
It may change or even vanish (if it shows to be not useful).
-
restricted: aBoolean
-
set or clear the flag bit stating that this method is restricted.
Execution of the receiver will only be allowed if the system is not in
'trap restricted mode' (-->ObjectMemory) otherise a runtime
error (PrivateMethodSignal) is raised.
Notice: method restriction is a nonstandard feature, not supported
by other smalltalk implementations and not specified in the ANSI spec.
This is EXPERIMENTAL - and being evaluated for usability.
It may change or even vanish (if it shows to be not useful).
-
setPrivacy: aSymbol
-
set the methods access rights (privacy) from a symbol;
Currently, this must be one of #private, #protected, #public or #ignored.
#setPrivacy: simply sets the attribute. When changing methods, that
have already been called, #privacy: should be used.
Notice: method privacy is a nonstandard feature, not supported
by other smalltalk implementations and not specified in the ANSI spec.
If at all, use it for debugging purposes, to catch messagesends
which are not supposed to be sent by others.
(especially, if working in a team, while integrating other peoples work)
This is EXPERIMENTAL - and being evaluated for usability.
It may change or even vanish (if it shows to be not useful).
-
setPrivacy: aSymbol flushCaches: doFlush
-
set the methods access rights (privacy) from a symbol;
Currently, this must be one of #private, #protected, #public or #ignored.
#setPrivacy: simply sets the attribute. When changing methods, that
have already been called, #privacy: should be used.
Notice: method privacy is a nonstandard feature, not supported
by other smalltalk implementations and not specified in the ANSI spec.
If at all, use it for debugging purposes, to catch messagesends
which are not supposed to be sent by others.
(especially, if working in a team, while integrating other peoples work)
This is EXPERIMENTAL - and being evaluated for usability.
It may change or even vanish (if it shows to be not useful).
binary storage
-
asByteCodeMethod
-
if the receiver has no bytecodes, create & return a method having
the same semantics as the receiver, but uses interpreted bytecodes.
Otherwise, return the receiver. The new method is not installed in
the methodDictionary of any class - just returned.
If the method contains primitive code, this may return a method
without bytecode.
Can be used to obtain a bytecode version of a machine-code method,
for binary storage or dynamic recompilation (which is not yet finished)
or to compile lazy methods down to executable ones.
-
asByteCodeMethodWithSource: newSource
-
-
asExecutableMethod
-
if the receiver has neither bytecodes nor machinecode, create & return a
method having semantics as the receivers source. This may be machine code,
if the system supports dynamic loading of object code and the source includes
primitive code. However, bytecode is preferred, since it compiles faster.
Otherwise, return the receiver. The new method is not installed in
the methodDictionary of any class - just returned.
Can be used to compile lazy methods down to executable ones.
-
asExecutableMethodWithSource: newSource
-
-
readBinaryContentsFrom: stream manager: manager
-
-
storeBinaryDefinitionOn: stream manager: manager
-
store the receiver in a binary format on stream.
This is an internal interface for binary storage mechanism.
only store bytecode-methods - machinecode methods are stored
as class/selector pair and a lookup is done when restored.
If the receiver method is a built-in (i.e. machine coded)
method, a temporary interpreted byte code method is created,
and its bytecode stored.
This works only, if the source of the method is available and the
method does not contain primitive code.
-
storeFullBinaryDefinitionOn: stream manager: manager
-
store full bytecoded-method.
copying
-
copy
-
redefined to change a source ref into a real string
error handling
-
invalidCodeObject
-
this method is triggered by the interpreter when a nil or non method
is about to be executed.
In this case, the VM sends this to the bad method (the receiver).
Also, the Compiler creates methods with their code/bytecode set to
this method if - after a class change - a method cannot be compiled
and is therefore no longer executable (for example, after an instvar
has been removed, and a method still tries to access this instvar)
Thus, we arrive here, when playing around in a classes methodArray,
or compiler/runtime system is broken :-(,
or you ignore the error messages during some recompile.
-
invalidCodeObjectWith: arg
-
When recompiling classes after a definition-change, all
uncompilable methods (with 1 arg) will be bound to this method here,
so that evaluating such an uncompilable method will trigger an error.
-
invalidCodeObjectWith: arg with: arg2
-
When recompiling classes after a definition-change, all
uncompilable methods (with 2 args) will be bound to this method here,
so that evaluating such an uncompilable method will trigger an error.
-
invalidCodeObjectWith: arg with: arg2 with: arg3
-
When recompiling classes after a definition-change, all
uncompilable methods (with 3 args) will be bound to this method here,
so that evaluating such an uncompilable method will trigger an error.
-
invalidCodeObjectWith: arg with: arg2 with: arg3 with: arg4
-
When recompiling classes after a definition-change, all
uncompilable methods (with 4 args) will be bound to this method here,
so that evaluating such an uncompilable method will trigger an error.
-
invalidCodeObjectWith: arg with: arg2 with: arg3 with: arg4 with: arg5
-
When recompiling classes after a definition-change, all
uncompilable methods (with 5 args) will be bound to this method here,
so that evaluating such an uncompilable method will trigger an error.
-
invalidCodeObjectWith: arg with: arg2 with: arg3 with: arg4 with: arg5 with: arg6
-
When recompiling classes after a definition-change, all
uncompilable methods (with 6 args) will be bound to this method here,
so that evaluating such an uncompilable method will trigger an error.
-
invalidCodeObjectWith: arg with: arg2 with: arg3 with: arg4 with: arg5 with: arg6 with: arg7
-
When recompiling classes after a definition-change, all
uncompilable methods (with 7 args) will be bound to this method here,
so that evaluating such an uncompilable method will trigger an error.
-
invalidCodeObjectWith: arg with: arg2 with: arg3 with: arg4 with: arg5 with: arg6 with: arg7 with: arg8
-
When recompiling classes after a definition-change, all
uncompilable methods (with 8 args) will be bound to this method here,
so that evaluating such an uncompilable method will trigger an error.
-
invalidCodeObjectWith: arg with: arg2 with: arg3 with: arg4 with: arg5 with: arg6 with: arg7 with: arg8 with: arg9
-
When recompiling classes after a definition-change, all
uncompilable methods (with 9 args) will be bound to this method here,
so that evaluating such an uncompilable method will trigger an error.
-
invalidCodeObjectWith: arg with: arg2 with: arg3 with: arg4 with: arg5 with: arg6 with: arg7 with: arg8 with: arg9 with: arg10
-
When recompiling classes after a definition-change, all
uncompilable methods (with 10 args) will be bound to this method here,
so that evaluating such an uncompilable method will trigger an error.
-
invalidCodeObjectWith: arg with: arg2 with: arg3 with: arg4 with: arg5 with: arg6 with: arg7 with: arg8 with: arg9 with: arg10 with: arg11
-
When recompiling classes after a definition-change, all
uncompilable methods (with 11 args) will be bound to this method here,
so that evaluating such an uncompilable method will trigger an error.
-
invalidCodeObjectWith: arg with: arg2 with: arg3 with: arg4 with: arg5 with: arg6 with: arg7 with: arg8 with: arg9 with: arg10 with: arg11 with: arg12
-
When recompiling classes after a definition-change, all
uncompilable methods (with 12 args) will be bound to this method here,
so that evaluating such an uncompilable method will trigger an error.
-
invalidCodeObjectWith: arg with: arg2 with: arg3 with: arg4 with: arg5 with: arg6 with: arg7 with: arg8 with: arg9 with: arg10 with: arg11 with: arg12 with: arg13
-
When recompiling classes after a definition-change, all
uncompilable methods (with 13 args) will be bound to this method here,
so that evaluating such an uncompilable method will trigger an error.
-
invalidCodeObjectWith: arg with: arg2 with: arg3 with: arg4 with: arg5 with: arg6 with: arg7 with: arg8 with: arg9 with: arg10 with: arg11 with: arg12 with: arg13 with: arg14
-
When recompiling classes after a definition-change, all
uncompilable methods (with 14 args) will be bound to this method here,
so that evaluating such an uncompilable method will trigger an error.
-
invalidCodeObjectWith: arg with: arg2 with: arg3 with: arg4 with: arg5 with: arg6 with: arg7 with: arg8 with: arg9 with: arg10 with: arg11 with: arg12 with: arg13 with: arg14 with: arg15
-
When recompiling classes after a definition-change, all
uncompilable methods (with 15 args) will be bound to this method here,
so that evaluating such an uncompilable method will trigger an error.
-
privateMethodCalled
-
this error is triggered, if a private or protected method is called.
If you continue in the debugger, the method will be called,
and further privacy exceptions will NOT be reported at this call location,
until any new method is compiled, or the privacy of any method changes,
or the caches are flushed.
(the reason is that after the continue, the method is enterred into the
calling cache, for which method privacy is not checked.
Any of the above actions flushes this cache and a privacy check
is performed again.)
Future versions may not enter private methods into the cache, to fix this
(unobvious) behavior. However, then you will get an exception for EVERY
call to a private method ...
Notice: method privacy is a nonstandard feature, not supported
by other smalltalk implementations and not specified in the ANSI spec.
This is EXPERIMENTAL - and being evaluated for usability.
It may change or even vanish (if it shows to be not useful).
-
uncompiledCodeObject
-
this method is invoked by methods which contain primitive code,
but have not been compiled to machine code (either due to an error
when compiling, or simply because no stc is available.
For those methods, the compiler generated a method object consisting
of the original source code, but with this methods machine/byte code.
-
unloadedCodeObject
-
this method is invoked by methods which have been binary-unloaded
For those the source info consists
of the original source code, but with this methods machine/byte code.
inspecting
-
inspectorExtraAttributes
-
extra (pseudo instvar) entries to be shown in an inspector.
printing & storing
-
printOn: aStream
-
put a printed representation of the receiver onto aStream.
Since methods do not store their class/selector, we have to search
for it here.
-
printStringForBrowserWithSelector: selector inClass: aClass
-
return a printString to represent myself to the user in a browser.
Defined here to allow for browsers to deal with nonStandard pseudoMethods
-
selectorPrintStringInBrowserFor: selector
-
-
selectorPrintStringInBrowserFor: selector class: aClass
-
-
whoString
-
return a string as className>>selector, if this is not an unbound
method. Otherwise return 'unbound'. Used with debugging.
private
-
cacheSourceStream: aStream
-
remember a (raw) source stream for later use
-
localSourceStream
-
try to open a stream from a local source file,
searching in standard places.
-
rawSourceStreamUsingCache: usingCacheBoolean
-
return an open sourceStream (needs positioning).
If usingCacheBoolean is true, cache the stream (but take care against concurrent access).
You have to close the stream, if usingCacheBoolean is false, ans should not close it
if usingCacheBoolean is true.
-
sourceChunkFromStream: aStream
-
-
sourceStreamUsingCache: usingCacheBoolean
-
return an open sourceStream (needs positioning).
If usingCacheBoolean is true, cache the stream (but take care against concurrent access).
You have to close the stream, if usingCacheBoolean is false, ans should not close it
if usingCacheBoolean is true.
private-compiler interface
-
primitiveNumber
-
for stx rel >= 5.x only:
return the primitive number.
-
setPrimitiveNumber: aNumber
-
for stx rel >= 5.x only:
mark the method as having primitive code.
-
setResourceFlag
-
mark the method as having a <resource> definition in its
source. This flag can be used to find resource-flagged methods quicker.
queries
-
accessedInstVars
-
return a collection of instVarNames, which are accessed by
the receiver method
-
containingClass
-
return the class I am defined in.
See comment in who.
-
externalLibraryFunction
-
if this is an externalLibraryFunction call, return the externalLibraryFunction.
Returns nil otherwise.
-
hasCanvasResource
-
return true, if this method is an image-resource method.
This is done by looking for a #canvas key in the method's resources.
-
hasImageResource
-
return true, if this method is an image-resource method.
This is done by looking for a #image key in the method's resources.
-
hasMenuResource
-
return true, if this method is a menu-resource method.
This is done by looking for a #image key in the method's resources.
-
hasPrimitiveCode
-
return true, if the method contains primitive code; false if not.
Uses Parser to parse methods source and get the information.
-
hasResource
-
return true if the method had a <resource> definition in its
source. This flag can be used to find resource-flagged methods quicker.
-
hasResource: aSymbol
-
return true if the method had a <resource> definition for aSymbol.
-
homeMethod
-
for common protocol with blocks: if the receiver is a method,
return the receiver; otherwise, if its a block, return its home
method.
-
indexOfOLECall
-
return true, if the method contains ole call; false if not.
Uses Parser to parse methods source and get the information.
-
isDocumentationMethod
-
Return true, if this is a documentation only (only a comment) method
(implies being a metaclass method)
-
isExternalLibraryFunctionCall
-
Return true, if this is an externalLibraryFunction call.
-
isInvalid
-
return true, if this method is not executable due to
a (re)-compilation error. Since invalidation is by patching the
methods code-pointer to a trap function, check for that here.
(see comment in Method>>invalidCodeObject).
-
isMethod
-
return true, if the receiver is some kind of method;
true returned here - the method is redefined from Object.
-
isOLECall
-
return true, if the method is an ole call; false if not.
-
isObsolete
-
returns true, if this method is obsolete and should not be used any longer
-
isVersionMethod
-
Return true, if this is a CVS, SVN or other version method.
Stupid: need to know all of them here; better add a pragma or
method attribute for that...
-
isVisualWorksTypedef
-
Return true, if this is a type-returning method (a visualWorks typedef)
-
mclass
-
return the class in which the receiver was compiled.
Same as #containingClass, for ST80 compatibility.
-
messages
-
return a collection of message-selectors, sent by this method.
-
messagesDo: aBlock
-
evaluate aBlock for each message-selector sent by this method.
Uses Parser to parse methods source and extract the names.
-
messagesSent
-
return a collection with the message selectors sent to by the receiver.
Uses Parser to parse methods source and extract the names.
The returned collection includes all used message selectors (i.e. including super-send messages)
-
messagesSentToSelf
-
return a collection with the message selectors sent to self by the receiver.
Uses Parser to parse methods source and extract the names.
-
messagesSentToSuper
-
return a collection with the message selectors sent to super by the receiver.
Uses Parser to parse methods source and extract the names.
-
methodArgAndVarNames
-
return a collection with the methods argument and variable names.
Uses Parser to parse methods source and extract the names.
Returns nil if the source is not available, or some other
syntax/parse error occurred. For methods with no args and no vars,
an empty collection is returned.
-
methodArgNames
-
return a collection with the methods argument names.
Uses Parser to parse methods source and extract the names.
-
methodComment
-
return the methods first comment, nil if there is none.
This is a somewhat stupid implementation.
-
methodDefinitionTemplate
-
return the string that defines the method and the arguments
-
methodInvocationInfo
-
-
methodVarNames
-
return a collection with the methods local-variable names.
Uses Parser to parse methods source and extract the names.
-
modificationTime
-
try to extract the modificationTime as a timeStamp from
the receivers source. If there is no source or no history line,
we do not know the modification time, and nil is returned.
-
name
-
for compatibility with javaMethods
-
parse: parseSelector return: accessSelector or: valueIfNoSource
-
helper for methodArgNames, methodVarNames etc.
Get the source, let parser parse it using parseSelector,
return parser-info using accessSelector
-
parse: parseSelector with: arg2 return: accessSelector or: valueIfNoSource
-
helper for methodArgNames, methodVarNames etc.
Get the source, let parser parse it using parseSelector,
return parser-info using accessSelector
-
parseResources
-
return the methods resource spec; either nil or a collection of symbols.
-
previousVersion
-
return the receivers previous versions source code
-
previousVersionCode
-
return the receivers previous versions source code
-
previousVersions
-
return a collection of the receivers previous versions (sources)
-
readsField: instVarIndex
-
return true, if the instvar at instVarIndex is read by the receiver.
Uses parser (for now); could look at bytecode as well here...
-
resourceType
-
ST-80 compatibility:
return the methods first resource specs key.
Returns either nil, or a single symbol.
-
resources
-
return the methods resource spec; either nil or a collection of symbols.
-
selector
-
return the selector under which I am found in my containingClasses
method-table.
See comment in who.
-
sends: aSelectorSymbol
-
return true, if this method contains a message-send
with aSelectorSymbol as selector.
-
sends: selectorSymbol1 or: selectorSymbol2
-
return true, if this method contains a message-send
to either selectorSymbol1 or selectorSymbol2.
-
shouldBeSkippedInDebuggersWalkBack
-
return true, if this method thinks, it should be skipped in a walkback.
This is done by looking for a #skipInDebuggersWalkBack flag in the methods resources.
-
superMessages
-
return a collection of message-selectors, sent to super by this method.
-
usedGlobals
-
return a collection with the global names referred to by the receiver.
Uses Parser to parse methods source and extract them.
-
usedSymbols
-
return a collection with the symbols referred to by the receiver.
Uses Parser to parse methods source and extract them.
This collection only includes implicit symbols references
(i.e. not messages sent)
-
who
-
return the class and selector of where I am defined in;
nil is returned for unbound methods.
ST/X special notice:
returns an instance of MethodWhoInfo, which
responds to #methodClass and #methodSelector query messages.
For backward- (& ST-80) compatibility, the returned object also
responds to #at:1 and #at:2 messages.
Implementation notice:
Since there is no information of the containing class
in the method, we have to do a search here.
Normally, this is not a problem, except when a method is
accepted in the debugger or redefined from within a method
(maybe done indirectly, if #doIt is done recursively)
- the information about which class the original method was
defined in is lost in this case.
Problem:
this is heavily called for in the debugger to create
a readable context walkback. For unbound methods, it is
slow, since the search (over all classes) will always fail.
Q: should we add a backref from the method to the class
and/or add a subclass of Method for unbound ones ?
Q2: if so, what about the bad guy then, who copies methods around to
other classes ?
-
wrapper
-
only for wrapped methods: return the wrapper.
Thats the WrapperMethod which contains myself.
-
writesField: instVarIndex
-
return true, if the instvar at instVarIndex is written (modified) by the receiver.
Uses parser (for now); could look at bytecode as well here...
trap methods
-
makeInvalid
-
make the receiver an invalid method, which raises an invalidCodeObject
signal when executed. This is not for public use - it is required for
the objectFileLoader to invalidate methods whose code is unloaded.
-
makeUncompiled
-
make the receiver an uncompiled method, which raises an invalidCodeObject
signal when executed. This is not for public use - it is required for
the compiler to invalidate methods which cannot be compiled due to errors
after a class definition change (for example: instvars are no longer there).
-
makeUnloaded
-
make the receiver an unloaded method, which raises an invalidCodeObject
signal when executed. This is not for public use - it is required for
the objectFileLoader to invalidate methods for which a shared library has
been removed.
-
trapMethodForNumArgs: numArgs
-
MethodWhoInfo
|