Class: WebIDL::ParseTree::Argument

Inherits:
Treetop::Runtime::SyntaxNode
  • Object
show all
Defined in:
lib/webidl/parse_tree/argument.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
# File 'lib/webidl/parse_tree/argument.rb', line 5

def build(parent)
  xattrs = eal.build(parent) unless eal.empty?

  options = {:extended_attributes => xattrs}

  if arg.respond_to?(:optional) && arg.optional.any?
    options[:optional] = true
    options[:default] = arg.default.build if arg.default.any?
  else
    options[:variadic] = arg.variadic.any?
  end

  Ast::Argument.new(
    arg.name.build,
    arg.type.build(parent),
    options
  )
end