class Bpl::AST::FunctionDeclaration

Public Instance Methods

abstract() click to toggle source
# File lib/bpl/passes/transformation/abstraction.rb, line 39
def abstract
  # XXX
  # not clear this one is useful
  # XXX
  #
  # unless body.nil?
  #   yield({
  #     description: "removing function body",
  #     weight: count,
  #     action: Proc.new do
  #       replace_children(:body,nil)
  #     end
  #   })
  # end
end
declarations() click to toggle source
# File lib/bpl/ast/declaration.rb, line 24
def declarations; @arguments end
show() { |a| ... } click to toggle source
# File lib/bpl/ast/declaration.rb, line 31
def show(&blk)
  args = @arguments.map{|a| yield a} * ", "
  ret = yield @return
  body = @body ? " { #{yield @body} }" : ";"
  "#{yield :function} #{show_attrs(&blk)} #{yield @name}(#{args}) #{yield :returns} (#{ret})#{body}".fmt
end
signature() click to toggle source
# File lib/bpl/ast/declaration.rb, line 27
def signature
  args = @arguments.map(&:flatten).flatten.map{|x|x.type} * ","
  "#{@name}(#{args}): #{@return.type}".gsub(/\s/,'')
end