Class: Idl::UserTypeNameAst

Inherits:
AstNode
  • Object
show all
Defined in:
lib/idl/ast.rb

Instance Method Summary collapse

Constructor Details

#initialize(input, interval) ⇒ UserTypeNameAst

Returns a new instance of UserTypeNameAst.



4688
4689
4690
4691
# File 'lib/idl/ast.rb', line 4688

def initialize(input, interval)
  super(input, interval, EMPTY_ARRAY)
  @type_cache = {}
end

Instance Method Details

#to_idlString

Return valid IDL representation of the node (and its subtree)

Returns:

  • (String)

    IDL code for the node



4709
# File 'lib/idl/ast.rb', line 4709

def to_idl = text_value

#type(symtab) ⇒ Object



4701
4702
4703
4704
4705
4706
# File 'lib/idl/ast.rb', line 4701

def type(symtab)
  typ = @type_cache[symtab.archdef]
  return typ unless typ.nil?

  @type_cache[symtab.archdef] = symtab.get(text_value)
end

#type_check(symtab) ⇒ void

This method returns an undefined value.

type check this node and all children

Calls to #type and/or #value may depend on type_check being called first with the same symtab. If not, those functions may raise an AstNode::InternalError

Parameters:

Raises:



4694
4695
4696
4697
4698
# File 'lib/idl/ast.rb', line 4694

def type_check(symtab)
  type = type(symtab)

  type_error "#{text_value} is not a type" unless type.is_a?(Type)
end