From: Matt S Trout Date: Tue, 18 Sep 2018 01:08:55 +0000 (+0000) Subject: extract _expand_maybe_list_expr X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=8476c6a3772941817b6b76f94d36d5796a58cdf1;p=scpubgit%2FQ-Branch.git extract _expand_maybe_list_expr --- diff --git a/lib/SQL/Abstract.pm b/lib/SQL/Abstract.pm index 38c1e9e..6666ace 100644 --- a/lib/SQL/Abstract.pm +++ b/lib/SQL/Abstract.pm @@ -1101,11 +1101,7 @@ sub _table { my $self = shift; my $from = shift; ($self->_render_expr( - ref($from) eq 'ARRAY' - ? { -op => [ - ',', map $self->_expand_expr($_, undef, -ident), @$from - ] } - : $self->_expand_expr($from, undef, -ident) + $self->_expand_maybe_list_expr($from, undef, -ident) ))[0]; } @@ -1114,6 +1110,15 @@ sub _table { # UTILITY FUNCTIONS #====================================================================== +sub _expand_maybe_list_expr { + my ($self, $expr, $logic, $default) = @_; + return ref($expr) eq 'ARRAY' + ? { -op => [ + ',', map $self->_expand_expr($_, $logic, $default), @$expr + ] } + : $self->_expand_expr($expr, $logic, $default); +} + # highly optimized, as it's called way too often sub _quote { # my ($self, $label) = @_;