Class: Dentaku::AST::Array

Inherits:
Node
  • Object
show all
Defined in:
lib/dentaku/ast/array.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Node

#name, precedence, resolve_class

Constructor Details

#initialize(*elements) ⇒ Array

Returns a new instance of Array.



17
18
19
# File 'lib/dentaku/ast/array.rb', line 17

def initialize(*elements)
  @elements = *elements
end

Class Method Details

.arityObject



6
7
# File 'lib/dentaku/ast/array.rb', line 6

def self.arity
end

.max_param_countObject



13
14
15
# File 'lib/dentaku/ast/array.rb', line 13

def self.max_param_count
  Float::INFINITY
end

.min_param_countObject



9
10
11
# File 'lib/dentaku/ast/array.rb', line 9

def self.min_param_count
  0
end

Instance Method Details

#accept(visitor) ⇒ Object



33
34
35
# File 'lib/dentaku/ast/array.rb', line 33

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

#dependencies(context = {}) ⇒ Object



25
26
27
# File 'lib/dentaku/ast/array.rb', line 25

def dependencies(context = {})
  @elements.flat_map { |el| el.dependencies(context) }
end

#typeObject



29
30
31
# File 'lib/dentaku/ast/array.rb', line 29

def type
  nil
end

#value(context = {}) ⇒ Object



21
22
23
# File 'lib/dentaku/ast/array.rb', line 21

def value(context = {})
  @elements.map { |el| el.value(context) }
end