[squeak-dev] The Trunk: Environments-ul.84.mcz
commits at source.squeak.org
commits at source.squeak.org
Thu Mar 31 07:44:53 UTC 2022
Levente Uzonyi uploaded a new version of Environments to project The Trunk:
http://source.squeak.org/trunk/Environments-ul.84.mcz
==================== Summary ====================
Name: Environments-ul.84
Author: ul
Time: 31 March 2022, 9:44:33.789829 am
UUID: 8bddd87e-953c-485a-b76a-991fd4548c87
Ancestors: Environments-ct.83
- use Symboll class >> #lookup: instead of #hasInterned:ifTrue:
- just check whether baseName is an existing symbol in Environment >> #classOrTraitNamed: instead of interning it, because if it is not a symbol, it cannot be present as a key in declarations
=============== Diff against Environments-ct.83 ===============
Item was changed:
----- Method: Environment>>classOrTraitNamed: (in category 'classes and traits') -----
classOrTraitNamed: aString
"aString is either a class or trait name or a class or trait name followed by ' class' or 'classTrait' respectively.
Answer the class or metaclass it names."
| meta baseName |
(aString endsWith: ' class')
+ ifTrue: [
+ meta := true.
+ baseName := aString copyFrom: 1 to: aString size - 6 ]
- ifTrue: [meta := true.
- baseName := aString copyFrom: 1 to: aString size - 6]
ifFalse: [
(aString endsWith: ' classTrait')
ifTrue: [
meta := true.
+ baseName := aString copyFrom: 1 to: aString size - 11 ]
- baseName := aString copyFrom: 1 to: aString size - 11]
ifFalse: [
meta := false.
+ baseName := aString ] ].
+ ^(Symbol lookup: baseName) ifNotNil: [ :baseNameSymbol |
+ declarations at: baseNameSymbol ifPresent: [ :global |
+ global isBehavior ifTrue: [
+ meta
+ ifFalse: [ global ]
+ ifTrue: [ global classSide ] ] ] ]!
- baseName := aString]].
-
- ^declarations at: baseName asSymbol ifPresent:
- [ :global |
- global isBehavior ifTrue:
- [ meta
- ifFalse: [ global ]
- ifTrue: [ global classSide ]]]!
Item was changed:
----- Method: Environment>>hasClassNamed: (in category 'classes and traits') -----
hasClassNamed: aString
+
+ ^(Symbol lookup: aString)
+ ifNil: [ false ]
+ ifNotNil: [:symbol |
+ (declarations at: symbol ifAbsent: [nil])
+ isKindOf: Class]!
- Symbol hasInterned: aString ifTrue:
- [:symbol |
- ^ (declarations at: symbol ifAbsent: [nil])
- isKindOf: Class].
- ^ false.!
More information about the Squeak-dev
mailing list
|