Sha256: ab097daaa18baec7c841799e29ed597915dfa4825873cdbf8d624faeb1773217

Contents?: true

Size: 680 Bytes

Versions: 3

Compression:

Stored size: 680 Bytes

Contents

# encoding: utf-8
# frozen_string_literal: true

module Carbon
  module Tacky
    # 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.
    class Reference
      # The id of the instruction that this reference points to.
      #
      # @return [::Numeric]
      attr_reader :id

      # Initializes the reference with the given ID.
      #
      # @param id [::Numeric] The ID.
      def initialize(id)
        @id = id
      end

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
carbon-core-0.2.1 lib/carbon/tacky/reference.rb
carbon-core-0.2.0 lib/carbon/tacky/reference.rb
carbon-core-0.1.1 lib/carbon/tacky/reference.rb