Class: Idl::FunctionDefSyntaxNode

Inherits:
SyntaxNode show all
Defined in:
lib/idlc/ast.rb

Instance Method Summary collapse

Methods inherited from Treetop::Runtime::SyntaxNode

#set_input_file, #set_input_file_unless_already_set, #space?

Instance Method Details

#to_astObject



8270
8271
8272
8273
8274
8275
8276
8277
8278
8279
8280
8281
8282
8283
8284
8285
# File 'lib/idlc/ast.rb', line 8270

def to_ast
  FunctionDefAst.new(
    input,
    interval,
    send(:function_name).text_value,
    if send(:ret).empty?
      []
    else
      [send(:ret).first.to_ast] + (send(:ret).respond_to?(:rest) ? send(:ret).rest.elements.map { |r| r.type_name.to_ast } : [])
    end,
    send(:args).empty? ? [] : [send(:args).first.to_ast] + send(:args).rest.elements.map { |r| r.single_declaration.to_ast },
    send(:desc).text_value,
    respond_to?(:type) ? send(:type).text_value.strip.to_sym : :normal,
    respond_to?(:body_block) ? send(:body_block).function_body.to_ast : nil
  )
end