better to_s for load constant

This commit is contained in:
Torsten Ruger 2015-08-09 00:52:47 +03:00
parent db31ff7021
commit bae7f5dcb1

View File

@ -13,8 +13,21 @@ module Register
attr_accessor :register , :constant attr_accessor :register , :constant
def to_s def to_s
"LoadConstant: #{register} <- #{constant}" "LoadConstant: #{register} <- #{constant_str}"
end end
private
def constant_str
case @constant
when String , Symbol , Fixnum , Integer
@constant.to_s
else
if( @constant.respond_to? :sof_reference_name )
constant.sof_reference_name
else
constant.class.name.to_s
end
end
end
end end
end end