Nicolas Cellier uploaded a new version of EToys to project The Trunk:
http://source.squeak.org/trunk/EToys-cmm.342.mcz ==================== Summary ==================== Name: EToys-cmm.342 Author: cmm Time: 7 May 2019, 6:34:48.519808 pm UUID: da78bdd2-19c3-446e-aec2-be2dab3a21eb Ancestors: EToys-kfr.341 Ask whether a Parameter and Phrase tiles whether they're #isBooleanType, to allow proper distinction of the actual instances of Boolean. =============== Diff against EToys-kfr.341 =============== Item was changed: ----- Method: CategoryViewer>>booleanPhraseFromPhrase: (in category 'support') ----- booleanPhraseFromPhrase: phrase "Answer, if possible, a boolean-valued phrase derived from the phrase provided" | retrieverOp retrieverTile | (phrase isKindOf: ParameterTile orOf: FunctionTile) ifTrue: [^ phrase booleanComparatorPhrase]. + phrase isBooleanType ifTrue: [^ phrase]. - phrase isBoolean ifTrue: [^ phrase]. ((scriptedPlayer respondsTo: #costume) and:[scriptedPlayer costume isInWorld not]) ifTrue: [^ Array new]. ((phrase isMemberOf: PhraseTileMorph) and: [phrase submorphs size > 1] and: [#(bearingTo: distanceToPlayer:) includes: phrase submorphs second operatorOrExpression]) ifTrue: [^ self booleanPhraseFromNumericGetterWithArgument: phrase]. ((retrieverTile := phrase submorphs last) isKindOf: TileMorph) ifFalse: [^ phrase]. retrieverOp := retrieverTile operatorOrExpression. (Vocabulary vocabularyForType: phrase resultType) affordsCoercionToBoolean ifTrue: [ retrieverOp = #getPatchValueIn: ifTrue: [ ^ self booleanPhraseForGetPatchValueOfType: phrase resultType retrieverOp: retrieverOp player: phrase actualObject. ]. retrieverOp = #getRedComponentIn: ifTrue: [ ^ self booleanPhraseForGetColorComponentOfType: phrase resultType componentName: #red retrieverOp: retrieverOp player: phrase actualObject. ]. retrieverOp = #getGreenComponentIn: ifTrue: [ ^ self booleanPhraseForGetColorComponentOfType: phrase resultType componentName: #green retrieverOp: retrieverOp player: phrase actualObject. ]. retrieverOp = #getBlueComponentIn: ifTrue: [ ^ self booleanPhraseForGetColorComponentOfType: phrase resultType componentName: #blue retrieverOp: retrieverOp player: phrase actualObject. ]. retrieverOp = #getUphillIn: ifTrue: [ ^ self booleanPhraseForGetUpHillOfType: phrase resultType retrieverOp: retrieverOp player: phrase actualObject. ]. retrieverOp = #getDistanceTo: ifTrue: [ ^ self booleanPhraseForGetDistanceToOfType: phrase resultType retrieverOp: retrieverOp player: phrase actualObject. ]. retrieverOp = #getAngleTo: ifTrue: [ ^ self booleanPhraseForGetAngleToOfType: phrase resultType retrieverOp: retrieverOp player: phrase actualObject. ]. retrieverOp = #bounceOn: ifTrue: [ ^ self booleanPhraseForBounceOnOfType: phrase resultType retrieverOp: retrieverOp player: phrase actualObject. ]. " (retrieverOp = #bounceOn:color: or: [retrieverOp = #bounceOnColor:]) ifTrue: [ ^ self booleanPhraseForBounceOnColorOfType: phrase resultType retrieverOp: retrieverOp player: phrase actualObject. ]." "retrieverOp = #getTurtleAt: ifTrue: [ ^ self booleanPhraseForGetTurtleAtOfType: phrase resultType retrieverOp: retrieverOp player: phrase actualObject. ]." retrieverOp = #getTurtleOf: ifTrue: [ ^ self booleanPhraseForGetTurtleOfOfType: phrase resultType retrieverOp: retrieverOp player: phrase actualObject. ]. ^ self booleanPhraseForRetrieverOfType: phrase resultType retrieverOp: retrieverOp player: phrase actualObject. ]. ^ phrase! Item was removed: - ----- Method: ParameterTile>>isBoolean (in category 'access') ----- - isBoolean - "Answer whether the receiver's type is inherently boolean" - - ^ self scriptEditor typeForParameter == #Boolean! Item was added: + ----- Method: ParameterTile>>isBooleanType (in category 'access') ----- + isBooleanType + "Answer whether the receiver's type is inherently boolean" + + ^ self scriptEditor typeForParameter == #Boolean! Item was removed: - ----- Method: PhraseTileMorph>>isBoolean (in category 'queries') ----- - isBoolean - "Answer whether the receiver has a boolean type" - - ^ self resultType = #Boolean! Item was added: + ----- Method: PhraseTileMorph>>isBooleanType (in category 'queries') ----- + isBooleanType + "Answer whether the receiver has a boolean type" + + ^ self resultType = #Boolean! Item was changed: ----- Method: PhraseTileMorph>>rowOfRightTypeFor:forActor: (in category 'all') ----- rowOfRightTypeFor: aLayoutMorph forActor: aPlayer "Answer a phrase of the right type for the putative container" | aTemporaryViewer aPhrase | aLayoutMorph demandsBoolean ifTrue: + [self isBooleanType ifTrue: [^ self]. - [self isBoolean ifTrue: [^ self]. aTemporaryViewer := CategoryViewer new invisiblySetPlayer: aPlayer. aPhrase := aTemporaryViewer booleanPhraseFromPhrase: self. aPhrase justGrabbedFromViewer: false. ^ aPhrase]. ^ self! Item was removed: - ----- Method: SystemQueryPhrase>>isBoolean (in category 'access') ----- - isBoolean - ^ true! Item was added: + ----- Method: SystemQueryPhrase>>isBooleanType (in category 'access') ----- + isBooleanType + ^ true! |
Free forum by Nabble | Edit this page |