From aa8386e6f3d55609bdd083299b0cd973823b7f69 Mon Sep 17 00:00:00 2001 From: Yorick Peterse Date: Wed, 29 Jul 2015 20:52:54 +0200 Subject: [PATCH] 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. --- lib/oga/xpath/compiler.rb | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/oga/xpath/compiler.rb b/lib/oga/xpath/compiler.rb index d50bacb..6804245 100644 --- a/lib/oga/xpath/compiler.rb +++ b/lib/oga/xpath/compiler.rb @@ -151,7 +151,7 @@ module Oga # @return [Oga::Ruby::Node] # def on_axis(ast, input, &block) - name, test = *ast.children + name, test = *ast handler = name.gsub('-', '_') @@ -407,28 +407,28 @@ module Oga # @return [Oga::Ruby::Node] # def on_call(ast, input, &block) - name, test = *ast.children + name, args = *ast handler = name.gsub('-', '_') - send(:"on_call_#{handler}", test, input, &block) + send(:"on_call_#{handler}", input, *args, &block) end ## # Processes the `true()` function call. # - # @see [#on_call] + # @return [Oga::Ruby::Node] # - def on_call_true(ast, input) + def on_call_true(*) literal('true') end ## # Processes the `false()` function call. # - # @see [#on_call] + # @return [Oga::Ruby::Node] # - def on_call_false(ast, input) + def on_call_false(*) literal('false') end