Top level scope

This commit is contained in:
2026-04-15 08:40:28 +02:00
parent 6df7f672d0
commit 19629363b0
3 changed files with 32 additions and 10 deletions
+1 -2
View File
@@ -1,3 +1,2 @@
pub mod scope;
pub mod top_level; pub mod top_level;
pub struct Scope {}
+21
View File
@@ -0,0 +1,21 @@
use std::{
collections::HashMap,
sync::{Arc, Mutex},
};
use crate::top_level;
pub enum Symbol {
Function(top_level::FunctionSymbol),
TypeSymbol(top_level::TypeSymbol),
StructSymbol(top_level::StructSymbol),
}
pub struct Scope {
pub parent: Option<Arc<Scope>>,
pub variables: Mutex<HashMap<String, Symbol>>,
}
impl Scope {
pub fn from_top_level() {}
}
+10 -8
View File
@@ -1,18 +1,20 @@
use std::collections::HashMap; use std::collections::HashMap;
pub struct TypeSymbol { pub struct TypeSymbol {
export: bool, pub export: bool,
name: String, pub name: String,
} }
pub struct FunctionSymbol { pub struct FunctionSymbol {
export: bool, pub export: bool,
name: String, pub name: String,
params: HashMap<String, TypeSymbol>, pub params: HashMap<String, TypeSymbol>,
} }
pub struct StructSymbol { pub struct StructSymbol {
export: bool, pub export: bool,
name: String, pub name: String,
fields: HashMap<String, TypeSymbol>, pub fields: HashMap<String, TypeSymbol>,
pub methods: HashMap<String, FunctionSymbol>,
} }