Class: WebIDL::ParseTree::Operation

Inherits:
Treetop::Runtime::SyntaxNode
  • Object
show all
Defined in:
lib/webidl/parse_tree/operation.rb

Instance Method Summary collapse

Instance Method Details

#build(parent) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/webidl/parse_tree/operation.rb', line 5

def build(parent)
  if respond_to?(:specials)
    special_list = specials.build unless specials.empty?
    operation    = op
  else
    special_list = []
    operation    = self
  end

  typ        = operation.type.build(parent)
  name       = operation.optional_id.text_value unless operation.optional_id.empty?
  arguments  = operation.args.build(parent) unless operation.args.empty?
  raise_list = operation.raises.build unless operation.raises.empty?

  Ast::Operation.new(
    parent, typ,  :name     => name,
                  :specials => special_list,
                  :args     => arguments,
                  :raises   => raise_list,
                  :static   => respond_to?(:static) && !static.empty?
  )
end