UndefinedObject.st
changeset 18480 d024e283fb68
parent 16908 25523cfdfa62
child 18482 68a43e2b3e78
child 20191 2081cd452152
equal deleted inserted replaced
18479:edff93c290bb 18480:d024e283fb68
     9  other person.  No title to or ownership of the software is
     9  other person.  No title to or ownership of the software is
    10  hereby transferred.
    10  hereby transferred.
    11 "
    11 "
    12 "{ Package: 'stx:libbasic' }"
    12 "{ Package: 'stx:libbasic' }"
    13 
    13 
       
    14 "{ NameSpace: Smalltalk }"
       
    15 
    14 Object subclass:#UndefinedObject
    16 Object subclass:#UndefinedObject
    15 	instanceVariableNames:''
    17 	instanceVariableNames:''
    16 	classVariableNames:'CreateMinimumProtocolInNewSubclassQuery'
    18 	classVariableNames:'CreateMinimumProtocolInNewSubclassQuery'
    17 	poolDictionaries:''
    19 	poolDictionaries:''
    18 	category:'Kernel-Objects'
    20 	category:'Kernel-Objects'
   106 
   108 
   107     "Created: 3.1.1997 / 15:05:48 / cg"
   109     "Created: 3.1.1997 / 15:05:48 / cg"
   108     "Modified: 3.1.1997 / 15:06:15 / cg"
   110     "Modified: 3.1.1997 / 15:06:15 / cg"
   109 ! !
   111 ! !
   110 
   112 
   111 
       
   112 !UndefinedObject class methodsFor:'queries'!
   113 !UndefinedObject class methodsFor:'queries'!
   113 
   114 
   114 canBeSubclassed
   115 canBeSubclassed
   115     "return true, if its allowed to create subclasses of the receiver.
   116     "return true, if its allowed to create subclasses of the receiver.
   116      Return false here - since it is NOT possible for UndefinedObject.
   117      Return false here - since it is NOT possible for UndefinedObject.
   153 ! !
   154 ! !
   154 
   155 
   155 
   156 
   156 
   157 
   157 
   158 
   158 
       
   159 
       
   160 !UndefinedObject methodsFor:'converting'!
   159 !UndefinedObject methodsFor:'converting'!
   161 
   160 
   162 asBoolean
   161 asBoolean
   163     ^ false
   162     ^ false
   164 !
   163 !
   297     "return the number of indexed instvars
   296     "return the number of indexed instvars
   298      defined here since size in Object ommits the nil-check"
   297      defined here since size in Object ommits the nil-check"
   299  
   298  
   300     ^ 0
   299     ^ 0
   301 ! !
   300 ! !
       
   301 
   302 
   302 
   303 !UndefinedObject methodsFor:'subclass creation'!
   303 !UndefinedObject methodsFor:'subclass creation'!
   304 
   304 
   305 nilSubclass:action
   305 nilSubclass:action
   306     "common helper for subclass creation.
   306     "common helper for subclass creation.
   451     "Modified: / 18.3.1999 / 18:30:16 / stefan"
   451     "Modified: / 18.3.1999 / 18:30:16 / stefan"
   452 ! !
   452 ! !
   453 
   453 
   454 !UndefinedObject methodsFor:'subclass creation-private'!
   454 !UndefinedObject methodsFor:'subclass creation-private'!
   455 
   455 
   456 subclass:nameSymbol instanceVariableNames:instVarNameString classVariableNames:classVarString poolDictionaries:pool privateIn:ownerClass
   456 subclass:nameSymbol instanceVariableNames:instVarNameString classVariableNames:classVarString poolDictionaries:pool privateIn:ownerClassArg
   457     "create a new private class which has nil as superclass 
   457     "create a new private class which has nil as superclass 
   458      - i.e. traps into #doesNotUnderstand: for all of its messages."
   458      - i.e. traps into #doesNotUnderstand: for all of its messages."
   459 
   459 
       
   460     |category ownerClass|
       
   461     
       
   462     (ownerClass := ownerClassArg) isNil ifTrue:[
       
   463         self error:'Nil (undefined) owner class - proceed to define as global' mayProceed:true.
       
   464     ] ifFalse:[
       
   465         category := ownerClassArg category
       
   466     ].
       
   467     
   460     ^ self 
   468     ^ self 
   461         nilSubclass:[
   469         nilSubclass:[
   462                 Object class
   470                 Object class
   463                     name:nameSymbol  
   471                     name:nameSymbol  
   464                     inEnvironment:ownerClass
   472                     inEnvironment:ownerClass
   467                     variable:false
   475                     variable:false
   468                     words:true
   476                     words:true
   469                     pointers:true
   477                     pointers:true
   470                     classVariableNames:classVarString
   478                     classVariableNames:classVarString
   471                     poolDictionaries:pool
   479                     poolDictionaries:pool
   472                     category:ownerClass category
   480                     category:category
   473                     comment:nil
   481                     comment:nil
   474                     changed:true
   482                     changed:true
   475         ]
   483         ]
   476 
   484 
   477     "Modified: / 3.1.1997 / 16:00:39 / cg"
   485     "Modified: / 3.1.1997 / 16:00:39 / cg"
   719     "dispatch for visitor pattern; send #visitNil:with: to aVisitor."
   727     "dispatch for visitor pattern; send #visitNil:with: to aVisitor."
   720 
   728 
   721     ^ aVisitor visitNilWith:aParameter
   729     ^ aVisitor visitNilWith:aParameter
   722 ! !
   730 ! !
   723 
   731 
   724 
       
   725 !UndefinedObject class methodsFor:'documentation'!
   732 !UndefinedObject class methodsFor:'documentation'!
   726 
   733 
   727 version
   734 version
   728     ^ '$Header: /cvs/stx/stx/libbasic/UndefinedObject.st,v 1.78 2014-10-26 01:31:37 vrany Exp $'
   735     ^ '$Header$'
   729 !
   736 !
   730 
   737 
   731 version_CVS
   738 version_CVS
   732     ^ '$Header: /cvs/stx/stx/libbasic/UndefinedObject.st,v 1.78 2014-10-26 01:31:37 vrany Exp $'
   739     ^ '$Header$'
   733 ! !
   740 ! !
   734 
   741 
   735 
   742 
   736 UndefinedObject initialize!
   743 UndefinedObject initialize!