Skip to main content

mysz_core/semantics/
analysis.rs

1use std::collections::HashMap;
2
3use indexmap::IndexMap;
4
5use crate::{parse::parsing::Type, utils::location::Location};
6
7#[derive(Debug)]
8pub struct Symbol {
9    pub name: String,
10    pub ty: Type,
11}
12
13#[derive(Debug)]
14pub struct Scope {
15    pub symbols: HashMap<String, Symbol>,
16    pub parent: Option<usize>,
17}
18
19#[derive(Clone, Debug)]
20pub struct StructSignature {
21    pub generic_params: Vec<String>,
22    pub fields: IndexMap<String, Type>,
23    pub location: Location,
24}
25
26#[derive(Clone, Debug)]
27pub struct FunctionSignature {
28    pub generic_params: Vec<String>,
29    pub public: bool,
30    pub param_types: Vec<Type>,
31    pub is_variadic: bool,
32    pub variadic_param_name: Option<String>,
33    pub return_type: Type,
34    pub location: Location,
35}