From: Matt S Trout Date: Tue, 18 Sep 2018 01:08:55 +0000 (+0000) Subject: extract _expand_maybe_list_expr X-Git-Tag: v2.000000~3^2~447 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=d4c6ca63c7c40da97c105bcc0d95099b3f35d208;p=dbsrgits%2FSQL-Abstract.git extract _expand_maybe_list_expr --- diff --git a/lib/SQL/Abstract.pm b/lib/SQL/Abstract.pm index f8d4d5d..583a1c5 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) = @_;