class Yoda::Model::NodeSignature

Attributes

node[R]

@return [::Parser::AST::Node]

trace[R]

@return [Typing::Traces::Base]

Public Class Methods

new(node, trace) click to toggle source

@param node [::Parser::AST::Node] @param trace [Typing::Traces::Base]

# File lib/yoda/model/node_signature.rb, line 12
def initialize(node, trace)
  @node = node
  @trace = trace
end

Public Instance Methods

descriptions() click to toggle source

@return [Array<Descriptions::Base>]

# File lib/yoda/model/node_signature.rb, line 23
def descriptions
  [top_description, *type_descriptions]
end
node_range() click to toggle source

@return [Range]

# File lib/yoda/model/node_signature.rb, line 18
def node_range
  Parsing::Range.of_ast_location(node.location)
end
top_description() click to toggle source

@return [Descriptions::NodeDescription]

# File lib/yoda/model/node_signature.rb, line 28
def top_description
  Descriptions::NodeDescription.new(node, trace)
end
type_descriptions() click to toggle source

@return [Array<Descriptions::Base>]

# File lib/yoda/model/node_signature.rb, line 33
def type_descriptions
  case trace
  when Typing::Traces::Send
    trace.functions.map { |function| Descriptions::FunctionDescription.new(function) }.take(1)
  else
    trace.values.map { |value| Descriptions::ValueDescription.new(value) }
  end
end