Cleaned up compiler handling of axes/calls

Function call handlers don't receive a single AST node, instead they
receive the XPath arguments as separate method arguments.
This commit is contained in:
Yorick Peterse 2015-07-29 20:52:54 +02:00
parent bfc970a95a
commit aa8386e6f3
1 changed files with 7 additions and 7 deletions

View File

@ -151,7 +151,7 @@ module Oga
# @return [Oga::Ruby::Node] # @return [Oga::Ruby::Node]
# #
def on_axis(ast, input, &block) def on_axis(ast, input, &block)
name, test = *ast.children name, test = *ast
handler = name.gsub('-', '_') handler = name.gsub('-', '_')
@ -407,28 +407,28 @@ module Oga
# @return [Oga::Ruby::Node] # @return [Oga::Ruby::Node]
# #
def on_call(ast, input, &block) def on_call(ast, input, &block)
name, test = *ast.children name, args = *ast
handler = name.gsub('-', '_') handler = name.gsub('-', '_')
send(:"on_call_#{handler}", test, input, &block) send(:"on_call_#{handler}", input, *args, &block)
end end
## ##
# Processes the `true()` function call. # Processes the `true()` function call.
# #
# @see [#on_call] # @return [Oga::Ruby::Node]
# #
def on_call_true(ast, input) def on_call_true(*)
literal('true') literal('true')
end end
## ##
# Processes the `false()` function call. # Processes the `false()` function call.
# #
# @see [#on_call] # @return [Oga::Ruby::Node]
# #
def on_call_false(ast, input) def on_call_false(*)
literal('false') literal('false')
end end