class Pione::Lang::Message

Message represents method callers in PIONE language.

Public Instance Methods

eval(env) click to toggle source

Evaluate the application expression and returns application result.

# File lib/pione/lang/message.rb, line 19
def eval(env)
  # evaluate the receiver in the environment
  _receiver = receiver.eval(env)
  if _receiver.is_a?(Variable)
    _receiver = _receiver.eval(env)
  end

  # send a message to it
  _receiver.call_pione_method(env, name, arguments)
end
eval!(env) click to toggle source
# File lib/pione/lang/message.rb, line 30
def eval!(env)
  eval(env).eval!(env)
end
pione_type(env) click to toggle source

Return PIONE model type of the message result according to type interface.

# File lib/pione/lang/message.rb, line 10
def pione_type(env)
  if pione_method = receiver.pione_type(env).find_method(env, name, receiver, arguments)
    pione_method.get_output_type(env, receiver)
  else
    raise MethodNotFound.new(env, name.to_s, receiver, arguments)
  end
end
textize() click to toggle source

Convert to text string.

# File lib/pione/lang/message.rb, line 35
def textize
  args = arguments.map {|arg| arg.textize}
  "#%s{name: %s, receiver: %s, arguments: %s}" % [Message, name, receiver.textize, args]
end