--- a/Method.st Wed Nov 28 10:22:05 2012 +0000
+++ b/Method.st Fri Nov 30 17:19:23 2012 +0000
@@ -397,133 +397,6 @@
!Method methodsFor:'accessing'!
-annotateWith: annotation
- | index |
-
- index := self annotationIndexOf: annotation key.
- index isNil ifTrue:[
- annotations := annotations isNil
- ifTrue:[Array with: annotation]
- ifFalse:[annotations copyWith:annotation]
- ] ifFalse:[
- annotations at: index put: annotation
- ].
-"/ annotation annotatesMethod: self.
-
- "
- (Object >> #yourself) annotateWith: (Annotation namespace: 'Fictious').
- (Object >> #yourself) annotations.
- (Object >> #yourself) annotationAt: #namespace:
- "
-
- "Created: / 19-05-2010 / 16:20:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
- "Modified: / 20-05-2010 / 11:22:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
- "Modified (format): / 26-07-2012 / 15:47:51 / cg"
-!
-
-annotationAt: key
- | index |
-
- index := self annotationIndexOf: key.
- index isNil ifTrue:[^ nil].
- ^ self annotationAtIndex: index.
-
- "
- (Object >> #yourself) annotationAt: #namespace:
- "
-
- "Created: / 19-05-2010 / 16:16:25 / Jan Vrany <jan.vrany@fit.cvut.cz>"
- "Modified: / 02-07-2010 / 22:35:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
- "Modified: / 18-11-2011 / 14:46:21 / cg"
- "Modified (format): / 26-07-2012 / 15:47:54 / cg"
-!
-
-annotations
- "Returns the annotations (or an empty collection)"
-
- annotations isNil ifTrue:[^#()].
- "iterate over annotation array to
- trigger lazy-loading"
- self annotationsDo:[:ignored | ].
- ^ annotations
-
- "Modified: / 11-07-2010 / 19:25:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
- "Modified: / 18-11-2011 / 14:46:56 / cg"
- "Modified (comment): / 26-07-2012 / 15:50:26 / cg"
-!
-
-annotations: anObject
- "set the annotations"
-
- self setAnnotations: anObject.
-"/ "iterate over annotations just to invoke
-"/ annotationAtIndex: which lazyliyinitialize annotations
-"/ and send #annotatesMethod:"
-"/ self annotationsDo:[:annotation|]
-
- "Created: / 02-07-2010 / 22:38:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-annotationsAt: key
-
- ^OrderedCollection
- streamContents:[:annotStream|
- self annotationsAt: key do: [:annot| annotStream nextPut: annot]
- ]
-
- "Created: / 16-07-2010 / 11:41:13 / Jan Vrany <jan.vrany@fit.cvut.cz>"
- "Modified (format): / 26-07-2012 / 15:46:56 / cg"
-!
-
-annotationsAt: key do: block
- | annots |
-
- annots := OrderedCollection new: 1.
- self annotationsDo: [:annot|
- annot key == key ifTrue:[block value: annot]
- ]
-
- "Created: / 16-07-2010 / 11:48:49 / Jan Vrany <jan.vrany@fit.cvut.cz>"
- "Modified (format): / 26-07-2012 / 15:48:37 / cg"
-!
-
-annotationsAt: key1 orAt: key2
-
- ^OrderedCollection
- streamContents:[:annotStream|
- self annotationsAt: key1 orAt: key2 do: [:annot|annotStream nextPut: annot]
- ]
-
- "Created: / 16-07-2010 / 11:41:13 / Jan Vrany <jan.vrany@fit.cvut.cz>"
- "Modified (format): / 26-07-2012 / 15:49:11 / cg"
-!
-
-annotationsAt: key1 orAt: key2 do: block
- | annots |
-
- annots := OrderedCollection new: 1.
- self annotationsDo:[:annot |
- (annot key == key1 or:[annot key == key2]) ifTrue:[
- block value: annot
- ]
- ]
-
- "Created: / 16-07-2010 / 11:47:20 / Jan Vrany <jan.vrany@fit.cvut.cz>"
- "Modified (format): / 26-07-2012 / 15:49:30 / cg"
-!
-
-annotationsDo: aBlock
-
- annotations isNil ifTrue:[^nil].
- 1 to: annotations size do: [:i|
- aBlock value: (self annotationAtIndex: i)
- ].
-
- "Created: / 02-07-2010 / 22:33:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
- "Modified: / 11-07-2010 / 19:38:54 / Jan Vrany <jan.vrany@fit.cvut.cz>"
- "Modified (format): / 18-11-2011 / 14:47:06 / cg"
-!
-
category
"return the methods category or nil"
@@ -641,10 +514,12 @@
!
mclass:aClass
- "set the method's class"
-
- mclass == aClass ifTrue:[ ^ self ].
-
+ "set the method's class. That is the class in which I am installed.
+ This is a cache; the validity of which will be checked and the cache
+ possibly be invalidated when mclass is asked for."
+
+"/ mclass == aClass ifTrue:[ ^ self ].
+"/
"/ (mclass notNil and:[aClass notNil]) ifTrue:[
"/ 'Method [warning]: mclass already set' errorPrintCR.
"/ ].
@@ -959,6 +834,135 @@
"Modified: 16.1.1997 / 01:28:25 / cg"
! !
+!Method methodsFor:'accessing-annotations'!
+
+annotateWith: annotation
+ | index |
+
+ index := self annotationIndexOf: annotation key.
+ index isNil ifTrue:[
+ annotations := annotations isNil
+ ifTrue:[Array with: annotation]
+ ifFalse:[annotations copyWith:annotation]
+ ] ifFalse:[
+ annotations at: index put: annotation
+ ].
+"/ annotation annotatesMethod: self.
+
+ "
+ (Object >> #yourself) annotateWith: (Annotation namespace: 'Fictious').
+ (Object >> #yourself) annotations.
+ (Object >> #yourself) annotationAt: #namespace:
+ "
+
+ "Created: / 19-05-2010 / 16:20:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 20-05-2010 / 11:22:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified (format): / 26-07-2012 / 15:47:51 / cg"
+!
+
+annotationAt: key
+ | index |
+
+ index := self annotationIndexOf: key.
+ index isNil ifTrue:[^ nil].
+ ^ self annotationAtIndex: index.
+
+ "
+ (Object >> #yourself) annotationAt: #namespace:
+ "
+
+ "Created: / 19-05-2010 / 16:16:25 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 02-07-2010 / 22:35:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 18-11-2011 / 14:46:21 / cg"
+ "Modified (format): / 26-07-2012 / 15:47:54 / cg"
+!
+
+annotations
+ "Returns the annotations (or an empty collection)"
+
+ annotations isNil ifTrue:[^#()].
+ "iterate over annotation array to
+ trigger lazy-loading"
+ self annotationsDo:[:ignored | ].
+ ^ annotations
+
+ "Modified: / 11-07-2010 / 19:25:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 18-11-2011 / 14:46:56 / cg"
+ "Modified (comment): / 26-07-2012 / 15:50:26 / cg"
+!
+
+annotations: anObject
+ "set the annotations"
+
+ self setAnnotations: anObject.
+"/ "iterate over annotations just to invoke
+"/ annotationAtIndex: which lazyliyinitialize annotations
+"/ and send #annotatesMethod:"
+"/ self annotationsDo:[:annotation|]
+
+ "Created: / 02-07-2010 / 22:38:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+annotationsAt: key
+
+ ^OrderedCollection
+ streamContents:[:annotStream|
+ self annotationsAt: key do: [:annot| annotStream nextPut: annot]
+ ]
+
+ "Created: / 16-07-2010 / 11:41:13 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified (format): / 26-07-2012 / 15:46:56 / cg"
+!
+
+annotationsAt: key do: block
+ | annots |
+
+ annots := OrderedCollection new: 1.
+ self annotationsDo: [:annot|
+ annot key == key ifTrue:[block value: annot]
+ ]
+
+ "Created: / 16-07-2010 / 11:48:49 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified (format): / 26-07-2012 / 15:48:37 / cg"
+!
+
+annotationsAt: key1 orAt: key2
+
+ ^OrderedCollection
+ streamContents:[:annotStream|
+ self annotationsAt: key1 orAt: key2 do: [:annot|annotStream nextPut: annot]
+ ]
+
+ "Created: / 16-07-2010 / 11:41:13 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified (format): / 26-07-2012 / 15:49:11 / cg"
+!
+
+annotationsAt: key1 orAt: key2 do: block
+ | annots |
+
+ annots := OrderedCollection new: 1.
+ self annotationsDo:[:annot |
+ (annot key == key1 or:[annot key == key2]) ifTrue:[
+ block value: annot
+ ]
+ ]
+
+ "Created: / 16-07-2010 / 11:47:20 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified (format): / 26-07-2012 / 15:49:30 / cg"
+!
+
+annotationsDo: aBlock
+
+ annotations isNil ifTrue:[^nil].
+ 1 to: annotations size do: [:i|
+ aBlock value: (self annotationAtIndex: i)
+ ].
+
+ "Created: / 02-07-2010 / 22:33:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 11-07-2010 / 19:38:54 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified (format): / 18-11-2011 / 14:47:06 / cg"
+! !
+
!Method methodsFor:'accessing-visibility'!
isIgnored
@@ -2226,8 +2230,10 @@
setLookupObject: lookup
"set the lookupObject (low level - use lookupObject:)"
- lookupObject := lookup.
- ObjectMemory flushCaches.
+ lookupObject ~~ lookup ifTrue:[
+ lookupObject := lookup.
+ ObjectMemory flushCaches.
+ ].
"Created: / 11-07-2010 / 19:31:59 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
@@ -2375,7 +2381,7 @@
|who|
mclass notNil ifTrue:[
- "/ check if this (cached) info is still valid ...
+ "/ check if this (cached) info is still valid...
(mclass containsMethod:self) ifTrue:[
^ mclass
].
@@ -2546,16 +2552,6 @@
"Modified: / 01-12-2010 / 13:59:58 / cg"
!
-homeMethod
- "for common protocol with blocks: if the receiver is a method,
- return the receiver; otherwise, if its a block, return its home
- method."
-
- ^ self
-
- "Created: 19.6.1997 / 16:13:12 / cg"
-!
-
indexOfOLECall
"return the vtable inedx, if the method contains an ole call; nil if not.
Uses Parser to parse methods source and get the information."
@@ -3796,11 +3792,11 @@
!Method class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/Method.st,v 1.398 2012/10/23 08:23:10 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Method.st,v 1.402 2012/11/25 09:53:30 cg Exp $'
!
version_CVS
- ^ '§Header: /cvs/stx/stx/libbasic/Method.st,v 1.398 2012/10/23 08:23:10 cg Exp §'
+ ^ '§Header: /cvs/stx/stx/libbasic/Method.st,v 1.402 2012/11/25 09:53:30 cg Exp §'
!
version_SVN