Class: IDL::AST::Valuebox

Inherits:
Leaf
  • Object
show all
Defined in:
lib/ridl/node.rb,
lib/ridl/node.rb

Overview

Port

Constant Summary collapse

NAMETYPE =
:class

Instance Attribute Summary collapse

Attributes inherited from Leaf

#annotations, #enclosure, #intern, #lm_name, #name, #prefix, #scopes

Instance Method Summary collapse

Methods inherited from Leaf

#_set_prefix, #has_annotations?, #is_template?, #lm_name_for_scope, #parsed_name_scope, #replace_prefix, #repo_scopes, #repository_id, #resolve, #scoped_lm_name, #scoped_name, #set_repo_id, #set_repo_version, #typename

Constructor Details

#initialize(_name, _enclosure, params) ⇒ Valuebox

Returns a new instance of Valuebox.



1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
# File 'lib/ridl/node.rb', line 1630

def initialize(_name, _enclosure, params)
  super(_name, _enclosure)
  @idltype = IDL::Type::Valuebox.new(self)
  @boxed_type  = params[:type]
  unless @boxed_type.is_a?(IDL::Type::ScopedName) && @boxed_type.is_node?(IDL::AST::TemplateParam)
    if @boxed_type.resolved_type.is_a?(IDL::Type::Valuetype)
      raise RuntimeError,
        "boxing valuetype #{@boxed_type.scoped_lm_name} in Valuebox #{scoped_lm_name} not allowed"
    end
  end
end

Instance Attribute Details

#boxed_typeObject (readonly)

Returns the value of attribute boxed_type.



1629
1630
1631
# File 'lib/ridl/node.rb', line 1629

def boxed_type
  @boxed_type
end

#idltypeObject (readonly)

Returns the value of attribute idltype.



1629
1630
1631
# File 'lib/ridl/node.rb', line 1629

def idltype
  @idltype
end

Instance Method Details

#instantiate(_context, _enclosure) ⇒ Object



1656
1657
1658
1659
1660
1661
# File 'lib/ridl/node.rb', line 1656

def instantiate(_context, _enclosure)
  _params = {
    :type => @boxed_type.instantiate(_context)
  }
  super(_context, _enclosure, _params)
end

#is_local?(recurstk = []) ⇒ Boolean

Returns:

  • (Boolean)


1642
1643
1644
# File 'lib/ridl/node.rb', line 1642

def is_local?(recurstk = [])
  boxed_type.is_local?(recurstk)
end

#marshal_dumpObject



1646
1647
1648
# File 'lib/ridl/node.rb', line 1646

def marshal_dump
  super() << @idltype << @boxed_type
end

#marshal_load(vars) ⇒ Object



1650
1651
1652
1653
1654
# File 'lib/ridl/node.rb', line 1650

def marshal_load(vars)
  @boxed_type = vars.pop
  @idltype = vars.pop
  super(vars)
end