File tree Expand file tree Collapse file tree
src/Famix-MetamodelBuilder-Core Expand file tree Collapse file tree Original file line number Diff line number Diff line change 99 #tag : ' Implementation'
1010}
1111
12+ { #category : ' adding' }
13+ FmxMBRealRingEnvironment >> addMethod: sourceCode in: aClassName classSide: aBoolean protocol: protocol [
14+
15+ changesToApply add: (FmxMethodAddition
16+ className: aClassName
17+ isClassSide: aBoolean
18+ sourceCode: sourceCode
19+ protocol: protocol)
20+ ]
21+
1222{ #category : ' accessing' }
1323FmxMBRealRingEnvironment >> apply [
1424
@@ -184,13 +194,13 @@ FmxMBRealRingEnvironment >> recordMethodsAdoptionsOf: realClass to: anRGClass re
184194 ((anRGClass localSelectors difference: generatedMethodNamesOfRealClass)
185195 select: [ :selectorOfMethodToAdd | realClass ifNil: [ true ] ifNotNil: [ (realClass localSelectors includes: selectorOfMethodToAdd) not ] ]
186196 thenCollect: [ :selectorOfMethodToAdd | anRGClass methodNamed: selectorOfMethodToAdd ])
187- ifNotEmpty: [ :methods | changesToApply add: ( FmxMethodAdditions className: aClassName isClassSide : anRGClass isClassSide rgMethods: methods) ].
197+ ifNotEmpty: [ :methods | methods do: [ :method | self addMethod: method sourceCode in: aClassName classSide : anRGClass isClassSide protocol: method protocol ] ].
188198
189199 " Finally, update methods needing updates"
190200 ((generatedMethodNamesOfRealClass intersection: anRGClass localSelectors)
191201 collect: [ :selectorOfMethodToUpdate | anRGClass methodNamed: selectorOfMethodToUpdate ]
192202 thenSelect: [ :method | realClass needToAdaptToMethod: method ])
193- ifNotEmpty: [ :methods | changesToApply add: ( FmxMethodUpdates className: aClassName isClassSide : anRGClass isClassSide rgMethods: methods) ]
203+ ifNotEmpty: [ :methods |methods do: [ :method | self addMethod: method sourceCode in: aClassName classSide : anRGClass isClassSide protocol: method protocol ] ]
194204]
195205
196206{ #category : ' installing' }
Original file line number Diff line number Diff line change 1+ "
2+ ## Description
3+
4+ I represent a change that would create a method to a class during a Famix generation
5+
6+ ## Examples
7+
8+ ```st
9+ FmxMethodAddition className: FmxMethodAddition isClassSide: false sourceCode: 'x ^ x' protocol: 'accessing'
10+ ```
11+ "
12+ Class {
13+ #name : ' FmxMethodAddition' ,
14+ #superclass : ' FmxLazyClassChange' ,
15+ #instVars : [
16+ ' protocol' ,
17+ ' sourceCode'
18+ ],
19+ #category : ' Famix-MetamodelBuilder-Core-Changes' ,
20+ #package : ' Famix-MetamodelBuilder-Core' ,
21+ #tag : ' Changes'
22+ }
23+
24+ { #category : ' class initialization' }
25+ FmxMethodAddition class >> className: aSymbol isClassSide: aBoolean sourceCode: aString protocol: protocol [
26+
27+ ^ self new
28+ className: aSymbol;
29+ isClassSide: aBoolean;
30+ sourceCode: aString;
31+ protocol: protocol;
32+ yourself
33+ ]
34+
35+ { #category : ' accessing' }
36+ FmxMethodAddition >> apply [
37+
38+ self realClass compile: sourceCode classified: protocol
39+ ]
40+
41+ { #category : ' printing' }
42+ FmxMethodAddition >> printOn: aStream [
43+
44+ super printOn: aStream.
45+
46+ aStream
47+ nextPutAll: ' [' ;
48+ nextPutAll: (protocol ifNil: [ ' empty' ]);
49+ nextPutAll: ' - ' ;
50+ nextPutAll: (sourceCode ifNil: [ ' empty' ]);
51+ nextPutAll: ' ]'
52+ ]
53+
54+ { #category : ' accessing' }
55+ FmxMethodAddition >> protocol: anObject [
56+ protocol := anObject
57+ ]
58+
59+ { #category : ' accessing' }
60+ FmxMethodAddition >> sourceCode: anObject [
61+ sourceCode := anObject
62+ ]
Load Diff This file was deleted.
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments