Hi,
I've been struggling with a Magritte validation problem. I find that a
condition I add (using #addCondition:labelled:) to a MABooleanDescription is
only intermittently called.
I've simplified the conditions to reproduce the problem to a component
description comprising of two MABooleanDescription descriptions. The second
description includes the condition which is intermittently called.
If the value of the first description is true (ie the checkbox is checked)
the second description's condition will be executed, however if it is false
it will never be executed.
I suspect the problems lies in the code in
MAValidatorVisitor>>#visitContainer: which calls
MAGraphVisitor>>#use:during: which is as follows:
MAGraphVisitor >>use: anObject during: aBlock
| previous |
(seen includes: anObject)
ifTrue: [ ^ self ].
anObject isNil
ifFalse: [ seen add: anObject ].
previous := object. object := anObject.
aBlock ensure: [ object := previous ]
If the first check box is false, and the second is also false then (seen
includes: anObject) will return true and method returns early resulting in
block associated with second description (self visit: description) never
being executed.
I've attached a file out of a simple
component TestMagritteValidation illustrating the problem that I tested in
the latest build from Hudson.
Thanks
Nick