Class: Yoda::Typing::Context::TraceStore::ParserNodeWrapper

Inherits:
Object
  • Object
show all
Defined in:
lib/yoda/typing/context.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(node) ⇒ ParserNodeWrapper

Returns a new instance of ParserNodeWrapper.

Parameters:

  • node (::Parser::AST::Node)


78
79
80
# File 'lib/yoda/typing/context.rb', line 78

def initialize(node)
  @node = node
end

Instance Attribute Details

#node::Parser::AST::Node (readonly)

Returns:

  • (::Parser::AST::Node)


75
76
77
# File 'lib/yoda/typing/context.rb', line 75

def node
  @node
end

Instance Method Details

#eql?(another) ⇒ Boolean

Parameters:

  • another (Object)

Returns:

  • (Boolean)


83
84
85
86
87
# File 'lib/yoda/typing/context.rb', line 83

def eql?(another)
  another.is_a?(ParserNodeWrapper) &&
    node == another.node &&
    node.location == another.node.location
end

#hashObject



89
90
91
# File 'lib/yoda/typing/context.rb', line 89

def hash
  [node, node.location].hash
end