338 ! ! |
343 ! ! |
339 |
344 |
340 !ClassDefinitionChange methodsFor:'printing & storing'! |
345 !ClassDefinitionChange methodsFor:'printing & storing'! |
341 |
346 |
342 definitionString |
347 definitionString |
343 |ns classNameUsed superClassNameUsed| |
348 |ns classNameUsed superClassNameUsed selPart| |
344 |
349 |
345 ns := self nameSpaceOverride. |
350 ns := self nameSpaceOverride. |
346 |
351 |
347 objectType == #variable ifTrue:[ |
352 objectType == #variable ifTrue:[ |
348 ^ String streamContents:[:stream | |
353 ^ String streamContents:[:stream | |
349 ns notNil ifTrue:[ |
354 ns notNil ifTrue:[ |
350 stream |
355 stream nextPutAll:((ns asCollectionOfSubstringsSeparatedBy:$.) asStringWith:'::') |
351 nextPutAll:((ns asCollectionOfSubstringsSeparatedBy:$.) asStringWith:'::') |
|
352 ] ifFalse:[ |
356 ] ifFalse:[ |
353 self halt:'can this happen ?'. |
357 self halt:'can this happen ?'. |
354 stream |
358 stream nextPutAll:'Smalltalk' |
355 nextPutAll:'Smalltalk' |
|
356 ]. |
359 ]. |
357 |
360 |
358 stream |
361 stream |
359 nextPutAll:' addClassVarName:'; |
362 nextPutAll:' addClassVarName:'; |
360 nextPutAll:className asString storeString |
363 nextPutAll:className asString storeString |
361 ]. |
364 ]. |
362 ]. |
365 ]. |
363 |
366 |
364 superClassNameUsed := self superClassName. |
367 superClassNameUsed := self superClassName. |
365 classNameUsed := self className. |
368 classNameUsed := self className. |
|
369 selPart := (self definitionSelector ? #'subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:') |
|
370 keywords first. |
366 |
371 |
367 ^ String streamContents:[:stream | |
372 ^ String streamContents:[:stream | |
368 self isPrivateClassDefinitionChange ifFalse:[ |
373 stream |
|
374 nextPutAll:superClassNameUsed; |
|
375 nextPutAll:' ',selPart; |
|
376 nextPutAll: classNameUsed asSymbol storeString; |
|
377 cr; |
|
378 spaces:4; |
|
379 nextPutAll:'instanceVariableNames: '; |
|
380 nextPutAll:(instanceVariableNames ? '') storeString; |
|
381 cr; |
|
382 spaces:4; |
|
383 nextPutAll:'classVariableNames: '; |
|
384 nextPutAll:(classVariableNames ? '') storeString; |
|
385 cr; |
|
386 spaces:4; |
|
387 nextPutAll:'poolDictionaries: '; |
|
388 nextPutAll:(poolDictionaries ? '') storeString; |
|
389 cr. |
|
390 private == true ifTrue:[ |
369 stream |
391 stream |
370 nextPutAll:superClassNameUsed; |
392 spaces:4; |
371 nextPutAll:' subclass:'; |
393 nextPutAll:'privateIn: '; |
372 nextPutAll: classNameUsed asSymbol storeString |
394 nextPutAll:(self owningClassName) |
373 ; |
395 ] ifFalse:[ |
374 cr; |
|
375 tab; |
|
376 nextPutAll:'instanceVariableNames:'; |
|
377 nextPutAll:(instanceVariableNames ? '') storeString; |
|
378 cr; |
|
379 tab; |
|
380 nextPutAll:'classVariableNames:'; |
|
381 nextPutAll:(classVariableNames ? '') storeString; |
|
382 cr; |
|
383 tab; |
|
384 nextPutAll:'poolDictionaries:'; |
|
385 nextPutAll:(poolDictionaries ? '') storeString; |
|
386 cr; |
|
387 tab; |
|
388 nextPutAll:'category:'; |
|
389 nextPutAll:(category ? '') storeString; |
|
390 cr |
|
391 ] ifTrue:[ |
|
392 stream |
396 stream |
393 nextPutAll:superClassNameUsed; |
397 spaces:4; |
394 nextPutAll:' subclass:'; |
398 nextPutAll:'category: '; |
395 nextPutAll: (classNameUsed copyFrom: owningClassName size + 3) asSymbol storeString |
399 nextPutAll:(category ? '') storeString |
396 ; |
400 ]. |
397 cr; |
401 ] |
398 tab; |
402 |
399 nextPutAll:'instanceVariableNames:'; |
403 "Modified: / 13-06-2012 / 13:01:58 / cg" |
400 nextPutAll:(instanceVariableNames ? '') storeString; |
|
401 cr; |
|
402 tab; |
|
403 nextPutAll:'classVariableNames:'; |
|
404 nextPutAll:(classVariableNames ? '') storeString; |
|
405 cr; |
|
406 tab; |
|
407 nextPutAll:'poolDictionaries:'; |
|
408 nextPutAll:(poolDictionaries ? '') storeString; |
|
409 cr; |
|
410 tab; |
|
411 nextPutAll:'privateIn:'; |
|
412 nextPutAll:owningClassName; |
|
413 cr |
|
414 ] |
|
415 ] |
|
416 |
|
417 "Modified: / 06-10-2011 / 17:02:05 / cg" |
|
418 "Modified: / 19-03-2012 / 19:19:19 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
419 ! |
|
420 |
|
421 definitionStringInNamespace: ns |
|
422 | classNameUsed superClassNameUsed | |
|
423 |
|
424 objectType == #variable ifTrue:[ |
|
425 ^ String streamContents:[:stream | |
|
426 ns notNil ifTrue:[ |
|
427 stream |
|
428 nextPutAll:((ns asCollectionOfSubstringsSeparatedBy:$.) asStringWith:'::') |
|
429 ] ifFalse:[ |
|
430 self halt:'can this happen ?'. |
|
431 stream |
|
432 nextPutAll:'Smalltalk' |
|
433 ]. |
|
434 |
|
435 stream |
|
436 nextPutAll:' addClassVarName:'; |
|
437 nextPutAll:className asString storeString |
|
438 ]. |
|
439 ]. |
|
440 |
|
441 superClassNameUsed := self superClassName. |
|
442 classNameUsed := self classNameWithoutNamespace. |
|
443 |
|
444 ^ String streamContents:[:stream | |
|
445 self isPrivateClassDefinitionChange ifFalse:[ |
|
446 stream |
|
447 nextPutAll:superClassNameUsed ? 'nil'; |
|
448 nextPutAll:' subclass:'; |
|
449 nextPutAll: classNameUsed asSymbol storeString |
|
450 ; |
|
451 cr; |
|
452 tab; |
|
453 nextPutAll:'instanceVariableNames:'; |
|
454 nextPutAll:(instanceVariableNames ? '') storeString; |
|
455 cr; |
|
456 tab; |
|
457 nextPutAll:'classVariableNames:'; |
|
458 nextPutAll:(classVariableNames ? '') storeString; |
|
459 cr; |
|
460 tab; |
|
461 nextPutAll:'poolDictionaries:'; |
|
462 nextPutAll:(poolDictionaries ? '') storeString; |
|
463 cr; |
|
464 tab; |
|
465 nextPutAll:'category:'; |
|
466 nextPutAll:(category ? '') storeString; |
|
467 cr |
|
468 ] ifTrue:[ |
|
469 stream |
|
470 nextPutAll:superClassNameUsed; |
|
471 nextPutAll:' subclass:'; |
|
472 nextPutAll: (self className copyFrom: owningClassName size + 3) asSymbol storeString |
|
473 ; |
|
474 cr; |
|
475 tab; |
|
476 nextPutAll:'instanceVariableNames:'; |
|
477 nextPutAll:(instanceVariableNames ? '') storeString; |
|
478 cr; |
|
479 tab; |
|
480 nextPutAll:'classVariableNames:'; |
|
481 nextPutAll:(classVariableNames ? '') storeString; |
|
482 cr; |
|
483 tab; |
|
484 nextPutAll:'poolDictionaries:'; |
|
485 nextPutAll:(poolDictionaries ? '') storeString; |
|
486 cr; |
|
487 tab; |
|
488 nextPutAll:'privateIn:'; |
|
489 nextPutAll: |
|
490 (ns isNil |
|
491 ifTrue:[owningClassName] |
|
492 ifFalse:[owningClassName copyFrom: ns size + 3]); |
|
493 cr |
|
494 ] |
|
495 ] |
|
496 |
|
497 "Modified: / 06-10-2011 / 17:02:05 / cg" |
|
498 "Created: / 20-03-2012 / 19:40:32 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
499 ! |
|
500 |
|
501 definitionStringWithoutNamespace |
|
502 |ns classNameUsed superClassNameUsed| |
|
503 |
|
504 ns := self nameSpaceOverride. |
|
505 |
|
506 objectType == #variable ifTrue:[ |
|
507 ^ String streamContents:[:stream | |
|
508 ns notNil ifTrue:[ |
|
509 stream |
|
510 nextPutAll:((ns asCollectionOfSubstringsSeparatedBy:$.) asStringWith:'::') |
|
511 ] ifFalse:[ |
|
512 self halt:'can this happen ?'. |
|
513 stream |
|
514 nextPutAll:'Smalltalk' |
|
515 ]. |
|
516 |
|
517 stream |
|
518 nextPutAll:' addClassVarName:'; |
|
519 nextPutAll:className asString storeString |
|
520 ]. |
|
521 ]. |
|
522 |
|
523 superClassNameUsed := self superClassName. |
|
524 classNameUsed := self classNameWithoutNamespace. |
|
525 |
|
526 ^ String streamContents:[:stream | |
|
527 self isPrivateClassDefinitionChange ifFalse:[ |
|
528 stream |
|
529 nextPutAll:superClassNameUsed; |
|
530 nextPutAll:' subclass:'; |
|
531 nextPutAll: classNameUsed asSymbol storeString |
|
532 ; |
|
533 cr; |
|
534 tab; |
|
535 nextPutAll:'instanceVariableNames:'; |
|
536 nextPutAll:(instanceVariableNames ? '') storeString; |
|
537 cr; |
|
538 tab; |
|
539 nextPutAll:'classVariableNames:'; |
|
540 nextPutAll:(classVariableNames ? '') storeString; |
|
541 cr; |
|
542 tab; |
|
543 nextPutAll:'poolDictionaries:'; |
|
544 nextPutAll:(poolDictionaries ? '') storeString; |
|
545 cr; |
|
546 tab; |
|
547 nextPutAll:'category:'; |
|
548 nextPutAll:(category ? '') storeString; |
|
549 cr |
|
550 ] ifTrue:[ |
|
551 stream |
|
552 nextPutAll:superClassNameUsed; |
|
553 nextPutAll:' subclass:'; |
|
554 nextPutAll: (self className copyFrom: owningClassName size + 3) asSymbol storeString |
|
555 ; |
|
556 cr; |
|
557 tab; |
|
558 nextPutAll:'instanceVariableNames:'; |
|
559 nextPutAll:(instanceVariableNames ? '') storeString; |
|
560 cr; |
|
561 tab; |
|
562 nextPutAll:'classVariableNames:'; |
|
563 nextPutAll:(classVariableNames ? '') storeString; |
|
564 cr; |
|
565 tab; |
|
566 nextPutAll:'poolDictionaries:'; |
|
567 nextPutAll:(poolDictionaries ? '') storeString; |
|
568 cr; |
|
569 tab; |
|
570 nextPutAll:'privateIn:'; |
|
571 nextPutAll: |
|
572 ((ns := self nameSpaceName) isNil |
|
573 ifTrue:[owningClassName] |
|
574 ifFalse:[owningClassName copyFrom: ns size + 3]); |
|
575 cr |
|
576 ] |
|
577 ] |
|
578 |
|
579 "Modified: / 06-10-2011 / 17:02:05 / cg" |
|
580 "Created: / 20-03-2012 / 16:37:56 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
581 ! |
404 ! |
582 |
405 |
583 printOn:aStream |
406 printOn:aStream |
584 aStream |
407 aStream |
585 nextPutAll:className; nextPutAll:' {definition}' |
408 nextPutAll:className; nextPutAll:' {definition}' |