code_emission.rs 577 Bytes
Newer Older
1 2 3 4
#![allow(dead_code)]

use compiler::CompilerPass;
use ast::ir::*;
qinsoon's avatar
qinsoon committed
5
use vm::VM;
6
use compiler::backend::emit_code;
7

qinsoon's avatar
qinsoon committed
8 9
use std::any::Any;

10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
pub struct CodeEmission {
    name: &'static str
}

impl CodeEmission {
    pub fn new() -> CodeEmission {
        CodeEmission {
            name: "Code Emission"
        }
    }
}

impl CompilerPass for CodeEmission {
    fn name(&self) -> &'static str {
        self.name
    }
26

qinsoon's avatar
qinsoon committed
27 28 29 30
    fn as_any(&self) -> &Any {
        self
    }

qinsoon's avatar
qinsoon committed
31 32
    fn visit_function(&mut self, vm: &VM, func: &mut MuFunctionVersion) {
        emit_code(func, vm);
33
    }
34
}