mirror of
https://github.com/Noratrieb/dilaria.git
synced 2026-01-16 18:35:02 +01:00
fix
This commit is contained in:
parent
5f9ca90fd5
commit
08d1f01802
5 changed files with 20 additions and 10 deletions
8
Cargo.lock
generated
8
Cargo.lock
generated
|
|
@ -86,9 +86,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "dbg-pls"
|
name = "dbg-pls"
|
||||||
version = "0.2.2"
|
version = "0.3.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "e845b944ea4a6b446aec7c221c48fd6e73f2ab38e1af720cac0f47895dcc4580"
|
checksum = "96fb680d63b394b942cb518404505ab0610e51e5be82af6818b45aae888064d9"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"dbg-pls-derive",
|
"dbg-pls-derive",
|
||||||
"itoa",
|
"itoa",
|
||||||
|
|
@ -104,9 +104,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "dbg-pls-derive"
|
name = "dbg-pls-derive"
|
||||||
version = "0.2.1"
|
version = "0.3.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "b46318b37603779055a193fbb0454bb762e284f72a4d3c231f4a6ab8d3eede31"
|
checksum = "18ad0d32e09e083b0bf764cc9c2f1956518afb16b6ae0e1110c909d056f8271f"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ edition = "2021"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
bumpalo = { version = "3.8.0", features = ["collections"] }
|
bumpalo = { version = "3.8.0", features = ["collections"] }
|
||||||
dbg-pls = { version = "0.2.2", features = ["colors", "derive"], optional = true }
|
dbg-pls = { version = "0.3.0", features = ["colors", "derive"], optional = true }
|
||||||
rustc-hash = { version = "1.1.0", optional = true }
|
rustc-hash = { version = "1.1.0", optional = true }
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -64,7 +64,6 @@ use bumpalo::collections::Vec;
|
||||||
use std::fmt::{Debug, Formatter};
|
use std::fmt::{Debug, Formatter};
|
||||||
|
|
||||||
/// This struct contains all data for a function.
|
/// This struct contains all data for a function.
|
||||||
#[cfg_attr(feature = "_debug", derive(dbg_pls::DebugPls))]
|
|
||||||
pub struct FnBlock<'bc> {
|
pub struct FnBlock<'bc> {
|
||||||
/// The bytecode of the function
|
/// The bytecode of the function
|
||||||
pub code: Vec<'bc, Instr>,
|
pub code: Vec<'bc, Instr>,
|
||||||
|
|
@ -136,3 +135,13 @@ pub enum Instr {
|
||||||
/// Shrinks the stack by `usize` elements, should always be emitted before backwards jumps
|
/// Shrinks the stack by `usize` elements, should always be emitted before backwards jumps
|
||||||
ShrinkStack(usize),
|
ShrinkStack(usize),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "_debug")]
|
||||||
|
impl dbg_pls::DebugPls for FnBlock<'_> {
|
||||||
|
fn fmt(&self, f: dbg_pls::Formatter<'_>) {
|
||||||
|
f.debug_struct("FnBlock")
|
||||||
|
.field("arity", &self.arity)
|
||||||
|
.field("code", &self.code.as_slice())
|
||||||
|
.finish_non_exhaustive()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
use crate::vm::Value;
|
use crate::vm::Value;
|
||||||
use crate::{HashMap, HashSet};
|
use crate::{HashMap, HashSet};
|
||||||
|
use dbg_pls::DebugPls;
|
||||||
use std::collections::LinkedList;
|
use std::collections::LinkedList;
|
||||||
use std::fmt::{Debug, Formatter};
|
use std::fmt::{Debug, Formatter};
|
||||||
use std::hash::{Hash, Hasher};
|
use std::hash::{Hash, Hasher};
|
||||||
|
|
@ -19,9 +20,9 @@ pub struct Gc<T: ?Sized> {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "_debug")]
|
#[cfg(feature = "_debug")]
|
||||||
impl<T: ?Sized> dbg_pls::DebugPls for Gc<T> {
|
impl<T: ?Sized + DebugPls> dbg_pls::DebugPls for Gc<T> {
|
||||||
fn fmt(&self, f: dbg_pls::Formatter<'_>) {
|
fn fmt(&self, f: dbg_pls::Formatter<'_>) {
|
||||||
todo!()
|
DebugPls::fmt(self.deref(), f)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -208,7 +209,7 @@ impl Deref for Symbol {
|
||||||
|
|
||||||
impl Debug for Symbol {
|
impl Debug for Symbol {
|
||||||
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
||||||
self.as_str().fmt(f)
|
Debug::fmt(self.as_str(), f)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -69,7 +69,7 @@ fn process_ast(program: &str, ast: &Program, mut runtime: RtAlloc, cfg: &mut Con
|
||||||
match bytecode {
|
match bytecode {
|
||||||
Ok(code) => {
|
Ok(code) => {
|
||||||
if cfg.debug {
|
if cfg.debug {
|
||||||
println!("Bytecode:\n{:#?}\n", code);
|
util::dbg("Bytecode:\n", code);
|
||||||
}
|
}
|
||||||
|
|
||||||
let result = vm::execute(code, runtime, cfg);
|
let result = vm::execute(code, runtime, cfg);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue