569 |
569 |
570 self executeCollectedChangesNamed:('Add Initialized Instance Creation to ' , className). |
570 self executeCollectedChangesNamed:('Add Initialized Instance Creation to ' , className). |
571 |
571 |
572 "Created: / 11-10-2001 / 22:18:55 / cg" |
572 "Created: / 11-10-2001 / 22:18:55 / cg" |
573 "Modified: / 30-01-2011 / 00:58:04 / cg" |
573 "Modified: / 30-01-2011 / 00:58:04 / cg" |
|
574 ! |
|
575 |
|
576 createIsAbstractMethodIn:aClass |
|
577 "create a #isAbstract query method (I'm tired of typing)" |
|
578 |
|
579 |metaClass className code| |
|
580 |
|
581 metaClass := aClass theMetaclass. |
|
582 className := aClass theNonMetaclass name. |
|
583 |
|
584 self startCollectChanges. |
|
585 |
|
586 (metaClass includesSelector:#isAbstract) ifFalse:[ |
|
587 code := |
|
588 'isAbstract |
|
589 "Return if this class is an abstract class. |
|
590 True is returned here for myself only; false for subclasses. |
|
591 Abstract subclasses must redefine again." |
|
592 |
|
593 ^ self == ',className,'. |
|
594 '. |
|
595 self |
|
596 compile:code |
|
597 forClass:metaClass |
|
598 inCategory:#'queries'. |
|
599 ]. |
|
600 self executeCollectedChangesNamed:('Make ',className,' abstract'). |
574 ! |
601 ! |
575 |
602 |
576 createParametrizedInstanceCreationMethodsNamed:selector in:aClass |
603 createParametrizedInstanceCreationMethodsNamed:selector in:aClass |
577 "create a #selector instance creation method (I'm tired of typing)" |
604 "create a #selector instance creation method (I'm tired of typing)" |
578 |
605 |
1951 source := source , (' ' , eachVar , ' := ' , eachVar , 'Arg.' , Character cr). |
1978 source := source , (' ' , eachVar , ' := ' , eachVar , 'Arg.' , Character cr). |
1952 ]. |
1979 ]. |
1953 self compile:source forClass:aClass inCategory:#accessing. |
1980 self compile:source forClass:aClass inCategory:#accessing. |
1954 ! |
1981 ! |
1955 |
1982 |
|
1983 createShouldImplementMethodFor:aSelector category:cat in:aClass |
|
1984 "add a subclassResponsibility method; |
|
1985 but only if not already present." |
|
1986 |
|
1987 (aClass includesSelector:aSelector) ifFalse:[ |
|
1988 |
|
1989 self compile: |
|
1990 (Method methodDefinitionTemplateForSelector:aSelector) , |
|
1991 ' |
|
1992 "raise an error: this method should be implemented (TODO)" |
|
1993 |
|
1994 ^ self shouldImplement |
|
1995 ' |
|
1996 forClass:aClass |
|
1997 inCategory:cat. |
|
1998 ]. |
|
1999 ! |
|
2000 |
1956 createSubclassResponsibilityMethodFor:aSelector category:cat in:aClass |
2001 createSubclassResponsibilityMethodFor:aSelector category:cat in:aClass |
1957 "add a subclassResponsibility method; |
2002 "add a subclassResponsibility method; |
1958 but only if not already present." |
2003 but only if not already present." |
1959 |
2004 |
1960 (aClass includesSelector:aSelector) ifFalse:[ |
2005 (aClass includesSelector:aSelector) ifFalse:[ |
2613 ! ! |
2658 ! ! |
2614 |
2659 |
2615 !SmalltalkCodeGeneratorTool class methodsFor:'documentation'! |
2660 !SmalltalkCodeGeneratorTool class methodsFor:'documentation'! |
2616 |
2661 |
2617 version |
2662 version |
2618 ^ '$Header: /cvs/stx/stx/libtool/SmalltalkCodeGeneratorTool.st,v 1.21 2013-06-07 12:08:27 cg Exp $' |
2663 ^ '$Header: /cvs/stx/stx/libtool/SmalltalkCodeGeneratorTool.st,v 1.23 2013-10-10 14:23:44 cg Exp $' |
2619 ! |
2664 ! |
2620 |
2665 |
2621 version_CVS |
2666 version_CVS |
2622 ^ '$Header: /cvs/stx/stx/libtool/SmalltalkCodeGeneratorTool.st,v 1.21 2013-06-07 12:08:27 cg Exp $' |
2667 ^ '$Header: /cvs/stx/stx/libtool/SmalltalkCodeGeneratorTool.st,v 1.23 2013-10-10 14:23:44 cg Exp $' |
2623 ! |
2668 ! |
2624 |
2669 |
2625 version_HG |
2670 version_HG |
2626 |
2671 |
2627 ^ '$Changeset: <not expanded> $' |
2672 ^ '$Changeset: <not expanded> $' |
2628 ! |
2673 ! |
2629 |
2674 |
2630 version_SVN |
2675 version_SVN |
2631 ^ '$Id: SmalltalkCodeGeneratorTool.st,v 1.21 2013-06-07 12:08:27 cg Exp $' |
2676 ^ '$Id: SmalltalkCodeGeneratorTool.st,v 1.23 2013-10-10 14:23:44 cg Exp $' |
2632 ! ! |
2677 ! ! |
2633 |
2678 |