hmmm
This commit is contained in:
parent
d7795e52f9
commit
05ebc02909
7 changed files with 171 additions and 154 deletions
|
|
@ -2,28 +2,3 @@ use std::collections::HashMap;
|
|||
|
||||
use inkwell::{builder::Builder, context::Context, module::Module, values::{FunctionValue, PointerValue}};
|
||||
|
||||
use crate::code_generation::Function;
|
||||
|
||||
pub struct Compiler<'a, 'ctx> {
|
||||
pub context: &'ctx Context,
|
||||
pub builder: &'a Builder<'ctx>,
|
||||
pub module: &'a Module<'ctx>,
|
||||
pub function: &'a Function,
|
||||
|
||||
variables: HashMap<String, PointerValue<'ctx>>,
|
||||
fn_value_opt: Option<FunctionValue<'ctx>>
|
||||
}
|
||||
|
||||
impl<'a, 'ctx> Compiler<'a, 'ctx> {
|
||||
/// Gets a defined function given its name.
|
||||
#[inline]
|
||||
fn get_function(&self, name: &str) -> Option<FunctionValue<'ctx>> {
|
||||
self.module.get_function(name)
|
||||
}
|
||||
|
||||
/// Returns the `FunctionValue` representing the function being compiled.
|
||||
#[inline]
|
||||
fn fn_value(&self) -> FunctionValue<'ctx> {
|
||||
self.fn_value_opt.unwrap()
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue