X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FSQL%2FAbstract%2FTree.pm;h=54dfd62035cbaf61f7f310269294e8eab57782b2;hb=1de1d085963125cb63f6a0986a9984470ff6f74b;hp=dedd8f394812d46c8f618c3b00dc7dc29552b602;hpb=b137b0744a3aaea3df1ba497345378e9d3f8da40;p=dbsrgits%2FSQL-Abstract.git diff --git a/lib/SQL/Abstract/Tree.pm b/lib/SQL/Abstract/Tree.pm index dedd8f3..54dfd62 100644 --- a/lib/SQL/Abstract/Tree.pm +++ b/lib/SQL/Abstract/Tree.pm @@ -731,6 +731,23 @@ sub _parenthesis_unroll { $changes++; } + # a construct of ... ( somefunc ( ... ) ) ... can safely lose the outer parens + # except for the case of ( NOT ( ... ) ) which has already been handled earlier + elsif ( + @{$child->[1]} == 1 + and + @{$child->[1][0][1]} == 1 + and + $child->[1][0][0] ne 'NOT' + and + ref $child->[1][0][1][0] eq 'ARRAY' + and + $child->[1][0][1][0][0] eq '-PAREN' + ) { + push @children, @{$child->[1]}; + $changes++; + } + # otherwise no more mucking for this pass else {