diff --git a/schala-lang/language/src/ast.rs b/schala-lang/language/src/ast.rs index 3f4d9be..cf1f89f 100644 --- a/schala-lang/language/src/ast.rs +++ b/schala-lang/language/src/ast.rs @@ -2,16 +2,18 @@ use std::rc::Rc; use std::convert::From; use crate::builtin::{BinOp, PrefixOp}; +use crate::typechecking::TypeData; #[derive(Clone, Debug, PartialEq)] pub struct Node { n: T, - source_map: SourceMap + source_map: SourceMap, + type_data: TypeData, } impl Node { pub fn new(n: T) -> Node { - Node { n, source_map: SourceMap::default() } + Node { n, source_map: SourceMap::default(), type_data: TypeData::new() } } pub fn node(&self) -> &T { @@ -26,7 +28,7 @@ struct SourceMap { impl From for Node { fn from(expr: Expression) -> Node { - Node { n: expr, source_map: SourceMap::default() } + Node { n: expr, source_map: SourceMap::default(), type_data: TypeData::new() } } } diff --git a/schala-lang/language/src/typechecking.rs b/schala-lang/language/src/typechecking.rs index 4a56c08..835fabc 100644 --- a/schala-lang/language/src/typechecking.rs +++ b/schala-lang/language/src/typechecking.rs @@ -8,6 +8,17 @@ use crate::ast::*; use crate::util::ScopeStack; use crate::builtin::{PrefixOp, BinOp}; +#[derive(Debug, Clone, PartialEq)] +pub struct TypeData { + ty: Option +} + +impl TypeData { + pub fn new() -> TypeData { + TypeData { ty: None } + } +} + pub type TypeName = Rc; pub struct TypeContext<'a> {