[squeak-dev] The Trunk: System-mt.1121.mcz
commits at source.squeak.org
commits at source.squeak.org
Mon Nov 18 13:11:40 UTC 2019
Marcel Taeumel uploaded a new version of System to project The Trunk:
http://source.squeak.org/trunk/System-mt.1121.mcz
==================== Summary ====================
Name: System-mt.1121
Author: mt
Time: 18 November 2019, 2:11:39.331051 pm
UUID: 123c20e2-fc1d-124a-af13-7b41a75bcab3
Ancestors: System-mt.1120
Adds #asSimpleGetter and #isSimpleGetter. Harmonize implementations considering #asSimpleSetter and #isSimpleSetter.
See:
http://forum.world.st/The-Inbox-Collections-ct-853-mcz-td5104261.html
I hope I did not mess up any performance considerations...
=============== Diff against System-mt.1120 ===============
Item was added:
+ ----- Method: String>>asSimpleGetter (in category '*System-Support') -----
+ asSimpleGetter
+ "Return a getter message from a setter message. For example, #name: asSimpleGetter returns #name"
+
+ self size > 0 ifTrue: [
+ self last = $:
+ ifTrue: [ self numArgs = 1 ifTrue: [ ^ self allButLast asSymbol ] ]
+ ifFalse: [ self numArgs = 0 ifTrue: [ ^ self asSymbol ] ] ].
+
+ self error: 'Only simple setters and getters can be converted to simple getters!!'.!
Item was changed:
----- Method: String>>asSimpleSetter (in category '*System-Support') -----
asSimpleSetter
+ "Return a setter message from a getter message. For example, #name asSimpleSetter returns #name:"
+
+ self size > 0 ifTrue: [
+ self last = $:
+ ifTrue: [ self numArgs = 1 ifTrue: [ ^ self asSymbol ] ]
+ ifFalse: [ self numArgs = 0 ifTrue: [ ^ (self copyWith: $:) asSymbol ] ] ].
+
+ self error: 'Only simple setters and getters can be converted to simple setters!!'.!
- "Return a setter message from a getter message. For example, #name asMutator returns #name:"
- ^ self last = $:
- ifTrue: [ self asSymbol ]
- ifFalse: [ (self copyWith: $:) asSymbol ]!
Item was added:
+ ----- Method: String>>isSimpleGetter (in category '*System-Support') -----
+ isSimpleGetter
+ "Only symbols can be simple getters."
+
+ ^ false!
Item was changed:
----- Method: String>>isSimpleSetter (in category '*System-Support') -----
isSimpleSetter
+ "Only symbols can be simple setters."
+ ^ false!
- ^ self isKeyword and: [self numArgs = 1]!
Item was added:
+ ----- Method: Symbol>>asSimpleGetter (in category '*System-Support') -----
+ asSimpleGetter
+
+ self precedence
+ caseOf: {
+ [ 1 ] -> [ self numArgs = 0 ifTrue: [ ^ self ] ].
+ [ 3 ] -> [ self numArgs = 1 ifTrue: [ ^ self allButLast asSymbol ] ] }
+ otherwise: [].
+
+ self error: 'Only simple setters and getters can be converted to simple getters!!'.!
Item was changed:
----- Method: Symbol>>asSimpleSetter (in category '*System-Support') -----
asSimpleSetter
+ self precedence
+ caseOf: {
+ [ 1 ] -> [ self numArgs = 0 ifTrue: [ ^ (self copyWith: $:) asSymbol ] ].
+ [ 3 ] -> [ self numArgs = 1 ifTrue: [ ^ self ] ] }
+ otherwise: [].
+
+ self error: 'Only simple setters and getters can be converted to simple setters!!'.!
- ^ self last = $:
- ifTrue: [ self ]
- ifFalse: [ (self copyWith: $:) asSymbol ]!
Item was added:
+ ----- Method: Symbol>>isSimpleGetter (in category '*System-Support') -----
+ isSimpleGetter
+
+ ^ self precedence = 1!
Item was added:
+ ----- Method: Symbol>>isSimpleSetter (in category '*System-Support') -----
+ isSimpleSetter
+
+ ^ self isKeyword and: [self numArgs = 1]!
More information about the Squeak-dev
mailing list
|