Class: HDLRuby::High::RefObject
- Inherits:
-
Low::Ref
- Object
- Base::Expression
- Low::Expression
- Low::Ref
- HDLRuby::High::RefObject
- Includes:
- HRef
- Defined in:
- lib/HDLRuby/hruby_high.rb
Overview
Describes a high-level object reference: no low-level equivalent!
Constant Summary
Constants included from Low::Low2Symbol
Low::Low2Symbol::Low2SymbolPrefix, Low::Low2Symbol::Low2SymbolTable, Low::Low2Symbol::Symbol2LowTable
Instance Attribute Summary collapse
-
#base ⇒ Object
readonly
The base of the reference.
-
#object ⇒ Object
readonly
The refered object.
Attributes inherited from Low::Expression
Attributes included from HDLRuby::Hdecorator
Attributes included from Low::Hparent
Instance Method Summary collapse
-
#constant? ⇒ Boolean
Tell if the expression is constant.
-
#eql?(obj) ⇒ Boolean
Comparison for hash: structural comparison.
-
#initialize(base, object) ⇒ RefObject
constructor
Creates a new reference from a +base+ reference and named +object+.
-
#method_missing(m, *args, &ruby_block) ⇒ Object
Missing methods are looked for into the refered object.
-
#to_low ⇒ Object
Converts the name reference to a HDLRuby::Low::RefName.
-
#to_ref ⇒ Object
Converts to a new reference.
Methods included from HRef
Methods inherited from Low::Ref
#each_node, #each_node_deep, #explicit_types, #hash, #map_nodes!, #path_each, #to_c, #to_high, #to_vhdl
Methods inherited from Low::Expression
#boolean?, #break_types!, #clone, #each_node, #each_node_deep, #each_ref_deep, #explicit_types, #extract_selects_to!, #hash, #leftvalue?, #map_nodes!, #replace_expressions!, #replace_names!, #rightvalue?, #set_type!, #statement, #to_c, #to_high, #to_vhdl, #use_name?
Methods included from Low::Low2Symbol
Methods included from HDLRuby::Hdecorator
decorate_parent_id, dump, each, each_with_property, get, included, load, #properties
Methods included from Low::Hparent
Constructor Details
#initialize(base, object) ⇒ RefObject
Creates a new reference from a +base+ reference and named +object+.
2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 |
# File 'lib/HDLRuby/hruby_high.rb', line 2895 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 |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(m, *args, &ruby_block) ⇒ Object
Missing methods are looked for into the refered object.
2942 2943 2944 |
# File 'lib/HDLRuby/hruby_high.rb', line 2942 def method_missing(m, *args, &ruby_block) @object.send(m,*args,&ruby_block) end |
Instance Attribute Details
#base ⇒ Object (readonly)
The base of the reference
2889 2890 2891 |
# File 'lib/HDLRuby/hruby_high.rb', line 2889 def base @base end |
#object ⇒ Object (readonly)
The refered object.
2892 2893 2894 |
# File 'lib/HDLRuby/hruby_high.rb', line 2892 def object @object end |
Instance Method Details
#constant? ⇒ Boolean
Tell if the expression is constant.
2913 2914 2915 |
# File 'lib/HDLRuby/hruby_high.rb', line 2913 def constant? return self.base.constant? end |
#eql?(obj) ⇒ Boolean
Comparison for hash: structural comparison.
2923 2924 2925 2926 2927 2928 |
# File 'lib/HDLRuby/hruby_high.rb', line 2923 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 |
#to_low ⇒ Object
Converts the name reference to a HDLRuby::Low::RefName.
2931 2932 2933 2934 2935 2936 2937 2938 2939 |
# File 'lib/HDLRuby/hruby_high.rb', line 2931 def to_low # return HDLRuby::Low::RefName.new(self.type.to_low, # @base.to_ref.to_low,@object.name) 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 return refNameL end |