feat(gs/achilles): Implement very basic monomorphization
Implement very basic monomorphization, by recording type variable instantiations when typechecking Call nodes and then using those in a new hir Visitor trait to copy the body of any generic decls for each possible set of instantiation of the type variables. Change-Id: Iab54030973e5d66e2b8bcd074b4cb6c001a90123 Reviewed-on: https://cl.tvl.fyi/c/depot/+/2617 Reviewed-by: glittershark <grfn@gws.fyi> Tested-by: BuildkiteCI
This commit is contained in:
parent
e7033bd8b0
commit
8d5f3029e5
12 changed files with 430 additions and 19 deletions
|
|
@ -8,6 +8,7 @@ use test_strategy::Arbitrary;
|
|||
|
||||
use crate::codegen::{self, Codegen};
|
||||
use crate::common::Result;
|
||||
use crate::passes::hir::monomorphize;
|
||||
use crate::{parser, tc};
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Arbitrary)]
|
||||
|
|
@ -55,7 +56,8 @@ pub struct CompilerOptions {
|
|||
pub fn compile_file(input: &Path, output: &Path, options: &CompilerOptions) -> Result<()> {
|
||||
let src = fs::read_to_string(input)?;
|
||||
let (_, decls) = parser::toplevel(&src)?; // TODO: statements
|
||||
let decls = tc::typecheck_toplevel(decls)?;
|
||||
let mut decls = tc::typecheck_toplevel(decls)?;
|
||||
monomorphize::run_toplevel(&mut decls);
|
||||
|
||||
let context = codegen::Context::create();
|
||||
let mut codegen = Codegen::new(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue