RosettaCodeData/Task/Tree-traversal/Smalltalk/tree-traversal-1.st
2023-07-01 13:44:08 -04:00

9 lines
220 B
Smalltalk

"Protocol: visiting"
EmptyNode>>accept: aVisitor
EmptyNode>>accept: aVisitor with: anObject
^anObject
"Protocol: enumerating"
EmptyNode>>traverse: aVisitorClass do: aBlock
^self accept: (aVisitorClass block: aBlock)