Commits

shl...@52c325ad-5fd0-0310-8a0f-c43feede02cc  committed 9954f87

Refactoring: extracted the $self->_new_empty_list() method.

  • Participants
  • Parent commits 776096a

Comments (0)

Files changed (1)

File perl/modules/XML-Grammar-Fiction/lib/XML/Grammar/Fiction/FromProto/Parser/QnD.pm

 {
     my $self = shift;
     my $open = shift;
-    my $children =
-        shift || 
-        $self->_new_list([]);
+    my $children = shift || $self->_new_empty_list();
 
     return
         $self->_new_node(
         );
 }
 
+sub _new_empty_list
+{
+    my $self = shift;
+    return $self->_new_list([]);
+}
+
 sub _new_list
 {
     my $self = shift;
     # If it's whitespace - return an empty list.
     if ((scalar(@ret) == 1) && (ref($ret[0]) eq "") && ($ret[0] !~ m{\S}))
     {
-        return $self->_new_list([]);
+        return $self->_new_empty_list();
     }
 
     return $self->_new_list(\@ret);