This commit is contained in:
nora 2022-07-24 18:22:52 +02:00
parent b74c11987b
commit 475a520de3
8 changed files with 61 additions and 8 deletions

7
analysis/src/hir.rs Normal file
View file

@ -0,0 +1,7 @@
pub struct Hir<'hir> {
x: &'hir (),
}
pub struct ExternalDecl;
pub struct FunctionDef;

View file

@ -1,6 +1,5 @@
#![allow(dead_code)] // TODO: no
#![warn(rust_2018_idioms)]
struct Ctx<P> {
parser: P,
}
mod hir;
mod lower;

31
analysis/src/lower.rs Normal file
View file

@ -0,0 +1,31 @@
use parser::{
ast::{self, Ident},
Span,
};
use rustc_hash::FxHashMap;
use crate::hir;
pub struct LowerCtx<'hir> {
hir_arena: &'hir bumpalo::Bump,
global_symbols: FxHashMap<Ident, &'hir hir::ExternalDecl>,
}
impl<'hir> LowerCtx<'hir> {
pub fn lower_translation_unit(&mut self, unit: &ast::TranslationUnit) -> hir::Hir<'hir> {
for decl in unit {}
todo!()
}
fn lower_decl(&mut self, decl: &ast::ExternalDecl, span: Span) -> hir::ExternalDecl {
match decl {
ast::ExternalDecl::Decl(_) => todo!(),
ast::ExternalDecl::FunctionDef(func) => todo!(),
}
}
fn lower_function_def(&mut self, def: &ast::FunctionDef, span: Span) -> hir::FunctionDef {
todo!()
}
}