class MIPSUnit::MSpec::Label

Author

Zachary Kurmas

Copyright

Copyright © 2012

Constants

DEFAULT_LABEL_NAME

Attributes

local_name[R]

The “local” name of this label – the name the programmer uses in the spec code

unique_name[R]

The “global” name of this label – a globally unique string placed in the assembly code

Public Class Methods

new(name=DEFAULT_LABEL_NAME) click to toggle source

Creates a new Label with the given local name and a globally unique name based on the local name. The parameter must either be a Symbol, or have a to_sym method that does not return nil.

# File lib/mipsunit/mspec/label.rb, line 41
def initialize(name=DEFAULT_LABEL_NAME)
  @local_name = name.to_sym
  if @local_name.nil?
    raise ArgumentError.new("Parameter #{name} produces a nil symbol")
  end

  # We use "send" so we don't make increment_count visible to users outside
  # this class.
  @unique_name = "#{@local_name}__#{increment_count(@local_name)}"
end