<commit_before>=head1 TITLE

Array - Perl 6 Array class

=head1 DESCRIPTION

Arrays are the mutable form of Lists.

=head2 Methods

=over 4

=cut

.namespace ['Array']
.sub 'onload' :anon :init :load
    .local pmc p6meta, proto
    p6meta = get_hll_global ['Mu'], '$!P6META'
    proto = p6meta.'new_class'('Array', 'parent'=>'List')
.end


=item new

=cut

.sub 'new' :method
    .param pmc values :slurpy
    .tailcall '&circumfix:<[ ]>'(values :flat)
.end

=back

=head2 Operators

=over 4

=item &circumfix:<[ ]>()

=cut

.namespace []
.sub '&circumfix:<[ ]>' 
    .param pmc values            :slurpy
    .local pmc parcel
    parcel = new ['Parcel']
    splice parcel, values, 0, 0
    $P0 = new ['Array']
    transform_to_p6opaque $P0
    $P0.'!STORE'(parcel)
    $P1 = new ['ObjectRef'], $P0
    $P2 = get_hll_global ['Bool'], 'True'
    setprop $P1, 'scalar', $P2
    .return ($P1)
.end

=back

=head2 Private methods

=over 4

=cut

.namespace ['Array']
.sub '!STORE' :method
    .param pmc source
    .local pmc list, flat, items, rest
    $P0 = get_hll_global 'Seq'
    list = $P0.'new'(source)
    list.'eager'()
    items = getattribute list, '@!items'
    rest  = getattribute list, '@!rest'
    if null items goto have_rest
    splice rest, items, 0, 0
    null items<commit_msg>Refactor Array.new and circumfix:<[ ]> so that subclasses of Array properly instantiate the correct type.  Reported by Util++ on #perl6.<commit_after>=head1 TITLE

Array - Perl 6 Array class

=head1 DESCRIPTION

Arrays are the mutable form of Lists.

=head2 Methods

=over 4

=cut

.namespace ['Array']
.sub 'onload' :anon :init :load
    .local pmc p6meta, proto
    p6meta = get_hll_global ['Mu'], '$!P6META'
    proto = p6meta.'new_class'('Array', 'parent'=>'List')
.end


=item new

=cut

.sub 'new' :method
    .param pmc values          :slurpy
    .local pmc p6meta, parrotclass, list, true
    p6meta = get_hll_global ['Mu'], '$!P6META'
    parrotclass = p6meta.'get_parrotclass'(self)
    list = new parrotclass
    setattribute list, '@!rest', values
    transform_to_p6opaque list
    list.'!STORE'(values)
    $P1 = new ['ObjectRef'], list
    $P2 = get_hll_global ['Bool'], 'True'
    setprop $P1, 'scalar', $P2
    .return ($P1)
.end

=back

=head2 Operators

=over 4

=item &circumfix:<[ ]>()

=cut

.namespace []
.sub '&circumfix:<[ ]>' 
    .param pmc values            :slurpy
    $P0 = get_hll_global 'Array'
    $P1 = $P0.'new'(values)
    .return ($P1)
.end

=back

=head2 Private methods

=over 4

=cut

.namespace ['Array']
.sub '!STORE' :method
    .param pmc source
    .local pmc list, flat, items, rest
    $P0 = get_hll_global 'Seq'
    list = $P0.'new'(source)
    list.'eager'()
    items = getattribute list, '@!items'
    rest  = getattribute list, '@!rest'
    if null items goto have_rest
    splice rest, items, 0, 0
    null items
{'fraction_non_alphanumeric': 0.14680181754631247, 'fraction_numerical': 0.02132121635791681, 'mean_word_length': 3.042372881355932, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3912410', 'n_tokens_mistral': 1131, 'n_tokens_neox': 1097, 'n_words': 323}