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.



4723
4724
4725
4726
# File 'lib/idl/ast.rb', line 4723

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



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

def to_idl = text_value

#type(symtab) ⇒ Object



4736
4737
4738
4739
4740
4741
# File 'lib/idl/ast.rb', line 4736

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

  @type_cache[symtab.cfg_arch] = 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:



4729
4730
4731
4732
4733
# File 'lib/idl/ast.rb', line 4729

def type_check(symtab)
  type = type(symtab)

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