Skip to content

Commit

Permalink
Merge pull request #354 from seandenigris/bug_property-arg-mismatch
Browse files Browse the repository at this point in the history
[Bug]: Property Owner Trait - Only Announce Change After Put
  • Loading branch information
seandenigris authored Mar 29, 2024
2 parents 3825b74 + a15f521 commit 13d01b7
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 13d01b7

Please sign in to comment.