From 511cc10e9851b1d2daea41a30b8b9f24c72b6491 Mon Sep 17 00:00:00 2001 From: Jeff Date: Fri, 23 Aug 2024 17:27:11 -0400 Subject: [PATCH] Pass all tests --- dust-lang/src/analyzer.rs | 6 +++--- dust-lang/src/lib.rs | 4 ++-- dust-lang/src/vm.rs | 8 ++++---- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/dust-lang/src/analyzer.rs b/dust-lang/src/analyzer.rs index 2abac46..6bd04a9 100644 --- a/dust-lang/src/analyzer.rs +++ b/dust-lang/src/analyzer.rs @@ -54,11 +54,11 @@ pub fn analyze(source: &str) -> Result<(), DustError> { /// # use dust_lang::*; /// let input = "x = 1 + false"; /// let abstract_tree = parse(input).unwrap(); -/// let mut context = Context::new(); -/// let mut analyzer = Analyzer::new(&abstract_tree, &mut context); +/// let context = Context::new(); +/// let mut analyzer = Analyzer::new(&abstract_tree, context); /// let result = analyzer.analyze(); /// -/// assert!(result.is_err()); +/// assert!(!analyzer.errors.is_empty()); pub struct Analyzer<'a> { abstract_tree: &'a AbstractSyntaxTree, context: Context, diff --git a/dust-lang/src/lib.rs b/dust-lang/src/lib.rs index 968eb30..e5e0159 100644 --- a/dust-lang/src/lib.rs +++ b/dust-lang/src/lib.rs @@ -6,8 +6,8 @@ //! use dust_lang::{run, Value}; //! //! let program = " -//! foo = 21 -//! bar = 2 +//! let foo = 21 +//! let bar = 2 //! foo * bar //! "; //! diff --git a/dust-lang/src/vm.rs b/dust-lang/src/vm.rs index efa7aed..05777ba 100644 --- a/dust-lang/src/vm.rs +++ b/dust-lang/src/vm.rs @@ -34,7 +34,7 @@ use crate::{ /// # use dust_lang::value::Value; /// let result = run("40 + 2"); /// -/// assert_eq!(result, Ok(Some(Value::Integer(42)))); +/// assert_eq!(result, Ok(Some(Value::integer(42)))); /// ``` pub fn run(source: &str) -> Result, DustError> { let context = core_library().create_child(); @@ -46,15 +46,15 @@ pub fn run(source: &str) -> Result, DustError> { /// /// # Example /// ``` -/// # use dust_lang::{Context, Identifier, Value, run_with_context}; +/// # use dust_lang::*; /// let context = Context::new(); /// -/// context.set_value(Identifier::new("foo"), Value::Integer(40)); +/// context.set_variable_value(Identifier::new("foo"), Value::integer(40)); /// context.update_last_position(&Identifier::new("foo"), (100, 100)); /// /// let result = run_with_context("foo + 2", context); /// -/// assert_eq!(result, Ok(Some(Value::Integer(42)))); +/// assert_eq!(result, Ok(Some(Value::integer(42)))); /// ``` pub fn run_with_context(source: &str, context: Context) -> Result, DustError> { let abstract_syntax_tree = parse(source)?;