[quickjs][oden][oden-js] Source maps

The worst support but it should cost very little if nobody is using
them (psst we're using them)
This commit is contained in:
John Doty 2023-09-20 09:31:57 -07:00
parent eb9fed759a
commit c96a1a4979
10 changed files with 554 additions and 374 deletions

View file

@ -2,6 +2,7 @@ use crate::{ContextRef, Runtime, ValueResult};
use oden_js_sys as sys;
use std::ops::Deref;
#[derive(Eq, PartialEq, Debug, Hash)]
pub struct AtomRef {
pub(crate) atom: sys::JSAtom,
}
@ -39,6 +40,11 @@ impl Atom {
rt: Runtime::from_raw(unsafe { sys::JS_GetRuntime(ctx.ctx) }),
}
}
pub(crate) fn consume(atom: Atom) -> u32 {
let atom = std::mem::ManuallyDrop::new(atom);
atom.atom.atom
}
}
impl Deref for Atom {
@ -56,3 +62,17 @@ impl Drop for Atom {
}
}
}
impl PartialEq for Atom {
fn eq(&self, other: &Self) -> bool {
self.atom == other.atom
}
}
impl Eq for Atom {}
impl std::hash::Hash for Atom {
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
self.atom.hash(state)
}
}