Class: Carbon::Tacky::Reference

Inherits:
Object
  • Object
show all
Defined in:
lib/carbon/tacky/reference.rb

Overview

A "reference." A reference is essentially a mapping to an instruction that returned a value, and the reference takes the place of said value. The reference represents the return value of an instruction.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id) ⇒ Reference

Initializes the reference with the given ID.

Parameters:

  • id (::Numeric)

    The ID.



18
19
20
# File 'lib/carbon/tacky/reference.rb', line 18

def initialize(id)
  @id = id
end

Instance Attribute Details

#id::Numeric (readonly)

The id of the instruction that this reference points to.

Returns:

  • (::Numeric)


13
14
15
# File 'lib/carbon/tacky/reference.rb', line 13

def id
  @id
end

Instance Method Details

#as(type) ⇒ Object



22
23
24
# File 'lib/carbon/tacky/reference.rb', line 22

def as(type)
  Tacky::Typed.new(self, type)
end