node@(Compiler SyntaxNode traits) macroExpand "The default do-nothing action of macro expansion." [ node ]. ann@(Compiler AnnotationNode traits) macroExpand "Return the comment node, but replace the expression that the comment annotates with its expansion." [| expansion | expansion: ann value macroExpand. argument = expansion ifFalse: [ann value: expansion]. ann ]. macro@(Compiler MacroNode traits) macroExpand "Simply apply the macro-method to its arguments." [ (macro selector sendTo: macro arguments) macroExpand ]. message@(Compiler MessageNode traits) macroExpand "Replace each argument to the message with its macro-expanded value." [ message arguments doWithIndex: [| :argument :index expansion | expansion: argument macroExpand. argument = expansion ifFalse: [message arguments at: index put: expansion] ]. message ]. group@(Compiler CompoundStatementNode traits) macroExpand "Replace the group's contents with their macro-expansions. This covers: ArrayNodes, BlockNodes, and ParenthesisNodes." [ group statements doWithIndex: [| :statement :index expansion | expansion: statement macroExpand. statement = expansion ifFalse: [group statements at: index put: expansion] ]. group ]. method@(Compiler MethodNode traits) macroExpand "Method nodes must handle the additional complication of roles." [ method roles doWithIndex: [| :role :index expansion | role ifNotNil: [ expansion: role macroExpand. role = expansion ifFalse: [method roles at: index put: expansion] ] ]. resend ]. store@(Compiler StoreVariableNode traits) macroExpand "Expand the value to be stored." [| expansion | expansion: store value macroExpand. store value = expansion ifFalse: [store value: expansion]. store ]. ret@(Compiler ReturnNode traits) macroExpand "Expand the value to be returned." [| expansion | expansion: store value macroExpand. ret value = expansion ifFalse: [ret value: expansion]. ret ].