class HDLRuby::High::RefObject
Describes a high-level object reference: no low-level equivalent!
Attributes
base[R]
The base of the reference
object[R]
The refered object.
Public Class Methods
new(base,object)
click to toggle source
Creates a new reference from a base
reference and named object
.
Calls superclass method
# File lib/HDLRuby/hruby_high.rb, line 2979 def initialize(base,object) if object.respond_to?(:type) then # Typed object, so typed reference. super(object.type) else # Untyped object, so untyped reference. super(void) end # Check and set the base (it must be convertible to a reference). unless base.respond_to?(:to_ref) raise AnyError, "Invalid base for a RefObject: #{base}" end @base = base # Set the object @object = object end
Public Instance Methods
constant?()
click to toggle source
Tell if the expression is constant.
# File lib/HDLRuby/hruby_high.rb, line 2997 def constant? return self.base.constant? end
eql?(obj)
click to toggle source
Comparison for hash: structural comparison.
# File lib/HDLRuby/hruby_high.rb, line 3007 def eql?(obj) return false unless obj.is_a?(RefObject) return false unless @base.eql?(obj.base) return false unless @object.eql?(obj.object) return true end
method_missing(m, *args, &ruby_block)
click to toggle source
Missing methods are looked for into the refered object.
# File lib/HDLRuby/hruby_high.rb, line 3026 def method_missing(m, *args, &ruby_block) @object.send(m,*args,&ruby_block) end
to_low()
click to toggle source
Converts the name reference to a HDLRuby::Low::RefName
.
# File lib/HDLRuby/hruby_high.rb, line 3015 def to_low # puts "to_low with base=#{@base} @object=#{@object}" refNameL = HDLRuby::Low::RefName.new(self.type.to_low, @base.to_ref.to_low,@object.name) # For debugging: set the source high object refNameL.properties[:low2high] = self.hdr_id self.properties[:high2low] = refNameL return refNameL end
to_ref()
click to toggle source
Converts to a new reference.
# File lib/HDLRuby/hruby_high.rb, line 3002 def to_ref return RefObject.new(@base,@object) end