Skip to content

module Crystal::HookExpansionsContainer

Holds hook expansions.

For example, a ClassDef node will include macro expansions that result from the inherited hook. So in this code:

class Foo
  macro inherited
    puts 1
  end
end

class Bar < Foo
end

The AST node for the Bar class declaration (a ClassDef) will include a hook expansion consisting of puts 1, that is typed and executed before Bar's body.

Direct including types

Crystal::ClassDef Crystal::Def Crystal::Extend Crystal::Include

Methods

#add_hook_expansion(node)

View source

#hook_expansions : Array(ASTNode)?

View source