Zachary Kurmas
Copyright © 2012
The “local” name of this label – the name the programmer uses in the spec code
The “global” name of this label – a globally unique string placed in the assembly code
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