Class: Dentaku::AST::Function

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

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Node

arity, precedence

Constructor Details

#initialize(*args) ⇒ Function

Returns a new instance of Function.



7
8
9
# File 'lib/dentaku/ast/function.rb', line 7

def initialize(*args)
  @args = args
end

Class Method Details

.get(name) ⇒ Object



15
16
17
# File 'lib/dentaku/ast/function.rb', line 15

def self.get(name)
  registry.get(name)
end

.register(name, type, implementation) ⇒ Object



19
20
21
# File 'lib/dentaku/ast/function.rb', line 19

def self.register(name, type, implementation)
  registry.register(name, type, implementation)
end

.register_class(name, function_class) ⇒ Object



23
24
25
# File 'lib/dentaku/ast/function.rb', line 23

def self.register_class(name, function_class)
  registry.register_class(name, function_class)
end

.registryObject



27
28
29
# File 'lib/dentaku/ast/function.rb', line 27

def self.registry
  @registry ||= FunctionRegistry.new
end

Instance Method Details

#dependencies(context = {}) ⇒ Object



11
12
13
# File 'lib/dentaku/ast/function.rb', line 11

def dependencies(context={})
  @args.flat_map { |a| a.dependencies(context) }
end