From 7dfc026be5cb1220d5e332041f880e4f5f004fb3 Mon Sep 17 00:00:00 2001 From: Jeff Date: Sat, 23 Mar 2024 20:36:23 -0400 Subject: [PATCH] Clean up --- dust-lang/src/context.rs | 14 +------------- dust-lang/src/lib.rs | 6 ++++-- 2 files changed, 5 insertions(+), 15 deletions(-) diff --git a/dust-lang/src/context.rs b/dust-lang/src/context.rs index 979429b..fbcffb1 100644 --- a/dust-lang/src/context.rs +++ b/dust-lang/src/context.rs @@ -6,21 +6,9 @@ use std::{ use crate::{ abstract_tree::{Identifier, Type}, error::{RwLockPoisonError, ValidationError}, - Interpreter, Value, + Value, }; -pub fn std_context() -> Context { - let context = Context::new(); - let mut interpreter = Interpreter::new(context.clone()); - - interpreter.run(include_str!("../../std/io.ds")).unwrap(); - interpreter - .run(include_str!("../../std/thread.ds")) - .unwrap(); - - context -} - #[derive(Clone, Debug)] pub struct Context { inner: Arc>>, diff --git a/dust-lang/src/lib.rs b/dust-lang/src/lib.rs index ba5151e..239c958 100644 --- a/dust-lang/src/lib.rs +++ b/dust-lang/src/lib.rs @@ -6,15 +6,17 @@ pub mod lexer; pub mod parser; pub mod value; -use context::{std_context, Context}; +use context::Context; use error::Error; use lexer::lex; use parser::parse; pub use value::Value; pub fn interpret(source: &str) -> Result, Vec> { - let mut interpreter = Interpreter::new(std_context()); + let mut interpreter = Interpreter::new(Context::new()); + interpreter.run(include_str!("../../std/io.ds"))?; + interpreter.run(include_str!("../../std/thread.ds"))?; interpreter.run(source) }