48 lines
1.2 KiB
Rust
48 lines
1.2 KiB
Rust
use crate::ast::field::Field;
|
|
use crate::ast::function::Function;
|
|
use crate::diagnostic::Diagnostic;
|
|
use crate::source_range::SourceRange;
|
|
use crate::symbol_table::SymbolTable;
|
|
use std::rc::Rc;
|
|
|
|
pub struct Class {
|
|
declared_name: Rc<str>,
|
|
declared_name_source_range: SourceRange,
|
|
fields: Vec<Field>,
|
|
functions: Vec<Function>,
|
|
}
|
|
|
|
impl Class {
|
|
pub fn new(
|
|
declared_name: &str,
|
|
declared_name_source_range: SourceRange,
|
|
fields: Vec<Field>,
|
|
functions: Vec<Function>,
|
|
) -> Self {
|
|
Class {
|
|
declared_name: declared_name.into(),
|
|
declared_name_source_range,
|
|
fields,
|
|
functions,
|
|
}
|
|
}
|
|
|
|
pub fn gather_declared_names(
|
|
&mut self,
|
|
symbol_table: &mut SymbolTable,
|
|
) -> Result<(), Vec<Diagnostic>> {
|
|
// 1. insert class symbol
|
|
// 2. gather fields
|
|
// 3. gather functions
|
|
todo!()
|
|
}
|
|
|
|
pub fn check_name_usages(&mut self, symbol_table: &SymbolTable) -> Result<(), Vec<Diagnostic>> {
|
|
todo!()
|
|
}
|
|
|
|
pub fn type_check(&mut self, symbol_table: &SymbolTable) -> Result<(), Vec<Diagnostic>> {
|
|
todo!()
|
|
}
|
|
}
|