<commit_before>import geom::matrix::{Matrix4, identity};
import opengles::gl2::{GLuint, delete_textures};

import std::cmp::fuzzy_eq;
import dvec::dvec;

enum Format {
    ARGB32Format,
    RGB24Format
}

enum Layer {
    ContainerLayerKind(@ContainerLayer),
    ImageLayerKind(@ImageLayer),
    TiledImageLayerKind(@TiledImageLayer)
}

class CommonLayer {
    let mut parent: option<Layer>;
    let mut prev_sibling: option<Layer>;
    let mut next_sibling: option<Layer>;

    let mut transform: Matrix4<f32>;

    new() {
        self.parent = none;
        self.prev_sibling = none;
        self.next_sibling = none;

        self.transform = identity(0.0f32);
    }

    // FIXME: Workaround for cross-crate bug regarding mutability of class fields
    fn set_transform(new_transform: Matrix4<f32>) {
        self.transform = new_transform;
    }
}

class ContainerLayer {
    let mut common: CommonLayer;
    let mut first_child: option<Layer>;
    let mut last_child: option<Layer>;

    new() {
        self.common = CommonLayer();
        self.first_child = none;
        self.last_child = none;
    }
}

class Image {
    let width: uint;
    let height: uint;
    let format: Format;
    let data: ~[u8];

    let mut texture: option<GLuint>;

    new(width: uint, height: uint, format: Format, +data: ~[u8]) {
        self.width = width;
        self.height = height;
        self.format = format;
        self.data = data;

        self.texture = none;
    }

    drop {
        match copy self.texture {
            none => {
                // Nothing to do.
            }
            some(texture) => {
                delete_textures(&[texture]);
            }
        }
    }
}

class ImageLayer {
    let mut common: CommonLayer;
    let mut image: @layers::Image;

    new(image: @layers::Image) {
        self.common = CommonLayer();
        self.image = image;
    }

    // FIXME: Workaround for cross-crate bug
    fn set_image(new_image: @layers::Image) {
        self.image = new_image;
    }
}

struct TiledImageLayer {
    mut common: CommonLayer;
    tiles: dvec<@layers::Image>;
    mut tiles_across: uint;
}

fn TiledImageLayer(in_tiles: &[@layers::Image], tiles_across: uint) -> TiledImageLayer {
    let tiles = dvec();
    for in_tiles.each |tile| {
        tiles.push(tile);
    }

    TiledImageLayer {
        common: CommonLayer(),
        tiles: tiles,
        tiles_across: tiles_across
    }
}
<commit_msg>Fix breakage<commit_after>import geom::matrix::{Matrix4, identity};
import opengles::gl2::{GLuint, delete_textures};

import std::cmp::fuzzy_eq;
import dvec::{DVec, dvec};

enum Format {
    ARGB32Format,
    RGB24Format
}

enum Layer {
    ContainerLayerKind(@ContainerLayer),
    ImageLayerKind(@ImageLayer),
    TiledImageLayerKind(@TiledImageLayer)
}

class CommonLayer {
    let mut parent: option<Layer>;
    let mut prev_sibling: option<Layer>;
    let mut next_sibling: option<Layer>;

    let mut transform: Matrix4<f32>;

    new() {
        self.parent = none;
        self.prev_sibling = none;
        self.next_sibling = none;

        self.transform = identity(0.0f32);
    }

    // FIXME: Workaround for cross-crate bug regarding mutability of class fields
    fn set_transform(new_transform: Matrix4<f32>) {
        self.transform = new_transform;
    }
}

class ContainerLayer {
    let mut common: CommonLayer;
    let mut first_child: option<Layer>;
    let mut last_child: option<Layer>;

    new() {
        self.common = CommonLayer();
        self.first_child = none;
        self.last_child = none;
    }
}

class Image {
    let width: uint;
    let height: uint;
    let format: Format;
    let data: ~[u8];

    let mut texture: option<GLuint>;

    new(width: uint, height: uint, format: Format, +data: ~[u8]) {
        self.width = width;
        self.height = height;
        self.format = format;
        self.data = data;

        self.texture = none;
    }

    drop {
        match copy self.texture {
            none => {
                // Nothing to do.
            }
            some(texture) => {
                delete_textures(&[texture]);
            }
        }
    }
}

class ImageLayer {
    let mut common: CommonLayer;
    let mut image: @layers::Image;

    new(image: @layers::Image) {
        self.common = CommonLayer();
        self.image = image;
    }

    // FIXME: Workaround for cross-crate bug
    fn set_image(new_image: @layers::Image) {
        self.image = new_image;
    }
}

struct TiledImageLayer {
    mut common: CommonLayer;
    tiles: DVec<@layers::Image>;
    mut tiles_across: uint;
}

fn TiledImageLayer(in_tiles: &[@layers::Image], tiles_across: uint) -> TiledImageLayer {
    let tiles = dvec();
    for in_tiles.each |tile| {
        tiles.push(tile);
    }

    TiledImageLayer {
        common: CommonLayer(),
        tiles: tiles,
        tiles_across: tiles_across
    }
}

{'fraction_non_alphanumeric': 0.11569067537237299, 'fraction_numerical': 0.007345439706182412, 'mean_word_length': 2.3690721649484536, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 27, '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': '7071722', 'n_tokens_mistral': 1574, 'n_tokens_neox': 1556, 'n_words': 370}