From d50f89cdf1687b3540a1173eaa471e1cf95b24fd Mon Sep 17 00:00:00 2001 From: Yorick Peterse Date: Wed, 29 Jul 2015 22:05:53 +0200 Subject: [PATCH] Use "node" for axis variables This ensures that any nested code uses the right variables. --- lib/oga/xpath/compiler.rb | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/oga/xpath/compiler.rb b/lib/oga/xpath/compiler.rb index 1013a48..7263433 100644 --- a/lib/oga/xpath/compiler.rb +++ b/lib/oga/xpath/compiler.rb @@ -193,8 +193,7 @@ module Oga # @param [Oga::Ruby::Node] input # @return [Oga::Ruby::Node] def on_axis_ancestor_or_self(ast, input, &block) - parent = literal('parent') - + parent = node_literal self_test = process(ast, input, &block).if_true { yield input } ancestors_test = input.each_ancestor.add_block(parent) do @@ -208,7 +207,7 @@ module Oga # @param [Oga::Ruby::Node] input # @return [Oga::Ruby::Node] def on_axis_ancestor(ast, input, &block) - parent = literal('parent') + parent = node_literal input.each_ancestor.add_block(parent) do process(ast, parent, &block).if_true { yield parent }