better to_s for load constant
This commit is contained in:
parent
db31ff7021
commit
bae7f5dcb1
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user