Method.st
changeset 13817 7d1e0e8ea364
parent 13805 dec466a100bc
child 13847 c1552e51c27a
equal deleted inserted replaced
13816:0acf49dc7d39 13817:7d1e0e8ea364
   429 annotationAt: key
   429 annotationAt: key
   430 
   430 
   431     | index |
   431     | index |
   432 
   432 
   433     index := self annotationIndexOf: key.
   433     index := self annotationIndexOf: key.
   434     index ifNil:[^nil].
   434     index isNil ifTrue:[^ nil].
   435     ^self annotationAtIndex: index.
   435     ^ self annotationAtIndex: index.
   436 
   436 
   437     "
   437     "
   438         (Object >> #yourself) annotationAt: #namespace:
   438         (Object >> #yourself) annotationAt: #namespace:
   439     "
   439     "
   440 
   440 
   441     "Created: / 19-05-2010 / 16:16:25 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   441     "Created: / 19-05-2010 / 16:16:25 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   442     "Modified: / 02-07-2010 / 22:35:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   442     "Modified: / 02-07-2010 / 22:35:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   443     "Modified: / 18-11-2011 / 14:46:21 / cg"
   443 !
   444 !
   444 
   445 
   445 annotations
   446 annotations
   446     "Returns annotations"
   447     "Returns annotations"
   447 
   448 
   448     annotations ifNil:[^#()].
   449     annotations isNil ifTrue:[^#()].
   449     "iterate over annotation array to
   450     "iterate over annotation array to
   450      trigger lazy-loading"
   451      trigger lazy-loading"
   451     self annotationsDo:[:ignored].
   452     self annotationsDo:[:ignored].
   452     ^ annotations
   453     ^ annotations
   453 
   454 
   454     "Modified: / 11-07-2010 / 19:25:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   455     "Modified: / 11-07-2010 / 19:25:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   456     "Modified: / 18-11-2011 / 14:46:56 / cg"
   455 !
   457 !
   456 
   458 
   457 annotations: anObject
   459 annotations: anObject
   458     "set the annotations"
   460     "set the annotations"
   459 
   461 
   510     "Created: / 16-07-2010 / 11:47:20 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   512     "Created: / 16-07-2010 / 11:47:20 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   511 !
   513 !
   512 
   514 
   513 annotationsDo: aBlock
   515 annotationsDo: aBlock
   514 
   516 
   515     annotations ifNil:[^nil].
   517     annotations isNil ifTrue:[^nil].
   516     1 to: annotations size do:
   518     1 to: annotations size do: [:i|
   517         [:i|aBlock value: (self annotationAtIndex: i)].
   519         aBlock value: (self annotationAtIndex: i)
       
   520     ].
   518 
   521 
   519     "Created: / 02-07-2010 / 22:33:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   522     "Created: / 02-07-2010 / 22:33:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   520     "Modified: / 11-07-2010 / 19:38:54 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   523     "Modified: / 11-07-2010 / 19:38:54 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   524     "Modified (format): / 18-11-2011 / 14:47:06 / cg"
   521 !
   525 !
   522 
   526 
   523 category
   527 category
   524     "return the methods category or nil"
   528     "return the methods category or nil"
   525 
   529 
   602     "Created: 16.1.1997 / 01:25:52 / cg"
   606     "Created: 16.1.1997 / 01:25:52 / cg"
   603 !
   607 !
   604 
   608 
   605 lookupObject
   609 lookupObject
   606 
   610 
   607     ^lookupObject ifNil:[Lookup builtin].
   611     ^lookupObject isNil ifTrue:[Lookup builtin].
   608 
   612 
   609     "Created: / 28-04-2010 / 18:36:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   613     "Created: / 28-04-2010 / 18:36:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   614     "Modified: / 18-11-2011 / 14:47:12 / cg"
   610 !
   615 !
   611 
   616 
   612 lookupObject: anObject
   617 lookupObject: anObject
   613 
   618 
   614     self setLookupObject: anObject.
   619     self setLookupObject: anObject.
   696 
   701 
   697     "Created: / 22-10-2010 / 11:46:07 / cg"
   702     "Created: / 22-10-2010 / 11:46:07 / cg"
   698 !
   703 !
   699 
   704 
   700 overriddenMethod
   705 overriddenMethod
   701 
       
   702     "Answers overridden method or nil."
   706     "Answers overridden method or nil."
   703 
   707 
   704     Overrides ifNil:[^nil].
   708     Overrides isNil ifTrue:[^ nil].
   705     ^(Overrides includesKey: self)
   709     ^ (Overrides includesKey: self)
   706         ifTrue:[Overrides at: self]
   710         ifTrue:[Overrides at: self]
   707 
   711 
   708     "Created: / 17-06-2009 / 19:09:58 / Jan Vrany <vranyj1@fel.cvut.cz>"
   712     "Created: / 17-06-2009 / 19:09:58 / Jan Vrany <vranyj1@fel.cvut.cz>"
       
   713     "Modified (format): / 18-11-2011 / 14:48:07 / cg"
   709 !
   714 !
   710 
   715 
   711 overriddenMethod: aMethod
   716 overriddenMethod: aMethod
   712 
   717 
   713     "Set overridden method to aMethod"
   718     "Set overridden method to aMethod"
   714 
   719 
   715     Overrides ifNil:[Overrides := WeakIdentityDictionary new:10].
   720     Overrides isNil ifTrue:[Overrides := WeakIdentityDictionary new:10].
   716     aMethod ifNotNil:[aMethod makeLocalStringSource].
   721     aMethod notNil ifTrue:[aMethod makeLocalStringSource].
   717     Overrides at: self put: aMethod
   722     Overrides at: self put: aMethod
   718 
   723 
   719     "Created: / 17-06-2009 / 19:09:17 / Jan Vrany <vranyj1@fel.cvut.cz>"
   724     "Created: / 17-06-2009 / 19:09:17 / Jan Vrany <vranyj1@fel.cvut.cz>"
   720     "Modified: / 22-08-2009 / 10:47:42 / Jan Vrany <vranyj1@fel.cvut.cz>"
   725     "Modified: / 22-08-2009 / 10:47:42 / Jan Vrany <vranyj1@fel.cvut.cz>"
       
   726     "Modified: / 18-11-2011 / 14:48:26 / cg"
   721 !
   727 !
   722 
   728 
   723 package
   729 package
   724     "return the package-ID of the method (nil is translated to noProject here)"
   730     "return the package-ID of the method (nil is translated to noProject here)"
   725 
   731 
  1889      any raw annotation array is lazily
  1895      any raw annotation array is lazily
  1890      initialized"
  1896      initialized"
  1891 
  1897 
  1892     | annotationOrArray annotation args |
  1898     | annotationOrArray annotation args |
  1893 
  1899 
  1894     annotations ifNil:[^nil].
  1900     annotations isNil ifTrue:[^nil].
  1895     annotationOrArray := annotation := annotations at: index.
  1901     annotationOrArray := annotation := annotations at: index.
  1896     annotationOrArray isArray ifTrue:[
  1902     annotationOrArray isArray ifTrue:[
  1897         args := annotationOrArray size == 2
  1903         args := annotationOrArray size == 2
  1898                     ifTrue:[annotationOrArray second]
  1904                     ifTrue:[annotationOrArray second]
  1899                     ifFalse:[#()].
  1905                     ifFalse:[#()].
  1909     ].
  1915     ].
  1910     ^annotation
  1916     ^annotation
  1911 
  1917 
  1912     "Created: / 02-07-2010 / 22:30:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1918     "Created: / 02-07-2010 / 22:30:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1913     "Modified: / 11-07-2010 / 19:39:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1919     "Modified: / 11-07-2010 / 19:39:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1914     "Modified: / 09-09-2011 / 05:00:52 / cg"
  1920     "Modified: / 18-11-2011 / 14:46:27 / cg"
  1915     "Modified (format): / 12-09-2011 / 09:34:48 / cg"
       
  1916 !
  1921 !
  1917 
  1922 
  1918 annotationIndexOf: key
  1923 annotationIndexOf: key
  1919 
  1924 
  1920     "Returns index of annotation with given key
  1925     "Returns index of annotation with given key
  1921      or nil if there is no such annotation"
  1926      or nil if there is no such annotation"
  1922 
  1927 
  1923     annotations ifNil:[^nil].
  1928     annotations isNil ifTrue:[^nil].
  1924 
  1929 
  1925     annotations keysAndValuesDo:
  1930     annotations keysAndValuesDo: [:index :annotationOrArray|
  1926         [:index :annotationOrArray|
       
  1927         annotationOrArray isArray
  1931         annotationOrArray isArray
  1928             ifTrue: [annotationOrArray first == key ifTrue:[^index]]
  1932             ifTrue: [annotationOrArray first == key ifTrue:[^index]]
  1929             ifFalse:[annotationOrArray key   == key ifTrue:[^index]]].
  1933             ifFalse:[annotationOrArray key == key ifTrue:[^index]]
       
  1934     ].
  1930     ^nil.
  1935     ^nil.
  1931 
  1936 
  1932     "Created: / 19-05-2010 / 16:40:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1937     "Created: / 19-05-2010 / 16:40:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1933     "Modified: / 11-07-2010 / 19:23:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1938     "Modified: / 11-07-2010 / 19:23:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
  1939     "Modified (format): / 18-11-2011 / 14:46:45 / cg"
  1934 !
  1940 !
  1935 
  1941 
  1936 cacheSourceStream:aStream
  1942 cacheSourceStream:aStream
  1937     "remember a (raw) source stream for later use"
  1943     "remember a (raw) source stream for later use"
  1938 
  1944 
  3063 
  3069 
  3064 resources
  3070 resources
  3065     "return the methods resource spec; either nil or a collection of symbols."
  3071     "return the methods resource spec; either nil or a collection of symbols."
  3066 
  3072 
  3067     | resources |
  3073     | resources |
       
  3074 
  3068     self hasResource ifFalse:[^ nil].
  3075     self hasResource ifFalse:[^ nil].
  3069     annotations ifNil:[^ self parseResources].
  3076     annotations isNil ifTrue:[^ self parseResources].
  3070 
  3077 
  3071     resources := IdentityDictionary new.
  3078     resources := IdentityDictionary new.
  3072     self annotationsAt: #resource: orAt: #resource:value: do:
  3079     self annotationsAt: #resource: orAt: #resource:value: do:[:annot|
  3073         [:annot|
  3080         resources at: annot type put: annot value ? true
  3074         resources at: annot type put: annot value ? true].
  3081     ].
  3075     ^resources
  3082     ^ resources
  3076 
  3083 
  3077     "Modified: / 16-07-2010 / 11:49:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  3084     "Modified: / 16-07-2010 / 11:49:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
  3085     "Modified: / 18-11-2011 / 14:48:41 / cg"
  3078 !
  3086 !
  3079 
  3087 
  3080 selector
  3088 selector
  3081     "return the selector under which I am found in my containingClasses
  3089     "return the selector under which I am found in my containingClasses
  3082      method-table.
  3090      method-table.
  3581 ! !
  3589 ! !
  3582 
  3590 
  3583 !Method class methodsFor:'documentation'!
  3591 !Method class methodsFor:'documentation'!
  3584 
  3592 
  3585 version
  3593 version
  3586     ^ '$Header: /cvs/stx/stx/libbasic/Method.st,v 1.378 2011-10-30 10:05:02 cg Exp $'
  3594     ^ '$Header: /cvs/stx/stx/libbasic/Method.st,v 1.379 2011-11-18 16:05:20 cg Exp $'
  3587 !
  3595 !
  3588 
  3596 
  3589 version_CVS
  3597 version_CVS
  3590     ^ '$Header: /cvs/stx/stx/libbasic/Method.st,v 1.378 2011-10-30 10:05:02 cg Exp $'
  3598     ^ '$Header: /cvs/stx/stx/libbasic/Method.st,v 1.379 2011-11-18 16:05:20 cg Exp $'
  3591 !
  3599 !
  3592 
  3600 
  3593 version_SVN
  3601 version_SVN
  3594     ^ '§ Id: Method.st 10648 2011-06-23 15:55:10Z vranyj1 §'
  3602     ^ '§ Id: Method.st 10648 2011-06-23 15:55:10Z vranyj1 §'
  3595 ! !
  3603 ! !