Skip to content

Commit

Permalink
[Bug]: Property Owner Trait - Only Announce Change After Put
Browse files Browse the repository at this point in the history
  • Loading branch information
seandenigris committed Mar 29, 2024
1 parent 3825b74 commit a15f521
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions source/Magritte-Model/MATPropertyOwner.trait.st
Original file line number Diff line number Diff line change
Expand Up @@ -142,18 +142,20 @@ MATPropertyOwner >> propertyAt: aKey ifPresent: oneArgBlock ifAbsent: absentBloc
{ #category : #accessing }
MATPropertyOwner >> propertyAt: aKey ifPresent: oneArgBlock ifAbsentPut: absentBlock [
"Lookup ==aKey==, if it is present, answer the value of evaluating the oneArgBlock with the value associated with the key, otherwise answer the value of absentBlock."
| anOldValue aNewValue |
anOldValue := nil.
aNewValue := self properties

| aValue didPut |
didPut := false.
aValue := self properties
at: aKey
ifPresent: [ :aValue |
anOldValue := aValue.
oneArgBlock value ]
ifAbsentPut: absentBlock.
ifPresent: oneArgBlock
ifAbsentPut: [
didPut := true.
absentBlock value ].

self propertyAnnounceKey: aKey oldValue: anOldValue newValue: aNewValue.

^ aNewValue
didPut ifTrue: [
self propertyAnnounceKey: aKey oldValue: nil newValue: aValue ].

^ aValue
]

{ #category : #accessing }
Expand Down

0 comments on commit a15f521

Please sign in to comment.