<commit_before>const CarbonBase = require("./CarbonBase");

class CBFunction extends CarbonBase {
    constructor(native, codeblock, arglist) {
        super("FUNCTION");

        this.args = arglist;
        this.native = native;
        this.content = codeblock;
    }

    toJsString() {
        return "FUNCTION"
    }

    getCodeBlock() {
        return this.content;
    }

    isNative() {
        return this.native;
    }

    apply(args) {
        if(!this.native) {
            this.content.apply({}, args);
        } else {
            throw new Error("The VM tried executing a native function as non-native");
        }
    }

    toJsBoolean() {
        return false;
    }

    toArgsObject(argvals) {
        let obj = {};
<commit_msg>Fix args being in the wrong order fixes #6<commit_after>const CarbonBase = require("./CarbonBase");
const CBNull = require("./CBNull");

class CBFunction extends CarbonBase {
    constructor(native, codeblock, arglist) {
        super("FUNCTION");

        this.args = arglist;
        this.native = native;
        this.content = codeblock;
    }

    toJsString() {
        return "FUNCTION"
    }

    getCodeBlock() {
        return this.content;
    }

    isNative() {
        return this.native;
    }

    apply(args) {
        if(!this.native) {
            this.content.apply({}, args);
        } else {
            throw new Error("The VM tried executing a native function as non-native");
        }
    }

    toJsBoolean() {
        return false;
    }

    toArgsObject(argvals) {
        let obj = {};

        //Make sure args are in the right order (Dioxide#6)
        while (this.args.length != argvals.length) {
            argvals.unshift(new CBNull());
        }

{'fraction_non_alphanumeric': 0.11808755760368664, 'fraction_numerical': 0.001152073732718894, 'mean_word_length': 1.8901830282861898, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '6164334', 'n_tokens_mistral': 519, 'n_tokens_neox': 495, 'n_words': 121}