<commit_before>/* Bento
 *
 * ResolvedArray.java
 *
 * Copyright (c) 2015 by bentodev.org
 *
 * Use of this code in source or compiled form is subject to the
 * Bento Poetic License at http://www.bentodev.org/poetic-license.html
 */

package bento.lang;

import java.util.Iterator;
import java.util.List;

import bento.runtime.Context;

class ResolvedArray extends ResolvedCollection {

    private CollectionDefinition collectionDef = null;
    protected BentoArray array = null;

    public ResolvedArray(Definition def, Context context, ArgumentList args, List<Index> indexes) throws Redirection {
        super(def, context, args, indexes);
        context = getResolutionContext();
        this.collectionDef = def.getCollectionDefinition(context, args);
        if (collectionDef.hasStaticData()) {
            array = (BentoArray) collectionDef.getStaticData();
        } else {
            array = createArray(collectionDef, context, args);
            // has no effect if def is not static
            collectionDef.setStaticData(array);
        }
    }

    public ResolvedArray(Definition def, Context context, ArgumentList args, List<Index> indexes, Object arrayData) throws Redirection {
        super(def, context, args, indexes);
        
        this.collectionDef = def.getCollectionDefinition(context, args);

        if (arrayData instanceof Instantiation) {
            arrayData = ((Instantiation) arrayData).getData(context);
            if (arrayData instanceof Value) {
                arrayData = ((Value) arrayData).getValue();
            }
        }
        
    	if (arrayData instanceof BentoArray) {
            array = (BentoArray) arrayData;<commit_msg>using resolution context for some reason breaks growable array and test support nonstandard tests<commit_after>/* Bento
 *
 * ResolvedArray.java
 *
 * Copyright (c) 2015 by bentodev.org
 *
 * Use of this code in source or compiled form is subject to the
 * Bento Poetic License at http://www.bentodev.org/poetic-license.html
 */

package bento.lang;

import java.util.Iterator;
import java.util.List;

import bento.runtime.Context;

class ResolvedArray extends ResolvedCollection {

    private CollectionDefinition collectionDef = null;
    protected BentoArray array = null;

    public ResolvedArray(Definition def, Context context, ArgumentList args, List<Index> indexes) throws Redirection {
        super(def, context, args, indexes);
        //context = getResolutionContext();
        this.collectionDef = def.getCollectionDefinition(context, args);
        if (collectionDef.hasStaticData()) {
            array = (BentoArray) collectionDef.getStaticData();
        } else {
            array = createArray(collectionDef, context, args);
            // has no effect if def is not static
            collectionDef.setStaticData(array);
        }
    }

    public ResolvedArray(Definition def, Context context, ArgumentList args, List<Index> indexes, Object arrayData) throws Redirection {
        super(def, context, args, indexes);
        
        this.collectionDef = def.getCollectionDefinition(context, args);

        if (arrayData instanceof Instantiation) {
            arrayData = ((Instantiation) arrayData).getData(context);
            if (arrayData instanceof Value) {
                arrayData = ((Value) arrayData).getValue();
            }
        }
        
    	if (arrayData instanceof BentoArray) {
            array = (BentoArray) arrayData;
{'fraction_non_alphanumeric': 0.08791208791208792, 'fraction_numerical': 0.002313475997686524, 'mean_word_length': 2.886516853932584, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '7038295', 'n_tokens_mistral': 907, 'n_tokens_neox': 877, 'n_words': 264}