class IDL::AST::TemplateParam

Attributes

concrete[R]
idltype[R]

Public Class Methods

concrete_param(instantiation_context, tpl_elem) click to toggle source
# File lib/ridl/node.rb, line 671
def self.concrete_param(instantiation_context, tpl_elem)
  # is this an element from the template's scope
  if tpl_elem.is_template?
    celem = if tpl_elem.is_a?(IDL::AST::TemplateParam) # an actual template parameter?
      tpl_elem.concrete # get the template parameter's concrete (instantiation argument) value
    else
      # referenced template elements should have been instantiated already and available through context
      ctxelem = instantiation_context[tpl_elem]
      # all items in the context are AST elements but for a concrete parameter value only constants and type
      # elements will be referenced; return accordingly
      ctxelem.is_a?(IDL::AST::Const) ? ctxelem.expression : ctxelem.idltype
    end
    raise "cannot resolve concrete node for template #{tpl_elem.typename} #{tpl_elem.scoped_lm_name}" unless celem

    celem
  else
    tpl_elem.idltype # just return the element's idltype if not from the template scope
  end
end
new(_name, _enclosure, params) click to toggle source
Calls superclass method IDL::AST::Leaf::new
# File lib/ridl/node.rb, line 640
def initialize(_name, _enclosure, params)
  super(_name, _enclosure)
  @idltype = params[:type]
  @concrete = nil
end

Public Instance Methods

concrete_matches?(idl_type) click to toggle source
# File lib/ridl/node.rb, line 663
def concrete_matches?(idl_type)
  if @concrete
    concrete_type = (@concrete.is_a?(IDL::Type) ? @concrete : @concrete.idltype).resolved_type
    return concrete_type.matches?(idl_type.resolved_type)
  end
  false
end
is_template?() click to toggle source
# File lib/ridl/node.rb, line 655
def is_template?
  true
end
marshal_dump() click to toggle source
Calls superclass method IDL::AST::Leaf#marshal_dump
# File lib/ridl/node.rb, line 646
def marshal_dump
  super() << @idltype
end
marshal_load(vars) click to toggle source
Calls superclass method IDL::AST::Leaf#marshal_load
# File lib/ridl/node.rb, line 650
def marshal_load(vars)
  @idltype = vars.pop
  super(vars)
end
set_concrete_param(_param) click to toggle source
# File lib/ridl/node.rb, line 659
def set_concrete_param(_param)
  @concrete = _param
end