mirror of
https://github.com/Noratrieb/uwucc.git
synced 2026-01-15 09:05:06 +01:00
analysis
This commit is contained in:
parent
b74c11987b
commit
475a520de3
8 changed files with 61 additions and 8 deletions
7
analysis/src/hir.rs
Normal file
7
analysis/src/hir.rs
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
pub struct Hir<'hir> {
|
||||
x: &'hir (),
|
||||
}
|
||||
|
||||
pub struct ExternalDecl;
|
||||
|
||||
pub struct FunctionDef;
|
||||
|
|
@ -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
31
analysis/src/lower.rs
Normal 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!()
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue