Class: Yadriggy::SingularClassDef

Inherits:
ModuleDef show all
Defined in:
lib/yadriggy/ast.rb

Overview

Singular class definition.

Instance Attribute Summary

Attributes inherited from ModuleDef

#body, #rescue

Attributes inherited from ASTnode

#parent, #usertype

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ModuleDef

#initialize_body

Methods included from AstHelper

#has_tag?, #to_node, #to_nodes

Methods inherited from ASTnode

#add_child, #add_children, #const_value, #const_value_in_class, #get_context_class, #get_receiver_object, #is_proc?, #pretty_print, #root, #source_location, #source_location_string, #value, #value_in_class

Constructor Details

#initialize(sexp) ⇒ SingularClassDef

Returns a new instance of SingularClassDef.



1692
1693
1694
1695
1696
# File 'lib/yadriggy/ast.rb', line 1692

def initialize(sexp)
  @name = to_node(sexp[1])  # Keyword, VariableCall, ...
  add_child(@name)
  initialize_body(has_tag?(sexp[2], :bodystmt))
end

Class Method Details

.tagObject



1690
# File 'lib/yadriggy/ast.rb', line 1690

def self.tag() :sclass end

Instance Method Details

#accept(evaluator) ⇒ void

This method returns an undefined value.

A method for Visitor pattern.

Parameters:

  • evaluator (Eval)

    the visitor of Visitor pattern.



1704
1705
1706
# File 'lib/yadriggy/ast.rb', line 1704

def accept(evaluator)
  evaluator.singular_class_def(self)
end

#nameKeyword|VariableCall|ASTnode

Returns self, the object, ...

Returns:



1699
# File 'lib/yadriggy/ast.rb', line 1699

def name() super end