core/RGBehavior.st
changeset 24 9f41491c02d8
parent 9 d64df1abdf2a
child 26 cc42c27a0987
equal deleted inserted replaced
23:ab8c90f017c4 24:9f41491c02d8
       
     1 "
       
     2 COPYRIGHT (c) 2021 LabWare
       
     3 "
     1 "{ Package: 'stx:goodies/ring/core' }"
     4 "{ Package: 'stx:goodies/ring/core' }"
     2 
     5 
     3 "{ NameSpace: Smalltalk }"
     6 "{ NameSpace: Smalltalk }"
     4 
     7 
     5 RGBehaviorStrategyUser subclass:#RGBehavior
     8 RGBehaviorStrategyUser subclass:#RGBehavior
    15 Instance Variables
    18 Instance Variables
    16 	methods:		<Collection>
    19 	methods:		<Collection>
    17 	protocols:		<Collection>
    20 	protocols:		<Collection>
    18 	superclass:		<Object>'
    21 	superclass:		<Object>'
    19 !
    22 !
       
    23 
       
    24 !RGBehavior class methodsFor:'documentation'!
       
    25 
       
    26 copyright
       
    27 "
       
    28 COPYRIGHT (c) 2021 LabWare
       
    29 
       
    30 
       
    31 "
       
    32 ! !
    20 
    33 
    21 !RGBehavior class methodsFor:'instance creation'!
    34 !RGBehavior class methodsFor:'instance creation'!
    22 
    35 
    23 newClass
    36 newClass
    24 
    37 
   406     allTags := self defaultTags.
   419     allTags := self defaultTags.
   407     self tagsDo: [ :each | allTags add: each].
   420     self tagsDo: [ :each | allTags add: each].
   408     ^ allTags 
   421     ^ allTags 
   409 ! !
   422 ! !
   410 
   423 
       
   424 
   411 !RGBehavior methodsFor:'accessing class hierarchy'!
   425 !RGBehavior methodsFor:'accessing class hierarchy'!
   412 
   426 
   413 subclasses
   427 subclasses
   414 
   428 
   415     | result |
   429     | result |
   441 
   455 
   442 !RGBehavior methodsFor:'asYetUnclassified'!
   456 !RGBehavior methodsFor:'asYetUnclassified'!
   443 
   457 
   444 asYetUnclassifiedProtocolName
   458 asYetUnclassifiedProtocolName
   445 
   459 
   446     ^ 'as yet unclassified' asSymbol
   460     ^ RGObject asYetUnclassifiedProtocolName
       
   461 
       
   462     "Modified: / 04-02-2021 / 10:09:01 / Jan Vrany <jan.vrany@labware.com>"
   447 !
   463 !
   448 
   464 
   449 usedTraits
   465 usedTraits
   450 
   466 
   451     ^ self traitComposition usedTraits
   467     ^ self traitComposition usedTraits
       
   468 ! !
       
   469 
       
   470 !RGBehavior methodsFor:'compiling'!
       
   471 
       
   472 compile: aString classified: aCategory
       
   473     ^ self compile: aString classified: aCategory notifying: nil
       
   474 
       
   475     "Created: / 04-02-2021 / 10:07:35 / Jan Vrany <jan.vrany@labware.com>"
       
   476 !
       
   477 
       
   478 compile: aString classified: aCategory notifying: anObject
       
   479 
       
   480         | parseTree selector newMethod | 
       
   481         
       
   482         parseTree := (RBParser 
       
   483                 parseMethod: aString
       
   484                 onError: [ :msg :pos | ^ nil ]) methodClass: self.
       
   485         
       
   486         selector := parseTree selector.
       
   487         newMethod := self ensureLocalMethodNamed: selector.
       
   488         newMethod sourceCode: aString.
       
   489         aCategory notNil ifTrue: [ 
       
   490                 newMethod tagWith: aCategory ].
       
   491         
       
   492         ^ selector.
       
   493 
       
   494     "Created: / 04-02-2021 / 10:06:43 / Jan Vrany <jan.vrany@labware.com>"
       
   495 !
       
   496 
       
   497 compile: aString notifying: anObject
       
   498     ^ self compile: aString classified: self asYetUnclassifiedProtocolName notifying: anObject
       
   499 
       
   500     "Created: / 04-02-2021 / 10:18:20 / Jan Vrany <jan.vrany@labware.com>"
   452 ! !
   501 ! !
   453 
   502 
   454 !RGBehavior methodsFor:'conversion'!
   503 !RGBehavior methodsFor:'conversion'!
   455 
   504 
   456 convertToMetaclassTrait
   505 convertToMetaclassTrait
   815 
   864 
   816     ^ traitComposition := anRGTraitComposition
   865     ^ traitComposition := anRGTraitComposition
   817 ! !
   866 ! !
   818 
   867 
   819 !RGBehavior methodsFor:'queries - methods'!
   868 !RGBehavior methodsFor:'queries - methods'!
       
   869 
       
   870 >> selector
       
   871     ^ self methodNamed: selector
       
   872 
       
   873     "Created: / 04-02-2021 / 08:56:16 / Jan Vrany <jan.vrany@labware.com>"
       
   874 !
   820 
   875 
   821 ensureLocalMethodNamed: aSymbol
   876 ensureLocalMethodNamed: aSymbol
   822 
   877 
   823     ^ self localMethodNamed: aSymbol ifAbsent: [ 
   878     ^ self localMethodNamed: aSymbol ifAbsent: [ 
   824         | newMethod |
   879         | newMethod |
  1132             [aSuperclass == aClass ifTrue: [^true].
  1187             [aSuperclass == aClass ifTrue: [^true].
  1133             aSuperclass := aSuperclass superclass].
  1188             aSuperclass := aSuperclass superclass].
  1134     ^false
  1189     ^false
  1135 ! !
  1190 ! !
  1136 
  1191 
       
  1192 !RGBehavior class methodsFor:'documentation'!
       
  1193 
       
  1194 version_HG
       
  1195 
       
  1196     ^ '$Changeset: <not expanded> $'
       
  1197 ! !
       
  1198