Class: Yoda::Typing::Traces::Normal

Inherits:
Base
  • Object
show all
Defined in:
lib/yoda/typing/traces/normal.rb

Overview

Store evaluation result for each ast node.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(context, type) ⇒ Normal

Returns a new instance of Normal.



10
11
12
13
14
# File 'lib/yoda/typing/traces/normal.rb', line 10

def initialize(context, type)
  fail ArgumentError, type unless type.is_a?(Model::TypeExpressions::Base)
  @context = context
  @type = type
end

Instance Attribute Details

#contextObject (readonly)

Returns the value of attribute context.



6
7
8
# File 'lib/yoda/typing/traces/normal.rb', line 6

def context
  @context
end

#typeObject (readonly)

Returns the value of attribute type.



6
7
8
# File 'lib/yoda/typing/traces/normal.rb', line 6

def type
  @type
end

Instance Method Details

#valuesObject



16
17
18
# File 'lib/yoda/typing/traces/normal.rb', line 16

def values
  type.resolve(context.registry)
end