work in progress - rewriting code generators to replace CustomSourceCodeBuilder, but RBClass, RBMetaclass, RBNamespace and CodeGenerator
add class + method API to category Refactory-Model
add method compile to reflect changes in change classes - refactoryBrowser/changes
inject search + replace + format functionality to RBMethod from CustomSourceCodeGenerator
add compatibility method names to category Refactory-Model
--- a/CustomClassQuery.st Sun Oct 05 14:15:21 2014 +0200
+++ b/CustomClassQuery.st Tue Oct 07 23:05:10 2014 +0200
@@ -24,21 +24,24 @@
methodForSuperclassSelector: aSelector class: aClass
"retrieve method under given selector in class
superclass or in superclass superclass until method is found
- or Object is reached"
+ or nil is reached"
+
+ | superclass |
- | method |
+ superclass := aClass superclass.
+ [ superclass notNil ] whileTrue: [
+ | method |
- (aClass == Object) ifTrue: [
- ^ nil
+ method := superclass compiledMethodAt: aSelector asSymbol.
+ method notNil ifTrue: [
+ ^ method
+ ].
+ superclass := superclass superclass.
].
- method := aClass superclass compiledMethodAt: aSelector asSymbol.
- method isNil ifTrue: [
- ^ self methodForSuperclassSelector: aSelector class: (aClass superclass)
- ] ifFalse: [
- ^ method
- ]
+ ^ nil
"Created: / 15-06-2014 / 14:58:31 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+ "Modified: / 07-10-2014 / 19:50:42 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
! !
--- a/CustomClassQueryTests.st Sun Oct 05 14:15:21 2014 +0200
+++ b/CustomClassQueryTests.st Tue Oct 07 23:05:10 2014 +0200
@@ -28,6 +28,24 @@
!CustomClassQueryTests methodsFor:'tests'!
+test_method_from_superclass_not_found_01
+ | method |
+
+ method := classQuery methodForSuperclassSelector: 'someNonExistingMethod:withParam:' class: Object.
+ self assert: method isNil.
+
+ "Created: / 07-10-2014 / 19:54:22 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+!
+
+test_method_from_superclass_not_found_02
+ | method |
+
+ method := classQuery methodForSuperclassSelector: 'someNonExistingMethod:withParam:' class: self class.
+ self assert: method isNil.
+
+ "Created: / 07-10-2014 / 19:54:33 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+!
+
test_method_from_superclass_retrieved
| method |
--- a/CustomCodeGeneratorOrRefactoring.st Sun Oct 05 14:15:21 2014 +0200
+++ b/CustomCodeGeneratorOrRefactoring.st Tue Oct 07 23:05:10 2014 +0200
@@ -218,15 +218,11 @@
!
sourceCodeGenerator
- "Returns initialized source code generator"
- | sourceCodeGenerator |
- sourceCodeGenerator := CustomSourceCodeGenerator new.
- sourceCodeGenerator formatter: formatter.
- ^ sourceCodeGenerator.
+ ^ codeBuilder sourceCodeGenerator
"Created: / 19-09-2014 / 20:56:22 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
- "Modified: / 19-09-2014 / 22:11:02 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+ "Modified: / 07-10-2014 / 22:47:34 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
!
userPreferences
--- a/CustomRBMethodTests.st Sun Oct 05 14:15:21 2014 +0200
+++ b/CustomRBMethodTests.st Tue Oct 07 23:05:10 2014 +0200
@@ -1,7 +1,7 @@
"{ Package: 'jn:refactoring_custom' }"
TestCase subclass:#CustomRBMethodTests
- instanceVariableNames:'rbMethod mock'
+ instanceVariableNames:'rbMethod mock model'
classVariableNames:''
poolDictionaries:''
category:'Interface-Refactoring-Custom-Tests'
@@ -13,9 +13,11 @@
mock := CustomMock new.
rbMethod := mock mockOf: RBMethod.
+ model := RBNamespace new.
+ rbMethod model: model.
"Created: / 30-09-2014 / 19:36:05 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
- "Modified: / 03-10-2014 / 20:21:57 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+ "Modified: / 06-10-2014 / 07:38:49 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
!
tearDown
@@ -27,6 +29,291 @@
!CustomRBMethodTests methodsFor:'tests'!
+test_category_custom_set
+ | expectedCategory actualCategory |
+
+ expectedCategory := 'test category'.
+
+ rbMethod category: expectedCategory.
+ actualCategory := rbMethod category.
+
+ self assert: expectedCategory = actualCategory
+
+ "Created: / 06-10-2014 / 08:11:36 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+!
+
+test_category_empty
+ | expectedCategory actualCategory |
+
+ expectedCategory := 'as yet unclassified'.
+
+ "actually we need to set model class with real class
+ and selector or source to retrieve 'as yet unclassified' category/protocol"
+ rbMethod
+ modelClass: (model classNamed: #Object);
+ selector: #someSelector.
+ actualCategory := rbMethod category.
+
+ self assert: expectedCategory = actualCategory
+
+ "Created: / 06-10-2014 / 08:12:16 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+!
+
+test_category_from_compiled_method
+ | expectedCategory actualCategory |
+
+ expectedCategory := 'tests'.
+
+ rbMethod method: (self class compiledMethodAt: #test_category_from_compiled_method).
+ actualCategory := rbMethod category.
+
+ self assert: expectedCategory = actualCategory
+
+ "Created: / 06-10-2014 / 08:20:43 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+!
+
+test_category_from_real_class
+ | expectedCategory actualCategory |
+
+ expectedCategory := 'tests'.
+
+ rbMethod
+ class: self class;
+ selector: #test_category_from_real_class.
+
+ actualCategory := rbMethod category.
+
+ self assert: expectedCategory = actualCategory
+
+ "Created: / 06-10-2014 / 08:21:29 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+!
+
+test_class_for_model_class
+ | expectedModelClass actualModelClass |
+
+ expectedModelClass := RBClass new.
+
+ rbMethod class: expectedModelClass.
+ actualModelClass := rbMethod modelClass.
+
+ self assert: expectedModelClass = actualModelClass
+
+ "Created: / 06-10-2014 / 07:36:05 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+!
+
+test_class_for_real_class
+ | expectedModelClass actualModelClass |
+
+ expectedModelClass := model classNamed: #Object.
+
+ rbMethod class: Object.
+ actualModelClass := rbMethod modelClass.
+
+ self assert: expectedModelClass = actualModelClass
+
+ "Created: / 06-10-2014 / 07:36:35 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+!
+
+test_class_for_real_metaclass
+ | expectedModelClass actualModelClass |
+
+ expectedModelClass := model metaclassNamed: #Object.
+
+ rbMethod class: Object class.
+ actualModelClass := rbMethod modelClass.
+
+ self assert: expectedModelClass = actualModelClass
+
+ "Created: / 06-10-2014 / 07:42:19 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+!
+
+test_compile_with_code_generator
+ | actualMethod generator class source expectedSource actualSource |
+
+ generator := CustomSourceCodeGenerator new
+ formatter: CustomNoneSourceCodeFormatter new.
+
+ class := RBClass new
+ name: #SomeTestClass;
+ model: model;
+ superclassName: #Object;
+ yourself.
+
+ actualMethod := class compiledMethodAt: #selector_01.
+ self assert: actualMethod isNil.
+
+ source := 'selector_01
+ "Comment"
+
+ `variable := 500.
+ ^ `variable'.
+
+ expectedSource := 'selector_01
+ "Comment"
+
+ variableName := 500.
+ ^ variableName'.
+
+ rbMethod
+ class: class;
+ sourceCodeGenerator: generator;
+ source: source;
+ replace: '`variable' with: 'variableName';
+ protocol: 'test protocol';
+ compile.
+
+ actualMethod := class compiledMethodAt: #selector_01.
+ actualSource := actualMethod source.
+
+ self assert: actualSource = expectedSource.
+ self assert: (actualMethod protocol) = (rbMethod protocol)
+
+ "Created: / 06-10-2014 / 22:45:23 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+!
+
+test_compile_without_code_generator
+ | actualMethod class |
+
+ class := RBClass new
+ name: #SomeTestClass;
+ model: model;
+ superclassName: #Object;
+ yourself.
+
+ actualMethod := class compiledMethodAt: #selector_01.
+ self assert: actualMethod isNil.
+
+ rbMethod
+ class: class;
+ source: 'selector_01 ^ 12';
+ protocol: 'test protocol';
+ compile.
+
+ actualMethod := class compiledMethodAt: #selector_01.
+
+ self assert: (actualMethod source) = (rbMethod source).
+ self assert: (actualMethod protocol) = (rbMethod protocol)
+
+ "Created: / 06-10-2014 / 21:11:48 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+ "Modified: / 06-10-2014 / 22:33:44 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+!
+
+test_method_arg_names_none_arg
+ | expectedArguments actualArguments |
+
+ expectedArguments := nil.
+
+ rbMethod source: 'selector ^ 5'.
+ actualArguments := rbMethod methodArgNames.
+
+ self assert: expectedArguments = actualArguments
+
+ "Created: / 07-10-2014 / 21:39:24 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+!
+
+test_method_arg_names_one_arg
+ | expectedArguments actualArguments |
+
+ expectedArguments := #('arg_01').
+
+ rbMethod source: 'selector: arg_01 ^ 5'.
+ actualArguments := rbMethod methodArgNames.
+
+ self assert: expectedArguments = actualArguments
+
+ "Created: / 07-10-2014 / 21:39:56 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+!
+
+test_method_arg_names_two_args
+ | expectedArguments actualArguments |
+
+ expectedArguments := #('arg_01' 'arg_02').
+
+ rbMethod source: 'selector: arg_01 param: arg_02 ^ 5'.
+ actualArguments := rbMethod methodArgNames.
+
+ self assert: expectedArguments = actualArguments
+
+ "Created: / 07-10-2014 / 21:57:02 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+!
+
+test_method_definition_template_none_arg
+ | expectedMethodDefinition actualMethodDefinition |
+
+ expectedMethodDefinition := 'selector'.
+
+ rbMethod source: 'selector ^ 5'.
+ actualMethodDefinition := rbMethod methodDefinitionTemplate.
+
+ self assert: expectedMethodDefinition = actualMethodDefinition
+
+ "Created: / 07-10-2014 / 22:32:06 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+!
+
+test_method_definition_template_two_args
+ | expectedMethodDefinition actualMethodDefinition |
+
+ expectedMethodDefinition := 'selector:arg_01 param:arg_02'.
+
+ rbMethod source: 'selector: arg_01 param: arg_02 ^ 5'.
+ actualMethodDefinition := rbMethod methodDefinitionTemplate.
+
+ self assert: expectedMethodDefinition = actualMethodDefinition
+
+ "Created: / 07-10-2014 / 22:24:29 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+!
+
+test_real_method_arg_names_none_arg
+ "to check what Method >> methodArgNames returns"
+
+ | expectedArguments actualArguments class method |
+
+ class := mock mockClassOf: Object.
+ class new compileMockMethod: 'selector ^ 5'.
+ method := class compiledMethodAt: #selector.
+
+ expectedArguments := nil.
+ actualArguments := method methodArgNames.
+
+ self assert: expectedArguments = actualArguments
+
+ "Created: / 07-10-2014 / 21:41:58 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+!
+
+test_real_method_arg_names_one_arg
+ "to check what Method >> methodArgNames returns"
+
+ | expectedArguments actualArguments class method |
+
+ class := mock mockClassOf: Object.
+ class new compileMockMethod: 'selector: arg_01 ^ 5'.
+ method := class compiledMethodAt: #selector:.
+
+ expectedArguments := #('arg_01').
+ actualArguments := method methodArgNames.
+
+ self assert: expectedArguments = actualArguments
+
+ "Created: / 07-10-2014 / 21:53:00 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+!
+
+test_real_method_arg_names_two_args
+ "to check what Method >> methodArgNames returns"
+
+ | expectedArguments actualArguments class method |
+
+ class := mock mockClassOf: Object.
+ class new compileMockMethod: 'selector: arg_01 param: arg_02 ^ 5'.
+ method := class compiledMethodAt: #selector:param:.
+
+ expectedArguments := #('arg_01' 'arg_02').
+ actualArguments := method methodArgNames.
+
+ self assert: expectedArguments = actualArguments
+
+ "Created: / 07-10-2014 / 21:55:50 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+!
+
test_sends_literal_or_sends_another_literal_first
rbMethod source: 'selector ^ self subclassResponsibility'.
--- a/CustomSourceCodeBuilder.st Sun Oct 05 14:15:21 2014 +0200
+++ b/CustomSourceCodeBuilder.st Tue Oct 07 23:05:10 2014 +0200
@@ -73,6 +73,18 @@
formatter := aFormatter
"Created: / 28-08-2014 / 23:19:26 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+!
+
+sourceCodeGenerator
+ "Returns initialized source code generator"
+ | sourceCodeGenerator |
+
+ sourceCodeGenerator := CustomSourceCodeGenerator new.
+ sourceCodeGenerator formatter: formatter.
+ ^ sourceCodeGenerator.
+
+ "Created: / 19-09-2014 / 20:56:22 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+ "Modified: / 19-09-2014 / 22:11:02 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
! !
!CustomSourceCodeBuilder methodsFor:'code creation'!
@@ -158,11 +170,11 @@
| methodBuilder |
methodBuilder := self methodBuilder.
- "/ codeBuilds add: methodBuilder.
+ methodBuilder sourceCodeGenerator: self sourceCodeGenerator.
^ methodBuilder
"Created: / 09-04-2014 / 23:54:03 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
- "Modified: / 29-09-2014 / 23:14:25 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+ "Modified: / 07-10-2014 / 22:48:32 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
!
createMethodImmediate: aClass protocol: aProtocol source: aSource
--- a/CustomUITestCaseCodeGenerator.st Sun Oct 05 14:15:21 2014 +0200
+++ b/CustomUITestCaseCodeGenerator.st Tue Oct 07 23:05:10 2014 +0200
@@ -7,6 +7,7 @@
category:'Interface-Refactoring-Custom-Generators'
!
+
!CustomUITestCaseCodeGenerator class methodsFor:'accessing-presentation'!
description
@@ -38,3 +39,10 @@
"Created: / 16-09-2014 / 11:20:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
+!CustomUITestCaseCodeGenerator class methodsFor:'documentation'!
+
+version_HG
+
+ ^ '$Changeset: <not expanded> $'
+! !
+
--- a/Make.proto Sun Oct 05 14:15:21 2014 +0200
+++ b/Make.proto Tue Oct 07 23:05:10 2014 +0200
@@ -184,10 +184,9 @@
$(OUTDIR)CustomSimpleAccessMethodsCodeGenerator.$(O) CustomSimpleAccessMethodsCodeGenerator.$(H): CustomSimpleAccessMethodsCodeGenerator.st $(INCLUDE_TOP)/jn/refactoring_custom/CustomAccessMethodsCodeGenerator.$(H) $(INCLUDE_TOP)/jn/refactoring_custom/CustomCodeGenerator.$(H) $(INCLUDE_TOP)/jn/refactoring_custom/CustomCodeGeneratorOrRefactoring.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
$(OUTDIR)CustomSimpleGetterMethodsCodeGenerator.$(O) CustomSimpleGetterMethodsCodeGenerator.$(H): CustomSimpleGetterMethodsCodeGenerator.st $(INCLUDE_TOP)/jn/refactoring_custom/CustomAccessMethodsCodeGenerator.$(H) $(INCLUDE_TOP)/jn/refactoring_custom/CustomCodeGenerator.$(H) $(INCLUDE_TOP)/jn/refactoring_custom/CustomCodeGeneratorOrRefactoring.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
$(OUTDIR)CustomSimpleSetterMethodsCodeGenerator.$(O) CustomSimpleSetterMethodsCodeGenerator.$(H): CustomSimpleSetterMethodsCodeGenerator.st $(INCLUDE_TOP)/jn/refactoring_custom/CustomAccessMethodsCodeGenerator.$(H) $(INCLUDE_TOP)/jn/refactoring_custom/CustomCodeGenerator.$(H) $(INCLUDE_TOP)/jn/refactoring_custom/CustomCodeGeneratorOrRefactoring.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
-$(OUTDIR)CustomSimpleTestCaseCodeGenerator.$(O) CustomSimpleTestCaseCodeGenerator.$(H): CustomSimpleTestCaseCodeGenerator.st $(INCLUDE_TOP)/jn/refactoring_custom/CustomCodeGenerator.$(H) $(INCLUDE_TOP)/jn/refactoring_custom/CustomCodeGeneratorOrRefactoring.$(H) $(INCLUDE_TOP)/jn/refactoring_custom/CustomTestCaseCodeGenerator.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)CustomUITestCaseCodeGenerator.$(O) CustomUITestCaseCodeGenerator.$(H): CustomUITestCaseCodeGenerator.st $(INCLUDE_TOP)/jn/refactoring_custom/CustomCodeGenerator.$(H) $(INCLUDE_TOP)/jn/refactoring_custom/CustomCodeGeneratorOrRefactoring.$(H) $(INCLUDE_TOP)/jn/refactoring_custom/CustomTestCaseCodeGenerator.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)CustomUITestCaseSetUpCodeGenerator.$(O) CustomUITestCaseSetUpCodeGenerator.$(H): CustomUITestCaseSetUpCodeGenerator.st $(INCLUDE_TOP)/jn/refactoring_custom/CustomCodeGenerator.$(H) $(INCLUDE_TOP)/jn/refactoring_custom/CustomCodeGeneratorOrRefactoring.$(H) $(INCLUDE_TOP)/jn/refactoring_custom/CustomTestCaseSetUpCodeGenerator.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
$(OUTDIR)CustomValueHolderAccessMethodsCodeGenerator.$(O) CustomValueHolderAccessMethodsCodeGenerator.$(H): CustomValueHolderAccessMethodsCodeGenerator.st $(INCLUDE_TOP)/jn/refactoring_custom/CustomAccessMethodsCodeGenerator.$(H) $(INCLUDE_TOP)/jn/refactoring_custom/CustomCodeGenerator.$(H) $(INCLUDE_TOP)/jn/refactoring_custom/CustomCodeGeneratorOrRefactoring.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
-$(OUTDIR)CustomUITestCaseCodeGenerator.$(O) CustomUITestCaseCodeGenerator.$(H): CustomUITestCaseCodeGenerator.st $(INCLUDE_TOP)/jn/refactoring_custom/CustomCodeGenerator.$(H) $(INCLUDE_TOP)/jn/refactoring_custom/CustomCodeGeneratorOrRefactoring.$(H) $(INCLUDE_TOP)/jn/refactoring_custom/CustomCodeGeneratorOrRefactoringBase.$(H) $(INCLUDE_TOP)/jn/refactoring_custom/CustomTestCaseCodeGenerator.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
-$(OUTDIR)CustomUITestCaseSetUpCodeGenerator.$(O) CustomUITestCaseSetUpCodeGenerator.$(H): CustomUITestCaseSetUpCodeGenerator.st $(INCLUDE_TOP)/jn/refactoring_custom/CustomCodeGenerator.$(H) $(INCLUDE_TOP)/jn/refactoring_custom/CustomCodeGeneratorOrRefactoring.$(H) $(INCLUDE_TOP)/jn/refactoring_custom/CustomCodeGeneratorOrRefactoringBase.$(H) $(INCLUDE_TOP)/jn/refactoring_custom/CustomTestCaseSetUpCodeGenerator.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
$(OUTDIR)CustomValueHolderGetterMethodsCodeGenerator.$(O) CustomValueHolderGetterMethodsCodeGenerator.$(H): CustomValueHolderGetterMethodsCodeGenerator.st $(INCLUDE_TOP)/jn/refactoring_custom/CustomAccessMethodsCodeGenerator.$(H) $(INCLUDE_TOP)/jn/refactoring_custom/CustomCodeGenerator.$(H) $(INCLUDE_TOP)/jn/refactoring_custom/CustomCodeGeneratorOrRefactoring.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
$(OUTDIR)CustomValueHolderWithChangeNotificationAccessMethodsCodeGenerator.$(O) CustomValueHolderWithChangeNotificationAccessMethodsCodeGenerator.$(H): CustomValueHolderWithChangeNotificationAccessMethodsCodeGenerator.st $(INCLUDE_TOP)/jn/refactoring_custom/CustomAccessMethodsCodeGenerator.$(H) $(INCLUDE_TOP)/jn/refactoring_custom/CustomCodeGenerator.$(H) $(INCLUDE_TOP)/jn/refactoring_custom/CustomCodeGeneratorOrRefactoring.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
$(OUTDIR)CustomValueHolderWithChangeNotificationGetterMethodsCodeGenerator.$(O) CustomValueHolderWithChangeNotificationGetterMethodsCodeGenerator.$(H): CustomValueHolderWithChangeNotificationGetterMethodsCodeGenerator.st $(INCLUDE_TOP)/jn/refactoring_custom/CustomAccessMethodsCodeGenerator.$(H) $(INCLUDE_TOP)/jn/refactoring_custom/CustomCodeGenerator.$(H) $(INCLUDE_TOP)/jn/refactoring_custom/CustomCodeGeneratorOrRefactoring.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
--- a/bc.mak Sun Oct 05 14:15:21 2014 +0200
+++ b/bc.mak Tue Oct 07 23:05:10 2014 +0200
@@ -130,10 +130,9 @@
$(OUTDIR)CustomSimpleAccessMethodsCodeGenerator.$(O) CustomSimpleAccessMethodsCodeGenerator.$(H): CustomSimpleAccessMethodsCodeGenerator.st $(INCLUDE_TOP)\jn\refactoring_custom\CustomAccessMethodsCodeGenerator.$(H) $(INCLUDE_TOP)\jn\refactoring_custom\CustomCodeGenerator.$(H) $(INCLUDE_TOP)\jn\refactoring_custom\CustomCodeGeneratorOrRefactoring.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
$(OUTDIR)CustomSimpleGetterMethodsCodeGenerator.$(O) CustomSimpleGetterMethodsCodeGenerator.$(H): CustomSimpleGetterMethodsCodeGenerator.st $(INCLUDE_TOP)\jn\refactoring_custom\CustomAccessMethodsCodeGenerator.$(H) $(INCLUDE_TOP)\jn\refactoring_custom\CustomCodeGenerator.$(H) $(INCLUDE_TOP)\jn\refactoring_custom\CustomCodeGeneratorOrRefactoring.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
$(OUTDIR)CustomSimpleSetterMethodsCodeGenerator.$(O) CustomSimpleSetterMethodsCodeGenerator.$(H): CustomSimpleSetterMethodsCodeGenerator.st $(INCLUDE_TOP)\jn\refactoring_custom\CustomAccessMethodsCodeGenerator.$(H) $(INCLUDE_TOP)\jn\refactoring_custom\CustomCodeGenerator.$(H) $(INCLUDE_TOP)\jn\refactoring_custom\CustomCodeGeneratorOrRefactoring.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
-$(OUTDIR)CustomSimpleTestCaseCodeGenerator.$(O) CustomSimpleTestCaseCodeGenerator.$(H): CustomSimpleTestCaseCodeGenerator.st $(INCLUDE_TOP)\jn\refactoring_custom\CustomCodeGenerator.$(H) $(INCLUDE_TOP)\jn\refactoring_custom\CustomCodeGeneratorOrRefactoring.$(H) $(INCLUDE_TOP)\jn\refactoring_custom\CustomTestCaseCodeGenerator.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
+$(OUTDIR)CustomUITestCaseCodeGenerator.$(O) CustomUITestCaseCodeGenerator.$(H): CustomUITestCaseCodeGenerator.st $(INCLUDE_TOP)\jn\refactoring_custom\CustomCodeGenerator.$(H) $(INCLUDE_TOP)\jn\refactoring_custom\CustomCodeGeneratorOrRefactoring.$(H) $(INCLUDE_TOP)\jn\refactoring_custom\CustomTestCaseCodeGenerator.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
+$(OUTDIR)CustomUITestCaseSetUpCodeGenerator.$(O) CustomUITestCaseSetUpCodeGenerator.$(H): CustomUITestCaseSetUpCodeGenerator.st $(INCLUDE_TOP)\jn\refactoring_custom\CustomCodeGenerator.$(H) $(INCLUDE_TOP)\jn\refactoring_custom\CustomCodeGeneratorOrRefactoring.$(H) $(INCLUDE_TOP)\jn\refactoring_custom\CustomTestCaseSetUpCodeGenerator.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
$(OUTDIR)CustomValueHolderAccessMethodsCodeGenerator.$(O) CustomValueHolderAccessMethodsCodeGenerator.$(H): CustomValueHolderAccessMethodsCodeGenerator.st $(INCLUDE_TOP)\jn\refactoring_custom\CustomAccessMethodsCodeGenerator.$(H) $(INCLUDE_TOP)\jn\refactoring_custom\CustomCodeGenerator.$(H) $(INCLUDE_TOP)\jn\refactoring_custom\CustomCodeGeneratorOrRefactoring.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
-$(OUTDIR)CustomUITestCaseCodeGenerator.$(O) CustomUITestCaseCodeGenerator.$(H): CustomUITestCaseCodeGenerator.st $(INCLUDE_TOP)\jn\refactoring_custom\CustomCodeGenerator.$(H) $(INCLUDE_TOP)\jn\refactoring_custom\CustomCodeGeneratorOrRefactoring.$(H) $(INCLUDE_TOP)\jn\refactoring_custom\CustomCodeGeneratorOrRefactoringBase.$(H) $(INCLUDE_TOP)\jn\refactoring_custom\CustomTestCaseCodeGenerator.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
-$(OUTDIR)CustomUITestCaseSetUpCodeGenerator.$(O) CustomUITestCaseSetUpCodeGenerator.$(H): CustomUITestCaseSetUpCodeGenerator.st $(INCLUDE_TOP)\jn\refactoring_custom\CustomCodeGenerator.$(H) $(INCLUDE_TOP)\jn\refactoring_custom\CustomCodeGeneratorOrRefactoring.$(H) $(INCLUDE_TOP)\jn\refactoring_custom\CustomCodeGeneratorOrRefactoringBase.$(H) $(INCLUDE_TOP)\jn\refactoring_custom\CustomTestCaseSetUpCodeGenerator.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
$(OUTDIR)CustomValueHolderGetterMethodsCodeGenerator.$(O) CustomValueHolderGetterMethodsCodeGenerator.$(H): CustomValueHolderGetterMethodsCodeGenerator.st $(INCLUDE_TOP)\jn\refactoring_custom\CustomAccessMethodsCodeGenerator.$(H) $(INCLUDE_TOP)\jn\refactoring_custom\CustomCodeGenerator.$(H) $(INCLUDE_TOP)\jn\refactoring_custom\CustomCodeGeneratorOrRefactoring.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
$(OUTDIR)CustomValueHolderWithChangeNotificationAccessMethodsCodeGenerator.$(O) CustomValueHolderWithChangeNotificationAccessMethodsCodeGenerator.$(H): CustomValueHolderWithChangeNotificationAccessMethodsCodeGenerator.st $(INCLUDE_TOP)\jn\refactoring_custom\CustomAccessMethodsCodeGenerator.$(H) $(INCLUDE_TOP)\jn\refactoring_custom\CustomCodeGenerator.$(H) $(INCLUDE_TOP)\jn\refactoring_custom\CustomCodeGeneratorOrRefactoring.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
$(OUTDIR)CustomValueHolderWithChangeNotificationGetterMethodsCodeGenerator.$(O) CustomValueHolderWithChangeNotificationGetterMethodsCodeGenerator.$(H): CustomValueHolderWithChangeNotificationGetterMethodsCodeGenerator.st $(INCLUDE_TOP)\jn\refactoring_custom\CustomAccessMethodsCodeGenerator.$(H) $(INCLUDE_TOP)\jn\refactoring_custom\CustomCodeGenerator.$(H) $(INCLUDE_TOP)\jn\refactoring_custom\CustomCodeGeneratorOrRefactoring.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
--- a/extensions.st Sun Oct 05 14:15:21 2014 +0200
+++ b/extensions.st Tue Oct 07 23:05:10 2014 +0200
@@ -56,6 +56,16 @@
!RBAbstractClass methodsFor:'accessing'!
+isModelClass
+ "Tells wheter this class is a model class ( and not real class )"
+
+ ^ true
+
+ "Created: / 06-10-2014 / 07:12:50 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+! !
+
+!RBAbstractClass methodsFor:'accessing'!
+
methodDictionary
"Stub method, returns real class MethodDictionary, although full MethodDictionary
implementation would be better here."
@@ -150,7 +160,7 @@
"Created: / 29-09-2014 / 22:48:09 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
! !
-!RBClass methodsFor:'accessing'!
+!RBClass methodsFor:'compiling'!
compile
"Updates class definition in the namespace along with code changes"
@@ -191,6 +201,148 @@
"Created: / 26-09-2014 / 21:28:37 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
! !
+!RBMethod methodsFor:'accessing'!
+
+category: aCategoryName
+ "Sets in which category/protocol does the method belongs within a class"
+
+ self objectAttributeAt: #category put: aCategoryName.
+
+ "Created: / 06-10-2014 / 07:54:57 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+! !
+
+!RBMethod methodsFor:'accessing'!
+
+class: aClass
+ "Helper for enabling usage of either real class or RBClass"
+
+ | modelClass |
+
+ ((aClass respondsTo: #isModelClass) and: [ aClass isModelClass ]) ifTrue: [
+ modelClass := aClass
+ ] ifFalse: [
+ aClass isMeta ifTrue: [
+ modelClass := self model metaclassNamed: aClass theNonMetaclass name.
+ ] ifFalse: [
+ modelClass := self model classNamed: aClass name.
+ ]
+ ].
+
+ self modelClass: modelClass
+
+ "Created: / 05-10-2014 / 21:04:44 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+ "Modified: / 06-10-2014 / 07:43:50 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+! !
+
+!RBMethod methodsFor:'compiling'!
+
+compile
+ "Modifies/adds method in the model class."
+
+ | newSource generator |
+
+ newSource := self source.
+ generator := self sourceCodeGenerator.
+ generator notNil ifTrue: [
+ generator source: newSource.
+ newSource := generator newSource.
+ ].
+
+ self modelClass compile: newSource classified: self category
+
+ "Created: / 06-10-2014 / 11:11:30 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+! !
+
+!RBMethod methodsFor:'accessing'!
+
+methodArgNames
+ "Returns collection of method argument names"
+
+ | methodNode arguments |
+
+ methodNode := RBParser
+ parseMethod: self source
+ onError: [ :str :pos |
+ self error: 'Cannot parse: ', str, ' at pos: ', pos asString
+ ].
+
+ "Transform arguments to what Method returns - keep compatibility"
+ arguments := methodNode arguments.
+ (arguments size > 0) ifTrue: [
+ | newArguments |
+
+ newArguments := OrderedCollection new.
+ arguments do: [ :argument |
+ newArguments add: argument name
+ ].
+ ^ newArguments asArray
+ ].
+
+ ^ nil
+
+ "Created: / 07-10-2014 / 20:18:53 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+ "Modified: / 07-10-2014 / 22:13:15 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+! !
+
+!RBMethod methodsFor:'queries'!
+
+methodDefinitionTemplate
+ "see Method >> methodDefinitionTemplate"
+
+ ^ Method
+ methodDefinitionTemplateForSelector:self selector
+ andArgumentNames:self methodArgNames
+
+ "Created: / 07-10-2014 / 20:18:53 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+! !
+
+!RBMethod methodsFor:'accessing'!
+
+model
+
+ ^ self objectAttributeAt: #model
+
+ "Created: / 05-10-2014 / 20:33:09 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+! !
+
+!RBMethod methodsFor:'accessing'!
+
+model: anRBSmalltalk
+
+ self objectAttributeAt: #model put: anRBSmalltalk
+
+ "Created: / 05-10-2014 / 20:32:38 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+! !
+
+!RBMethod methodsFor:'accessing'!
+
+protocol
+ "Returns in which category/protocol does the method belongs within a class"
+
+ ^ self category
+
+ "Created: / 06-10-2014 / 07:46:14 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+! !
+
+!RBMethod methodsFor:'accessing'!
+
+protocol: aProtocolName
+ "Sets in which category/protocol does the method belongs within a class"
+
+ self category: aProtocolName.
+
+ "Created: / 06-10-2014 / 07:56:27 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+! !
+
+!RBMethod methodsFor:'accessing'!
+
+replace: placeholder with: code
+
+ self sourceCodeGenerator replace: placeholder with: code
+
+ "Created: / 06-10-2014 / 08:58:31 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+! !
+
!RBMethod methodsFor:'queries'!
sends:selectorSymbol1 or:selectorSymbol2
@@ -203,6 +355,26 @@
"Created: / 04-10-2014 / 00:01:56 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
! !
+!RBMethod methodsFor:'accessing'!
+
+sourceCodeGenerator
+ "Returns helper tool for method source code manipulation like formatting and search & replace"
+
+ ^ self objectAttributeAt: #sourceCodeGenerator
+
+ "Created: / 06-10-2014 / 08:33:09 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+! !
+
+!RBMethod methodsFor:'accessing'!
+
+sourceCodeGenerator: aSourceCodeGenerator
+ "Set ... see method sourceCodeGenerator"
+
+ ^ self objectAttributeAt: #sourceCodeGenerator put: aSourceCodeGenerator
+
+ "Created: / 06-10-2014 / 08:37:54 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+! !
+
!Tools::NewSystemBrowser methodsFor:'menus extensions-custom refactorings'!
classMenuExtensionCustomGenerators:aMenu
--- a/jn_refactoring_custom.st Sun Oct 05 14:15:21 2014 +0200
+++ b/jn_refactoring_custom.st Tue Oct 07 23:05:10 2014 +0200
@@ -195,6 +195,19 @@
RBMetaclass theMetaclass
RBAbstractClass instVarNames:
RBMethod sends:or:
+ RBAbstractClass isModelClass
+ RBMethod category:
+ RBMethod class:
+ RBMethod compile
+ RBMethod methodArgNames
+ RBMethod methodDefinitionTemplate
+ RBMethod model
+ RBMethod model:
+ RBMethod protocol
+ RBMethod protocol:
+ RBMethod replace:with:
+ RBMethod sourceCodeGenerator
+ RBMethod sourceCodeGenerator:
)
! !
--- a/patches/Make.proto Sun Oct 05 14:15:21 2014 +0200
+++ b/patches/Make.proto Tue Oct 07 23:05:10 2014 +0200
@@ -30,15 +30,38 @@
REQUIRED_SUPPORT_DIRS=
+# if your embedded C code requires any system includes,
+# add the path(es) here:,
+# ********** OPTIONAL: MODIFY the next lines ***
+# LOCALINCLUDES=-Ifoo -Ibar
+LOCALINCLUDES= -I$(INCLUDE_TOP)/stx/goodies/refactoryBrowser/helpers -I$(INCLUDE_TOP)/stx/libbasic -I$(INCLUDE_TOP)/stx/libcomp
+
+
+# if you need any additional defines for embedded C code,
+# add them here:,
+# ********** OPTIONAL: MODIFY the next lines ***
+# LOCALDEFINES=-Dfoo -Dbar -DDEBUG
+LOCALDEFINES=
+
+LIBNAME=libjn_refactoring_custom_patches
+STCLOCALOPT='-package=$(PACKAGE)' -I. $(LOCALINCLUDES) $(STCLOCALOPTIMIZATIONS) $(STCWARNINGS) $(LOCALDEFINES) -headerDir=. -varPrefix=$(LIBNAME)
+
+
+# ********** OPTIONAL: MODIFY the next line ***
+# additional C-libraries that should be pre-linked with the class-objects
+LD_OBJ_LIBS=
+LOCAL_SHARED_LIBS=
+
+
# ********** OPTIONAL: MODIFY the next line ***
# additional C targets or libraries should be added below
LOCAL_EXTRA_TARGETS=
-OBJS=
+OBJS= $(COMMON_OBJS) $(UNIX_OBJS)
-all:: preMake postMake
+all:: preMake classLibRule postMake
pre_objs::
@@ -78,6 +101,9 @@
# build all mandatory prerequisite packages (containing superclasses) for this package
prereq:
+ cd $(TOP)/libbasic && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
+ cd $(TOP)/goodies/refactoryBrowser/helpers && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
+
# build all packages containing referenced classes for this package
@@ -95,3 +121,9 @@
-rm -f *.so *.dll
+# BEGINMAKEDEPEND --- do not remove this line; make depend needs it
+$(OUTDIR)jn_refactoring_custom_patches.$(O) jn_refactoring_custom_patches.$(H): jn_refactoring_custom_patches.st $(INCLUDE_TOP)/stx/libbasic/LibraryDefinition.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(INCLUDE_TOP)/stx/libbasic/ProjectDefinition.$(H) $(STCHDR)
+$(OUTDIR)extensions.$(O): extensions.st $(INCLUDE_TOP)/stx/goodies/refactoryBrowser/helpers/RBAbstractClass.$(H) $(INCLUDE_TOP)/stx/goodies/refactoryBrowser/helpers/RBMethod.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+
+# ENDMAKEDEPEND --- do not remove this line
+
--- a/patches/Make.spec Sun Oct 05 14:15:21 2014 +0200
+++ b/patches/Make.spec Tue Oct 07 23:05:10 2014 +0200
@@ -15,3 +15,49 @@
MODULE=jn
MODULE_DIR=refactoring_custom/patches
PACKAGE=$(MODULE):$(MODULE_DIR)
+
+
+# Argument(s) to the stc compiler (stc --usage).
+# -headerDir=. : create header files locally
+# (if removed, they will be created as common
+# -Pxxx : defines the package
+# -Zxxx : a prefix for variables within the classLib
+# -Dxxx : defines passed to to CC for inline C-code
+# -Ixxx : include path passed to CC for inline C-code
+# +optspace : optimized for space
+# +optspace2 : optimized more for space
+# +optspace3 : optimized even more for space
+# +optinline : generate inline code for some ST constructs
+# +inlineNew : additionally inline new
+# +inlineMath : additionally inline some floatPnt math stuff
+#
+# ********** OPTIONAL: MODIFY the next line(s) ***
+# STCLOCALOPTIMIZATIONS=+optinline +inlineNew
+# STCLOCALOPTIMIZATIONS=+optspace3
+STCLOCALOPTIMIZATIONS=+optspace3
+
+
+# Argument(s) to the stc compiler (stc --usage).
+# -warn : no warnings
+# -warnNonStandard : no warnings about ST/X extensions
+# -warnEOLComments : no warnings about EOL comment extension
+# -warnPrivacy : no warnings about privateClass extension
+#
+# ********** OPTIONAL: MODIFY the next line(s) ***
+# STCWARNINGS=-warn
+# STCWARNINGS=-warnNonStandard
+# STCWARNINGS=-warnEOLComments
+STCWARNINGS=-warnNonStandard
+
+COMMON_CLASSES= \
+ jn_refactoring_custom_patches \
+
+
+
+
+COMMON_OBJS= \
+ $(OUTDIR_SLASH)jn_refactoring_custom_patches.$(O) \
+ $(OUTDIR_SLASH)extensions.$(O) \
+
+
+
--- a/patches/bc.mak Sun Oct 05 14:15:21 2014 +0200
+++ b/patches/bc.mak Tue Oct 07 23:05:10 2014 +0200
@@ -23,20 +23,35 @@
TOP=..\..\..\stx
INCLUDE_TOP=$(TOP)\..
+
+
!INCLUDE $(TOP)\rules\stdHeader_bc
!INCLUDE Make.spec
+LIBNAME=libjn_refactoring_custom_patches
+RESFILES=patches.$(RES)
+
-OBJS=
+LOCALINCLUDES= -I$(INCLUDE_TOP)\stx\goodies\refactoryBrowser\helpers -I$(INCLUDE_TOP)\stx\libbasic -I$(INCLUDE_TOP)\stx\libcomp
+LOCALDEFINES=
+
+STCLOCALOPT=-package=$(PACKAGE) -I. $(LOCALINCLUDES) -headerDir=. $(STCLOCALOPTIMIZATIONS) $(STCWARNINGS) $(LOCALDEFINES) -varPrefix=$(LIBNAME)
+LOCALLIBS=
-ALL::
+OBJS= $(COMMON_OBJS) $(WIN32_OBJS)
+
+ALL:: classLibRule
+
+classLibRule: $(OUTDIR) $(OUTDIR)$(LIBNAME).dll
!INCLUDE $(TOP)\rules\stdRules_bc
# build all mandatory prerequisite packages (containing superclasses) for this package
prereq:
+ pushd ..\..\..\stx\libbasic & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
+ pushd ..\..\..\stx\goodies\refactoryBrowser\helpers & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
@@ -47,11 +62,17 @@
test: $(TOP)\goodies\builder\reports\NUL
pushd $(TOP)\goodies\builder\reports & $(MAKE_BAT)
$(TOP)\goodies\builder\reports\report-runner.bat -D . -r Builder::TestReport -p $(PACKAGE)
-
+
clean::
del *.$(CSUFFIX)
+# BEGINMAKEDEPEND --- do not remove this line; make depend needs it
+$(OUTDIR)jn_refactoring_custom_patches.$(O) jn_refactoring_custom_patches.$(H): jn_refactoring_custom_patches.st $(INCLUDE_TOP)\stx\libbasic\LibraryDefinition.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(INCLUDE_TOP)\stx\libbasic\ProjectDefinition.$(H) $(STCHDR)
+$(OUTDIR)extensions.$(O): extensions.st $(INCLUDE_TOP)\stx\goodies\refactoryBrowser\helpers\RBAbstractClass.$(H) $(INCLUDE_TOP)\stx\goodies\refactoryBrowser\helpers\RBMethod.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
+
+# ENDMAKEDEPEND --- do not remove this line
+
# **Must be at end**
# Enforce recompilation of package definition class if Mercurial working
--- a/patches/extensions.st Sun Oct 05 14:15:21 2014 +0200
+++ b/patches/extensions.st Tue Oct 07 23:05:10 2014 +0200
@@ -1,5 +1,90 @@
"{ Package: 'jn:refactoring_custom/patches' }"!
+!RBAbstractClass methodsFor:'method accessing'!
+
+compile: aString classified: aSymbolCollection
+ | change method |
+ change := model
+ compile: aString
+ in: self
+ classified: aSymbolCollection.
+ method := RBMethod
+ for: self
+ source: aString
+ selector: change selector.
+ method category: aSymbolCollection.
+ self addMethod: method
+
+ "Modified: / 06-10-2014 / 22:38:27 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+! !
+
+!RBAbstractClass methodsFor:'method accessing'!
+
+compileTree: aBRMethodNode classified: aSymbolCollection
+ | method source |
+ source := aBRMethodNode formattedCode.
+ model
+ compile: source
+ in: self
+ classified: aSymbolCollection.
+ method := RBMethod
+ for: self
+ source: source
+ selector: aBRMethodNode selector.
+ method category: aSymbolCollection.
+" method parseTree: aBRMethodNode."
+ self addMethod: method
+
+ "Modified: / 06-10-2014 / 22:37:13 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+! !
+
+!RBAbstractClass methodsFor:'method accessing'!
+
+compileTree: aBRMethodNode usingSource:newSource classified: aSymbolCollection
+ | method source |
+
+ source := newSource.
+ model
+ compile: source
+ in: self
+ classified: aSymbolCollection.
+ method := RBMethod
+ for: self
+ source: newSource
+ selector: aBRMethodNode selector.
+ method category: aSymbolCollection.
+" method parseTree: aBRMethodNode."
+ self addMethod: method
+
+ "Modified: / 06-10-2014 / 22:38:57 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+! !
+
+!RBMethod methodsFor:'accessing'!
+
+category
+ "Returns in which category/protocol does the method belongs within a class"
+
+ | category |
+
+ category := self objectAttributeAt: #category.
+
+ category isNil ifTrue: [
+ | compiledMethod |
+
+ compiledMethod := self method.
+ compiledMethod notNil ifTrue:[
+ ^ compiledMethod category.
+ ].
+
+ ^ 'as yet unclassified'
+ ].
+
+ ^ category
+
+ "Created: / 17-02-2012 / 00:06:20 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified (comment): / 06-10-2014 / 07:55:28 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+! !
+
!RBMethod methodsFor:'accessing'!
info
--- a/patches/jn_refactoring_custom_patches.st Sun Oct 05 14:15:21 2014 +0200
+++ b/patches/jn_refactoring_custom_patches.st Tue Oct 07 23:05:10 2014 +0200
@@ -21,6 +21,32 @@
!jn_refactoring_custom_patches class methodsFor:'description'!
+mandatoryPreRequisites
+ "list packages which are mandatory as a prerequisite.
+ This are packages containing superclasses of my classes and classes which
+ are extended by myself.
+ They are mandatory, because we need these packages as a prerequisite for loading and compiling.
+ This method is generated automatically,
+ by searching along the inheritance chain of all of my classes."
+
+ ^ #(
+ #'stx:goodies/refactoryBrowser/helpers' "RBAbstractClass - extended"
+ #'stx:libbasic' "LibraryDefinition - superclass of jn_refactoring_custom_patches"
+ )
+!
+
+referencedPreRequisites
+ "list packages which are a prerequisite, because they contain
+ classes which are referenced by my classes.
+ We do not need these packages as a prerequisite for loading or compiling.
+ This method is generated automatically,
+ by searching all classes (and their packages) which are referenced by my classes."
+
+ ^ #(
+ #'stx:libcomp' "Parser - referenced by RBMethod>>info"
+ )
+!
+
subProjects
"list packages which are known as subprojects.
The generated makefile will enter those and make there as well.
@@ -43,6 +69,19 @@
"<className> or (<className> attributes...) in load order"
#'jn_refactoring_custom_patches'
)
+!
+
+extensionMethodNames
+ "list class/selector pairs of extensions.
+ A correponding method with real names must be present in my concrete subclasses"
+
+ ^ #(
+ RBAbstractClass compile:classified:
+ RBAbstractClass compileTree:classified:
+ RBAbstractClass compileTree:usingSource:classified:
+ RBMethod category
+ RBMethod info
+ )
! !
!jn_refactoring_custom_patches class methodsFor:'documentation'!
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/patches/libInit.cc Tue Oct 07 23:05:10 2014 +0200
@@ -0,0 +1,34 @@
+/*
+ * $Header$
+ *
+ * DO NOT EDIT
+ * automagically generated from the projectDefinition: jn_refactoring_custom_patches.
+ */
+#define __INDIRECTVMINITCALLS__
+#include <stc.h>
+
+#ifdef WIN32
+# pragma codeseg INITCODE "INITCODE"
+#endif
+
+#if defined(INIT_TEXT_SECTION) || defined(DLL_EXPORT)
+DLL_EXPORT void _libjn_refactoring_custom_patches_Init() INIT_TEXT_SECTION;
+DLL_EXPORT void _libjn_refactoring_custom_patches_InitDefinition() INIT_TEXT_SECTION;
+#endif
+
+void _libjn_refactoring_custom_patches_InitDefinition(pass, __pRT__, snd)
+OBJ snd; struct __vmData__ *__pRT__; {
+__BEGIN_PACKAGE2__("libjn_refactoring_custom_patches__DFN", _libjn_refactoring_custom_patches_InitDefinition, "jn:refactoring_custom/patches");
+_jn_137refactoring_137custom_137patches_Init(pass,__pRT__,snd);
+
+__END_PACKAGE__();
+}
+
+void _libjn_refactoring_custom_patches_Init(pass, __pRT__, snd)
+OBJ snd; struct __vmData__ *__pRT__; {
+__BEGIN_PACKAGE2__("libjn_refactoring_custom_patches", _libjn_refactoring_custom_patches_Init, "jn:refactoring_custom/patches");
+_jn_137refactoring_137custom_137patches_Init(pass,__pRT__,snd);
+
+_jn_137refactoring_137custom_137patches_extensions_Init(pass,__pRT__,snd);
+__END_PACKAGE__();
+}
--- a/patches/patches.rc Sun Oct 05 14:15:21 2014 +0200
+++ b/patches/patches.rc Tue Oct 07 23:05:10 2014 +0200
@@ -4,7 +4,7 @@
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 6,2,32767,32767
- PRODUCTVERSION 6,2,4,1333
+ PRODUCTVERSION 6,2,4,1378
#if (__BORLANDC__)
FILEFLAGSMASK VS_FF_DEBUG | VS_FF_PRERELEASE
FILEFLAGS VS_FF_PRERELEASE | VS_FF_SPECIALBUILD
@@ -19,13 +19,13 @@
BLOCK "040904E4"
BEGIN
VALUE "CompanyName", "My Company\0"
- VALUE "FileDescription", "LibraryName patches\0"
+ VALUE "FileDescription", "Class Library (LIB)\0"
VALUE "FileVersion", "6.2.32767.32767\0"
VALUE "InternalName", "jn:refactoring_custom/patches\0"
VALUE "LegalCopyright", "My CopyRight or CopyLeft\0"
VALUE "ProductName", "LibraryName\0"
- VALUE "ProductVersion", "6.2.4.1333\0"
- VALUE "ProductDate", "Sun, 05 Oct 2014 10:12:07 GMT\0"
+ VALUE "ProductVersion", "6.2.4.1378\0"
+ VALUE "ProductDate", "Tue, 07 Oct 2014 20:53:56 GMT\0"
END
END
--- a/refactoring_custom.rc Sun Oct 05 14:15:21 2014 +0200
+++ b/refactoring_custom.rc Tue Oct 07 23:05:10 2014 +0200
@@ -4,7 +4,7 @@
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 6,2,32767,32767
- PRODUCTVERSION 6,2,4,0
+ PRODUCTVERSION 6,2,4,1378
#if (__BORLANDC__)
FILEFLAGSMASK VS_FF_DEBUG | VS_FF_PRERELEASE
FILEFLAGS VS_FF_PRERELEASE | VS_FF_SPECIALBUILD
@@ -24,8 +24,8 @@
VALUE "InternalName", "jn:refactoring_custom\0"
VALUE "LegalCopyright", "My CopyRight or CopyLeft\0"
VALUE "ProductName", "ProductName\0"
- VALUE "ProductVersion", "6.2.4.0\0"
- VALUE "ProductDate", "Sun, 05 Oct 2014 10:12:03 GMT\0"
+ VALUE "ProductVersion", "6.2.4.1378\0"
+ VALUE "ProductDate", "Tue, 07 Oct 2014 20:53:53 GMT\0"
END
END