class IDL::Type::Sequence

def initialize(t, size)

def initialize(t, size)
  raise "Anonymous type definitions are not allowed!" if t.is_anonymous?
  @basetype = t
  @size = size
  @typename = format("sequence<%s%s>", t.typename,
                     if @size.nil? then
                        ""
                     else
                        ", #{IDL::Expression::ScopedName === size ? size.node.name : size.to_s}"
                     end)
  @recursive = false
end

def instantiate(instantiation_context)

def instantiate(instantiation_context)
  if self.is_template?
    Type::Sequence.new(@basetype.instantiate(instantiation_context), @size ? @size.instantiate(instantiation_context).value : nil)
  else
    self
  end
end

def is_anonymous?

def is_anonymous?
  true
end

def is_complete?

def is_complete?
  @basetype.resolved_type.is_complete?
end

def is_local?(recurstk = [])

def is_local?(recurstk = [])
  @basetype.resolved_type.is_local?(recurstk)
end

def is_recursive?

def is_recursive?
  @recursive
end

def is_template?

def is_template?
  (@size && @size.is_a?(IDL::Expression::ScopedName) && @size.node.is_a?(IDL::AST::TemplateParam)) || @basetype.is_template?
end

def length

def length
  @size
end

def matches?(idltype)

def matches?(idltype)
  super && self.size == idltype.size && self.basetype.resolved_type.matches?(idltype.basetype.resolved_type)
end

def narrow(obj)

def narrow(obj)
  typeerror(obj)
end

def typename

def typename
  @typename
end