0
0
mirror of https://github.com/zeux/pugixml.git synced 2025-01-03 01:55:25 +08:00

XPath: Split optimize into optimize and optimize_self

This makes the code slightly more readable, but more importantly it fixes a
false positive in Clang static analyzer.

Fixes #47.
This commit is contained in:
Arseny Kapoulkine 2015-07-22 21:06:39 -07:00
parent d4fedd6775
commit 4460da54a1

View File

@ -10660,6 +10660,11 @@ PUGI__NS_BEGIN
if (_right) _right->optimize(alloc);
if (_next) _next->optimize(alloc);
optimize_self(alloc);
}
void optimize_self(xpath_allocator* alloc)
{
// Rewrite [position()=expr] with [expr]
// Note that this step has to go before classification to recognize [position()=1]
if ((_type == ast_filter || _type == ast_predicate) &&