Expand description
Runtime heap
Fields
loc: Option<Box<Location>>
Implementations
sourceimpl Heap
impl Heap
pub const NULL: JSRef = _
pub const GLOBAL: JSRef = _
pub const OBJECT_PROTO: JSRef = _
pub const FUNCTION_PROTO: JSRef = _
pub const ARRAY_PROTO: JSRef = _
pub const BOOLEAN_PROTO: JSRef = _
pub const STRING_PROTO: JSRef = _
pub const REGEXP_PROTO: JSRef = _
pub const ERROR_PROTO: JSRef = _
pub fn new() -> Self
pub fn get(&self, objref: JSRef) -> &JSObject
pub fn get_mut(&mut self, objref: JSRef) -> &mut JSObject
pub fn get_index(&self, index: usize) -> Option<&JSObject>
pub fn alloc(&mut self, object: JSObject) -> JSRef
pub fn alloc_func(&mut self, func: HostFn) -> JSRef
pub fn init_class(&mut self, proto: JSRef, class: &HostClass) -> JSResult<()>
sourcepub fn object_from_json(&mut self, json: &JSON) -> JSValue
pub fn object_from_json(&mut self, json: &JSON) -> JSValue
Deserializes JSON into objects on the heap
sourcepub fn interpret_this(&mut self) -> JSRef
pub fn interpret_this(&mut self) -> JSRef
Find out what this
currently is.
pub fn scope_mut(&mut self) -> &mut JSObject
pub fn declare_variable(&mut self, var: &Identifier) -> JSResult<()>
pub fn declare_binding(&mut self, binding: &Binding) -> JSResult<()>
pub fn declare(
&mut self,
bindings: impl Iterator<Item = Binding>
) -> JSResult<()>
pub fn lookup_var(&self, name: &str) -> Option<Interpreted>
sourcepub fn lookup_path(&self, names: &[&str]) -> JSResult<Interpreted>
pub fn lookup_path(&self, names: &[&str]) -> JSResult<Interpreted>
Lookup a property chain starting from the current scope, e.g.
assert_eq!(
heap.lookup_path(&["Array", "prototype"]).unwrap(),
Interpreted::from(Heap::ARRAY_PROTO)
);
pub fn enter_new_scope<T, F>(
&mut self,
this_ref: JSRef,
captured_scope: JSRef,
action: F
) -> JSResult<T> where
F: FnMut(&mut Heap) -> JSResult<T>,
sourcepub fn lookup_protochain(
&self,
objref: JSRef,
propname: &str
) -> Option<Interpreted>
pub fn lookup_protochain(
&self,
objref: JSRef,
propname: &str
) -> Option<Interpreted>
Find the location of propname
on the prototype chain of objref
.
Return None
or Some(Interpreted::Member{..})
pointing to the found own property.
sourcepub fn evaluate<T: Interpretable>(
&mut self,
interpretable: &T
) -> JSResult<JSValue>
pub fn evaluate<T: Interpretable>(
&mut self,
interpretable: &T
) -> JSResult<JSValue>
A shortcut for interpretable.evaluate(&mut heap)
.
sourcepub fn execute(
&mut self,
func_ref: JSRef,
call: CallContext
) -> JSResult<Interpreted>
pub fn execute(
&mut self,
func_ref: JSRef,
call: CallContext
) -> JSResult<Interpreted>
Given a func_ref
to a closure or a native call and a set of arguments,
executes the function. this_ref
is bound as this
.
pub fn throw<T>(&self, exc: Exception) -> JSResult<T>
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Heap
impl !Send for Heap
impl !Sync for Heap
impl Unpin for Heap
impl UnwindSafe for Heap
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more