From 2f06b18c3cecb68e6572d90b430777b6a5be75bf Mon Sep 17 00:00:00 2001 From: Jeff Date: Fri, 2 Aug 2024 16:33:40 -0400 Subject: [PATCH] Move type module out of abstract tree module --- dust-lang/src/abstract_tree/mod.rs | 3 +-- dust-lang/src/context.rs | 4 ++-- dust-lang/src/error.rs | 3 ++- dust-lang/src/lib.rs | 3 ++- dust-lang/src/{abstract_tree => }/type.rs | 0 dust-lang/src/value.rs | 3 ++- dust-lang/tests/values.rs | 3 +-- dust-lang/tests/variables.rs | 4 ++-- 8 files changed, 12 insertions(+), 11 deletions(-) rename dust-lang/src/{abstract_tree => }/type.rs (100%) diff --git a/dust-lang/src/abstract_tree/mod.rs b/dust-lang/src/abstract_tree/mod.rs index 80d5c8c..1fb5418 100644 --- a/dust-lang/src/abstract_tree/mod.rs +++ b/dust-lang/src/abstract_tree/mod.rs @@ -14,7 +14,6 @@ pub mod map_index; pub mod math; pub mod statement; pub mod structure_definition; -pub mod r#type; pub mod type_alias; pub mod type_constructor; pub mod r#use; @@ -45,7 +44,6 @@ pub use self::{ math::Math, r#as::As, r#loop::Loop, - r#type::Type, r#use::Use, r#while::While, statement::Statement, @@ -58,6 +56,7 @@ pub use self::{ use crate::{ context::Context, error::{DustError, RuntimeError, ValidationError}, + r#type::Type, Value, }; diff --git a/dust-lang/src/context.rs b/dust-lang/src/context.rs index 8e105ba..388fc18 100644 --- a/dust-lang/src/context.rs +++ b/dust-lang/src/context.rs @@ -9,12 +9,12 @@ use log::trace; use rand::random; use crate::{ - abstract_tree::{SourcePosition, Type}, + abstract_tree::SourcePosition, error::{PoisonError, ValidationError}, identifier::Identifier, standard_library::core_context, value::ValueInner, - Value, + Type, Value, }; type VariableInfo = (VariableData, UsageData, SourcePosition); diff --git a/dust-lang/src/error.rs b/dust-lang/src/error.rs index 3591d6b..78bf902 100644 --- a/dust-lang/src/error.rs +++ b/dust-lang/src/error.rs @@ -3,9 +3,10 @@ use std::{io, sync::PoisonError as StdPoisonError}; use chumsky::{prelude::Rich, span::Span}; use crate::{ - abstract_tree::{r#type::Type, Expression, SourcePosition, TypeConstructor}, + abstract_tree::{Expression, SourcePosition, TypeConstructor}, identifier::Identifier, lexer::Token, + Type, }; #[derive(Debug, PartialEq)] diff --git a/dust-lang/src/lib.rs b/dust-lang/src/lib.rs index a84fd39..2cd6d57 100644 --- a/dust-lang/src/lib.rs +++ b/dust-lang/src/lib.rs @@ -15,11 +15,12 @@ pub mod interpreter; pub mod lexer; pub mod parser; pub mod standard_library; +pub mod r#type; pub mod value; -pub use abstract_tree::Type; pub use context::Context; pub use interpreter::{interpret, Interpreter, InterpreterError}; pub use lexer::{lex, lexer}; pub use parser::{parse, parser}; +pub use r#type::Type; pub use value::Value; diff --git a/dust-lang/src/abstract_tree/type.rs b/dust-lang/src/type.rs similarity index 100% rename from dust-lang/src/abstract_tree/type.rs rename to dust-lang/src/type.rs diff --git a/dust-lang/src/value.rs b/dust-lang/src/value.rs index 3dcfc67..4903a1d 100644 --- a/dust-lang/src/value.rs +++ b/dust-lang/src/value.rs @@ -15,10 +15,11 @@ use serde::{ }; use crate::{ - abstract_tree::{AbstractNode, Block, BuiltInFunction, Evaluation, SourcePosition, Type}, + abstract_tree::{AbstractNode, Block, BuiltInFunction, Evaluation, SourcePosition}, context::Context, error::{RuntimeError, ValidationError}, identifier::Identifier, + Type, }; #[derive(Clone, Debug, PartialEq)] diff --git a/dust-lang/tests/values.rs b/dust-lang/tests/values.rs index 5dd5d74..5fbd43f 100644 --- a/dust-lang/tests/values.rs +++ b/dust-lang/tests/values.rs @@ -1,10 +1,9 @@ use std::collections::BTreeMap; use dust_lang::{ - abstract_tree::Type, error::{DustError, TypeConflict, ValidationError}, identifier::Identifier, - *, + Type, *, }; #[test] diff --git a/dust-lang/tests/variables.rs b/dust-lang/tests/variables.rs index cd3bdc7..ccb390f 100644 --- a/dust-lang/tests/variables.rs +++ b/dust-lang/tests/variables.rs @@ -1,7 +1,7 @@ use dust_lang::{ - abstract_tree::{Block, Expression, Statement, Type, WithPos}, + abstract_tree::{Block, Expression, Statement, WithPos}, identifier::Identifier, - *, + Type, *, }; #[test]