Class.st
changeset 14704 9393f4343773
parent 14695 8494f93748c1
child 14708 e79cbf6abb76
equal deleted inserted replaced
14703:6a9a49cea683 14704:9393f4343773
   444     ^ self == Class class or:[self == Class]
   444     ^ self == Class class or:[self == Class]
   445 
   445 
   446     "Created: 15.4.1996 / 17:17:13 / cg"
   446     "Created: 15.4.1996 / 17:17:13 / cg"
   447     "Modified: 23.4.1996 / 15:56:58 / cg"
   447     "Modified: 23.4.1996 / 15:56:58 / cg"
   448 ! !
   448 ! !
   449 
       
   450 
   449 
   451 
   450 
   452 !Class methodsFor:'Compatibility-Dolphin'!
   451 !Class methodsFor:'Compatibility-Dolphin'!
   453 
   452 
   454 defaultCategoryForDolphinClasses
   453 defaultCategoryForDolphinClasses
   961 	self changed:#comment with:oldComment.
   960 	self changed:#comment with:oldComment.
   962 	Smalltalk changed:#classComment with:self.
   961 	Smalltalk changed:#classComment with:self.
   963     ]
   962     ]
   964 !
   963 !
   965 
   964 
       
   965 containingNameSpace
       
   966     "return the namespace I am really contained in;
       
   967      For private or anonymous classes, nil is returned -
       
   968      for public classes, Smalltalk is returned."
       
   969 
       
   970     |e|
       
   971 
       
   972     e := self nameSpace.
       
   973     "/ validate
       
   974     (e at:name ifAbsent:nil) == self ifFalse:[
       
   975         ^ nil
       
   976     ].
       
   977     ^ e
       
   978 !
       
   979 
   966 environment
   980 environment
   967     "return the namespace I am contained in; ST-80 compatible name"
   981     "return the namespace I am contained in; ST-80 compatible name"
   968 
   982 
   969     ^ self nameSpace
   983     ^ self nameSpace
   970 !
   984 !
  1023 !
  1037 !
  1024 
  1038 
  1025 nameSpace
  1039 nameSpace
  1026     "return the namespace I am contained in;
  1040     "return the namespace I am contained in;
  1027      For private or anonymous classes, nil is returned -
  1041      For private or anonymous classes, nil is returned -
  1028      for public classes, Smalltalk is returned."
  1042      for public classes, Smalltalk is returned.
       
  1043      For now, this also returns Smalltalk for classes which are actually anonymous;
       
  1044      this is left in for a while (because many users f this method expect a non-nil return value).
       
  1045      but will change in the future to return nil then.
       
  1046      In the meantime, use containingNameSpace, which provides the correct answer"
  1029 
  1047 
  1030     |idx nsName e|
  1048     |idx nsName e|
  1031 
  1049 
  1032     "/ cached in environment
  1050     "/ cached in environment
  1033     environment isNil ifTrue:[
  1051     environment isNil ifTrue:[
  1034 	e := Smalltalk. "/ default
  1052         e := Smalltalk. "/ default
  1035 
  1053 
  1036 	name notNil ifTrue:[
  1054         name notNil ifTrue:[
  1037 	    "/ due to the implementation, extract this from my name
  1055             "/ due to the implementation, extract this from my name
  1038 	    "/ (physically, all classes are found in Smalltalk)
  1056             "/ (physically, all classes are found in Smalltalk)
  1039 
  1057 
  1040 	    idx := name lastIndexOf:$:.
  1058             idx := name lastIndexOf:$:.
  1041 	    idx ~~ 0 ifTrue:[
  1059             idx ~~ 0 ifTrue:[
  1042 		(name at:idx-1) == $: ifTrue:[
  1060                 (name at:idx-1) == $: ifTrue:[
  1043 		    nsName := name copyTo:(idx - 2).
  1061                     nsName := name copyTo:(idx - 2).
  1044 		    e := Smalltalk at:nsName asSymbol.
  1062                     e := Smalltalk at:nsName asSymbol.
  1045 		]
  1063                 ]
  1046 	    ].
  1064             ].
  1047 	].
  1065         ].
  1048 	environment := e.
  1066         environment := e.
  1049     ].
  1067     ].
  1050     ^ environment
  1068     ^ environment
  1051 
  1069 
  1052     "Modified: / 20.7.1998 / 14:21:36 / cg"
  1070     "Modified: / 20.7.1998 / 14:21:36 / cg"
  1053 !
  1071 !
  5496 ! !
  5514 ! !
  5497 
  5515 
  5498 !Class class methodsFor:'documentation'!
  5516 !Class class methodsFor:'documentation'!
  5499 
  5517 
  5500 version
  5518 version
  5501     ^ '$Header: /cvs/stx/stx/libbasic/Class.st,v 1.614 2013-01-23 22:03:22 cg Exp $'
  5519     ^ '$Header: /cvs/stx/stx/libbasic/Class.st,v 1.615 2013-01-24 15:51:02 cg Exp $'
  5502 !
  5520 !
  5503 
  5521 
  5504 version_CVS
  5522 version_CVS
  5505     ^ '$Header: /cvs/stx/stx/libbasic/Class.st,v 1.614 2013-01-23 22:03:22 cg Exp $'
  5523     ^ '$Header: /cvs/stx/stx/libbasic/Class.st,v 1.615 2013-01-24 15:51:02 cg Exp $'
  5506 !
  5524 !
  5507 
  5525 
  5508 version_SVN
  5526 version_SVN
  5509     ^ '§ Id: Class.st 10643 2011-06-08 21:53:07Z vranyj1  §'
  5527     ^ '§ Id: Class.st 10643 2011-06-08 21:53:07Z vranyj1  §'
  5510 ! !
  5528 ! !