Skip to content

Commit

Permalink
Remove part of ReAsClassRule about #asClass
Browse files Browse the repository at this point in the history
#asClass ot deprecated in P12 and will be removed soon in P13. Thus we should not refer to it anymore.
  • Loading branch information
jecisc committed May 15, 2024
1 parent ab2e281 commit f90c07e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 23 deletions.
14 changes: 0 additions & 14 deletions src/General-Rules-Tests/ReAsClassRuleTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,6 @@ Class {
#tag : 'Migrated'
}

{ #category : 'test-help' }
ReAsClassRuleTest >> methodWithAsClass [

self class asClass
]

{ #category : 'test-help' }
ReAsClassRuleTest >> methodWithAsClassIfAbsent [

Expand All @@ -33,14 +27,6 @@ ReAsClassRuleTest >> testRuleNotViolated [
self assertEmpty: critiques
]

{ #category : 'tests' }
ReAsClassRuleTest >> testRuleWithAsClass [

| critiques |
critiques := self myCritiquesOnMethod: self class >> #methodWithAsClass.
self assert: critiques size equals: 1
]

{ #category : 'tests' }
ReAsClassRuleTest >> testRuleWithAsClassIfAbsent [

Expand Down
12 changes: 3 additions & 9 deletions src/General-Rules/ReAsClassRule.class.st
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
"
Do not use methods such as
#asClass
#asClassIfAbsent:
#asClassIfPresent:
Expand All @@ -23,16 +22,11 @@ ReAsClassRule >> group [

{ #category : 'initialization' }
ReAsClassRule >> initialize [

super initialize.
self
replace: '`@expr asClass'
with: 'self class environment at: `@expr';

replace: '`@expr asClassIfAbsent: `@block'
with: 'self class environment at: `@expr ifAbsent: `@block';

replace: '`@expr asClassIfPresent: `@block'
with: 'self class environment at: `@expr ifPresent: `@block'
replace: '`@expr asClassIfAbsent: `@block' with: 'self class environment at: `@expr ifAbsent: `@block';
replace: '`@expr asClassIfPresent: `@block' with: 'self class environment at: `@expr ifPresent: `@block'
]

{ #category : 'accessing' }
Expand Down

0 comments on commit f90c07e

Please sign in to comment.