From 1155b5fff8405b236066ba2bcaf28b3b7262b606 Mon Sep 17 00:00:00 2001 From: Jeff Date: Fri, 7 Feb 2025 11:14:44 -0500 Subject: [PATCH] Clean up --- dust-lang/src/chunk/disassembler.rs | 2 +- dust-lang/src/chunk/mod.rs | 2 +- dust-lang/src/native_function/string.rs | 4 ++-- dust-lang/src/native_function/thread.rs | 11 +++-------- dust-lang/src/vm/action.rs | 14 +++++++++----- 5 files changed, 16 insertions(+), 17 deletions(-) diff --git a/dust-lang/src/chunk/disassembler.rs b/dust-lang/src/chunk/disassembler.rs index 118ef46..38501c5 100644 --- a/dust-lang/src/chunk/disassembler.rs +++ b/dust-lang/src/chunk/disassembler.rs @@ -43,7 +43,7 @@ use std::io::{self, Write}; use colored::{ColoredString, Colorize}; -use crate::{Chunk, Local, Type}; +use crate::{Chunk, Local}; const INSTRUCTION_COLUMNS: [(&str, usize); 4] = [("i", 5), ("POSITION", 12), ("OPERATION", 17), ("INFO", 41)]; diff --git a/dust-lang/src/chunk/mod.rs b/dust-lang/src/chunk/mod.rs index 3f5e215..3cbbcdd 100644 --- a/dust-lang/src/chunk/mod.rs +++ b/dust-lang/src/chunk/mod.rs @@ -27,7 +27,7 @@ use std::sync::Arc; use serde::{Deserialize, Serialize}; -use crate::{ConcreteValue, DustString, Function, FunctionType, Instruction, Span, Value}; +use crate::{ConcreteValue, DustString, Function, FunctionType, Instruction, Span}; /// Representation of a Dust program or function. /// diff --git a/dust-lang/src/native_function/string.rs b/dust-lang/src/native_function/string.rs index 65da95b..9c33b7b 100644 --- a/dust-lang/src/native_function/string.rs +++ b/dust-lang/src/native_function/string.rs @@ -1,7 +1,7 @@ use std::ops::Range; -use crate::{ConcreteValue, Value, vm::Thread}; +use crate::vm::Thread; -pub fn to_string(thread: &mut Thread, destination: usize, argument_range: Range) { +pub fn to_string(_thread: &mut Thread, _destination: usize, _argument_range: Range) { todo!() } diff --git a/dust-lang/src/native_function/thread.rs b/dust-lang/src/native_function/thread.rs index b108031..832fa5e 100644 --- a/dust-lang/src/native_function/thread.rs +++ b/dust-lang/src/native_function/thread.rs @@ -1,13 +1,8 @@ -use std::{ - ops::Range, - thread::{Builder, JoinHandle}, -}; +use std::{ops::Range, thread::JoinHandle}; -use tracing::{Level, info, span}; +use crate::vm::Thread; -use crate::{DustString, vm::Thread}; - -fn start_thread(thread: &mut Thread, argument_range: Range) -> JoinHandle<()> { +fn start_thread(_thread: &mut Thread, _argument_range: Range) -> JoinHandle<()> { todo!(); } diff --git a/dust-lang/src/vm/action.rs b/dust-lang/src/vm/action.rs index 37af11c..80a08dc 100644 --- a/dust-lang/src/vm/action.rs +++ b/dust-lang/src/vm/action.rs @@ -68,11 +68,11 @@ pub const RUNNER_LOGIC_TABLE: [RunnerLogic; 23] = [ r#return, ]; -pub fn point(instruction: InstructionFields, thread: &mut Thread) {} +pub fn point(_: InstructionFields, thread: &mut Thread) {} -pub fn close(instruction: InstructionFields, thread: &mut Thread) {} +pub fn close(_: InstructionFields, thread: &mut Thread) {} -pub fn load_boolean(instruction: InstructionFields, thread: &mut Thread) {} +pub fn load_boolean(_: InstructionFields, _: &mut Thread) {} pub fn load_constant(instruction: InstructionFields, thread: &mut Thread) { let destination = instruction.a_field as usize; @@ -97,15 +97,19 @@ pub fn load_constant(instruction: InstructionFields, thread: &mut Thread) { let constant = *thread.get_constant(constant_index).as_integer().unwrap(); let register = Register::Value(constant); - thread.set_integer_register(destination as usize, register); + thread.set_integer_register(destination, register); } TypeCode::STRING => { let register = Register::Pointer(Pointer::Constant(constant_index)); - thread.set_string_register(destination as usize, register); + thread.set_string_register(destination, register); } _ => unimplemented!(), } + + if jump_next { + thread.current_frame_mut().ip += 1; + } } pub fn load_list(instruction: InstructionFields, thread: &mut Thread) {}