class Yadriggy::ModuleDef

Module definition.

Attributes

body[R]

@return [Exprs|ASTnode] the body.

name[R]

@return [Const|ConstPathRef] the module name.

rescue[R]

@return [Rescue|nil] the rescue clause.

Public Class Methods

new(sexp) click to toggle source
# File lib/yadriggy/ast.rb, line 1638
def initialize(sexp)
  @name = to_node(sexp[1])  # Const or ConstPathRef
  add_child(@name)
  initialize_body(has_tag?(sexp[2], :bodystmt))
end
tag() click to toggle source
# File lib/yadriggy/ast.rb, line 1636
def self.tag() :module end

Public Instance Methods

accept(evaluator) click to toggle source

A method for Visitor pattern. @param [Eval] evaluator the visitor of Visitor pattern. @return [void]

# File lib/yadriggy/ast.rb, line 1654
def accept(evaluator)
  evaluator.module_def(self)
end
initialize_body(bodystmt) click to toggle source
# File lib/yadriggy/ast.rb, line 1644
def initialize_body(bodystmt)
  @body = Exprs.make(bodystmt[1] - [[:void_stmt]])
  @rescue = Rescue.make(bodystmt[2], bodystmt[3], bodystmt[4])
  add_child(@body)
  add_child(@rescue)
end