Class: Kumi::Core::NAST::Declaration

Inherits:
Node
  • Object
show all
Defined in:
lib/kumi/core/nast.rb

Instance Attribute Summary collapse

Attributes inherited from Node

#id, #loc, #meta

Instance Method Summary collapse

Constructor Details

#initialize(name:, body:, **k) ⇒ Declaration

Returns a new instance of Declaration.



210
211
212
213
214
# File 'lib/kumi/core/nast.rb', line 210

def initialize(name:, body:, **k)
  super(**k)
  @name = name.to_sym
  @body = body
end

Instance Attribute Details

#bodyObject (readonly)

Returns the value of attribute body.



208
209
210
# File 'lib/kumi/core/nast.rb', line 208

def body
  @body
end

#nameObject (readonly)

Returns the value of attribute name.



208
209
210
# File 'lib/kumi/core/nast.rb', line 208

def name
  @name
end

Instance Method Details

#accept(visitor) ⇒ Object



216
217
218
# File 'lib/kumi/core/nast.rb', line 216

def accept(visitor)
  visitor.visit_declaration(self)
end

#kindObject



220
221
222
# File 'lib/kumi/core/nast.rb', line 220

def kind
  meta[:kind]
end