Add mutable values

This commit is contained in:
Jeff 2024-08-14 01:03:46 -04:00
parent 17286896a8
commit 535e120256
2 changed files with 794 additions and 280 deletions

File diff suppressed because it is too large Load Diff

View File

@ -12,9 +12,9 @@ use std::{
use rayon::iter::{IntoParallelIterator, ParallelIterator}; use rayon::iter::{IntoParallelIterator, ParallelIterator};
use crate::{ use crate::{
parse, value::ValueInner, AbstractSyntaxTree, Analyzer, AssignmentOperator, BinaryOperator, parse, AbstractSyntaxTree, Analyzer, AssignmentOperator, BinaryOperator, BuiltInFunctionError,
BuiltInFunctionError, Context, DustError, Identifier, Node, ParseError, Span, Statement, Context, DustError, Identifier, Node, ParseError, Span, Statement, Struct, StructType, Type,
Struct, StructType, Type, UnaryOperator, Value, ValueError, UnaryOperator, Value, ValueError,
}; };
/// Run the source code and return the result. /// Run the source code and return the result.
@ -688,8 +688,8 @@ impl Vm {
let condition_position = condition.position; let condition_position = condition.position;
while let Some(condition_value) = self.run_statement(*condition.clone())? { while let Some(condition_value) = self.run_statement(*condition.clone())? {
if let ValueInner::Boolean(condition_value) = condition_value.inner().as_ref() { if let Some(condition) = condition_value.as_boolean() {
if !condition_value { if !condition {
break; break;
} }
} else { } else {