diff --git a/source/Magritte-Model/MATPropertyOwner.trait.st b/source/Magritte-Model/MATPropertyOwner.trait.st index 94a43c2c..63c8a135 100644 --- a/source/Magritte-Model/MATPropertyOwner.trait.st +++ b/source/Magritte-Model/MATPropertyOwner.trait.st @@ -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 }