Class: Nydp::FunctionInvocation

Inherits:
Object
  • Object
show all
Extended by:
Helper
Defined in:
lib/nydp/function_invocation.rb

Constant Summary collapse

@@seen =
{ }

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Helper

cons, list, literal?, pair?, sig, sym, sym?

Methods included from Converter

#n2r, #r2n, #rubify

Constructor Details

#initialize(function_instruction, argument_instructions, source, sig = nil) ⇒ FunctionInvocation

Returns a new instance of FunctionInvocation.



120
121
122
123
# File 'lib/nydp/function_invocation.rb', line 120

def initialize function_instruction, argument_instructions, source, sig=nil
  @function_instruction, @argument_instructions, @source = function_instruction, argument_instructions, source
  @sig = sig
end

Instance Attribute Details

#argument_instructionsObject

Returns the value of attribute argument_instructions.



95
96
97
# File 'lib/nydp/function_invocation.rb', line 95

def argument_instructions
  @argument_instructions
end

#function_instructionObject

Returns the value of attribute function_instruction.



95
96
97
# File 'lib/nydp/function_invocation.rb', line 95

def function_instruction
  @function_instruction
end

Class Method Details

.build(expression, bindings, ns) ⇒ Object



114
115
116
117
118
# File 'lib/nydp/function_invocation.rb', line 114

def self.build expression, bindings, ns
  compiled   = Compiler.compile_each(expression, bindings, ns)

  Invocation::Base.new(compiled, expression)
end

Instance Method Details

#compile_to_ruby(indent, srcs, opts = nil) ⇒ Object



101
102
103
104
105
106
107
108
109
110
# File 'lib/nydp/function_invocation.rb', line 101

def compile_to_ruby indent, srcs, opts=nil
  ra = argument_instructions.map { |e| e.compile_to_ruby "#{indent}  ", srcs, cando: true }.to_a
  if ra.length == 1
    "#{indent}#{ra.shift}._nydp_call()"
  else
    "#{indent}#{ra.shift}._nydp_call(
#{ra.join(",\n")}
#{indent})"
  end
end

#inspectObject



125
# File 'lib/nydp/function_invocation.rb', line 125

def inspect ; @function_instruction._nydp_inspect ; end

#lexical_reach(n) ⇒ Object



97
98
99
# File 'lib/nydp/function_invocation.rb', line 97

def lexical_reach n
  function_instruction.lexical_reach(n)
end

#to_sObject



126
# File 'lib/nydp/function_invocation.rb', line 126

def to_s    ; @source.to_s                        ; end