Class: Dentaku::AST::Access

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

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Node

precedence

Constructor Details

#initialize(data_structure, index) ⇒ Access

Returns a new instance of Access.



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

def initialize(data_structure, index)
  @structure = data_structure
  @index = index
end

Class Method Details

.arityObject



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

def self.arity
  2
end

.max_param_countObject



14
15
16
# File 'lib/dentaku/ast/access.rb', line 14

def self.max_param_count
  arity
end

.min_param_countObject



10
11
12
# File 'lib/dentaku/ast/access.rb', line 10

def self.min_param_count
  arity
end

.peekObject



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

def self.peek(*)
end

Instance Method Details

#dependencies(context = {}) ⇒ Object



32
33
34
# File 'lib/dentaku/ast/access.rb', line 32

def dependencies(context = {})
  @structure.dependencies(context) + @index.dependencies(context)
end

#typeObject



36
37
38
# File 'lib/dentaku/ast/access.rb', line 36

def type
  nil
end

#value(context = {}) ⇒ Object



26
27
28
29
30
# File 'lib/dentaku/ast/access.rb', line 26

def value(context = {})
  structure = @structure.value(context)
  index = @index.value(context)
  structure[index]
end