ClassDefinitionChange.st
branchjv
changeset 3062 3bef6850206d
parent 3058 c4388bddfcb1
child 3069 89d2cfee177f
equal deleted inserted replaced
3061:e581f232e55f 3062:3bef6850206d
   401       ]
   401       ]
   402 
   402 
   403     "Modified: / 13-06-2012 / 13:01:58 / cg"
   403     "Modified: / 13-06-2012 / 13:01:58 / cg"
   404 !
   404 !
   405 
   405 
       
   406 definitionStringInNamespace: ns
       
   407     | classNameUsed superClassNameUsed |
       
   408 
       
   409     objectType == #variable ifTrue:[
       
   410         ^ String streamContents:[:stream |
       
   411             ns notNil ifTrue:[
       
   412                 stream 
       
   413                     nextPutAll:((ns asCollectionOfSubstringsSeparatedBy:$.) asStringWith:'::')
       
   414             ] ifFalse:[
       
   415                 self halt:'can this happen ?'.
       
   416                 stream 
       
   417                     nextPutAll:'Smalltalk'
       
   418             ].
       
   419 
       
   420             stream 
       
   421                 nextPutAll:' addClassVarName:';
       
   422                 nextPutAll:className asString storeString
       
   423           ].
       
   424     ].
       
   425 
       
   426     superClassNameUsed := self superClassName.
       
   427     classNameUsed := self classNameWithoutNamespace.
       
   428 
       
   429     ^ String streamContents:[:stream |
       
   430         self isPrivateClassDefinitionChange ifFalse:[
       
   431             stream 
       
   432                 nextPutAll:superClassNameUsed;
       
   433                 nextPutAll:' subclass:';
       
   434                 nextPutAll: classNameUsed asSymbol storeString
       
   435                 ;
       
   436                 cr;
       
   437                 tab;
       
   438                 nextPutAll:'instanceVariableNames:';
       
   439                 nextPutAll:(instanceVariableNames ? '') storeString;
       
   440                 cr;
       
   441                 tab;
       
   442                 nextPutAll:'classVariableNames:';
       
   443                 nextPutAll:(classVariableNames ? '') storeString;
       
   444                 cr;
       
   445                 tab;
       
   446                 nextPutAll:'poolDictionaries:';
       
   447                 nextPutAll:(poolDictionaries ? '') storeString;
       
   448                 cr;
       
   449                 tab;
       
   450                 nextPutAll:'category:';
       
   451                 nextPutAll:(category ? '') storeString;
       
   452                 cr
       
   453         ] ifTrue:[
       
   454             stream 
       
   455                 nextPutAll:superClassNameUsed;
       
   456                 nextPutAll:' subclass:';
       
   457                 nextPutAll: (self className copyFrom: owningClassName size + 3) asSymbol storeString
       
   458                 ;
       
   459                 cr;
       
   460                 tab;
       
   461                 nextPutAll:'instanceVariableNames:';
       
   462                 nextPutAll:(instanceVariableNames ? '') storeString;
       
   463                 cr;
       
   464                 tab;
       
   465                 nextPutAll:'classVariableNames:';
       
   466                 nextPutAll:(classVariableNames ? '') storeString;
       
   467                 cr;
       
   468                 tab;
       
   469                 nextPutAll:'poolDictionaries:';
       
   470                 nextPutAll:(poolDictionaries ? '') storeString;
       
   471                 cr;
       
   472                 tab;
       
   473                 nextPutAll:'privateIn:';
       
   474                 nextPutAll:
       
   475                     (ns isNil
       
   476                         ifTrue:[owningClassName]
       
   477                         ifFalse:[owningClassName copyFrom: ns size + 3]);
       
   478                 cr
       
   479         ]
       
   480     ]
       
   481 
       
   482     "Modified: / 06-10-2011 / 17:02:05 / cg"
       
   483     "Created: / 20-03-2012 / 19:40:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   484 !
       
   485 
       
   486 definitionStringWithoutNamespace
       
   487     |ns classNameUsed superClassNameUsed|
       
   488 
       
   489     ns := self nameSpaceOverride.
       
   490 
       
   491     objectType == #variable ifTrue:[
       
   492         ^ String streamContents:[:stream |
       
   493             ns notNil ifTrue:[
       
   494                 stream 
       
   495                     nextPutAll:((ns asCollectionOfSubstringsSeparatedBy:$.) asStringWith:'::')
       
   496             ] ifFalse:[
       
   497                 self halt:'can this happen ?'.
       
   498                 stream 
       
   499                     nextPutAll:'Smalltalk'
       
   500             ].
       
   501 
       
   502             stream 
       
   503                 nextPutAll:' addClassVarName:';
       
   504                 nextPutAll:className asString storeString
       
   505           ].
       
   506     ].
       
   507 
       
   508     superClassNameUsed := self superClassName.
       
   509     classNameUsed := self classNameWithoutNamespace.
       
   510 
       
   511     ^ String streamContents:[:stream |
       
   512         self isPrivateClassDefinitionChange ifFalse:[
       
   513             stream 
       
   514                 nextPutAll:superClassNameUsed;
       
   515                 nextPutAll:' subclass:';
       
   516                 nextPutAll: classNameUsed asSymbol storeString
       
   517                 ;
       
   518                 cr;
       
   519                 tab;
       
   520                 nextPutAll:'instanceVariableNames:';
       
   521                 nextPutAll:(instanceVariableNames ? '') storeString;
       
   522                 cr;
       
   523                 tab;
       
   524                 nextPutAll:'classVariableNames:';
       
   525                 nextPutAll:(classVariableNames ? '') storeString;
       
   526                 cr;
       
   527                 tab;
       
   528                 nextPutAll:'poolDictionaries:';
       
   529                 nextPutAll:(poolDictionaries ? '') storeString;
       
   530                 cr;
       
   531                 tab;
       
   532                 nextPutAll:'category:';
       
   533                 nextPutAll:(category ? '') storeString;
       
   534                 cr
       
   535         ] ifTrue:[
       
   536             stream 
       
   537                 nextPutAll:superClassNameUsed;
       
   538                 nextPutAll:' subclass:';
       
   539                 nextPutAll: (self className copyFrom: owningClassName size + 3) asSymbol storeString
       
   540                 ;
       
   541                 cr;
       
   542                 tab;
       
   543                 nextPutAll:'instanceVariableNames:';
       
   544                 nextPutAll:(instanceVariableNames ? '') storeString;
       
   545                 cr;
       
   546                 tab;
       
   547                 nextPutAll:'classVariableNames:';
       
   548                 nextPutAll:(classVariableNames ? '') storeString;
       
   549                 cr;
       
   550                 tab;
       
   551                 nextPutAll:'poolDictionaries:';
       
   552                 nextPutAll:(poolDictionaries ? '') storeString;
       
   553                 cr;
       
   554                 tab;
       
   555                 nextPutAll:'privateIn:';
       
   556                 nextPutAll:
       
   557                     ((ns := self nameSpaceName) isNil
       
   558                         ifTrue:[owningClassName]
       
   559                         ifFalse:[owningClassName copyFrom: ns size + 3]);
       
   560                 cr
       
   561         ]
       
   562     ]
       
   563 
       
   564     "Modified: / 06-10-2011 / 17:02:05 / cg"
       
   565     "Created: / 20-03-2012 / 16:37:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   566 !
       
   567 
   406 printOn:aStream
   568 printOn:aStream
   407     aStream 
   569     aStream 
   408         nextPutAll:className; nextPutAll:' {definition}'
   570         nextPutAll:className; nextPutAll:' {definition}'
   409 
   571 
   410     "Modified: / 12-10-2006 / 17:48:28 / cg"
   572     "Modified: / 12-10-2006 / 17:48:28 / cg"
   590 ! !
   752 ! !
   591 
   753 
   592 !ClassDefinitionChange class methodsFor:'documentation'!
   754 !ClassDefinitionChange class methodsFor:'documentation'!
   593 
   755 
   594 version
   756 version
   595     ^ '$Header: /cvs/stx/stx/libbasic3/ClassDefinitionChange.st,v 1.70 2012/06/13 11:03:04 cg Exp $'
   757     ^ '$Id: ClassDefinitionChange.st 1936 2012-07-24 15:47:21Z vranyj1 $'
   596 !
   758 !
   597 
   759 
   598 version_CVS
   760 version_CVS
   599     ^ 'Header: /cvs/stx/stx/libbasic3/ClassDefinitionChange.st,v 1.70 2012/06/13 11:03:04 cg Exp '
   761     ^ '§Header: /cvs/stx/stx/libbasic3/ClassDefinitionChange.st,v 1.70 2012/06/13 11:03:04 cg Exp §'
   600 !
   762 !
   601 
   763 
   602 version_SVN
   764 version_SVN
   603     ^ '$ Id: ClassDefinitionChange.st 1867 2011-06-08 21:57:08Z vranyj1  $'
   765     ^ '$Id:: ClassDefinitionChange.st 1936 2012-07-24 15:47:21Z vranyj1                                                             $'
   604 ! !
   766 ! !