diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e8e80e3ae..55f8c60de 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -164,13 +164,13 @@ jobs: os: ubuntu-latest rust: stable target: i686-unknown-linux-gnu - features: exports + features: full-async optimization: false - task: bindings os: ubuntu-latest rust: stable target: x86_64-unknown-linux-gnu - features: exports + features: full-async optimization: false - task: bindings os: macos-latest @@ -233,12 +233,6 @@ jobs: features: full-async optimization: false # Test features - - task: features - os: ubuntu-latest - rust: stable - target: x86_64-unknown-linux-gnu - features: exports - optimization: false - task: features os: ubuntu-latest rust: stable @@ -401,7 +395,7 @@ jobs: RUST_LOG: bindgen=warn,bindgen::ir=error,bindgen::codegen=error run: | cargo clean - cargo build ${{ matrix.optimization && '--release' || '' }} --manifest-path sys/Cargo.toml --target ${{ matrix.target }} --features exports,bindgen,update-bindings,logging + cargo build ${{ matrix.optimization && '--release' || '' }} --manifest-path sys/Cargo.toml --target ${{ matrix.target }} --features bindgen,update-bindings,logging - name: Upload bindings if: matrix.task == 'bindings' uses: actions/upload-artifact@v3 diff --git a/Cargo.toml b/Cargo.toml index bc453fdd2..58e0f6778 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -41,10 +41,10 @@ members = [ ] [features] -default = ["exports", "classes", "properties"] +default = ["classes", "properties"] # Almost all features excluding "parallel" and support for async runtimes -full = ["chrono", "exports", "loader", "allocator", "dyn-load", "either", "indexmap", "classes", "properties", "array-buffer", "macro", "phf"] +full = ["chrono", "loader", "allocator", "dyn-load", "either", "indexmap", "classes", "properties", "array-buffer", "macro", "phf"] # Almost all features excluding "parallel" full-async = ["full", "futures"] @@ -68,9 +68,6 @@ bindgen = ["rquickjs-core/bindgen", "rquickjs-macro?/bindgen"] # Enable support of parallel execution parallel = ["rquickjs-core/parallel"] -# Enable support of reading module exports -exports = ["rquickjs-core/exports"] - # Enable user-defined module loader support loader = ["rquickjs-core/loader"] diff --git a/core/Cargo.toml b/core/Cargo.toml index c37928e76..8c700300b 100644 --- a/core/Cargo.toml +++ b/core/Cargo.toml @@ -47,7 +47,7 @@ optional = true default = [] # Almost all features excluding "parallel" and support for async runtimes -full = ["chrono", "exports", "loader", "allocator", "dyn-load", "either", "indexmap", "classes", "properties", "array-buffer"] +full = ["chrono", "loader", "allocator", "dyn-load", "either", "indexmap", "classes", "properties", "array-buffer"] # Almost all features excluding "parallel" full-async = ["full", "futures"] @@ -59,9 +59,6 @@ bindgen = ["rquickjs-sys/bindgen"] # Enable support of parallel execution parallel = [] -# Enable support of reading module exports -exports = ["rquickjs-sys/exports"] - # Enable user-defined module loader support loader = ["relative-path"] diff --git a/core/src/class/trace.rs b/core/src/class/trace.rs index b05f8f97b..8d9089504 100644 --- a/core/src/class/trace.rs +++ b/core/src/class/trace.rs @@ -3,7 +3,7 @@ use std::marker::PhantomData; #[cfg(feature = "either")] use either::{Either, Left, Right}; -use crate::{markers::Invariant, qjs, Class, Ctx, Value}; +use crate::{markers::Invariant, qjs, Class, Ctx, Module, Value}; use super::JsClass; @@ -80,6 +80,10 @@ where } } +impl<'js, T> Trace<'js> for Module<'js, T> { + fn trace<'a>(&self, _tracer: Tracer<'a, 'js>) {} +} + impl<'js, T> Trace<'js> for Option where T: Trace<'js>, @@ -200,7 +204,6 @@ trace_impls! { bool,char, String, crate::Atom<'js>, - crate::Module<'js>, } trace_impls! { diff --git a/core/src/context/base.rs b/core/src/context/base.rs index 7555135bb..aaf271e97 100644 --- a/core/src/context/base.rs +++ b/core/src/context/base.rs @@ -53,6 +53,8 @@ impl Context { let ctx = NonNull::new(unsafe { qjs::JS_NewContextRaw(guard.rt.as_ptr()) }) .ok_or_else(|| Error::Allocation)?; unsafe { I::add_intrinsic(ctx) }; + // rquickjs assumes the base objects exist, so we allways need to add this. + unsafe { intrinsic::Base::add_intrinsic(ctx) }; unsafe { Self::init_raw(ctx.as_ptr()) } let res = Inner { ctx, @@ -194,20 +196,21 @@ mod test { }); } - #[cfg(feature = "exports")] #[test] fn module() { test_with(|ctx| { - let _value: Module = ctx - .compile( - "test_mod", - r#" + Module::evaluate( + ctx, + "test_mod", + r#" let t = "3"; let b = (a) => a + 3; export { b, t} "#, - ) - .unwrap(); + ) + .unwrap() + .finish::<()>() + .unwrap(); }); } diff --git a/core/src/context/ctx.rs b/core/src/context/ctx.rs index 1cb3f921a..e4b79274d 100644 --- a/core/src/context/ctx.rs +++ b/core/src/context/ctx.rs @@ -1,6 +1,7 @@ use std::{ ffi::{CStr, CString}, - fs, mem, + fs, + mem::{self, MaybeUninit}, path::Path, ptr::NonNull, }; @@ -11,11 +12,12 @@ use std::future::Future; #[cfg(feature = "futures")] use crate::AsyncContext; use crate::{ - markers::Invariant, qjs, runtime::raw::Opaque, Context, Error, FromJs, Function, IntoJs, - Module, Object, Result, String, Value, + atom::PredefinedAtom, markers::Invariant, qjs, runtime::raw::Opaque, Atom, Context, Error, + FromJs, Function, IntoJs, Object, Promise, Result, String, Value, }; /// Eval options. +#[non_exhaustive] pub struct EvalOptions { /// Global code. pub global: bool, @@ -23,6 +25,8 @@ pub struct EvalOptions { pub strict: bool, /// Don't include the stack frames before this eval in the Error() backtraces. pub backtrace_barrier: bool, + /// Support top-level-await. + pub promise: bool, } impl EvalOptions { @@ -41,6 +45,10 @@ impl EvalOptions { flag |= qjs::JS_EVAL_FLAG_BACKTRACE_BARRIER; } + if self.promise { + flag |= qjs::JS_EVAL_FLAG_ASYNC; + } + flag as i32 } } @@ -51,6 +59,7 @@ impl Default for EvalOptions { global: true, strict: true, backtrace_barrier: false, + promise: false, } } } @@ -135,6 +144,20 @@ impl<'js> Ctx<'js> { self.eval_with_options(source, Default::default()) } + /// Evaluate a script in global context with top level await support. + /// + /// This function always returns a promise which resolves to the result of the evaluated + /// expression. + pub fn eval_promise>>(&self, source: S) -> Result> { + self.eval_with_options( + source, + EvalOptions { + promise: true, + ..Default::default() + }, + ) + } + /// Evaluate a script with the given options. pub fn eval_with_options, S: Into>>( &self, @@ -174,15 +197,6 @@ impl<'js> Ctx<'js> { }) } - /// Compile a module for later use. - pub fn compile(self, name: N, source: S) -> Result> - where - N: Into>, - S: Into>, - { - Module::evaluate(self, name, source) - } - /// Returns the global object of this context. pub fn globals(&self) -> Object<'js> { unsafe { @@ -344,8 +358,8 @@ impl<'js> Ctx<'js> { } } - // Creates promise and resolving functions. - pub fn promise(&self) -> Result<(Object<'js>, Function<'js>, Function<'js>)> { + /// Creates javascipt promise along with its reject and resolve functions. + pub fn promise(&self) -> Result<(Promise<'js>, Function<'js>, Function<'js>)> { let mut funcs = mem::MaybeUninit::<(qjs::JSValue, qjs::JSValue)>::uninit(); Ok(unsafe { @@ -353,15 +367,26 @@ impl<'js> Ctx<'js> { self.ctx.as_ptr(), funcs.as_mut_ptr() as _, ))?; - let (then, catch) = funcs.assume_init(); + let (resolve, reject) = funcs.assume_init(); ( - Object::from_js_value(self.clone(), promise), - Function::from_js_value(self.clone(), then), - Function::from_js_value(self.clone(), catch), + Promise::from_js_value(self.clone(), promise), + Function::from_js_value(self.clone(), resolve), + Function::from_js_value(self.clone(), reject), ) }) } + /// Executes a quickjs job. + /// + /// Returns wether a job was actually executed. + /// If this function returned false, no job was pending. + pub fn execute_pending_job(&self) -> bool { + let mut ptr = MaybeUninit::<*mut qjs::JSContext>::uninit(); + let rt = unsafe { qjs::JS_GetRuntime(self.ctx.as_ptr()) }; + let res = unsafe { qjs::JS_ExecutePendingJob(rt, ptr.as_mut_ptr()) }; + res != 0 + } + pub(crate) unsafe fn get_opaque(&self) -> *mut Opaque<'js> { let rt = qjs::JS_GetRuntime(self.ctx.as_ptr()); qjs::JS_GetRuntimeOpaque(rt).cast::() @@ -402,41 +427,54 @@ impl<'js> Ctx<'js> { } } + pub fn script_or_module_name(&self, stack_level: isize) -> Option> { + let stack_level = std::os::raw::c_int::try_from(stack_level).unwrap(); + let atom = unsafe { qjs::JS_GetScriptOrModuleName(self.as_ptr(), stack_level) }; + if PredefinedAtom::Null as u32 == atom { + unsafe { qjs::JS_FreeAtom(self.as_ptr(), atom) }; + return None; + } + unsafe { Some(Atom::from_atom_val(self.clone(), atom)) } + } + /// Returns the pointer to the C library context. pub fn as_raw(&self) -> NonNull { self.ctx } - /// Frees modules which aren't evaluated. - /// - /// When a module is compiled and the compilation results in an error the module can already - /// have resolved several modules. Originally QuickJS freed all these module when compiling - /// (but not when a it was dynamically imported), this library patched that behavior out - /// because it proved to be hard to make safe. This function will free those modules. - /// - /// # Safety - /// Caller must ensure that this method is not called from a module being evaluated. + /* + // Frees modules which aren't evaluated. + // + // When a module is compiled and the compilation results in an error the module can already + // have resolved several modules. Originally QuickJS freed all these module when compiling + // (but not when a it was dynamically imported), this library patched that behavior out + // because it proved to be hard to make safe. This function will free those modules. + // + // # Safety + // Caller must ensure that this method is not called from a module being evaluated. pub unsafe fn free_unevaluated_modules(&self) { qjs::JS_FreeUnevaluatedModules(self.ctx.as_ptr()) } + */ } #[cfg(test)] mod test { - #[cfg(feature = "exports")] #[test] fn exports() { - use crate::{context::intrinsic, Context, Function, Runtime}; + use crate::{context::intrinsic, Context, Function, Module, Promise, Runtime}; let runtime = Runtime::new().unwrap(); let ctx = Context::custom::<(intrinsic::Promise, intrinsic::Eval)>(&runtime).unwrap(); ctx.with(|ctx| { - let module = ctx - .compile("test", "export default async () => 1;") + let (module, promise) = Module::declare(ctx, "test", "export default async () => 1;") + .unwrap() + .eval() .unwrap(); + promise.finish::<()>().unwrap(); let func: Function = module.get("default").unwrap(); - func.call::<(), ()>(()).unwrap(); + func.call::<(), Promise>(()).unwrap(); }); } @@ -464,6 +502,18 @@ mod test { }) } + #[test] + fn eval_minimal_test() { + use crate::{Context, Runtime}; + + let runtime = Runtime::new().unwrap(); + let ctx = Context::full(&runtime).unwrap(); + ctx.with(|ctx| { + let res: i32 = ctx.eval(" 1 + 1 ").unwrap(); + assert_eq!(2, res); + }) + } + #[test] #[should_panic(expected = "'foo' is not defined")] fn eval_with_sloppy_code() { diff --git a/core/src/lib.rs b/core/src/lib.rs index 73651b974..aa24d282b 100644 --- a/core/src/lib.rs +++ b/core/src/lib.rs @@ -59,9 +59,9 @@ mod persistent; mod value; pub use persistent::{Outlive, Persistent}; pub use value::{ - array, atom, convert, function, module, object, Array, Atom, BigInt, Coerced, Exception, - Filter, FromAtom, FromIteratorJs, FromJs, Function, IntoAtom, IntoJs, IteratorJs, Module, Null, - Object, String, Symbol, Type, Undefined, Value, + array, atom, convert, function, module, object, promise, Array, Atom, BigInt, Coerced, + Exception, Filter, FromAtom, FromIteratorJs, FromJs, Function, IntoAtom, IntoJs, IteratorJs, + Module, Null, Object, Promise, String, Symbol, Type, Undefined, Value, }; pub mod class; @@ -73,10 +73,6 @@ pub use value::{ArrayBuffer, TypedArray}; pub(crate) use std::{result::Result as StdResult, string::String as StdString}; -#[cfg(feature = "futures")] -#[cfg_attr(feature = "doc-cfg", doc(cfg(feature = "futures")))] -pub mod promise; - #[cfg(feature = "allocator")] #[cfg_attr(feature = "doc-cfg", doc(cfg(feature = "allocator")))] pub mod allocator; diff --git a/core/src/loader.rs b/core/src/loader.rs index 4515f069a..5ce2f3121 100644 --- a/core/src/loader.rs +++ b/core/src/loader.rs @@ -2,7 +2,7 @@ use std::{ffi::CStr, ptr}; -use crate::{module::ModuleData, qjs, Ctx, Module, Result}; +use crate::{module::Declared, qjs, Ctx, Module, Result}; mod builtin_resolver; pub use builtin_resolver::BuiltinResolver; @@ -69,37 +69,12 @@ pub trait Resolver { #[cfg_attr(feature = "doc-cfg", doc(cfg(feature = "loader")))] pub trait Loader { /// Load module by name - fn load<'js>(&mut self, ctx: &Ctx<'js>, name: &str) -> Result; -} - -/// The Raw Module loader interface. -/// -/// When implementing a module loader prefer the to implement [`Loader`] instead. -/// All struct which implement [`Loader`] will automatically implement this trait. -/// -/// # Safety -/// Implementors must ensure that all module declaration and evaluation errors are returned from -/// this function. -#[cfg_attr(feature = "doc-cfg", doc(cfg(feature = "loader")))] -pub unsafe trait RawLoader { - /// Load module by name, should return an unevaluated module. - /// - /// # Safety - /// Callers must ensure that the module returned by this function is not used after an module - /// declaration or evaluation failed. - unsafe fn raw_load<'js>(&mut self, ctx: &Ctx<'js>, name: &str) -> Result>; -} - -unsafe impl RawLoader for T { - unsafe fn raw_load<'js>(&mut self, ctx: &Ctx<'js>, name: &str) -> Result> { - let res = self.load(ctx, name)?.unsafe_declare(ctx.clone())?; - Ok(res) - } + fn load<'js>(&mut self, ctx: &Ctx<'js>, name: &str) -> Result>; } struct LoaderOpaque { resolver: Box, - loader: Box, + loader: Box, } #[derive(Debug)] @@ -116,7 +91,7 @@ impl LoaderHolder { pub fn new(resolver: R, loader: L) -> Self where R: Resolver + 'static, - L: RawLoader + 'static, + L: Loader + 'static, { Self(Box::into_raw(Box::new(LoaderOpaque { resolver: Box::new(resolver), @@ -180,7 +155,7 @@ impl LoaderHolder { ) -> Result<*mut qjs::JSModuleDef> { let name = name.to_str()?; - Ok(opaque.loader.raw_load(ctx, name)?.as_module_def().as_ptr()) + Ok(opaque.loader.load(ctx, name)?.as_ptr()) } unsafe extern "C" fn load_raw( @@ -238,17 +213,17 @@ macro_rules! loader_impls { } } - unsafe impl< $($t,)*> $crate::loader::RawLoader for ($($t,)*) + impl< $($t,)*> $crate::loader::Loader for ($($t,)*) where - $($t: $crate::loader::RawLoader,)* + $($t: $crate::loader::Loader,)* { #[allow(non_snake_case)] #[allow(unused_mut)] - unsafe fn raw_load<'js>(&mut self, _ctx: &Ctx<'js>, name: &str) -> Result> { + fn load<'js>(&mut self, _ctx: &Ctx<'js>, name: &str) -> Result> { let mut messages = Vec::::new(); let ($($t,)*) = self; $( - match $t.raw_load(_ctx, name) { + match $t.load(_ctx, name) { // Still could try the next loader Err($crate::Error::Loading { message, .. }) => { message.map(|message| messages.push(message)); @@ -270,7 +245,7 @@ loader_impls!(A B C D E F G H); #[cfg(test)] mod test { - use crate::{module::ModuleData, Context, Ctx, Error, Result, Runtime}; + use crate::{CatchResultExt, Context, Ctx, Error, Module, Result, Runtime}; use super::{Loader, Resolver}; @@ -293,15 +268,16 @@ mod test { struct TestLoader; impl Loader for TestLoader { - fn load<'js>(&mut self, _ctx: &Ctx<'js>, name: &str) -> Result { + fn load<'js>(&mut self, ctx: &Ctx<'js>, name: &str) -> Result> { if name == "test" { - Ok(ModuleData::source( + Module::declare( + ctx.clone(), "test", r#" export const n = 123; export const s = "abc"; "#, - )) + ) } else { Err(Error::new_loading_message(name, "unable to load")) } @@ -314,41 +290,39 @@ mod test { let ctx = Context::full(&rt).unwrap(); rt.set_loader(TestResolver, TestLoader); ctx.with(|ctx| { - let _module = ctx - .compile( - "loader", - r#" + Module::evaluate( + ctx, + "loader", + r#" import { n, s } from "test"; export default [n, s]; "#, - ) - .unwrap(); + ) + .unwrap() + .finish::<()>() + .unwrap(); }) } #[test] - #[should_panic(expected = "Unable to resolve")] + #[should_panic(expected = "Error resolving module")] fn resolving_error() { let rt = Runtime::new().unwrap(); let ctx = Context::full(&rt).unwrap(); rt.set_loader(TestResolver, TestLoader); ctx.with(|ctx| { - let _ = ctx - .compile( - "loader", - r#" + Module::evaluate( + ctx.clone(), + "loader", + r#" import { n, s } from "test_"; "#, - ) - .map_err(|error| { - println!("{error:?}"); - // TODO: Error::Resolving - if let Error::Exception = error { - } else { - panic!(); - } - }) - .expect("Unable to resolve"); + ) + .catch(&ctx) + .unwrap() + .finish::<()>() + .catch(&ctx) + .expect("Unable to resolve"); }) } } diff --git a/core/src/loader/builtin_loader.rs b/core/src/loader/builtin_loader.rs index 5ee7cbc20..0723b1944 100644 --- a/core/src/loader/builtin_loader.rs +++ b/core/src/loader/builtin_loader.rs @@ -1,4 +1,4 @@ -use crate::{loader::Loader, module::ModuleData, Ctx, Error, Result}; +use crate::{loader::Loader, module::Declared, Ctx, Error, Module, Result}; use std::collections::HashMap; /// The builtin script module loader @@ -29,9 +29,9 @@ impl BuiltinLoader { } impl Loader for BuiltinLoader { - fn load<'js>(&mut self, _ctx: &Ctx<'js>, path: &str) -> Result { + fn load<'js>(&mut self, ctx: &Ctx<'js>, path: &str) -> Result> { match self.modules.remove(path) { - Some(source) => Ok(ModuleData::source(path, source)), + Some(source) => Module::declare(ctx.clone(), path, source), _ => Err(Error::new_loading(path)), } } diff --git a/core/src/loader/bundle.rs b/core/src/loader/bundle.rs index 7c6f97339..f4254893d 100644 --- a/core/src/loader/bundle.rs +++ b/core/src/loader/bundle.rs @@ -1,7 +1,7 @@ //! Utilities for embedding JS modules. use super::{util::resolve_simple, Loader, Resolver}; -use crate::{module::ModuleData, Ctx, Error, Result}; +use crate::{Ctx, Error, Module, Result}; use std::ops::Deref; /// The module data which contains bytecode @@ -67,11 +67,12 @@ impl Loader for Bundle> where D: HasByteCode<'static>, { - fn load<'js>(&mut self, _ctx: &Ctx<'js>, name: &str) -> Result { - self.iter() - .find(|(module_name, _)| *module_name == name) - .map(|(_, bytecode)| unsafe { ModuleData::bytecode(name, bytecode.get_bytecode()) }) - .ok_or_else(|| Error::new_loading(name)) + fn load<'js>(&mut self, ctx: &Ctx<'js>, name: &str) -> Result> { + if let Some((_, x)) = self.iter().find(|(module_name, _)| *module_name == name) { + let module = unsafe { Module::load(ctx.clone(), x.get_bytecode())? }; + return Ok(module); + } + Err(Error::new_loading(name)) } } @@ -80,9 +81,11 @@ impl Loader for Bundle> where D: HasByteCode<'static>, { - fn load<'js>(&mut self, _ctx: &Ctx<'js>, name: &str) -> Result { - self.get(name) - .map(|bytecode| unsafe { ModuleData::bytecode(name, bytecode.get_bytecode()) }) - .ok_or_else(|| Error::new_loading(name)) + fn load<'js>(&mut self, ctx: &Ctx<'js>, name: &str) -> Result> { + if let Some(x) = self.get(name) { + let module = unsafe { Module::load(ctx.clone(), x.get_bytecode())? }; + return Ok(module); + } + Err(Error::new_loading(name)) } } diff --git a/core/src/loader/compile.rs b/core/src/loader/compile.rs index 3db9809c4..0811498bc 100644 --- a/core/src/loader/compile.rs +++ b/core/src/loader/compile.rs @@ -1,6 +1,5 @@ use crate::{ - loader::{util::resolve_simple, Loader, RawLoader, Resolver}, - module::ModuleDataKind, + loader::{util::resolve_simple, Loader, Resolver}, Ctx, Lock, Module, Mut, Ref, Result, }; use std::{ @@ -182,19 +181,13 @@ where } } -unsafe impl RawLoader for Compile +impl Loader for Compile where L: Loader, { - unsafe fn raw_load<'js>(&mut self, ctx: &Ctx<'js>, path: &str) -> Result> { - let data = self.inner.load(ctx, path)?; - assert!( - matches!(data.kind(), ModuleDataKind::Source(_) | ModuleDataKind::ByteCode(_)) , - "can't compile native modules, loader `{}` returned a native module, but `Compile` can only handle modules loaded from source or bytecode", - std::any::type_name::() - ); - let module = data.unsafe_declare(ctx.clone())?; - let data = module.write_object(false)?; + fn load<'js>(&mut self, ctx: &Ctx<'js>, path: &str) -> Result> { + let module = self.inner.load(ctx, path)?; + let data = module.write(false)?; self.data.lock().bytecodes.push((path.into(), data)); Ok(module) } diff --git a/core/src/loader/module_loader.rs b/core/src/loader/module_loader.rs index 31b138539..62c6089bf 100644 --- a/core/src/loader/module_loader.rs +++ b/core/src/loader/module_loader.rs @@ -1,26 +1,26 @@ -use crate::{ - module::{ModuleData, ModuleDef}, - Ctx, Error, Result, -}; +use crate::{module::ModuleDef, Ctx, Error, Module, Result}; use std::{collections::HashMap, fmt::Debug}; use super::Loader; +type LoadFn = for<'js> fn(Ctx<'js>, Vec) -> Result>; + /// The builtin native module loader /// /// This loader can be used as the nested backing loader in user-defined loaders. #[derive(Debug, Default)] pub struct ModuleLoader { - modules: HashMap, + modules: HashMap, } impl ModuleLoader { + fn load_func<'js, D: ModuleDef>(ctx: Ctx<'js>, name: Vec) -> Result> { + Module::declare_def::(ctx, name) + } + /// Add module pub fn add_module, M: ModuleDef>(&mut self, name: N, _module: M) -> &mut Self { - let name = name.into(); - let data = ModuleData::native::(name.clone()); - - self.modules.insert(name, data); + self.modules.insert(name.into(), Self::load_func::); self } @@ -33,9 +33,12 @@ impl ModuleLoader { } impl Loader for ModuleLoader { - fn load<'js>(&mut self, _ctx: &Ctx<'js>, path: &str) -> Result { - self.modules + fn load<'js>(&mut self, ctx: &Ctx<'js>, path: &str) -> Result> { + let load = self + .modules .remove(path) - .ok_or_else(|| Error::new_loading(path)) + .ok_or_else(|| Error::new_loading(path))?; + + (load)(ctx.clone(), Vec::from(path)) } } diff --git a/core/src/loader/native_loader.rs b/core/src/loader/native_loader.rs index b3271e6d9..672c1be30 100644 --- a/core/src/loader/native_loader.rs +++ b/core/src/loader/native_loader.rs @@ -1,6 +1,4 @@ -use crate::{ - loader::util::check_extensions, module::ModuleData, module::ModuleLoadFn, Ctx, Error, Result, -}; +use crate::{loader::util::check_extensions, module::ModuleLoadFn, Ctx, Error, Module, Result}; use super::Loader; @@ -49,7 +47,7 @@ impl Default for NativeLoader { } impl Loader for NativeLoader { - fn load<'js>(&mut self, _ctx: &Ctx<'js>, path: &str) -> Result { + fn load<'js>(&mut self, ctx: &Ctx<'js>, path: &str) -> Result> { use dlopen::raw::Library; if !check_extensions(path, &self.extensions) { @@ -62,7 +60,7 @@ impl Loader for NativeLoader { Error::new_loading_message(path, "Unable to find symbol `js_init_module`") })?; - let module = unsafe { ModuleData::raw(path, load) }; + let module = unsafe { Module::from_load_fn(ctx.clone(), path, load)? }; self.libs.push(lib); diff --git a/core/src/loader/script_loader.rs b/core/src/loader/script_loader.rs index e9b7067a0..ea8191dcd 100644 --- a/core/src/loader/script_loader.rs +++ b/core/src/loader/script_loader.rs @@ -1,7 +1,6 @@ use crate::{ loader::{util::check_extensions, Loader}, - module::ModuleData, - Ctx, Error, Result, + Ctx, Error, Module, Result, }; /// The script module loader @@ -36,12 +35,12 @@ impl Default for ScriptLoader { } impl Loader for ScriptLoader { - fn load<'js>(&mut self, _ctx: &Ctx<'js>, path: &str) -> Result { + fn load<'js>(&mut self, ctx: &Ctx<'js>, path: &str) -> Result> { if !check_extensions(path, &self.extensions) { return Err(Error::new_loading(path)); } let source: Vec<_> = std::fs::read(path)?; - Ok(ModuleData::source(path, source)) + Module::declare(ctx.clone(), path, source) } } diff --git a/core/src/promise.rs b/core/src/promise.rs deleted file mode 100644 index 3e2c2735a..000000000 --- a/core/src/promise.rs +++ /dev/null @@ -1,258 +0,0 @@ -//! Utilities for converting promises to futures and vice versa. - -use std::{ - cell::Cell, - future::Future, - pin::Pin, - task::{Context as TaskContext, Poll, Waker}, -}; - -use crate::{ - atom::PredefinedAtom, function::This, qjs, safe_ref::Ref, CatchResultExt, CaughtError, - CaughtResult, Ctx, Exception, FromJs, Function, IntoJs, Object, Result, ThrowResultExt, Value, -}; - -/// Future-aware promise -#[cfg_attr(feature = "doc-cfg", doc(cfg(feature = "futures")))] -pub struct Promise<'js, T> { - state: Ref>, - promise: Object<'js>, -} - -struct State<'js, T> { - waker: Cell>, - result: Cell>>, -} - -impl<'js, T: 'js> State<'js, T> { - fn poll(&self, waker: Waker) -> Option { - self.waker.replace(Some(waker)) - } - - fn take_result(&self) -> Option> { - self.result.take() - } - - fn resolve(&self, result: CaughtResult<'js, T>) { - self.result.set(Some(result)); - self.waker - .take() - .expect("promise resolved before being polled") - .wake(); - } -} - -unsafe impl<'js, T> Send for State<'js, T> {} -unsafe impl<'js, T> Sync for State<'js, T> {} - -impl<'js, T> FromJs<'js> for Promise<'js, T> -where - T: FromJs<'js> + 'js, -{ - fn from_js(ctx: &Ctx<'js>, value: Value<'js>) -> Result { - let promise = Object::from_js(ctx, value)?; - let state = Ref::new(State { - waker: Cell::new(None), - result: Cell::new(None), - }); - - Ok(Promise { state, promise }) - } -} - -impl<'js, T> Future for Promise<'js, T> -where - T: FromJs<'js> + 'js, -{ - type Output = Result; - - fn poll(self: Pin<&mut Self>, cx: &mut TaskContext) -> Poll { - let ctx = self.promise.ctx(); - if let Some(x) = self.state.take_result() { - return Poll::Ready(x.throw(ctx)); - } - - if self.state.poll(cx.waker().clone()).is_none() { - let then: Function = self.promise.get(PredefinedAtom::Then)?; - let state = self.state.clone(); - let resolve = Function::new(ctx.clone(), move |ctx: Ctx<'js>, value: Value<'js>| { - let t = T::from_js(&ctx, value).catch(&ctx); - state.resolve(t); - }); - let state = self.state.clone(); - let reject = Function::new(ctx.clone(), move |value: Value<'js>| { - let e = - if let Some(e) = value.clone().into_object().and_then(Exception::from_object) { - CaughtError::Exception(e) - } else { - CaughtError::Value(value) - }; - state.resolve(Err(e)) - }); - then.call((This(self.promise.clone()), resolve, reject))?; - }; - Poll::Pending - } -} - -/// Wrapper for futures to convert to JS promises -#[cfg_attr(feature = "doc-cfg", doc(cfg(feature = "futures")))] -#[repr(transparent)] -pub struct Promised(pub T); - -impl From for Promised { - fn from(future: T) -> Self { - Self(future) - } -} - -impl<'js, T, R> IntoJs<'js> for Promised -where - T: Future + 'js, - R: IntoJs<'js> + 'js, -{ - fn into_js(self, ctx: &Ctx<'js>) -> Result> { - let (promise, resolve, reject) = ctx.promise()?; - let ctx_clone = ctx.clone(); - - let future = async move { - let err = match self.0.await.into_js(&ctx_clone).catch(&ctx_clone) { - Ok(x) => resolve.call::<_, ()>((x,)), - Err(e) => match e { - CaughtError::Exception(e) => reject.call::<_, ()>((e,)), - CaughtError::Value(e) => reject.call::<_, ()>((e,)), - CaughtError::Error(e) => { - let is_exception = unsafe { qjs::JS_IsException(e.throw(&ctx_clone)) }; - debug_assert!(is_exception); - let e = ctx_clone.catch(); - reject.call::<_, ()>((e,)) - } - }, - }; - // TODO figure out something better to do here. - if let Err(e) = err { - println!("promise handle function returned error:{}", e); - } - }; - ctx.spawn(future); - Ok(promise.into_value()) - } -} - -#[cfg(test)] -mod test { - use std::time::Duration; - - use super::*; - use crate::{ - async_with, - function::{Async, Func}, - AsyncContext, AsyncRuntime, - }; - - async fn set_timeout<'js>(cb: Function<'js>, number: f64) -> Result<()> { - tokio::time::sleep(Duration::from_secs_f64(number / 1000.0)).await; - cb.call::<_, ()>(()) - } - - #[tokio::test] - async fn promise() { - let rt = AsyncRuntime::new().unwrap(); - let ctx = AsyncContext::full(&rt).await.unwrap(); - - async_with!(ctx => |ctx| { - ctx.globals().set("setTimeout",Func::from(Async(set_timeout))).unwrap(); - - let func = ctx - .eval::( - r" - (function(){ - return new Promise((resolve) => { - setTimeout(x => { - resolve(42) - },100) - }) - }) - ", - ) - .catch(&ctx) - .unwrap(); - let promise: Promise = func.call(()).unwrap(); - assert_eq!(promise.await.catch(&ctx).unwrap(), 42); - - let func = ctx - .eval::( - r" - (function(){ - return new Promise((_,reject) => { - setTimeout(x => { - reject(42) - },100) - }) - }) - ", - ) - .catch(&ctx) - .unwrap(); - let promise: Promise<()> = func.call(()).unwrap(); - let err = promise.await.catch(&ctx); - match err { - Err(CaughtError::Value(v)) => { - assert_eq!(v.as_int().unwrap(), 42) - } - _ => panic!(), - } - }) - .await - } - - #[tokio::test] - async fn promised() { - let rt = AsyncRuntime::new().unwrap(); - let ctx = AsyncContext::full(&rt).await.unwrap(); - - async_with!(ctx => |ctx| { - let promised = Promised::from(async { - tokio::time::sleep(Duration::from_millis(100)).await; - 42 - }); - - let function = ctx.eval::(r" - (async function(v){ - let val = await v; - if(val !== 42){ - throw new Error('not correct value') - } - }) - ").catch(&ctx).unwrap(); - - function.call::<_,Promise<()>>((promised,)).unwrap().await.unwrap(); - - let ctx_clone = ctx.clone(); - let promised = Promised::from(async move { - tokio::time::sleep(Duration::from_millis(100)).await; - Result::<()>::Err(Exception::throw_message(&ctx_clone, "some_message")) - }); - - let function = ctx.eval::(r" - (async function(v){ - try{ - await v; - }catch(e) { - if (e.message !== 'some_message'){ - throw new Error('wrong error') - } - return - } - throw new Error('no error thrown') - }) - ") - .catch(&ctx) - .unwrap(); - - - function.call::<_,Promise<()>>((promised,)).unwrap().await.unwrap() - }) - .await - } -} diff --git a/core/src/result.rs b/core/src/result.rs index d29f076e7..4cb63f635 100644 --- a/core/src/result.rs +++ b/core/src/result.rs @@ -63,6 +63,8 @@ pub enum Error { Allocation, /// A module defined two exported values with the same name. DuplicateExports, + /// Tried to export a entry which was not previously declared. + InvalidExport, /// Found a string with a internal null byte while converting /// to C string. InvalidString(NulError), @@ -117,11 +119,13 @@ pub enum Error { name: StdString, message: Option, }, - #[cfg(feature = "array-buffer")] AsSlice(AsSliceError), /// Error when restoring a Persistent in a runtime other than the original runtime. UnrelatedRuntime, + /// An error returned by a blocked on promise if block on the promise would result in a dead + /// lock. + WouldBlock, /// An error from QuickJS from which the specifics are unknown. /// Should eventually be removed as development progresses. Unknown, @@ -356,6 +360,7 @@ impl Display for Error { DuplicateExports => { "Tried to export two values with the same name from one module".fmt(f)? } + InvalidExport => "Tried to export a value which was not previously declared".fmt(f)?, InvalidString(error) => { "String contained internal null bytes: ".fmt(f)?; error.fmt(f)?; @@ -453,6 +458,7 @@ impl Display for Error { "Error borrowing function: ".fmt(f)?; x.fmt(f)?; } + WouldBlock => "Error blocking on a promise resulted in a dead lock".fmt(f)?, #[cfg(feature = "array-buffer")] AsSlice(x) => { "Could not convert array buffer to slice: ".fmt(f)?; diff --git a/core/src/runtime/async.rs b/core/src/runtime/async.rs index 7ddeb2576..deef026a7 100644 --- a/core/src/runtime/async.rs +++ b/core/src/runtime/async.rs @@ -13,7 +13,7 @@ use async_lock::Mutex; #[cfg(feature = "allocator")] use crate::allocator::Allocator; #[cfg(feature = "loader")] -use crate::loader::{RawLoader, Resolver}; +use crate::loader::{Loader, Resolver}; #[cfg(feature = "parallel")] use crate::qjs; use crate::{context::AsyncContext, result::AsyncJobException, Ctx, Error, Exception, Result}; @@ -180,7 +180,7 @@ impl AsyncRuntime { pub async fn set_loader(&self, resolver: R, loader: L) where R: Resolver + 'static, - L: RawLoader + 'static, + L: Loader + 'static, { unsafe { self.inner.lock().await.runtime.set_loader(resolver, loader); diff --git a/core/src/runtime/base.rs b/core/src/runtime/base.rs index 1395614fc..d24ac1199 100644 --- a/core/src/runtime/base.rs +++ b/core/src/runtime/base.rs @@ -1,7 +1,7 @@ //! QuickJS runtime related types. #[cfg(feature = "loader")] -use crate::loader::{RawLoader, Resolver}; +use crate::loader::{Loader, Resolver}; use crate::{result::JobException, Context, Error, Mut, Ref, Result, Weak}; use std::{ffi::CString, ptr::NonNull, result::Result as StdResult}; @@ -86,7 +86,7 @@ impl Runtime { pub fn set_loader(&self, resolver: R, loader: L) where R: Resolver + 'static, - L: RawLoader + 'static, + L: Loader + 'static, { unsafe { self.inner.lock().set_loader(resolver, loader); @@ -160,7 +160,9 @@ impl Runtime { /// Returns true when job was executed or false when queue is empty or error when exception thrown under execution. #[inline] pub fn execute_pending_job(&self) -> StdResult { - self.inner.lock().execute_pending_job().map_err(|e| { + let mut lock = self.inner.lock(); + lock.update_stack_top(); + lock.execute_pending_job().map_err(|e| { JobException(unsafe { Context::from_raw( NonNull::new(e).expect("QuickJS returned null ptr for job error"), diff --git a/core/src/runtime/raw.rs b/core/src/runtime/raw.rs index ebbc5ac46..01ac74d99 100644 --- a/core/src/runtime/raw.rs +++ b/core/src/runtime/raw.rs @@ -6,7 +6,7 @@ use std::{ #[cfg(feature = "allocator")] use crate::allocator::{Allocator, AllocatorHolder}; #[cfg(feature = "loader")] -use crate::loader::{LoaderHolder, RawLoader, Resolver}; +use crate::loader::{Loader, LoaderHolder, Resolver}; use crate::qjs; #[cfg(feature = "futures")] @@ -155,7 +155,6 @@ impl RawRuntime { pub fn execute_pending_job(&mut self) -> StdResult { let mut ctx_ptr = mem::MaybeUninit::<*mut qjs::JSContext>::uninit(); - self.update_stack_top(); let result = unsafe { qjs::JS_ExecutePendingJob(self.rt.as_ptr(), ctx_ptr.as_mut_ptr()) }; if result == 0 { // no jobs executed @@ -172,7 +171,7 @@ impl RawRuntime { pub unsafe fn set_loader(&mut self, resolver: R, loader: L) where R: Resolver + 'static, - L: RawLoader + 'static, + L: Loader + 'static, { let loader = LoaderHolder::new(resolver, loader); loader.set_to_runtime(self.rt.as_ptr()); diff --git a/core/src/runtime/schedular/atomic_waker.rs b/core/src/runtime/schedular/atomic_waker.rs index cc593c618..6b2efffff 100644 --- a/core/src/runtime/schedular/atomic_waker.rs +++ b/core/src/runtime/schedular/atomic_waker.rs @@ -10,10 +10,6 @@ use core::task::Waker; use atomic::AtomicUsize; use atomic::Ordering::{AcqRel, Acquire, Release}; -#[cfg(feature = "portable-atomic")] -use portable_atomic as atomic; - -#[cfg(not(feature = "portable-atomic"))] use core::sync::atomic; /// A synchronization primitive for task wakeup. diff --git a/core/src/runtime/spawner.rs b/core/src/runtime/spawner.rs index c445b2273..37ff9d786 100644 --- a/core/src/runtime/spawner.rs +++ b/core/src/runtime/spawner.rs @@ -11,8 +11,6 @@ use crate::AsyncRuntime; use super::{schedular::Schedular, AsyncWeakRuntime, InnerRuntime}; /// A structure to hold futures spawned inside the runtime. -/// -/// TODO: change future lookup in poll from O(n) to O(1). pub struct Spawner { schedular: Schedular, wakeup: Vec, diff --git a/core/src/value.rs b/core/src/value.rs index ced353858..88915d06e 100644 --- a/core/src/value.rs +++ b/core/src/value.rs @@ -9,6 +9,7 @@ pub(crate) mod exception; pub mod function; pub mod module; pub mod object; +pub mod promise; mod string; mod symbol; @@ -20,6 +21,7 @@ pub use exception::Exception; pub use function::{Constructor, Function}; pub use module::Module; pub use object::{Filter, Object}; +pub use promise::Promise; pub use string::String; pub use symbol::Symbol; @@ -99,7 +101,7 @@ impl<'js> fmt::Debug for Value<'js> { unsafe { self.ref_string() }.to_string().fmt(f)?; write!(f, ")")?; } - Symbol | Object | Array | Function | Constructor => { + Symbol | Object | Array | Function | Constructor | Promise => { write!(f, "(")?; unsafe { self.get_ptr() }.fmt(f)?; write!(f, ")")?; @@ -359,6 +361,12 @@ impl<'js> Value<'js> { 0 != unsafe { qjs::JS_IsConstructor(self.ctx.as_ptr(), self.value) } } + /// Check if the value is a promise. + #[inline] + pub fn is_promise(&self) -> bool { + (unsafe { qjs::JS_PromiseState(self.ctx.as_ptr(), self.value) } as std::os::raw::c_int) >= 0 + } + /// Check if the value is an exception #[inline] pub fn is_exception(&self) -> bool { @@ -437,7 +445,7 @@ macro_rules! type_impls { } match other{ Float => matches!(self, Int), - Object => matches!(self, Array | Function | Constructor | Exception), + Object => matches!(self, Array | Function | Constructor | Exception | Promise), Function => matches!(self, Constructor), _ => false } @@ -495,6 +503,7 @@ macro_rules! type_impls { (@cond Array $self:expr) => { $self.is_array() }; (@cond Constructor $self:expr) => { $self.is_constructor() }; (@cond Function $self:expr) => { $self.is_function() }; + (@cond Promise $self:expr) => { $self.is_promise() }; (@cond Exception $self:expr) => { $self.is_error() }; (@cond $type:ident $self:expr) => { true }; } @@ -511,6 +520,7 @@ type_impls! { Array: array => JS_TAG_OBJECT, Constructor: constructor => JS_TAG_OBJECT, Function: function => JS_TAG_OBJECT, + Promise: promise => JS_TAG_OBJECT, Exception: exception => JS_TAG_OBJECT, Object: object => JS_TAG_OBJECT, Module: module => JS_TAG_MODULE, @@ -559,12 +569,16 @@ macro_rules! sub_types { #[allow(unused)] pub(crate) unsafe fn from_js_value_const(ctx: Ctx<'js>, value: qjs::JSValueConst) -> Self { - sub_types!(@wrap $head$(->$sub_type)* Value::from_js_value_const(ctx, value)) + let v = Value::from_js_value_const(ctx, value); + debug_assert!(v.$as().is_some(),"tried to cource js value {:?} to the wrong type, this is a rquickjs bug",v); + sub_types!(@wrap $head$(->$sub_type)* v) } #[allow(unused)] pub(crate) unsafe fn from_js_value(ctx: Ctx<'js>, value: qjs::JSValue) -> Self { - sub_types!(@wrap $head$(->$sub_type)* Value::from_js_value(ctx, value)) + let v = Value::from_js_value(ctx, value); + debug_assert!(v.$as().is_some(),"tried to cource js value {:?} to the wrong type, this is a rquickjs bug",v); + sub_types!(@wrap $head$(->$sub_type)* v) } #[allow(unused)] @@ -700,6 +714,7 @@ sub_types! { Object->Value as_object ref_object into_object try_into_object from_object, Function->Object->Value as_function ref_function into_function try_into_function from_function, Constructor->Function->Object->Value as_constructor ref_constructor into_constructor try_into_constructor from_constructor, + Promise->Object->Value as_promise ref_promise into_promise try_into_promise from_promise, Array->Object->Value as_array ref_array into_array try_into_array from_array, Exception->Object->Value as_exception ref_exception into_exception try_into_exception from_exception, BigInt->Value as_big_int ref_big_int into_big_int try_into_big_int from_big_int, diff --git a/core/src/value/exception.rs b/core/src/value/exception.rs index df122bc4f..a1babefc2 100644 --- a/core/src/value/exception.rs +++ b/core/src/value/exception.rs @@ -1,4 +1,4 @@ -use std::{error::Error as ErrorTrait, ffi::CStr, fmt, usize}; +use std::{error::Error as ErrorTrait, ffi::CStr, fmt}; use crate::{atom::PredefinedAtom, convert::Coerced, qjs, Ctx, Error, Object, Result, Value}; diff --git a/core/src/value/function/types.rs b/core/src/value/function/types.rs index 8a5c5f4a6..038cac507 100644 --- a/core/src/value/function/types.rs +++ b/core/src/value/function/types.rs @@ -64,6 +64,7 @@ pub struct Flat(pub T); /// Helper type for making an parameter set exhaustive. pub struct Exhaustive; +#[cfg(feature = "futures")] /// Helper type for creating a function from a closure which returns a future. pub struct Async(pub T); diff --git a/core/src/value/module.rs b/core/src/value/module.rs index 1555f0368..e976e855f 100644 --- a/core/src/value/module.rs +++ b/core/src/value/module.rs @@ -1,19 +1,17 @@ //! Types for loading and handling JS modules. use std::{ - borrow::Cow, - collections::HashSet, ffi::{CStr, CString}, - fmt, + marker::PhantomData, mem::MaybeUninit, ptr::{self, NonNull}, slice, }; -#[cfg(feature = "exports")] -use std::marker::PhantomData; - -use crate::{qjs, Atom, Context, Ctx, Error, FromAtom, FromJs, IntoJs, Result, Value}; +use crate::{ + atom::PredefinedAtom, qjs, Atom, Context, Ctx, Error, FromAtom, FromJs, IntoAtom, IntoJs, + Object, Promise, Result, Value, +}; /// Helper macro to provide module init function. /// Use for exporting module definitions to be loaded as part of a dynamic library. @@ -48,510 +46,274 @@ macro_rules! module_init { pub type ModuleLoadFn = unsafe extern "C" fn(*mut qjs::JSContext, *const qjs::c_char) -> *mut qjs::JSModuleDef; -/// An enum containing all possible ways to declare an module. -#[derive(Clone)] -pub enum ModuleDataKind { - /// Module source text, - Source(Vec), - /// A function which loads a module from Rust. - Native(for<'js> unsafe fn(ctx: &Ctx<'js>, name: Vec) -> Result>), - /// A raw loading function, used for loading from dynamic libraries. - Raw(ModuleLoadFn), - /// Module object bytecode. - ByteCode(Cow<'static, [u8]>), -} - -// Debug could not be derived on stable because the fn only implemented it for a specific lifetime -// <'js> not a general one. -// -// Remove when stable has caught up to nightly.. -impl fmt::Debug for ModuleDataKind { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - match *self { - ModuleDataKind::Source(ref x) => { - f.debug_tuple("ModuleDataKind::Source").field(x).finish() - } - ModuleDataKind::Raw(ref x) => f.debug_tuple("ModuleDataKind::Raw").field(x).finish(), - ModuleDataKind::ByteCode(ref x) => { - f.debug_tuple("ModuleDataKind::ByteCode").field(x).finish() - } - ModuleDataKind::Native(_) => f - .debug_tuple("ModuleDataKind::ByteCode") - .field(&"") - .finish(), - } +/// A class which can be used to declare rust-native JavaScript modules. +pub trait ModuleDef { + fn declare<'js>(decl: &Declarations<'js>) -> Result<()> { + let _ = decl; + Ok(()) } -} -impl ModuleDataKind { - unsafe fn declare<'js, N: Into>>(self, ctx: Ctx<'js>, name: N) -> Result> { - match self { - ModuleDataKind::Source(x) => Module::unsafe_declare(ctx, name, x), - ModuleDataKind::Native(x) => (x)(&ctx, name.into()), - ModuleDataKind::Raw(x) => { - let name = CString::new(name)?; - let ptr = (x)(ctx.as_ptr(), name.as_ptr().cast()); - let ptr = NonNull::new(ptr).ok_or(Error::Unknown)?; - Ok(Module::from_module_def(ctx, ptr)) - } - ModuleDataKind::ByteCode(x) => Module::unsafe_declare_read_object(ctx, x.as_ref()), - } + fn evaluate<'js>(ctx: &Ctx<'js>, exports: &Exports<'js>) -> Result<()> { + let _ = (exports, ctx); + Ok(()) } } -/// The data required to load a module, either from source or native. -#[derive(Clone, Debug)] -pub struct ModuleData { - name: Vec, - data: ModuleDataKind, -} +/// A struct used for setting declarations on a module. +pub struct Declarations<'js>(Module<'js, Declared>); -impl ModuleData { - /// Create module data for a module loaded from source. - pub fn source(name: N, source: S) -> Self +impl<'js> Declarations<'js> { + /// Define a new export in a module. + pub fn declare(&self, name: N) -> Result<&Self> where N: Into>, - S: Into>, { - ModuleData { - name: name.into(), - data: ModuleDataKind::Source(source.into()), - } + let name = CString::new(name)?; + self.declare_c_str(name.as_c_str()) } - /// Create module data for a module loaded from source. + /// Define a new export in a module. /// - /// # Safety - /// User must ensure that the bytecode is valid QuickJS bytecode. - pub unsafe fn bytecode(name: N, bytecode: S) -> Self - where - N: Into>, - S: Into>, - { - ModuleData { - name: name.into(), - data: ModuleDataKind::ByteCode(bytecode.into()), - } + /// This function avoids an extra allocation, having to convert from a rust string into a + /// null-terminated CStr. + pub fn declare_c_str(&self, name: &CStr) -> Result<&Self> { + unsafe { qjs::JS_AddModuleExport(self.0.ctx.as_ptr(), self.0.as_ptr(), name.as_ptr()) }; + Ok(self) } +} - /// Create module data for a module loaded from a native Rust definition. - pub fn native(name: N) -> Self - where - D: ModuleDef, - N: Into>, - { - unsafe fn define<'js, D: ModuleDef>(ctx: &Ctx<'js>, name: Vec) -> Result> { - Module::unsafe_declare_def::(ctx.clone(), name) - } +/// A struct used for setting the value of previously declared exporsts of a module. +pub struct Exports<'js>(Module<'js, Declared>); - ModuleData { - name: name.into(), - data: ModuleDataKind::Native(define::), - } +impl<'js> Exports<'js> { + /// Set the value of an exported entry. + pub fn export>, T: IntoJs<'js>>(&self, name: N, value: T) -> Result<&Self> { + let name = CString::new(name.into())?; + self.export_c_str(name.as_c_str(), value) } - /// Create module data for a module loaded from a native Rust definition. - /// - /// # Safety - /// User must ensure that `load_fn` behaves like a loader function. + /// Set the value of an exported entry. /// - /// The function must take a context and a c string without taking ownership of either values - /// and return a pointer to `qjs::JSModuleDef`, or a null pointer if there was some error. - pub unsafe fn raw(name: N, load_fn: ModuleLoadFn) -> Self - where - N: Into>, - { - ModuleData { - name: name.into(), - data: ModuleDataKind::Raw(load_fn), - } - } - - /// Returns the kind of `ModuleData`. - pub fn kind(&self) -> &ModuleDataKind { - &self.data - } - - /// Declare the module defined in the `ModuleData`. - pub fn declare<'js>(self, ctx: Ctx<'js>) -> Result<()> { - unsafe { - let _ = self.unsafe_declare(ctx)?; + /// This function avoids a possible conversion from a rust string into a CStr + pub fn export_c_str>(&self, name: &CStr, value: T) -> Result<&Self> { + let value = value.into_js(&self.0.ctx)?; + let res = unsafe { + qjs::JS_SetModuleExport( + self.0.ctx.as_ptr(), + self.0.as_ptr(), + name.as_ptr(), + value.into_js_value(), + ) + }; + if res < 0 { + return Err(Error::InvalidExport); } - Ok(()) - } - /// Declare the module defined in the `ModuleData`. - /// - /// # Safety - /// This method returns an unevaluated module. - /// It is UB to hold unto unevaluated modules across any call to a module function which can - /// invalidate unevaluated modules and returned an error. - pub unsafe fn unsafe_declare<'js>(self, ctx: Ctx<'js>) -> Result> { - self.data.declare(ctx, self.name) + Ok(self) } } -/// A struct for loading multiple modules at once safely. -/// -/// Modules are built in two steps, declare and evaluate. During evaluation a module might import -/// another module, if no such declared module exist the evaluation fails. -/// -/// This struct allows one to first declare all possible modules and then evaluate them allowing -/// modules to import each other. -/// -/// Only use if you need to acquire the module objects after. Otherwise, it is easier to use the -/// other safe methods on the [`Module`] struct like [`Module::evaluate`] -pub struct ModulesBuilder { - modules: Vec, +/// A marker struct used to indicate that a module is possibly not yet evaluated. +#[derive(Clone, Copy, Debug)] +pub struct Declared; +/// A marker struct used to indicate that a module was evaluated. +#[derive(Clone, Copy, Debug)] +pub struct Evaluated; + +/// A JavaScript module. +#[derive(Clone, Debug)] +pub struct Module<'js, T = Declared> { + ptr: NonNull, + ctx: Ctx<'js>, + _type_marker: PhantomData, } -impl ModulesBuilder { - pub fn new() -> Self { - ModulesBuilder { - modules: Vec::new(), - } +impl<'js, T> Module<'js, T> { + pub(crate) fn as_ptr(&self) -> *mut qjs::JSModuleDef { + self.ptr.as_ptr() } - pub fn source(mut self, name: N, source: S) -> Self - where - N: Into>, - S: Into>, - { - self.with_source(name, source); - self + pub(crate) unsafe fn from_ptr(ctx: Ctx<'js>, ptr: NonNull) -> Module<'js, T> { + Module { + ptr, + ctx, + _type_marker: PhantomData, + } } - pub fn with_source(&mut self, name: N, source: S) -> &mut Self + unsafe extern "C" fn eval_fn( + ctx: *mut qjs::JSContext, + ptr: *mut qjs::JSModuleDef, + ) -> qjs::c_int where - N: Into>, - S: Into>, + D: ModuleDef, { - self.modules.push(ModuleData::source(name, source)); - self + let ctx = Ctx::from_ptr(ctx); + // Should never be null + let ptr = NonNull::new(ptr).unwrap(); + let module = unsafe { Module::from_ptr(ctx.clone(), ptr) }; + let exports = Exports(module); + match D::evaluate(&ctx, &exports) { + Ok(_) => 0, + Err(error) => { + error.throw(&ctx); + -1 + } + } } - pub fn native(mut self, name: N) -> Self + /// Returns the name of the module + pub fn name(&self) -> Result where - D: ModuleDef, - N: Into>, + N: FromAtom<'js>, { - self.with_native::(name); - self + let name = unsafe { + Atom::from_atom_val( + self.ctx.clone(), + qjs::JS_GetModuleName(self.ctx.as_ptr(), self.as_ptr()), + ) + }; + N::from_atom(name) } +} - pub fn with_native(&mut self, name: N) -> &mut Self +impl<'js> Module<'js, Declared> { + /// Declare a module but don't evaluate it. + pub fn declare(ctx: Ctx<'js>, name: N, source: S) -> Result> where - D: ModuleDef, N: Into>, + S: Into>, { - self.modules.push(ModuleData::native::(name)); - self - } - - pub fn eval<'js>(self, ctx: &Ctx<'js>) -> Result>> { - let mut modules = Vec::with_capacity(self.modules.len()); - for m in self - .modules - .into_iter() - .map(|x| unsafe { x.unsafe_declare(ctx.clone()) }) - { - modules.push(m?); - } - - for m in modules.iter() { - // Safety: This is save usage of the modules since if any fail to evaluate we - // immediately return and drop all modules - unsafe { m.eval()? } - } - // All modules evaluated without error so they are all still alive. - Ok(modules) - } -} - -impl Default for ModulesBuilder { - fn default() -> Self { - Self::new() - } -} - -/// Module declarations. -/// -/// Struct used in the [`ModuleDef`] trait for declaring module exports. -pub struct Declarations { - declarations: HashSet>, -} + let name = CString::new(name)?; + let flag = + qjs::JS_EVAL_TYPE_MODULE | qjs::JS_EVAL_FLAG_STRICT | qjs::JS_EVAL_FLAG_COMPILE_ONLY; -impl Declarations { - pub(crate) fn new() -> Self { - Declarations { - declarations: HashSet::new(), - } + let module_val = unsafe { ctx.eval_raw(source, name.as_c_str(), flag as i32)? }; + let module_val = unsafe { ctx.handle_exception(module_val)? }; + debug_assert_eq!(qjs::JS_TAG_MODULE, unsafe { + qjs::JS_VALUE_GET_TAG(module_val) + }); + let module_ptr = unsafe { + NonNull::new(qjs::JS_VALUE_GET_PTR(module_val).cast()).ok_or(Error::Unknown)? + }; + unsafe { Ok(Module::from_ptr(ctx, module_ptr)) } } - /// Define a new export in a module. - pub fn declare(&mut self, name: N) -> Result<&mut Self> + /// Declare a rust native module but don't evaluate it. + pub fn declare_def(ctx: Ctx<'js>, name: N) -> Result> where N: Into>, + D: ModuleDef, { - self.declarations.insert(Cow::Owned(CString::new(name)?)); - Ok(self) - } - - /// Define a new export in a module using a static `CStr`. - /// - /// This method is can be used to avoid some allocation in the case that the name is static. - pub fn declare_static(&mut self, name: &'static CStr) -> Result<&mut Self> { - self.declarations.insert(Cow::Borrowed(name)); - Ok(self) - } - - pub(crate) unsafe fn apply(self, ctx: Ctx<'_>, module: &Module) -> Result<()> { - for k in self.declarations { - let ptr = match k { - Cow::Borrowed(x) => x.as_ptr(), - Cow::Owned(x) => x.into_raw(), - }; - let res = unsafe { - qjs::JS_AddModuleExport(ctx.as_ptr(), module.as_module_def().as_ptr(), ptr) - }; - if res < 0 { - return Err(Error::Allocation); - } - } - Ok(()) - } - - /// Returns an iterator over existing declarations. - pub fn iter(&self) -> impl Iterator> { - self.declarations.iter() - } -} - -struct Export<'js> { - name: CString, - value: Value<'js>, -} - -/// A struct used to load the exports of a module. -/// -/// Used in the `ModuleDef::load`. -pub struct Exports<'js> { - ctx: Ctx<'js>, - exports: Vec>, -} - -impl<'js> Exports<'js> { - pub(crate) fn new(ctx: Ctx<'js>) -> Self { - Exports { - ctx, - exports: Vec::new(), - } - } - - /// Export a new value from the module. - pub fn export>, T: IntoJs<'js>>( - &mut self, - name: N, - value: T, - ) -> Result<&mut Self> { - let name = CString::new(name.into())?; - let value = value.into_js(&self.ctx)?; - self.export_value(name, value) - } - - /// Export a new value from the module. - pub fn export_value(&mut self, name: CString, value: Value<'js>) -> Result<&mut Self> { - self.exports.push(Export { name, value }); - Ok(self) - } - - pub(crate) unsafe fn apply(self, module: Module) -> Result<()> { - for export in self.exports { - let name = export.name; - let value = export.value; - - let res = unsafe { - // Ownership of name is retained - // Ownership of value is transferred. - qjs::JS_SetModuleExport( - self.ctx.as_ptr(), - module.as_module_def().as_ptr(), - name.as_ref().as_ptr(), - value.into_js_value(), - ) - }; - - // The below is wrong, if a value is applied but not previously defined the above - // function can error! - // - // WRONG: previous checks and the fact that we also previously added the export should ensure - // that the only error can be an allocation error. - if res < 0 { - return Err(Error::Unknown); - } - } - Ok(()) - } - - /// Returns an iterator over existing imports. - pub fn iter(&self) -> impl Iterator)> { - self.exports.iter().map(|x| (x.name.as_c_str(), &x.value)) - } -} - -/// A JavaScript module. -/// -/// # Safety -/// In QuickJS JavaScript modules are loaded in two steps. First a module is declared, the runtime -/// is made aware of its existence, given a name, and its exports are defined. -/// -/// Then after declaration the module is evaluated, the module's exports are actually given a -/// value. -/// -/// QuickJS handles module lifetime differently then other JavaScript values. Modules live, once -/// evaluated, for the entire lifetime of the runtime. However before they are evaluated they can -/// be removed at any point. -/// -/// Specifically all unevaluated modules are removed if any module generates an error during either -/// declaration or evaluation. As a result while it is possible to acquire a unevaluated module, it -/// is unsafe to hold onto such a module and any function which returns such an unevaluated modules -/// is marked as unsafe. -#[derive(Clone)] -#[must_use = "if access to the module object is not required, prefer to only declare a module"] -pub struct Module<'js> { - ctx: Ctx<'js>, - /// Module lifetime, behave differently then normal lifetimes. - /// A module lives for the entire lifetime of the runtime, so we don't need to keep track of - /// reference counts. - module: NonNull, -} - -/// Module definition trait -pub trait ModuleDef { - fn declare(declare: &mut Declarations) -> Result<()> { - let _ = declare; - Ok(()) - } - - /// The exports should be added here - fn evaluate<'js>(_ctx: &Ctx<'js>, exports: &mut Exports<'js>) -> Result<()> { - let _ = exports; - Ok(()) - } -} + let name = CString::new(name)?; + let ptr = + unsafe { qjs::JS_NewCModule(ctx.as_ptr(), name.as_ptr(), Some(Self::eval_fn::)) }; + let ptr = NonNull::new(ptr).ok_or(Error::Unknown)?; + let m = unsafe { Module::from_ptr(ctx, ptr) }; -impl<'js> Module<'js> { - pub(crate) fn from_module_def(ctx: Ctx<'js>, def: NonNull) -> Self { - Module { ctx, module: def } - } + let decl = Declarations(m); + D::declare(&decl)?; - pub(crate) fn as_module_def(&self) -> NonNull { - self.module + Ok(decl.0) + //Ok(()) } - /// Declares a new JS module in the context. - /// - /// This function doesn't return a module since holding on to unevaluated modules is unsafe. - /// If you need to hold onto unsafe modules use the [`Module::unsafe_declare`] functions. + /// Evaluate the source of a module. /// - /// It is unsafe to hold onto unevaluated modules across this call. - pub fn declare(ctx: Ctx<'js>, name: N, source: S) -> Result<()> - where - N: Into>, - S: Into>, - { - unsafe { - let _ = Self::unsafe_declare(ctx, name, source)?; - } - Ok(()) - } - - /// Creates a new module from JS source, and evaluates it. + /// This function returns a promise which resolved when the modules was fully compiled and + /// returns undefined. /// - /// It is unsafe to hold onto unevaluated modules across this call. - pub fn evaluate(ctx: Ctx<'js>, name: N, source: S) -> Result> + /// Since QuickJS doesn't give us a way to retrieve the module if we immediately evaluate a + /// modules source this function doesn't return a module object. + /// If the module is required, you should first declare it with [`Module::declare`] and then call [`Module::eval`] on the + /// returned module. + pub fn evaluate(ctx: Ctx<'js>, name: N, source: S) -> Result> where N: Into>, S: Into>, { - let module = unsafe { Self::unsafe_declare(ctx, name, source)? }; - unsafe { module.eval()? }; - Ok(module) - } + let name = CString::new(name)?; + let flag = qjs::JS_EVAL_TYPE_MODULE | qjs::JS_EVAL_FLAG_STRICT; - /// Declare a module in the runtime. - /// - /// This function doesn't return a module since holding on to unevaluated modules is unsafe. - /// If you need to hold onto unsafe modules use the [`Module::unsafe_declare_def`] functions. - /// - /// It is unsound to hold onto an unevaluated module across any call to this function which - /// returns an error. - pub fn declare_def(ctx: Ctx<'js>, name: N) -> Result<()> - where - N: Into>, - D: ModuleDef, - { - unsafe { - let _ = Self::unsafe_declare_def::(ctx, name)?; - } - Ok(()) + let module_val = unsafe { ctx.eval_raw(source, name.as_c_str(), flag as i32)? }; + let module_val = unsafe { ctx.handle_exception(module_val)? }; + let v = unsafe { Value::from_js_value(ctx, module_val) }; + Ok(v.into_promise().expect("evaluate should return a promise")) } /// Declares a module in the runtime and evaluates it. - /// - /// It is unsound to hold onto an unevaluated module across any call to this function which - /// returns an error. - pub fn evaluate_def(ctx: Ctx<'js>, name: N) -> Result> + pub fn evaluate_def( + ctx: Ctx<'js>, + name: N, + ) -> Result<(Module<'js, Evaluated>, Promise<'js>)> where N: Into>, D: ModuleDef, { - let module = unsafe { Self::unsafe_declare_def::(ctx, name)? }; - unsafe { module.eval()? }; - Ok(module) + let module = Self::declare_def::(ctx, name)?; + module.eval() } - /// Returns the name of the module - pub fn name(&self) -> Result - where - N: FromAtom<'js>, - { - let name = unsafe { - Atom::from_atom_val( - self.ctx.clone(), - qjs::JS_GetModuleName(self.ctx.as_ptr(), self.as_module_def().as_ptr()), + /// Load a module from quickjs bytecode. + /// + /// # Safety + /// User must ensure that bytes handed to this function contain valid bytecode. + pub unsafe fn load(ctx: Ctx<'js>, bytes: &[u8]) -> Result> { + let module = unsafe { + qjs::JS_ReadObject( + ctx.as_ptr(), + bytes.as_ptr(), + bytes.len() as _, + (qjs::JS_READ_OBJ_BYTECODE | qjs::JS_READ_OBJ_ROM_DATA) as i32, ) }; - N::from_atom(name) + let module = ctx.handle_exception(module)?; + debug_assert_eq!(qjs::JS_TAG_MODULE, unsafe { qjs::JS_VALUE_GET_TAG(module) }); + let module_ptr = + unsafe { NonNull::new(qjs::JS_VALUE_GET_PTR(module).cast()).ok_or(Error::Unknown)? }; + unsafe { Ok(Module::from_ptr(ctx, module_ptr)) } } - /// Return the `import.meta` object of a module - pub fn meta(&self) -> Result + /// Load a module from a raw module loading function. + /// + /// # Safety + /// The soundness of this function depends completely on if load_fn is implemented correctly. + /// THe load_fn function must return a pointer to a valid module loaded with the given context. + pub unsafe fn from_load_fn( + ctx: Ctx<'js>, + name: N, + load_fn: ModuleLoadFn, + ) -> Result> where - T: FromJs<'js>, + N: Into>, { - let meta = unsafe { - Value::from_js_value( - self.ctx.clone(), - self.ctx.handle_exception(qjs::JS_GetImportMeta( - self.ctx.as_ptr(), - self.as_module_def().as_ptr(), - ))?, - ) - }; - T::from_js(&self.ctx, meta) - } - - /// Write object bytecode for the module in little endian format. - pub fn write_object_le(&self) -> Result> { - let swap = cfg!(target_endian = "big"); - self.write_object(swap) + let name = CString::new(name)?; + let ptr = (load_fn)(ctx.as_ptr(), name.as_ptr().cast()); + let ptr = NonNull::new(ptr).ok_or(Error::Exception)?; + unsafe { Ok(Module::from_ptr(ctx, ptr)) } } - /// Write object bytecode for the module in big endian format. - pub fn write_object_be(&self) -> Result> { - let swap = cfg!(target_endian = "little"); - self.write_object(swap) + /// Evaluate the module. + /// + /// Returns the module as being evaluated and a promise which resolves when the module has finished evaluating. + /// The return value of the promise is the JavaScript value undefined. + pub fn eval(self) -> Result<(Module<'js, Evaluated>, Promise<'js>)> { + let ret = unsafe { + // JS_EvalFunction `free's` the module so we should dup first + let v = qjs::JS_MKPTR(qjs::JS_TAG_MODULE, self.ptr.as_ptr().cast()); + qjs::JS_DupValue(v); + qjs::JS_EvalFunction(self.ctx.as_ptr(), v) + }; + let ret = unsafe { self.ctx.handle_exception(ret)? }; + let promise = unsafe { Promise::from_js_value(self.ctx.clone(), ret) }; + Ok(( + Module { + ptr: self.ptr, + ctx: self.ctx, + _type_marker: PhantomData, + }, + promise, + )) } /// A function for loading a Rust module from C. @@ -569,8 +331,8 @@ impl<'js> Module<'js> { Context::init_raw(ctx); let ctx = Ctx::from_ptr(ctx); let name = CStr::from_ptr(name).to_bytes(); - match Self::unsafe_declare_def::(ctx.clone(), name) { - Ok(module) => module.as_module_def().as_ptr(), + match Self::declare_def::(ctx.clone(), name) { + Ok(module) => module.as_ptr(), Err(error) => { error.throw(&ctx); ptr::null_mut() @@ -578,12 +340,48 @@ impl<'js> Module<'js> { } } + /// Import and evaluate a module + /// + /// This will work similar to an `import(specifier)` statement in JavaScript returning a promise with the result of the imported module. + pub fn import>>(ctx: &Ctx<'js>, specifier: S) -> Result> { + let specifier = CString::new(specifier)?; + unsafe { + let base_name = ctx + .script_or_module_name(1) + .unwrap_or_else(|| Atom::from_predefined(ctx.clone(), PredefinedAtom::Empty)); + + let base_name_c_str = qjs::JS_AtomToCString(ctx.as_ptr(), base_name.atom); + + let res = qjs::JS_LoadModule(ctx.as_ptr(), base_name_c_str, specifier.as_ptr()); + + qjs::JS_FreeCString(ctx.as_ptr(), base_name_c_str); + + let res = ctx.handle_exception(res)?; + + Ok(Promise::from_js_value(ctx.clone(), res)) + } + } +} + +impl<'js, Evaluated> Module<'js, Evaluated> { + /// Write object bytecode for the module in little endian format. + pub fn write_le(&self) -> Result> { + let swap = cfg!(target_endian = "big"); + self.write(swap) + } + + /// Write object bytecode for the module in big endian format. + pub fn write_be(&self) -> Result> { + let swap = cfg!(target_endian = "little"); + self.write(swap) + } + /// Write object bytecode for the module. /// /// `swap_endianess` swaps the endianness of the bytecode, if true, from native to the other /// kind. Use if the bytecode is meant for a target with a different endianness than the /// current. - pub fn write_object(&self, swap_endianess: bool) -> Result> { + pub fn write(&self, swap_endianess: bool) -> Result> { let ctx = &self.ctx; let mut len = MaybeUninit::uninit(); // TODO: Allow inclusion of other flags? @@ -591,9 +389,14 @@ impl<'js> Module<'js> { if swap_endianess { flags |= qjs::JS_WRITE_OBJ_BSWAP; } - let value = qjs::JS_MKPTR(qjs::JS_TAG_MODULE, self.module.as_ptr().cast()); - let buf = - unsafe { qjs::JS_WriteObject(ctx.as_ptr(), len.as_mut_ptr(), value, flags as i32) }; + let buf = unsafe { + qjs::JS_WriteObject( + ctx.as_ptr(), + len.as_mut_ptr(), + qjs::JS_MKPTR(qjs::JS_TAG_MODULE, self.ptr.as_ptr().cast()), + flags as i32, + ) + }; if buf.is_null() { return Err(ctx.raise_exception()); } @@ -604,313 +407,44 @@ impl<'js> Module<'js> { Ok(obj) } - /// Read object bytecode and declare it as a module. - pub fn declare_read_object(ctx: Ctx<'js>, bytes: &[u8]) -> Result<()> { - unsafe { - let _ = Self::unsafe_declare_read_object(ctx, bytes)?; - } - Ok(()) - } - - /// Read object bytecode and declare it as a module and then evaluate it. - pub fn instantiate_read_object(ctx: Ctx<'js>, bytes: &[u8]) -> Result> { - let module = unsafe { Self::unsafe_declare_read_object(ctx, bytes)? }; + /// Return the `import.meta` object of a module + pub fn meta(&self) -> Result> { unsafe { - module.eval()?; - } - Ok(module) - } - - /// Read object bytecode and declare it as a module. - /// - /// # Safety - /// - /// QuickJS frees all unevaluated modules if any error happens while declaring or evaluating a - /// module. If any call to either `Module::new` or `Module::eval` fails it is undefined - /// behavior to use any unevaluated modules. - /// - /// It is unsound to hold onto an unevaluated module across any call to this function which - /// returns an error. - pub unsafe fn unsafe_declare_read_object(ctx: Ctx<'js>, bytes: &[u8]) -> Result> { - let module = unsafe { - qjs::JS_ReadObject( - ctx.as_ptr(), - bytes.as_ptr(), - bytes.len() as _, - (qjs::JS_READ_OBJ_BYTECODE | qjs::JS_READ_OBJ_ROM_DATA) as i32, - ) - }; - let module = ctx.handle_exception(module)?; - debug_assert_eq!(qjs::JS_TAG_MODULE, unsafe { qjs::JS_VALUE_GET_TAG(module) }); - let module = qjs::JS_VALUE_GET_PTR(module).cast::(); - // QuickJS should throw an exception on allocation errors - // So this should always be non-null. - let module = NonNull::new(module).unwrap(); - Ok(Module { ctx, module }) - } - - /// Creates a new module from JS source but doesn't evaluate the module. - /// - /// # Safety - /// - /// QuickJS frees all unevaluated modules if any error happens while declaring or evaluating a - /// module. If any call to either `Module::new` or `Module::eval` fails it is undefined - /// behavior to use any unevaluated modules. - /// - /// It is unsound to hold onto an unevaluated module across any call to this function which - /// returns an error. - pub unsafe fn unsafe_declare(ctx: Ctx<'js>, name: N, source: S) -> Result> - where - N: Into>, - S: Into>, - { - let name = CString::new(name)?; - let flag = - qjs::JS_EVAL_TYPE_MODULE | qjs::JS_EVAL_FLAG_STRICT | qjs::JS_EVAL_FLAG_COMPILE_ONLY; - - let module = unsafe { ctx.eval_raw(source, name.as_c_str(), flag as i32)? }; - let module = ctx.handle_exception(module)?; - debug_assert_eq!(qjs::JS_TAG_MODULE, unsafe { qjs::JS_VALUE_GET_TAG(module) }); - let module = qjs::JS_VALUE_GET_PTR(module).cast::(); - // QuickJS should throw an exception on allocation errors - // So this should always be non-null. - let module = NonNull::new(module).unwrap(); - - Ok(Module { ctx, module }) - } - - /// Creates a new module from JS source but doesn't evaluate the module. - /// - /// # Safety - /// It is unsafe to use an unevaluated for anything other then evaluating it with - /// `Module::eval`. - /// - /// QuickJS frees all unevaluated modules if any error happens while declaring or evaluating a - /// module. If any call to either `Module::new` or `Module::eval` fails it is undefined - /// behavior to use any unevaluated modules. - /// - /// It is unsound to hold onto an unevaluated module across any call to this function which - /// returns an error. - pub unsafe fn unsafe_declare_def(ctx: Ctx<'js>, name: N) -> Result> - where - N: Into>, - D: ModuleDef, - { - let name = CString::new(name)?; - - let mut defs = Declarations::new(); - D::declare(&mut defs)?; - - let ptr = - unsafe { qjs::JS_NewCModule(ctx.as_ptr(), name.as_ptr(), Some(Self::eval_fn::)) }; - - let ptr = NonNull::new(ptr).ok_or(Error::Allocation)?; - let module = Module::from_module_def(ctx.clone(), ptr); - // Safety: Safe because this is a newly created - unsafe { defs.apply(ctx, &module)? }; - Ok(module) - } - - unsafe extern "C" fn eval_fn( - ctx: *mut qjs::JSContext, - ptr: *mut qjs::JSModuleDef, - ) -> qjs::c_int - where - D: ModuleDef, - { - let ctx = Ctx::from_ptr(ctx); - // Should never be null - debug_assert_ne!(ptr, ptr::null_mut()); - let ptr = NonNull::new_unchecked(ptr); - let module = Self::from_module_def(ctx.clone(), ptr); - let mut exports = Exports::new(ctx.clone()); - match D::evaluate(&ctx, &mut exports).and_then(|_| exports.apply(module)) { - Ok(_) => 0, - Err(error) => { - error.throw(&ctx); - -1 - } + Ok(Object::from_js_value( + self.ctx.clone(), + self.ctx + .handle_exception(qjs::JS_GetImportMeta(self.ctx.as_ptr(), self.as_ptr()))?, + )) } } - /// Evaluates an unevaluated module. - /// - /// # Safety - /// This function should only be called on unevaluated modules. - /// - /// QuickJS frees all unevaluated modules if any error happens while declaring or evaluating a - /// module. If any call to either `Module::new` or `Module::eval` fails it is undefined - /// behavior to use any unevaluated modules. - /// - /// Prefer the use of either `ModuleBuilder` or `Module::new`. - /// - /// It is unsound to hold onto an unevaluated module across any call to this function which - /// returns an error. - pub unsafe fn eval(&self) -> Result<()> { + /// Returns the module namespace, an object containing all the module exported values. + pub fn namespace(&self) -> Result> { unsafe { - let value = qjs::JS_MKPTR(qjs::JS_TAG_MODULE, self.module.as_ptr().cast()); - // JS_EvalFunction `free's` the module so we should dup first - let ret = qjs::JS_EvalFunction(self.ctx.as_ptr(), qjs::JS_DupValue(value)); - self.ctx.handle_exception(ret)?; + let v = qjs::JS_GetModuleNamespace(self.ctx.as_ptr(), self.as_ptr()); + let v = self.ctx.handle_exception(v)?; + Ok(Object::from_js_value(self.ctx.clone(), v)) } - Ok(()) - } - - /// Import and evaluate a module - /// - /// This will work similar to an `await import(specifier)` statement in JavaScript but will return the import and not a promise - pub fn import, S: AsRef<[u8]>>(ctx: &Ctx<'js>, specifier: S) -> Result { - let specifier = specifier.as_ref(); - let val = unsafe { - let js_string_val = qjs::JS_NewStringLen( - ctx.as_ptr(), - specifier.as_ptr() as *mut _, - specifier.len() as qjs::size_t, - ); - let js_string = qjs::JS_ToCString(ctx.as_ptr(), js_string_val); - let val = qjs::JS_DynamicImportSync(ctx.as_ptr(), js_string); - qjs::JS_FreeValue(ctx.as_ptr(), js_string_val); - let val = ctx.handle_exception(val)?; - Value::from_js_value(ctx.clone(), val) - }; - - V::from_js(ctx, val) } -} -#[cfg(feature = "exports")] -impl<'js> Module<'js> { /// Return exported value by name pub fn get(&self, name: N) -> Result where - N: AsRef, + N: IntoAtom<'js>, T: FromJs<'js>, { - let name = CString::new(name.as_ref())?; - let value = unsafe { - Value::from_js_value( - self.ctx.clone(), - self.ctx.handle_exception(qjs::JS_GetModuleExport( - self.ctx.as_ptr(), - self.as_module_def().as_ptr(), - name.as_ptr(), - ))?, - ) - }; - T::from_js(&self.ctx, value) - } - - /// Returns a iterator over the exported names of the module export. - #[cfg_attr(feature = "doc-cfg", doc(cfg(feature = "exports")))] - pub fn names(self) -> ExportNamesIter<'js, N> - where - N: FromAtom<'js>, - { - let count = unsafe { qjs::JS_GetModuleExportEntriesCount(self.as_module_def().as_ptr()) }; - ExportNamesIter { - module: self, - count, - index: 0, - marker: PhantomData, - } - } - - /// Returns a iterator over the items the module export. - #[cfg_attr(feature = "doc-cfg", doc(cfg(feature = "exports")))] - pub fn entries(self) -> ExportEntriesIter<'js, N, T> - where - N: FromAtom<'js>, - T: FromJs<'js>, - { - let count = unsafe { qjs::JS_GetModuleExportEntriesCount(self.as_module_def().as_ptr()) }; - ExportEntriesIter { - module: self, - count, - index: 0, - marker: PhantomData, - } - } - - #[doc(hidden)] - pub unsafe fn dump_exports(&self) { - let ptr = self.as_module_def().as_ptr(); - let count = qjs::JS_GetModuleExportEntriesCount(ptr); - for i in 0..count { - let atom_name = Atom::from_atom_val( - self.ctx.clone(), - qjs::JS_GetModuleExportEntryName(self.ctx.as_ptr(), ptr, i), - ); - println!("{}", atom_name.to_string().unwrap()); - } - } -} - -/// An iterator over the items exported out a module -#[cfg(feature = "exports")] -#[cfg_attr(feature = "doc-cfg", doc(cfg(feature = "exports")))] -pub struct ExportNamesIter<'js, N> { - module: Module<'js>, - count: i32, - index: i32, - marker: PhantomData, -} - -#[cfg(feature = "exports")] -impl<'js, N> Iterator for ExportNamesIter<'js, N> -where - N: FromAtom<'js>, -{ - type Item = Result; - - fn next(&mut self) -> Option { - if self.index == self.count { - return None; - } - let ctx = &self.module.ctx; - let ptr = self.module.as_module_def().as_ptr(); - let atom = unsafe { - let atom_val = qjs::JS_GetModuleExportEntryName(ctx.as_ptr(), ptr, self.index); - Atom::from_atom_val(ctx.clone(), atom_val) - }; - self.index += 1; - Some(N::from_atom(atom)) + self.namespace()?.get(name) } -} -/// An iterator over the items exported out a module -#[cfg(feature = "exports")] -#[cfg_attr(feature = "doc-cfg", doc(cfg(feature = "exports")))] -pub struct ExportEntriesIter<'js, N, T> { - module: Module<'js>, - count: i32, - index: i32, - marker: PhantomData<(N, T)>, -} - -#[cfg(feature = "exports")] -impl<'js, N, T> Iterator for ExportEntriesIter<'js, N, T> -where - N: FromAtom<'js>, - T: FromJs<'js>, -{ - type Item = Result<(N, T)>; - - fn next(&mut self) -> Option { - if self.index == self.count { - return None; + /// Change the module back to being only declared. + /// + /// This is always safe to do since calling eval again on an already evaluated module is safe. + pub fn into_declared(self) -> Module<'js, Declared> { + Module { + ptr: self.ptr, + ctx: self.ctx, + _type_marker: PhantomData, } - let ctx = &self.module.ctx; - let ptr = self.module.as_module_def().as_ptr(); - let name = unsafe { - let atom_val = qjs::JS_GetModuleExportEntryName(ctx.as_ptr(), ptr, self.index); - Atom::from_atom_val(ctx.clone(), atom_val) - }; - let value = unsafe { - let js_val = qjs::JS_GetModuleExportEntry(ctx.as_ptr(), ptr, self.index); - Value::from_js_value(ctx.clone(), js_val) - }; - self.index += 1; - Some(N::from_atom(name).and_then(|name| T::from_js(ctx, value).map(|value| (name, value)))) } } @@ -923,13 +457,13 @@ mod test { pub struct RustModule; impl ModuleDef for RustModule { - fn declare(define: &mut Declarations) -> Result<()> { - define.declare_static(CStr::from_bytes_with_nul(b"hello\0")?)?; + fn declare(define: &Declarations) -> Result<()> { + define.declare_c_str(CStr::from_bytes_with_nul(b"hello\0")?)?; Ok(()) } - fn evaluate<'js>(_ctx: &Ctx<'js>, exports: &mut Exports<'js>) -> Result<()> { - exports.export("hello", "world".to_string())?; + fn evaluate<'js>(_ctx: &Ctx<'js>, exports: &Exports<'js>) -> Result<()> { + exports.export_c_str(CStr::from_bytes_with_nul(b"hello\0")?, "world")?; Ok(()) } } @@ -937,11 +471,11 @@ mod test { pub struct CrashingRustModule; impl ModuleDef for CrashingRustModule { - fn declare(_: &mut Declarations) -> Result<()> { + fn declare(_: &Declarations) -> Result<()> { Ok(()) } - fn evaluate<'js>(ctx: &Ctx<'js>, _exports: &mut Exports<'js>) -> Result<()> { + fn evaluate<'js>(ctx: &Ctx<'js>, _exports: &Exports<'js>) -> Result<()> { ctx.eval::<(), _>(r#"throw new Error("kaboom")"#)?; Ok(()) } @@ -965,17 +499,53 @@ mod test { fn import_native() { test_with(|ctx| { Module::declare_def::(ctx.clone(), "rust_mod").unwrap(); - let _ = ctx - .clone() - .compile( - "test", - r#" + Module::evaluate( + ctx.clone(), + "test", + r#" import { hello } from "rust_mod"; globalThis.hello = hello; "#, - ) + ) + .unwrap() + .finish::<()>() + .unwrap(); + let text = ctx + .globals() + .get::<_, String>("hello") + .unwrap() + .to_string() .unwrap(); + assert_eq!(text.as_str(), "world"); + }) + } + + #[test] + fn import_async() { + test_with(|ctx| { + Module::declare( + ctx.clone(), + "rust_mod", + " + async function foo(){ + return 'world'; + }; + export let hello = await foo(); + ", + ) + .unwrap(); + Module::evaluate( + ctx.clone(), + "test", + r#" + import { hello } from "rust_mod"; + globalThis.hello = hello; + "#, + ) + .unwrap() + .finish::<()>() + .unwrap(); let text = ctx .globals() .get::<_, String>("hello") @@ -990,7 +560,7 @@ mod test { fn import() { test_with(|ctx| { Module::declare_def::(ctx.clone(), "rust_mod").unwrap(); - let val: Object = Module::import(&ctx, "rust_mod").unwrap(); + let val: Object = Module::import(&ctx, "rust_mod").unwrap().finish().unwrap(); let hello: StdString = val.get("hello").unwrap(); assert_eq!(&hello, "world"); @@ -1006,54 +576,74 @@ mod test { let ctx = Context::full(&runtime).unwrap(); ctx.with(|ctx| { Module::declare_def::(ctx.clone(), "bad_rust_mod").unwrap(); - let _: Value = Module::import(&ctx, "bad_rust_mod").catch(&ctx).unwrap(); + let _: Value = Module::import(&ctx, "bad_rust_mod") + .catch(&ctx) + .unwrap() + .finish() + .catch(&ctx) + .unwrap(); }); } #[test] - fn holding_onto_unevaluated() { + fn eval_crashing_module_inside_module() { let runtime = Runtime::new().unwrap(); let ctx = Context::full(&runtime).unwrap(); + ctx.with(|ctx| { - let module = unsafe { - Module::unsafe_declare( - ctx.clone(), - "test", - "export function add(a,b){ return a + b }", - ) - .unwrap() + let globals = ctx.globals(); + let eval_crashing = |ctx: Ctx| { + Module::evaluate(ctx, "test2", "throw new Error(1)").map(|x| x.finish::<()>()) }; - // Error - ctx.compile("test2", "throw new Error(1)").ok(); + let function = Function::new(ctx.clone(), eval_crashing).unwrap(); + globals.set("eval_crashing", function).unwrap(); - unsafe { module.eval().unwrap() } + let res = Module::evaluate(ctx, "test", " eval_crashing(); ") + .unwrap() + .finish::<()>(); + assert!(res.is_err()) }); } #[test] - fn eval_crashing_module_inside_module() { + fn access_before_fully_evaluating_module() { let runtime = Runtime::new().unwrap(); let ctx = Context::full(&runtime).unwrap(); ctx.with(|ctx| { - let globals = ctx.globals(); - let eval_crashing = |ctx: Ctx| ctx.compile("test2", "throw new Error(1)").map(|_| ()); - let function = Function::new(ctx.clone(), eval_crashing).unwrap(); - globals.set("eval_crashing", function).unwrap(); + let decl = Module::declare( + ctx, + "test", + r#" + async function async_res(){ + return await (async () => { + return "OK" + })() + }; + + export let res = await async_res() + "#, + ) + .unwrap(); - let res = ctx.compile("test", " eval_crashing(); "); - assert!(res.is_err()) + let (decl, promise) = decl.eval().unwrap(); + + let ns = decl.namespace().unwrap(); + ns.get::<_, ()>("res").unwrap_err(); + + promise.finish::<()>().unwrap(); + + assert_eq!(ns.get::<_, std::string::String>("res").unwrap(), "OK"); }); } #[test] fn from_javascript() { test_with(|ctx| { - let module: Module = ctx - .clone() - .compile( - "Test", - r#" + let (module, promise) = Module::declare( + ctx.clone(), + "Test", + r#" export var a = 2; export function foo(){ return "bar"} export class Baz{ @@ -1062,35 +652,23 @@ mod test { } } "#, - ) - .unwrap(); + ) + .unwrap() + .eval() + .unwrap(); + + promise.finish::<()>().unwrap(); assert_eq!(module.name::().unwrap(), "Test"); - let _ = module.meta::().unwrap(); - - #[cfg(feature = "exports")] - { - let names = module - .clone() - .names() - .collect::>>() - .unwrap(); - - assert_eq!(names[0], "a"); - assert_eq!(names[1], "foo"); - assert_eq!(names[2], "Baz"); - - let entries = module - .clone() - .entries() - .collect::>>() - .unwrap(); - - assert_eq!(entries[0].0, "a"); - assert_eq!(i32::from_js(&ctx, entries[0].1.clone()).unwrap(), 2); - assert_eq!(entries[1].0, "foo"); - assert_eq!(entries[2].0, "Baz"); - } + let _ = module.meta().unwrap(); + + let ns = module.namespace().unwrap(); + + assert!(ns.contains_key("a").unwrap()); + assert!(ns.contains_key("foo").unwrap()); + assert!(ns.contains_key("Baz").unwrap()); + + assert_eq!(ns.get::<_, u32>("a").unwrap(), 2u32); }); } } diff --git a/core/src/value/promise.rs b/core/src/value/promise.rs new file mode 100644 index 000000000..757aea17b --- /dev/null +++ b/core/src/value/promise.rs @@ -0,0 +1,464 @@ +//! Javascript promises and future integration. +#[cfg(feature = "futures")] +use std::{ + cell::RefCell, + future::Future, + marker::PhantomData, + pin::Pin, + rc::Rc, + task::{Context as TaskContext, Poll, Waker}, +}; + +use crate::{ + atom::PredefinedAtom, qjs, Ctx, Error, FromJs, Function, IntoJs, Object, Result, Value, +}; +#[cfg(feature = "futures")] +use crate::{function::This, CatchResultExt, CaughtError}; + +/// The execution state of a promise. +#[derive(Clone, Copy, Eq, PartialEq, Debug)] +pub enum PromiseState { + /// The promise has not yet completed. + Pending, + /// The promise completed succefully. + Resolved, + /// The promise completed with an error. + Rejected, +} + +/// A JavaScript promise. +#[derive(Debug, PartialEq, Clone, Hash, Eq)] +#[repr(transparent)] +pub struct Promise<'js>(pub(crate) Object<'js>); + +impl<'js> Promise<'js> { + #[cfg_attr(feature = "doc-cfg", doc(cfg(feature = "futures")))] + #[cfg(feature = "futures")] + pub fn wrap_future(ctx: &Ctx<'js>, future: F) -> Result + where + F: Future + 'js, + R: IntoJs<'js>, + { + let (promise, resolve, reject) = ctx.promise()?; + let ctx_clone = ctx.clone(); + let future = async move { + let err = match future.await.into_js(&ctx_clone).catch(&ctx_clone) { + Ok(x) => resolve.call::<_, ()>((x,)), + Err(e) => match e { + CaughtError::Exception(e) => reject.call::<_, ()>((e,)), + CaughtError::Value(e) => reject.call::<_, ()>((e,)), + CaughtError::Error(e) => { + let is_exception = unsafe { qjs::JS_IsException(e.throw(&ctx_clone)) }; + debug_assert!(is_exception); + let e = ctx_clone.catch(); + reject.call::<_, ()>((e,)) + } + }, + }; + // TODO figure out something better to do here. + if let Err(e) = err { + println!("promise handle function returned error:{}", e); + } + }; + ctx.spawn(future); + Ok(promise) + } + + /// Create a new JavaScript promise along with its resolve and reject functions. + pub fn new(ctx: &Ctx<'js>) -> Result<(Self, Function<'js>, Function<'js>)> { + ctx.promise() + } + + /// Returns the state of the promise, either pending,resolved or rejected. + pub fn state(&self) -> PromiseState { + let v = unsafe { qjs::JS_PromiseState(self.ctx().as_ptr(), self.as_js_value()) }; + match v { + qjs::JSPromiseStateEnum_JS_PROMISE_PENDING => PromiseState::Pending, + qjs::JSPromiseStateEnum_JS_PROMISE_FULFILLED => PromiseState::Resolved, + qjs::JSPromiseStateEnum_JS_PROMISE_REJECTED => PromiseState::Rejected, + _ => unreachable!(), + } + } + + /// Returns the `then` function, used for chaining promises. + pub fn then(&self) -> Result> { + self.get(PredefinedAtom::Then) + } + + /// Returns the `catch` function, used for retrieving the result of a rejected promise. + pub fn catch(&self) -> Result> { + self.get(PredefinedAtom::Catch) + } + + /// Returns the result of the future if there is one. + /// + /// Returns None if the promise has not yet been completed, Ok if the promise was resolved, and + /// [`Error::Exception`] if the promise rejected with the rejected value as the thrown + /// value retrievable via [`Ctx::catch`]. + pub fn result>(&self) -> Option> { + match self.state() { + PromiseState::Pending => None, + PromiseState::Resolved => { + let v = unsafe { qjs::JS_PromiseResult(self.ctx().as_ptr(), self.as_js_value()) }; + let v = unsafe { Value::from_js_value(self.ctx().clone(), v) }; + Some(FromJs::from_js(self.ctx(), v)) + } + PromiseState::Rejected => { + unsafe { + let v = qjs::JS_PromiseResult(self.ctx().as_ptr(), self.as_js_value()); + qjs::JS_Throw(self.ctx().as_ptr(), v); + }; + Some(Err(Error::Exception)) + } + } + } + + /// Runs the quickjs job queue until the promise is either rejected or resolved. + /// + /// If blocking on the promise would result in blocking, i.e. when the job queue runs out of + /// jobs before the promise can be resolved, this function returns [`Error::WouldBlock`] + /// indicating that no more work can be done at the momement. + /// + /// This function only drives the quickjs job queue, futures are not polled. + pub fn finish>(&self) -> Result { + loop { + if let Some(x) = self.result() { + return x; + } + + if !self.ctx.execute_pending_job() { + return Err(Error::WouldBlock); + } + } + } + + /// Wrap the promise into a struct which can be polled as a rust future. + #[cfg_attr(feature = "doc-cfg", doc(cfg(feature = "futures")))] + #[cfg(feature = "futures")] + pub fn into_future(self) -> PromiseFuture<'js, T> + where + T: FromJs<'js>, + { + PromiseFuture { + state: None, + promise: self, + _marker: PhantomData, + } + } +} + +/// Future-aware promise +#[cfg_attr(feature = "doc-cfg", doc(cfg(feature = "futures")))] +#[cfg(feature = "futures")] +#[must_use = "futures do nothing unless you `.await` or poll them"] +#[derive(Debug)] +pub struct PromiseFuture<'js, T> { + state: Option>>, + promise: Promise<'js>, + _marker: PhantomData, +} + +// Nothing is actually pinned so promise future is unpin. +#[cfg(feature = "futures")] +impl<'js, T> Unpin for PromiseFuture<'js, T> {} + +#[cfg(feature = "futures")] +impl<'js, T> Future for PromiseFuture<'js, T> +where + T: FromJs<'js>, +{ + type Output = Result; + + fn poll(self: Pin<&mut Self>, cx: &mut TaskContext<'_>) -> Poll { + let this = self.get_mut(); + + if let Some(x) = this.promise.result() { + return Poll::Ready(x); + } + + if this.state.is_none() { + let inner = Rc::new(RefCell::new(cx.waker().clone())); + this.state = Some(inner.clone()); + + let resolve = Function::new(this.promise.ctx.clone(), move || { + inner.borrow().wake_by_ref(); + })?; + + this.promise + .then()? + .call((This(this.promise.clone()), resolve.clone(), resolve))?; + return Poll::Pending; + } + + this.state + .as_ref() + .unwrap() + .borrow_mut() + .clone_from(cx.waker()); + + Poll::Pending + } +} + +/// Wrapper for futures to convert to JS promises +#[cfg_attr(feature = "doc-cfg", doc(cfg(feature = "futures")))] +#[repr(transparent)] +#[cfg(feature = "futures")] +pub struct Promised(pub T); + +#[cfg(feature = "futures")] +impl From for Promised { + fn from(future: T) -> Self { + Self(future) + } +} + +#[cfg(feature = "futures")] +impl<'js, T, R> IntoJs<'js> for Promised +where + T: Future + 'js, + R: IntoJs<'js> + 'js, +{ + fn into_js(self, ctx: &Ctx<'js>) -> Result> { + Promise::wrap_future(ctx, self.0).map(|x| x.into_value()) + } +} + +/// A type which behaves like a promise but can wrap any javascript value. +/// +/// This type is usefull when you are unsure if a function will return a promise. +/// You can call finish and turn it into a future like a normal promise. +/// When the value this type us converted isn't a promise it will behave like an promise which is +/// already resolved, otherwise it will call the right functions on the promise. +#[derive(Debug, PartialEq, Clone, Hash, Eq)] +pub struct MaybePromise<'js>(Value<'js>); + +impl<'js> FromJs<'js> for MaybePromise<'js> { + fn from_js(_ctx: &Ctx<'js>, value: Value<'js>) -> Result { + Ok(MaybePromise(value)) + } +} + +impl<'js> IntoJs<'js> for MaybePromise<'js> { + fn into_js(self, _ctx: &Ctx<'js>) -> Result> { + Ok(self.0) + } +} + +impl<'js> MaybePromise<'js> { + /// Reference to the inner value + pub fn as_value(&self) -> &Value<'js> { + &self.0 + } + + /// Convert into the inner value + pub fn into_value(self) -> Value<'js> { + self.0 + } + + /// Convert into the inner value + pub fn from_value(value: Value<'js>) -> Self { + MaybePromise(value) + } + + /// Returns the [`Ctx`] object associated with this value + pub fn ctx(&self) -> &Ctx<'js> { + self.0.ctx() + } + + /// Returns [`PromiseState::Resolved`] if the wrapped value isn't a promise, otherwise calls + /// [`Promise::state`] on the promise and returns it's value. + pub fn state(&self) -> PromiseState { + if let Some(x) = self.0.as_promise() { + x.state() + } else { + PromiseState::Resolved + } + } + + /// Returns the value if self isn't a promise, otherwise calls [`Promise::result`] on the promise. + pub fn result>(&self) -> Option> { + if let Some(x) = self.0.as_promise() { + x.result::() + } else { + Some(T::from_js(self.0.ctx(), self.0.clone())) + } + } + + /// Returns the value if self isn't a promise, otherwise calls [`Promise::finish`] on the promise. + pub fn finish>(&self) -> Result { + if let Some(x) = self.0.as_promise() { + x.finish::() + } else { + T::from_js(self.0.ctx(), self.0.clone()) + } + } + + /// Convert self into a future which will return ready if the wrapped value isn't a promise, + /// otherwise it will handle the promise like the future returned from + /// [`Promise::into_future`]. + #[cfg_attr(feature = "doc-cfg", doc(cfg(feature = "futures")))] + #[cfg(feature = "futures")] + pub fn into_future>(self) -> MaybePromiseFuture<'js, T> { + if self.0.is_promise() { + let fut = self.0.into_promise().unwrap().into_future(); + MaybePromiseFuture(MaybePromiseFutureInner::Future(fut)) + } else { + MaybePromiseFuture(MaybePromiseFutureInner::Ready(self.0)) + } + } +} + +/// Future-aware maybe promise +#[cfg_attr(feature = "doc-cfg", doc(cfg(feature = "futures")))] +#[cfg(feature = "futures")] +#[must_use = "futures do nothing unless you `.await` or poll them"] +#[derive(Debug)] +pub struct MaybePromiseFuture<'js, T>(MaybePromiseFutureInner<'js, T>); + +#[cfg_attr(feature = "doc-cfg", doc(cfg(feature = "futures")))] +#[cfg(feature = "futures")] +#[derive(Debug)] +enum MaybePromiseFutureInner<'js, T> { + Ready(Value<'js>), + Future(PromiseFuture<'js, T>), +} + +#[cfg(feature = "futures")] +impl<'js, T> Future for MaybePromiseFuture<'js, T> +where + T: FromJs<'js>, +{ + type Output = Result; + + fn poll(self: Pin<&mut Self>, cx: &mut TaskContext<'_>) -> Poll { + match self.get_mut().0 { + MaybePromiseFutureInner::Ready(ref x) => Poll::Ready(T::from_js(x.ctx(), x.clone())), + MaybePromiseFutureInner::Future(ref mut x) => Pin::new(x).poll(cx), + } + } +} + +#[cfg(test)] +mod test { + use std::time::Duration; + + use super::*; + #[cfg(feature = "futures")] + use crate::{ + async_with, + function::{Async, Func}, + AsyncContext, AsyncRuntime, + }; + + #[cfg(feature = "futures")] + async fn set_timeout<'js>(cb: Function<'js>, number: f64) -> Result<()> { + tokio::time::sleep(Duration::from_secs_f64(number / 1000.0)).await; + cb.call::<_, ()>(()) + } + + #[cfg(feature = "futures")] + #[tokio::test] + async fn promise() { + let rt = AsyncRuntime::new().unwrap(); + let ctx = AsyncContext::full(&rt).await.unwrap(); + + async_with!(ctx => |ctx| { + ctx.globals().set("setTimeout",Func::from(Async(set_timeout))).unwrap(); + + let func = ctx + .eval::( + r" + (function(){ + return new Promise((resolve) => { + setTimeout(x => { + resolve(42) + },100) + }) + }) + ", + ) + .catch(&ctx) + .unwrap(); + let promise: Promise = func.call(()).unwrap(); + assert_eq!(promise.into_future::().await.catch(&ctx).unwrap(), 42); + + let func = ctx + .eval::( + r" + (function(){ + return new Promise((_,reject) => { + setTimeout(x => { + reject(42) + },100) + }) + }) + ", + ) + .catch(&ctx) + .unwrap(); + let promise: Promise = func.call(()).unwrap(); + let err = promise.into_future::<()>().await.catch(&ctx); + match err { + Err(CaughtError::Value(v)) => { + assert_eq!(v.as_int().unwrap(), 42) + } + _ => panic!(), + } + }) + .await + } + + #[cfg(feature = "futures")] + #[tokio::test] + async fn promised() { + use crate::Exception; + + let rt = AsyncRuntime::new().unwrap(); + let ctx = AsyncContext::full(&rt).await.unwrap(); + + async_with!(ctx => |ctx| { + let promised = Promised::from(async { + tokio::time::sleep(Duration::from_millis(100)).await; + 42 + }); + + let function = ctx.eval::(r" + (async function(v){ + let val = await v; + if(val !== 42){ + throw new Error('not correct value') + } + }) + ").catch(&ctx).unwrap(); + + function.call::<_,Promise>((promised,)).unwrap().into_future::<()>().await.unwrap(); + + let ctx_clone = ctx.clone(); + let promised = Promised::from(async move { + tokio::time::sleep(Duration::from_millis(100)).await; + Result::<()>::Err(Exception::throw_message(&ctx_clone, "some_message")) + }); + + let function = ctx.eval::(r" + (async function(v){ + try{ + await v; + }catch(e) { + if (e.message !== 'some_message'){ + throw new Error('wrong error') + } + return + } + throw new Error('no error thrown') + }) + ") + .catch(&ctx) + .unwrap(); + + + function.call::<_,Promise>((promised,)).unwrap().into_future::<()>().await.unwrap() + }) + .await + } +} diff --git a/core/src/value/symbol.rs b/core/src/value/symbol.rs index 37640599e..540f75ed3 100644 --- a/core/src/value/symbol.rs +++ b/core/src/value/symbol.rs @@ -1,4 +1,4 @@ -use crate::{qjs, Atom, Ctx, Result, String, Value}; +use crate::{qjs, Atom, Ctx, Result, Value}; /// Rust representation of a JavaScript symbol. #[derive(Debug, Clone, PartialEq, Hash)] @@ -7,12 +7,12 @@ pub struct Symbol<'js>(pub(crate) Value<'js>); impl<'js> Symbol<'js> { /// Get the symbol description - pub fn description(&self) -> Result> { + pub fn description(&self) -> Result> { let atom = Atom::from_str(self.0.ctx.clone(), "description")?; unsafe { let val = qjs::JS_GetProperty(self.0.ctx.as_ptr(), self.0.as_js_value(), atom.atom); let val = self.0.ctx.handle_exception(val)?; - Ok(String::from_js_value(self.0.ctx.clone(), val)) + Ok(Value::from_js_value(self.0.ctx.clone(), val)) } } @@ -77,10 +77,18 @@ mod test { fn description() { test_with(|ctx| { let s: Symbol<'_> = ctx.eval("Symbol('foo bar baz')").unwrap(); - assert_eq!(s.description().unwrap().to_string().unwrap(), "foo bar baz"); + assert_eq!( + s.description() + .unwrap() + .into_string() + .unwrap() + .to_string() + .unwrap(), + "foo bar baz" + ); let s: Symbol<'_> = ctx.eval("Symbol()").unwrap(); - assert_eq!(s.description().unwrap().to_string().unwrap(), "undefined"); + assert!(s.description().unwrap().is_undefined()); }); } } diff --git a/examples/module-loader/Cargo.toml b/examples/module-loader/Cargo.toml index 4885f9151..9bc3dc259 100644 --- a/examples/module-loader/Cargo.toml +++ b/examples/module-loader/Cargo.toml @@ -8,7 +8,7 @@ publish = false [dependencies.rquickjs] path = "../.." default-features = false -features = ["exports", "futures", "rust-alloc", "loader", "dyn-load"] +features = ["futures", "rust-alloc", "loader", "dyn-load"] [features] default = ["macro"] diff --git a/examples/module-loader/src/bundle/hand_written.rs b/examples/module-loader/src/bundle/hand_written.rs index 7636986f6..9e8f6ca64 100644 --- a/examples/module-loader/src/bundle/hand_written.rs +++ b/examples/module-loader/src/bundle/hand_written.rs @@ -3,14 +3,14 @@ use rquickjs::{module::ModuleDef, Ctx, Function, Result}; pub struct NativeModule; impl ModuleDef for NativeModule { - fn declare(decl: &mut rquickjs::module::Declarations) -> Result<()> { + fn declare(decl: &rquickjs::module::Declarations) -> Result<()> { decl.declare("n")?; decl.declare("s")?; decl.declare("f")?; Ok(()) } - fn evaluate<'js>(ctx: &Ctx<'js>, exports: &mut rquickjs::module::Exports<'js>) -> Result<()> { + fn evaluate<'js>(ctx: &Ctx<'js>, exports: &rquickjs::module::Exports<'js>) -> Result<()> { exports.export("n", 123)?; exports.export("s", "abc")?; exports.export( diff --git a/examples/module-loader/src/main.rs b/examples/module-loader/src/main.rs index e76ff2fb1..f99ce7c35 100644 --- a/examples/module-loader/src/main.rs +++ b/examples/module-loader/src/main.rs @@ -2,7 +2,7 @@ use rquickjs::{ loader::{ BuiltinLoader, BuiltinResolver, FileResolver, ModuleLoader, NativeLoader, ScriptLoader, }, - Context, Function, Runtime, + Context, Function, Module, Runtime, }; mod bundle; @@ -46,58 +46,63 @@ fn main() { .unwrap(); println!("import script module"); - let _ = ctx - .clone() - .compile( - "test", - r#" + Module::evaluate( + ctx.clone(), + "test", + r#" import { n, s, f } from "script_module"; print(`n = ${n}`); print(`s = "${s}"`); print(`f(2, 4) = ${f(2, 4)}`); "#, - ) - .unwrap(); + ) + .unwrap() + .finish::<()>() + .unwrap(); println!("import native module"); - let _ = ctx - .clone() - .compile( - "test", - r#" + Module::evaluate( + ctx.clone(), + "test", + r#" import { n, s, f } from "native_module"; print(`n = ${n}`); print(`s = "${s}"`); print(`f(2, 4) = ${f(2, 4)}`); "#, - ) - .unwrap(); + ) + .unwrap() + .finish::<()>() + .unwrap(); println!("import bundled script module"); - let _ = ctx - .clone() - .compile( - "test", - r#" + Module::evaluate( + ctx.clone(), + "test", + r#" import { n, s, f } from "bundle/script_module"; print(`n = ${n}`); print(`s = "${s}"`); print(`f(2, 4) = ${f(2, 4)}`); "#, - ) - .unwrap(); + ) + .unwrap() + .finish::<()>() + .unwrap(); println!("import bundled native module"); - let _ = ctx - .compile( - "test", - r#" + Module::evaluate( + ctx.clone(), + "test", + r#" import { n, s, f } from "bundle/native_module"; print(`n = ${n}`); print(`s = "${s}"`); print(`f(2, 4) = ${f(2, 4)}`); "#, - ) - .unwrap(); + ) + .unwrap() + .finish::<()>() + .unwrap(); }); } diff --git a/examples/native-module/src/hand_written.rs b/examples/native-module/src/hand_written.rs index 7c20d0b6e..8eb42e106 100644 --- a/examples/native-module/src/hand_written.rs +++ b/examples/native-module/src/hand_written.rs @@ -3,7 +3,7 @@ use rquickjs::{module::ModuleDef, Ctx, Function}; pub struct NativeModule; impl ModuleDef for NativeModule { - fn declare(declare: &mut rquickjs::module::Declarations) -> rquickjs::Result<()> { + fn declare(declare: &rquickjs::module::Declarations) -> rquickjs::Result<()> { declare.declare("n")?; declare.declare("s")?; declare.declare("f")?; @@ -12,7 +12,7 @@ impl ModuleDef for NativeModule { fn evaluate<'js>( ctx: &Ctx<'js>, - exports: &mut rquickjs::module::Exports<'js>, + exports: &rquickjs::module::Exports<'js>, ) -> rquickjs::Result<()> { exports.export("n", 123)?; exports.export("s", "abc")?; diff --git a/macro/src/embed.rs b/macro/src/embed.rs index 5355ed755..cef24d95e 100644 --- a/macro/src/embed.rs +++ b/macro/src/embed.rs @@ -96,9 +96,7 @@ pub fn embed(modules: EmbedModules) -> TokenStream { ctx.with(|ctx| -> Result<()> { for f in files.into_iter() { - let bc = unsafe { - Module::unsafe_declare(ctx.clone(), f.0.clone(), f.1)?.write_object(false)? - }; + let bc = Module::declare(ctx.clone(), f.0.clone(), f.1)?.write(false)?; modules.push((f.0, bc)); } Ok(()) diff --git a/macro/src/lib.rs b/macro/src/lib.rs index 02f4fbaea..af9e6602b 100644 --- a/macro/src/lib.rs +++ b/macro/src/lib.rs @@ -339,7 +339,6 @@ pub fn methods(attr: TokenStream1, item: TokenStream1) -> TokenStream1 { /// # Example /// /// ``` -/// /// use rquickjs::{CatchResultExt, Context, Module, Runtime}; /// /// /// A class which will be exported from the module. @@ -407,7 +406,7 @@ pub fn methods(attr: TokenStream1, item: TokenStream1) -> TokenStream1 { /// /// If your module doesn't quite fit with how this macro exports you can manually export from /// /// the declare and evaluate functions. /// #[qjs(declare)] -/// pub fn declare(declare: &mut rquickjs::module::Declarations) -> rquickjs::Result<()> { +/// pub fn declare(declare: &rquickjs::module::Declarations) -> rquickjs::Result<()> { /// declare.declare("aManuallyExportedValue")?; /// Ok(()) /// } @@ -415,7 +414,7 @@ pub fn methods(attr: TokenStream1, item: TokenStream1) -> TokenStream1 { /// #[qjs(evaluate)] /// pub fn evaluate<'js>( /// _ctx: &Ctx<'js>, -/// exports: &mut rquickjs::module::Exports<'js>, +/// exports: &rquickjs::module::Exports<'js>, /// ) -> rquickjs::Result<()> { /// exports.export("aManuallyExportedValue", "Some Value")?; /// Ok(()) @@ -434,30 +433,29 @@ pub fn methods(attr: TokenStream1, item: TokenStream1) -> TokenStream1 { /// } /// } /// -/// /// fn main() { /// assert_eq!(test_mod::ignore_function(), 4); /// let rt = Runtime::new().unwrap(); /// let ctx = Context::full(&rt).unwrap(); /// /// ctx.with(|ctx| { -/// // These modules are declared like normal with the declare_def function. -/// // The name of the module is js_ + the name of the module. This prefix can be changed -/// // by writing for example `#[rquickjs::module(prefix = "prefix_")]`. -/// Module::declare_def::(ctx.clone(), "test").unwrap(); -/// let _ = Module::evaluate( -/// ctx.clone(), -/// "test2", -/// r" -/// import { RenamedTest, foo,aManuallyExportedValue, aConstValue, aStaticValue, FooBar } from 'test'; -/// if (foo() !== 2){ -/// throw new Error(1); -/// } -/// " -/// ) -/// .catch(&ctx) -/// .unwrap(); -/// }) +/// // These modules are declared like normal with the declare_def function. +/// // The name of the module is js_ + the name of the module. This prefix can be changed +/// // by writing for example `#[rquickjs::module(prefix = "prefix_")]`. +/// Module::declare_def::(ctx.clone(), "test").unwrap(); +/// let _ = Module::evaluate( +/// ctx.clone(), +/// "test2", +/// r" +/// import { RenamedTest, foo,aManuallyExportedValue, aConstValue, aStaticValue, FooBar } from 'test'; +/// if (foo() !== 2){ +/// throw new Error(1); +/// } +/// " +/// ) +/// .catch(&ctx) +/// .unwrap(); +/// }) /// } /// ``` #[proc_macro_attribute] @@ -491,7 +489,7 @@ pub fn trace(stream: TokenStream1) -> TokenStream1 { /// # Usage /// /// ``` -/// use rquickjs::{embed, loader::Bundle, CatchResultExt, Context, Runtime}; +/// use rquickjs::{embed, loader::Bundle, CatchResultExt, Context, Module, Runtime}; /// /// /// load the `my_module.js` file and name it myModule /// static BUNDLE: Bundle = embed! { @@ -504,19 +502,20 @@ pub fn trace(stream: TokenStream1) -> TokenStream1 { /// /// rt.set_loader(BUNDLE, BUNDLE); /// ctx.with(|ctx| { -/// let _ = ctx -/// .clone() -/// .compile( -/// "testModule", -/// r#" +/// Module::evaluate( +/// ctx.clone(), +/// "testModule", +/// r#" /// import { foo } from 'myModule'; /// if(foo() !== 2){ /// throw new Error("Function didn't return the correct value"); /// } /// "#, -/// ) -/// .catch(&ctx) -/// .unwrap(); +/// ) +/// .unwrap() +/// .finish::<()>() +/// .catch(&ctx) +/// .unwrap(); /// }) /// } /// ``` diff --git a/macro/src/module/mod.rs b/macro/src/module/mod.rs index 3ae4673a4..65fea7626 100644 --- a/macro/src/module/mod.rs +++ b/macro/src/module/mod.rs @@ -438,12 +438,12 @@ pub(crate) fn expand(options: OptionList, mut item: ItemMod) -> To #vis struct #name; impl #crate_name::module::ModuleDef for #name{ - fn declare(_declare: &mut #crate_name::module::Declarations) -> #crate_name::Result<()>{ + fn declare(_declare: &#crate_name::module::Declarations) -> #crate_name::Result<()>{ #declarations #declare Ok(()) } - fn evaluate<'js>(_ctx: &#crate_name::Ctx<'js>, _exports: &mut #crate_name::module::Exports<'js>) -> #crate_name::Result<()>{ + fn evaluate<'js>(_ctx: &#crate_name::Ctx<'js>, _exports: &#crate_name::module::Exports<'js>) -> #crate_name::Result<()>{ #exports #evaluate Ok(()) diff --git a/src/lib.rs b/src/lib.rs index 2cde1ea30..940630500 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -37,7 +37,6 @@ //! - `classes` enables support for ES6 classes. Any user-defined Rust //! type can be exported to JS as an ES6 class which can be derived and extended by JS. //! - `properties` enables support for object properties (`Object.defineProperty`). -//! - `exports` adds an ability to read the module exports. //! //! ## Advanced //! diff --git a/sys/Cargo.toml b/sys/Cargo.toml index 05e564b44..27705bafa 100644 --- a/sys/Cargo.toml +++ b/sys/Cargo.toml @@ -23,7 +23,6 @@ version = "0.5" optional = true [features] -exports = [] bindgen = ["bindgen-rs"] # Debug logging diff --git a/sys/build.rs b/sys/build.rs index b7578e460..e05027cb5 100644 --- a/sys/build.rs +++ b/sys/build.rs @@ -94,7 +94,6 @@ fn main() { pretty_env_logger::init(); let features = [ - "exports", "bindgen", "update-bindings", "dump-bytecode", @@ -148,8 +147,6 @@ fn main() { "get_function_proto.patch", "check_stack_overflow.patch", "infinity_handling.patch", - "atomic_new_class_id.patch", - "dynamic_import_sync.patch", ]; let mut defines = vec![ @@ -164,11 +161,6 @@ fn main() { patch_files.push("basic_msvc_compat.patch"); } - if env::var("CARGO_FEATURE_EXPORTS").is_ok() { - patch_files.push("read_module_exports.patch"); - defines.push(("CONFIG_MODULE_EXPORTS".into(), None)); - } - for feature in &features { if feature.starts_with("dump-") && env::var(feature_to_cargo(feature)).is_ok() { defines.push((feature_to_define(feature), None)); diff --git a/sys/patches/atomic_new_class_id.patch b/sys/patches/atomic_new_class_id.patch deleted file mode 100644 index d8cf6eb4c..000000000 --- a/sys/patches/atomic_new_class_id.patch +++ /dev/null @@ -1,24 +0,0 @@ -diff --git a/quickjs.c b/quickjs.c -index ccf0916..5098719 100644 ---- a/quickjs.c -+++ b/quickjs.c -@@ -3371,12 +3371,18 @@ static inline BOOL JS_IsEmptyString(JSValueConst v) - JSClassID JS_NewClassID(JSClassID *pclass_id) - { - JSClassID class_id; -- /* XXX: make it thread safe */ -+#ifdef CONFIG_ATOMICS -+ static atomic_flag lock = ATOMIC_FLAG_INIT; -+ while(atomic_flag_test_and_set_explicit(&lock, memory_order_acquire)); -+#endif - class_id = *pclass_id; - if (class_id == 0) { - class_id = js_class_id_alloc++; - *pclass_id = class_id; - } -+#ifdef CONFIG_ATOMICS -+ atomic_flag_clear_explicit(&lock, memory_order_release); -+#endif - return class_id; - } - diff --git a/sys/patches/basic_msvc_compat.patch b/sys/patches/basic_msvc_compat.patch index 75792a939..3429ca1c6 100644 --- a/sys/patches/basic_msvc_compat.patch +++ b/sys/patches/basic_msvc_compat.patch @@ -1,5 +1,5 @@ diff --git a/cutils.c b/cutils.c -index a02fb76..f28e6f6 100644 +index c0aacef..c861f74 100644 --- a/cutils.c +++ b/cutils.c @@ -29,6 +29,32 @@ @@ -36,24 +36,20 @@ index a02fb76..f28e6f6 100644 { int c; diff --git a/cutils.h b/cutils.h -index 31f7cd8..3363ec5 100644 +index f079e5c..612220c 100644 --- a/cutils.h +++ b/cutils.h -@@ -28,14 +28,34 @@ +@@ -28,12 +28,30 @@ #include + #include #include - +#ifdef _MSC_VER +#include +#include -+ +int gettimeofday(struct timeval *tvp, void *tzp); +#else +#include +#endif -+ - /* set if CPU is big endian */ - #undef WORDS_BIGENDIAN +#ifndef __has_attribute +#define likely(x) (x) @@ -74,7 +70,7 @@ index 31f7cd8..3363ec5 100644 #define xglue(x, y) x ## y #define glue(x, y) xglue(x, y) -@@ -114,27 +134,88 @@ static inline int64_t min_int64(int64_t a, int64_t b) +@@ -128,27 +146,88 @@ static inline int64_t min_int64(int64_t a, int64_t b) /* WARNING: undefined if a = 0 */ static inline int clz32(unsigned int a) { @@ -163,7 +159,7 @@ index 31f7cd8..3363ec5 100644 struct __attribute__((packed)) packed_u64 { uint64_t v; }; -@@ -146,6 +227,7 @@ struct __attribute__((packed)) packed_u32 { +@@ -160,6 +239,7 @@ struct __attribute__((packed)) packed_u32 { struct __attribute__((packed)) packed_u16 { uint16_t v; }; @@ -172,20 +168,20 @@ index 31f7cd8..3363ec5 100644 static inline uint64_t get_u64(const uint8_t *tab) { diff --git a/libbf.h b/libbf.h -index 48e9d95..dc2137a 100644 +index a1436ab..65e111c 100644 --- a/libbf.h +++ b/libbf.h @@ -27,7 +27,7 @@ #include #include --#if INTPTR_MAX >= INT64_MAX -+#if INTPTR_MAX >= INT64_MAX && !defined(_MSC_VER) +-#if defined(__SIZEOF_INT128__) && (INTPTR_MAX >= INT64_MAX) ++#if defined(__SIZEOF_INT128__) && (INTPTR_MAX >= INT64_MAX) && !defined(_MSC_VER) #define LIMB_LOG2_BITS 6 #else #define LIMB_LOG2_BITS 5 diff --git a/quickjs.c b/quickjs.c -index 5098719..de6741e 100644 +index e8fdd8a..828e70f 100644 --- a/quickjs.c +++ b/quickjs.c @@ -28,7 +28,6 @@ @@ -196,7 +192,7 @@ index 5098719..de6741e 100644 #include #include #include -@@ -50,7 +49,7 @@ +@@ -48,7 +47,7 @@ #define OPTIMIZE 1 #define SHORT_OPCODES 1 @@ -205,7 +201,7 @@ index 5098719..de6741e 100644 #define DIRECT_DISPATCH 0 #else #define DIRECT_DISPATCH 1 -@@ -69,11 +68,11 @@ +@@ -67,11 +66,11 @@ /* define to include Atomics.* operations which depend on the OS threads */ @@ -219,7 +215,7 @@ index 5098719..de6741e 100644 /* enable stack limitation */ #define CONFIG_STACK_CHECK #endif -@@ -7250,7 +7249,7 @@ static int JS_DefinePrivateField(JSContext *ctx, JSValueConst obj, +@@ -7302,7 +7301,7 @@ static int JS_DefinePrivateField(JSContext *ctx, JSValueConst obj, JS_ThrowTypeErrorNotASymbol(ctx); goto fail; } @@ -228,7 +224,7 @@ index 5098719..de6741e 100644 p = JS_VALUE_GET_OBJ(obj); prs = find_own_property(&pr, p, prop); if (prs) { -@@ -7281,7 +7280,7 @@ static JSValue JS_GetPrivateField(JSContext *ctx, JSValueConst obj, +@@ -7333,7 +7332,7 @@ static JSValue JS_GetPrivateField(JSContext *ctx, JSValueConst obj, /* safety check */ if (unlikely(JS_VALUE_GET_TAG(name) != JS_TAG_SYMBOL)) return JS_ThrowTypeErrorNotASymbol(ctx); @@ -237,7 +233,7 @@ index 5098719..de6741e 100644 p = JS_VALUE_GET_OBJ(obj); prs = find_own_property(&pr, p, prop); if (!prs) { -@@ -7308,7 +7307,7 @@ static int JS_SetPrivateField(JSContext *ctx, JSValueConst obj, +@@ -7360,7 +7359,7 @@ static int JS_SetPrivateField(JSContext *ctx, JSValueConst obj, JS_ThrowTypeErrorNotASymbol(ctx); goto fail; } @@ -246,16 +242,16 @@ index 5098719..de6741e 100644 p = JS_VALUE_GET_OBJ(obj); prs = find_own_property(&pr, p, prop); if (!prs) { -@@ -7398,7 +7397,7 @@ static int JS_CheckBrand(JSContext *ctx, JSValueConst obj, JSValueConst func) - if (unlikely(JS_VALUE_GET_TAG(obj) != JS_TAG_OBJECT)) - goto not_obj; +@@ -7459,7 +7458,7 @@ static int JS_CheckBrand(JSContext *ctx, JSValueConst obj, JSValueConst func) + return -1; + } p = JS_VALUE_GET_OBJ(obj); - prs = find_own_property(&pr, p, js_symbol_to_atom(ctx, (JSValue)brand)); + prs = find_own_property(&pr, p, js_symbol_to_atom(ctx, *(JSValue*)&brand)); - if (!prs) { - JS_ThrowTypeError(ctx, "invalid brand on object"); - return -1; -@@ -9050,7 +9049,7 @@ int JS_DefineProperty(JSContext *ctx, JSValueConst this_obj, + return (prs != NULL); + } + +@@ -9079,7 +9078,7 @@ int JS_DefineProperty(JSContext *ctx, JSValueConst this_obj, return -1; } /* this code relies on the fact that Uint32 are never allocated */ @@ -264,7 +260,7 @@ index 5098719..de6741e 100644 /* prs may have been modified */ prs = find_own_property(&pr, p, prop); assert(prs != NULL); -@@ -16051,7 +16050,7 @@ static JSValue js_call_c_function(JSContext *ctx, JSValueConst func_obj, +@@ -15980,7 +15979,7 @@ static JSValue js_call_c_function(JSContext *ctx, JSValueConst func_obj, #else sf->js_mode = 0; #endif @@ -273,7 +269,7 @@ index 5098719..de6741e 100644 sf->arg_count = argc; arg_buf = argv; -@@ -16064,7 +16063,7 @@ static JSValue js_call_c_function(JSContext *ctx, JSValueConst func_obj, +@@ -15993,7 +15992,7 @@ static JSValue js_call_c_function(JSContext *ctx, JSValueConst func_obj, arg_buf[i] = JS_UNDEFINED; sf->arg_count = arg_count; } @@ -282,7 +278,7 @@ index 5098719..de6741e 100644 func = p->u.cfunc.c_function; switch(cproto) { -@@ -16295,7 +16294,7 @@ static JSValue JS_CallInternal(JSContext *caller_ctx, JSValueConst func_obj, +@@ -16225,7 +16224,7 @@ static JSValue JS_CallInternal(JSContext *caller_ctx, JSValueConst func_obj, sf->js_mode = b->js_mode; arg_buf = argv; sf->arg_count = argc; @@ -291,7 +287,7 @@ index 5098719..de6741e 100644 init_list_head(&sf->var_ref_list); var_refs = p->u.func.var_refs; -@@ -39266,8 +39265,8 @@ static int64_t JS_FlattenIntoArray(JSContext *ctx, JSValueConst target, +@@ -40392,8 +40391,8 @@ static int64_t JS_FlattenIntoArray(JSContext *ctx, JSValueConst target, if (!JS_IsUndefined(mapperFunction)) { JSValueConst args[3] = { element, JS_NewInt64(ctx, sourceIndex), source }; element = JS_Call(ctx, mapperFunction, thisArg, 3, args); @@ -302,7 +298,7 @@ index 5098719..de6741e 100644 if (JS_IsException(element)) return -1; } -@@ -40684,7 +40683,7 @@ static JSValue js_string_match(JSContext *ctx, JSValueConst this_val, +@@ -41959,7 +41958,7 @@ static JSValue js_string_match(JSContext *ctx, JSValueConst this_val, str = JS_NewString(ctx, "g"); if (JS_IsException(str)) goto fail; @@ -311,29 +307,20 @@ index 5098719..de6741e 100644 } rx = JS_CallConstructor(ctx, ctx->regexp_ctor, args_len, args); JS_FreeValue(ctx, str); -@@ -41914,6 +41913,10 @@ static JSValue js_math_random(JSContext *ctx, JSValueConst this_val, +@@ -43264,6 +43263,12 @@ static JSValue js_math_random(JSContext *ctx, JSValueConst this_val, return __JS_NewFloat64(ctx, u.d - 1.0); } ++#ifdef _MSC_VER +#pragma function (ceil) +#pragma function (floor) +#pragma function (log2) ++#endif + static const JSCFunctionListEntry js_math_funcs[] = { JS_CFUNC_MAGIC_DEF("min", 2, js_math_min_max, 0 ), JS_CFUNC_MAGIC_DEF("max", 2, js_math_min_max, 1 ), -@@ -41997,7 +42000,9 @@ static JSValue js___date_clock(JSContext *ctx, JSValueConst this_val, - between UTC time and local time 'd' in minutes */ - static int getTimezoneOffset(int64_t time) { - #if defined(_WIN32) -- /* XXX: TODO */ -+ TIME_ZONE_INFORMATION tzi; -+ if (!GetTimeZoneInformation(&tzi)) -+ return tzi.Bias; - return 0; - #else - time_t ti; -@@ -45712,7 +45717,7 @@ static JSMapRecord *map_add_record(JSContext *ctx, JSMapState *s, +@@ -47158,7 +47163,7 @@ static JSMapRecord *map_add_record(JSContext *ctx, JSMapState *s, } else { JS_DupValue(ctx, key); } @@ -342,7 +329,7 @@ index 5098719..de6741e 100644 h = map_hash_key(ctx, key) & (s->hash_size - 1); list_add_tail(&mr->hash_link, &s->hash_table[h]); list_add_tail(&mr->link, &s->records); -@@ -45934,7 +45939,7 @@ static JSValue js_map_forEach(JSContext *ctx, JSValueConst this_val, +@@ -47380,7 +47385,7 @@ static JSValue js_map_forEach(JSContext *ctx, JSValueConst this_val, args[0] = args[1]; else args[0] = JS_DupValue(ctx, mr->value); @@ -351,7 +338,7 @@ index 5098719..de6741e 100644 ret = JS_Call(ctx, func, this_arg, 3, (JSValueConst *)args); JS_FreeValue(ctx, args[0]); if (!magic) -@@ -46912,7 +46917,7 @@ static JSValue js_promise_all(JSContext *ctx, JSValueConst this_val, +@@ -48482,7 +48487,7 @@ static JSValue js_promise_all(JSContext *ctx, JSValueConst this_val, goto fail_reject; } resolve_element_data[0] = JS_NewBool(ctx, FALSE); @@ -360,7 +347,7 @@ index 5098719..de6741e 100644 resolve_element_data[2] = values; resolve_element_data[3] = resolving_funcs[is_promise_any]; resolve_element_data[4] = resolve_element_env; -@@ -47271,7 +47276,7 @@ static JSValue js_async_from_sync_iterator_unwrap_func_create(JSContext *ctx, +@@ -48841,7 +48846,7 @@ static JSValue js_async_from_sync_iterator_unwrap_func_create(JSContext *ctx, { JSValueConst func_data[1]; @@ -369,8 +356,8 @@ index 5098719..de6741e 100644 return JS_NewCFunctionData(ctx, js_async_from_sync_iterator_unwrap, 1, 0, 1, func_data); } -@@ -52700,8 +52705,8 @@ static int js_TA_cmp_generic(const void *a, const void *b, void *opaque) { - psc->exception = 1; +@@ -54601,8 +54606,8 @@ static int js_TA_cmp_generic(const void *a, const void *b, void *opaque) { + psc->exception = 2; } done: - JS_FreeValue(ctx, (JSValue)argv[0]); @@ -381,10 +368,10 @@ index 5098719..de6741e 100644 return cmp; } diff --git a/quickjs.h b/quickjs.h -index d4a5cd3..299d938 100644 +index 7199936..30fdb2f 100644 --- a/quickjs.h +++ b/quickjs.h -@@ -666,7 +666,7 @@ static inline JSValue JS_DupValue(JSContext *ctx, JSValueConst v) +@@ -670,7 +670,7 @@ static inline JSValue JS_DupValue(JSContext *ctx, JSValueConst v) JSRefCountHeader *p = (JSRefCountHeader *)JS_VALUE_GET_PTR(v); p->ref_count++; } @@ -393,7 +380,7 @@ index d4a5cd3..299d938 100644 } static inline JSValue JS_DupValueRT(JSRuntime *rt, JSValueConst v) -@@ -675,7 +675,7 @@ static inline JSValue JS_DupValueRT(JSRuntime *rt, JSValueConst v) +@@ -679,7 +679,7 @@ static inline JSValue JS_DupValueRT(JSRuntime *rt, JSValueConst v) JSRefCountHeader *p = (JSRefCountHeader *)JS_VALUE_GET_PTR(v); p->ref_count++; } diff --git a/sys/patches/dynamic_import_sync.patch b/sys/patches/dynamic_import_sync.patch deleted file mode 100644 index 13c67524c..000000000 --- a/sys/patches/dynamic_import_sync.patch +++ /dev/null @@ -1,181 +0,0 @@ -diff --git a/quickjs.c b/quickjs.c -index 48aeffc..6862b8c 100644 ---- a/quickjs.c -+++ b/quickjs.c -@@ -1192,6 +1192,8 @@ static void js_free_module_def(JSContext *ctx, JSModuleDef *m); - static void js_mark_module_def(JSRuntime *rt, JSModuleDef *m, - JS_MarkFunc *mark_func); - static JSValue js_import_meta(JSContext *ctx); -+JSValue JS_DynamicImportSync(JSContext *ctx, const char *specifier); -+static JSValue js_dynamic_import_run(JSContext *ctx, JSValueConst basename_val, const char *specifier); - static JSValue js_dynamic_import(JSContext *ctx, JSValueConst specifier); - static void free_var_ref(JSRuntime *rt, JSVarRef *var_ref); - static JSValue js_new_promise_capability(JSContext *ctx, -@@ -28210,29 +28212,14 @@ static JSValue js_dynamic_import_job(JSContext *ctx, - JSValueConst *resolving_funcs = argv; - JSValueConst basename_val = argv[2]; - JSValueConst specifier = argv[3]; -- JSModuleDef *m; -- const char *basename = NULL, *filename; -+ const char *filename; - JSValue ret, err, ns; - -- if (!JS_IsString(basename_val)) { -- JS_ThrowTypeError(ctx, "no function filename for import()"); -- goto exception; -- } -- basename = JS_ToCString(ctx, basename_val); -- if (!basename) -- goto exception; -- - filename = JS_ToCString(ctx, specifier); - if (!filename) - goto exception; -- -- m = JS_RunModule(ctx, basename, filename); -- JS_FreeCString(ctx, filename); -- if (!m) -- goto exception; - -- /* return the module namespace */ -- ns = js_get_module_ns(ctx, m); -+ ns = js_dynamic_import_run(ctx, basename_val, filename); - if (JS_IsException(ns)) - goto exception; - -@@ -28240,7 +28227,6 @@ static JSValue js_dynamic_import_job(JSContext *ctx, - 1, (JSValueConst *)&ns); - JS_FreeValue(ctx, ret); /* XXX: what to do if exception ? */ - JS_FreeValue(ctx, ns); -- JS_FreeCString(ctx, basename); - return JS_UNDEFINED; - exception: - -@@ -28249,10 +28235,38 @@ static JSValue js_dynamic_import_job(JSContext *ctx, - 1, (JSValueConst *)&err); - JS_FreeValue(ctx, ret); /* XXX: what to do if exception ? */ - JS_FreeValue(ctx, err); -- JS_FreeCString(ctx, basename); - return JS_UNDEFINED; - } - -+JSValue JS_DynamicImportSync(JSContext *ctx, const char *specifier) -+{ -+ JSAtom basename_atom; -+ JSValue basename_val; -+ JSValue ns; -+ -+ basename_atom = JS_GetScriptOrModuleName(ctx, 1); -+ if (basename_atom == JS_ATOM_NULL) -+ { -+ JS_FreeAtom(ctx, basename_atom); -+ basename_val = js_new_string8(ctx, NULL, 0); //module name can't be accessed if we are running (eval) -+ } -+ else -+ { -+ basename_val = JS_AtomToValue(ctx, basename_atom); -+ JS_FreeAtom(ctx, basename_atom); -+ } -+ if (JS_IsException(basename_val)) -+ return basename_val; -+ -+ ns = js_dynamic_import_run(ctx, basename_val, specifier); -+ if (JS_IsException(ns)) -+ { -+ return JS_EXCEPTION; -+ } -+ -+ return ns; -+} -+ - static JSValue js_dynamic_import(JSContext *ctx, JSValueConst specifier) - { - JSAtom basename; -@@ -28343,6 +28357,44 @@ static JSValue js_evaluate_module(JSContext *ctx, JSModuleDef *m) - return ret_val; - } - -+static JSValue js_dynamic_import_run(JSContext *ctx, JSValueConst basename_val, const char *specifier) -+{ -+ JSModuleDef *m; -+ const char *basename = NULL; -+ JSValue ns; -+ -+ if (JS_IsString(basename_val)) -+ { -+ basename = JS_ToCString(ctx, basename_val); -+ if (!basename) -+ { -+ JS_ThrowTypeError(ctx, "no function filename for import()"); -+ goto exception; -+ } -+ } -+ else -+ { -+ JS_ThrowTypeError(ctx, "basename received by import() was not a string"); -+ goto exception; -+ } -+ -+ m = JS_RunModule(ctx, basename, specifier); -+ JS_FreeCString(ctx, specifier); -+ if (!m) -+ goto exception; -+ -+ /* return the module namespace */ -+ ns = js_get_module_ns(ctx, m); -+ if (JS_IsException(ns)) -+ goto exception; -+ -+ JS_FreeCString(ctx, basename); -+ return ns; -+exception: -+ JS_FreeCString(ctx, basename); -+ return JS_EXCEPTION; -+} -+ - static __exception JSAtom js_parse_from_clause(JSParseState *s) - { - JSAtom module_name; -@@ -33532,7 +33584,7 @@ static JSValue JS_EvalFunctionInternal(JSContext *ctx, JSValue fun_obj, - ret_val = js_evaluate_module(ctx, m); - if (JS_IsException(ret_val)) { - fail: -- js_free_modules(ctx, JS_FREE_MODULE_NOT_EVALUATED); -+ js_free_modules(ctx, JS_FREE_MODULE_NOT_RESOLVED); - return JS_EXCEPTION; - } - } else { -@@ -33542,6 +33594,10 @@ static JSValue JS_EvalFunctionInternal(JSContext *ctx, JSValue fun_obj, - return ret_val; - } - -+void JS_FreeUnevaluatedModules(JSContext *ctx){ -+ js_free_modules(ctx, JS_FREE_MODULE_NOT_EVALUATED); -+} -+ - JSValue JS_EvalFunction(JSContext *ctx, JSValue fun_obj) - { - return JS_EvalFunctionInternal(ctx, fun_obj, ctx->global_obj, NULL, NULL); -diff --git a/quickjs.h b/quickjs.h -index d4a5cd3..0ad5b30 100644 ---- a/quickjs.h -+++ b/quickjs.h -@@ -866,6 +866,9 @@ void JS_SetModuleLoaderFunc(JSRuntime *rt, - JSValue JS_GetImportMeta(JSContext *ctx, JSModuleDef *m); - JSAtom JS_GetModuleName(JSContext *ctx, JSModuleDef *m); - -+void JS_FreeUnevaluatedModules(JSContext *ctx); -+ -+ - /* JS Job support */ - - typedef JSValue JSJobFunc(JSContext *ctx, int argc, JSValueConst *argv); -@@ -1039,6 +1042,8 @@ int JS_SetModuleExport(JSContext *ctx, JSModuleDef *m, const char *export_name, - int JS_SetModuleExportList(JSContext *ctx, JSModuleDef *m, - const JSCFunctionListEntry *tab, int len); - -+JSValue JS_DynamicImportSync(JSContext *ctx, const char *specifier); -+ - #undef js_unlikely - #undef js_force_inline - diff --git a/sys/patches/error_column_number.patch b/sys/patches/error_column_number.patch index b9bbac22e..2d89b3069 100644 --- a/sys/patches/error_column_number.patch +++ b/sys/patches/error_column_number.patch @@ -1,5 +1,17 @@ +diff --git a/Makefile b/Makefile +index 0270a6a..1c78547 100644 +--- a/Makefile ++++ b/Makefile +@@ -445,6 +445,7 @@ test: qjs + ./qjs tests/test_bignum.js + ./qjs tests/test_std.js + ./qjs tests/test_worker.js ++ ./qjs tests/test_line_column.js + ifdef CONFIG_SHARED_LIBS + ifdef CONFIG_BIGNUM + ./qjs --bignum tests/test_bjson.js diff --git a/cutils.c b/cutils.c -index a02fb768..3c0e47a6 100644 +index c0aacef..37ed9c2 100644 --- a/cutils.c +++ b/cutils.c @@ -303,6 +303,16 @@ int unicode_from_utf8(const uint8_t *p, int max_len, const uint8_t **pp) @@ -20,19 +32,19 @@ index a02fb768..3c0e47a6 100644 #if defined(EMSCRIPTEN) || defined(__ANDROID__) diff --git a/cutils.h b/cutils.h -index 31f7cd84..4e0519c9 100644 +index f079e5c..75ab735 100644 --- a/cutils.h +++ b/cutils.h -@@ -277,6 +277,7 @@ static inline void dbuf_set_error(DynBuf *s) +@@ -297,6 +297,7 @@ static inline void dbuf_set_error(DynBuf *s) int unicode_to_utf8(uint8_t *buf, unsigned int c); int unicode_from_utf8(const uint8_t *p, int max_len, const uint8_t **pp); +int utf8_str_len(const uint8_t *p_start, const uint8_t *p_end); - static inline int from_hex(int c) + static inline BOOL is_surrogate(uint32_t c) { diff --git a/quickjs-atom.h b/quickjs-atom.h -index 4c227945..d7fe9ced 100644 +index f4d5838..481ddb0 100644 --- a/quickjs-atom.h +++ b/quickjs-atom.h @@ -81,6 +81,7 @@ DEF(empty_string, "") @@ -41,25 +53,25 @@ index 4c227945..d7fe9ced 100644 DEF(lineNumber, "lineNumber") +DEF(columnNumber, "columnNumber") DEF(message, "message") + DEF(cause, "cause") DEF(errors, "errors") - DEF(stack, "stack") diff --git a/quickjs-opcode.h b/quickjs-opcode.h -index c731a14a..458a8828 100644 +index 1e18212..40cb15e 100644 --- a/quickjs-opcode.h +++ b/quickjs-opcode.h -@@ -284,6 +284,7 @@ def(scope_put_private_field, 7, 1, 1, atom_u16) /* obj value ->, emitted in phas +@@ -291,6 +291,7 @@ def(get_array_el_opt_chain, 1, 2, 1, none) /* emitted in phase 1, removed in pha def( set_class_name, 5, 1, 1, u32) /* emitted in phase 1, removed in phase 2 */ - + def( line_num, 5, 0, 0, u32) /* emitted in phase 1, removed in phase 3 */ +def( column_num, 5, 0, 0, u32) /* emitted in phase 1, removed in phase 3 */ #if SHORT_OPCODES DEF( push_minus1, 1, 0, 1, none_int) diff --git a/quickjs.c b/quickjs.c -index 79160139..3fb3c09e 100644 +index e8fdd8a..92745d8 100644 --- a/quickjs.c +++ b/quickjs.c -@@ -574,6 +574,10 @@ typedef struct JSVarDef { +@@ -573,6 +573,10 @@ typedef struct JSVarDef { #define PC2LINE_RANGE 5 #define PC2LINE_OP_FIRST 1 #define PC2LINE_DIFF_PC_MAX ((255 - PC2LINE_OP_FIRST) / PC2LINE_RANGE) @@ -83,7 +95,7 @@ index 79160139..3fb3c09e 100644 char *source; } debug; } JSFunctionBytecode; -@@ -5829,6 +5836,8 @@ typedef struct JSMemoryUsage_helper { +@@ -5891,6 +5898,8 @@ typedef struct JSMemoryUsage_helper { int64_t js_func_code_size; int64_t js_func_pc2line_count; int64_t js_func_pc2line_size; @@ -92,7 +104,7 @@ index 79160139..3fb3c09e 100644 } JSMemoryUsage_helper; static void compute_value_size(JSValueConst val, JSMemoryUsage_helper *hp); -@@ -5876,6 +5885,11 @@ static void compute_bytecode_size(JSFunctionBytecode *b, JSMemoryUsage_helper *h +@@ -5938,6 +5947,11 @@ static void compute_bytecode_size(JSFunctionBytecode *b, JSMemoryUsage_helper *h hp->js_func_pc2line_count += 1; hp->js_func_pc2line_size += b->debug.pc2line_len; } @@ -104,7 +116,7 @@ index 79160139..3fb3c09e 100644 } hp->js_func_size += js_func_size; hp->js_func_count += 1; -@@ -6179,13 +6193,17 @@ void JS_ComputeMemoryUsage(JSRuntime *rt, JSMemoryUsage *s) +@@ -6239,13 +6253,17 @@ void JS_ComputeMemoryUsage(JSRuntime *rt, JSMemoryUsage *s) s->js_func_code_size = mem.js_func_code_size; s->js_func_pc2line_count = mem.js_func_pc2line_count; s->js_func_pc2line_size = mem.js_func_pc2line_size; @@ -124,7 +136,7 @@ index 79160139..3fb3c09e 100644 } void JS_DumpMemoryUsage(FILE *fp, const JSMemoryUsage *s, JSRuntime *rt) -@@ -6297,6 +6315,12 @@ void JS_DumpMemoryUsage(FILE *fp, const JSMemoryUsage *s, JSRuntime *rt) +@@ -6357,6 +6375,12 @@ void JS_DumpMemoryUsage(FILE *fp, const JSMemoryUsage *s, JSRuntime *rt) s->js_func_pc2line_size, (double)s->js_func_pc2line_size / s->js_func_pc2line_count); } @@ -137,12 +149,12 @@ index 79160139..3fb3c09e 100644 } if (s->c_func_count) { fprintf(fp, "%-20s %8"PRId64"\n", "C functions", s->c_func_count); -@@ -6441,6 +6465,55 @@ static int find_line_num(JSContext *ctx, JSFunctionBytecode *b, +@@ -6501,6 +6525,55 @@ static int find_line_num(JSContext *ctx, JSFunctionBytecode *b, return line_num; } -+int find_column_num(JSContext* ctx, JSFunctionBytecode* b, -+ uint32_t pc_value) ++int find_column_num(JSContext* ctx, JSFunctionBytecode* b, ++ uint32_t pc_value) +{ + const uint8_t* p_end, *p; + int new_column_num, column_num, pc, v, ret; @@ -193,7 +205,7 @@ index 79160139..3fb3c09e 100644 /* in order to avoid executing arbitrary code during the stack trace generation, we only look at simple 'name' properties containing a string. */ -@@ -6471,7 +6544,7 @@ static const char *get_func_name(JSContext *ctx, JSValueConst func) +@@ -6531,7 +6604,7 @@ static const char *get_func_name(JSContext *ctx, JSValueConst func) and line number information (used for parse error). */ static void build_backtrace(JSContext *ctx, JSValueConst error_obj, const char *filename, int line_num, @@ -202,13 +214,13 @@ index 79160139..3fb3c09e 100644 { JSStackFrame *sf; JSValue str; -@@ -6480,18 +6553,24 @@ static void build_backtrace(JSContext *ctx, JSValueConst error_obj, +@@ -6540,18 +6613,24 @@ static void build_backtrace(JSContext *ctx, JSValueConst error_obj, const char *str1; JSObject *p; BOOL backtrace_barrier; + int latest_line_num = -1; + int latest_column_num = -1; - + js_dbuf_init(ctx, &dbuf); if (filename) { dbuf_printf(&dbuf, " at %s", filename); @@ -230,7 +242,7 @@ index 79160139..3fb3c09e 100644 if (backtrace_flags & JS_BACKTRACE_FLAG_SINGLE_LEVEL) goto done; } -@@ -6513,19 +6592,33 @@ static void build_backtrace(JSContext *ctx, JSValueConst error_obj, +@@ -6573,19 +6652,33 @@ static void build_backtrace(JSContext *ctx, JSValueConst error_obj, if (js_class_has_bytecode(p->class_id)) { JSFunctionBytecode *b; const char *atom_str; @@ -269,23 +281,23 @@ index 79160139..3fb3c09e 100644 dbuf_putc(&dbuf, ')'); } } else { -@@ -6545,6 +6638,15 @@ static void build_backtrace(JSContext *ctx, JSValueConst error_obj, +@@ -6605,6 +6698,15 @@ static void build_backtrace(JSContext *ctx, JSValueConst error_obj, dbuf_free(&dbuf); JS_DefinePropertyValue(ctx, error_obj, JS_ATOM_stack, str, JS_PROP_WRITABLE | JS_PROP_CONFIGURABLE); + if (line_num != -1) { -+ JS_DefinePropertyValue(ctx, error_obj, JS_ATOM_lineNumber, JS_NewInt32(ctx, latest_line_num), ++ JS_DefinePropertyValue(ctx, error_obj, JS_ATOM_lineNumber, JS_NewInt32(ctx, latest_line_num), + JS_PROP_WRITABLE | JS_PROP_CONFIGURABLE); + + if (column_num != -1) { -+ JS_DefinePropertyValue(ctx, error_obj, JS_ATOM_columnNumber, JS_NewInt32(ctx, latest_column_num), ++ JS_DefinePropertyValue(ctx, error_obj, JS_ATOM_columnNumber, JS_NewInt32(ctx, latest_column_num), + JS_PROP_WRITABLE | JS_PROP_CONFIGURABLE); + } + } } /* Note: it is important that no exception is returned by this function */ -@@ -6584,7 +6686,7 @@ static JSValue JS_ThrowError2(JSContext *ctx, JSErrorEnum error_num, +@@ -6644,7 +6746,7 @@ static JSValue JS_ThrowError2(JSContext *ctx, JSErrorEnum error_num, JS_PROP_WRITABLE | JS_PROP_CONFIGURABLE); } if (add_backtrace) { @@ -294,7 +306,7 @@ index 79160139..3fb3c09e 100644 } ret = JS_Throw(ctx, obj); return ret; -@@ -14921,6 +15023,14 @@ static JSValue js_function_proto_lineNumber(JSContext *ctx, +@@ -14794,6 +14896,14 @@ static JSValue js_function_proto_lineNumber(JSContext *ctx, return JS_UNDEFINED; } @@ -309,7 +321,7 @@ index 79160139..3fb3c09e 100644 static int js_arguments_define_own_property(JSContext *ctx, JSValueConst this_obj, JSAtom prop, JSValueConst val, -@@ -18664,7 +18774,7 @@ static JSValue JS_CallInternal(JSContext *caller_ctx, JSValueConst func_obj, +@@ -18637,7 +18747,7 @@ static JSValue JS_CallInternal(JSContext *caller_ctx, JSValueConst func_obj, before if the exception happens in a bytecode operation */ sf->cur_pc = pc; @@ -318,7 +330,7 @@ index 79160139..3fb3c09e 100644 } if (!JS_IsUncatchableError(ctx, rt->current_exception)) { while (sp > stack_buf) { -@@ -19928,6 +20038,11 @@ typedef struct LineNumberSlot { +@@ -19911,6 +20021,11 @@ typedef struct LineNumberSlot { int line_num; } LineNumberSlot; @@ -330,7 +342,7 @@ index 79160139..3fb3c09e 100644 typedef enum JSParseFunctionEnum { JS_PARSE_FUNC_STATEMENT, JS_PARSE_FUNC_VAR, -@@ -20046,10 +20161,18 @@ typedef struct JSFunctionDef { +@@ -20030,10 +20145,18 @@ typedef struct JSFunctionDef { int line_number_last; int line_number_last_pc; @@ -349,7 +361,7 @@ index 79160139..3fb3c09e 100644 char *source; /* raw source, utf-8 encoded */ int source_len; -@@ -20059,7 +20182,8 @@ typedef struct JSFunctionDef { +@@ -20044,7 +20167,8 @@ typedef struct JSFunctionDef { typedef struct JSToken { int val; @@ -359,7 +371,7 @@ index 79160139..3fb3c09e 100644 const uint8_t *ptr; union { struct { -@@ -20088,6 +20212,9 @@ typedef struct JSParseState { +@@ -20073,6 +20197,9 @@ typedef struct JSParseState { JSContext *ctx; int last_line_num; /* line number of last token */ int line_num; /* line number of current offset */ @@ -369,7 +381,7 @@ index 79160139..3fb3c09e 100644 const char *filename; JSToken token; BOOL got_lf; /* true if got line feed before the current token */ -@@ -20230,11 +20357,19 @@ static void __attribute((unused)) dump_token(JSParseState *s, +@@ -20213,11 +20340,19 @@ static void __attribute((unused)) dump_token(JSParseState *s, } } @@ -387,10 +399,10 @@ index 79160139..3fb3c09e 100644 va_list ap; - int backtrace_flags; + int backtrace_flags, column_num; - + va_start(ap, fmt); JS_ThrowError2(ctx, JS_SYNTAX_ERROR, fmt, ap, FALSE); -@@ -20242,7 +20377,9 @@ int __attribute__((format(printf, 2, 3))) js_parse_error(JSParseState *s, const +@@ -20225,7 +20360,9 @@ int __attribute__((format(printf, 2, 3))) js_parse_error(JSParseState *s, const backtrace_flags = 0; if (s->cur_func && s->cur_func->backtrace_barrier) backtrace_flags = JS_BACKTRACE_FLAG_SINGLE_LEVEL; @@ -400,7 +412,7 @@ index 79160139..3fb3c09e 100644 backtrace_flags); return -1; } -@@ -20280,6 +20417,7 @@ static __exception int js_parse_template_part(JSParseState *s, const uint8_t *p) +@@ -20263,6 +20400,7 @@ static __exception int js_parse_template_part(JSParseState *s, const uint8_t *p) { uint32_t c; StringBuffer b_s, *b = &b_s; @@ -408,7 +420,7 @@ index 79160139..3fb3c09e 100644 /* p points to the first byte of the template part */ if (string_buffer_init(s->ctx, b, 32)) -@@ -20312,6 +20450,8 @@ static __exception int js_parse_template_part(JSParseState *s, const uint8_t *p) +@@ -20295,6 +20433,8 @@ static __exception int js_parse_template_part(JSParseState *s, const uint8_t *p) } if (c == '\n') { s->line_num++; @@ -417,7 +429,7 @@ index 79160139..3fb3c09e 100644 } else if (c >= 0x80) { const uint8_t *p_next; c = unicode_from_utf8(p - 1, UTF8_CHAR_LEN_MAX, &p_next); -@@ -20344,6 +20484,7 @@ static __exception int js_parse_string(JSParseState *s, int sep, +@@ -20327,6 +20467,7 @@ static __exception int js_parse_string(JSParseState *s, int sep, int ret; uint32_t c; StringBuffer b_s, *b = &b_s; @@ -425,21 +437,20 @@ index 79160139..3fb3c09e 100644 /* string */ if (string_buffer_init(s->ctx, b, 32)) -@@ -20399,8 +20540,11 @@ static __exception int js_parse_string(JSParseState *s, int sep, +@@ -20382,8 +20523,11 @@ static __exception int js_parse_string(JSParseState *s, int sep, case '\n': /* ignore escaped newline sequence */ p++; - if (sep != '`') -- s->line_num++; + if (sep != '`') { -+ s->line_num++; + s->line_num++; + s->column_ptr = s->column_last_ptr = p; + s->column_num_count = 0; + } continue; default: if (c >= '0' && c <= '9') { -@@ -20673,7 +20817,9 @@ static __exception int next_token(JSParseState *s) +@@ -20698,7 +20842,9 @@ static __exception int next_token(JSParseState *s) s->got_lf = FALSE; s->last_line_num = s->token.line_num; redo: @@ -449,7 +460,7 @@ index 79160139..3fb3c09e 100644 s->token.ptr = p; c = *p; switch(c) { -@@ -20704,6 +20850,8 @@ static __exception int next_token(JSParseState *s) +@@ -20729,6 +20875,8 @@ static __exception int next_token(JSParseState *s) line_terminator: s->got_lf = TRUE; s->line_num++; @@ -458,16 +469,17 @@ index 79160139..3fb3c09e 100644 goto redo; case '\f': case '\v': -@@ -20727,6 +20875,8 @@ static __exception int next_token(JSParseState *s) +@@ -20752,7 +20900,8 @@ static __exception int next_token(JSParseState *s) if (*p == '\n') { s->line_num++; s->got_lf = TRUE; /* considered as LF for ASI */ +- p++; + s->column_ptr = ++p; + s->column_num_count = 0; - p++; } else if (*p == '\r') { s->got_lf = TRUE; /* considered as LF for ASI */ -@@ -21161,6 +21311,9 @@ static __exception int next_token(JSParseState *s) + p++; +@@ -21164,6 +21313,9 @@ static __exception int next_token(JSParseState *s) break; } s->buf_ptr = p; @@ -477,7 +489,7 @@ index 79160139..3fb3c09e 100644 // dump_token(s, &s->token); return 0; -@@ -21219,7 +21372,9 @@ static __exception int json_next_token(JSParseState *s) +@@ -21222,7 +21374,9 @@ static __exception int json_next_token(JSParseState *s) p = s->last_ptr = s->buf_ptr; s->last_line_num = s->token.line_num; redo: @@ -487,7 +499,7 @@ index 79160139..3fb3c09e 100644 s->token.ptr = p; c = *p; switch(c) { -@@ -21248,6 +21403,8 @@ static __exception int json_next_token(JSParseState *s) +@@ -21251,6 +21405,8 @@ static __exception int json_next_token(JSParseState *s) case '\n': p++; s->line_num++; @@ -496,18 +508,17 @@ index 79160139..3fb3c09e 100644 goto redo; case '\f': case '\v': -@@ -21278,7 +21435,9 @@ static __exception int json_next_token(JSParseState *s) - break; +@@ -21282,7 +21438,8 @@ static __exception int json_next_token(JSParseState *s) } if (*p == '\n') { -- s->line_num++; -+ s->line_num++; + s->line_num++; +- p++; + s->column_ptr = ++p; + s->column_num_count = 0; - p++; } else if (*p == '\r') { p++; -@@ -21389,6 +21548,9 @@ static __exception int json_next_token(JSParseState *s) + } else if (*p >= 0x80) { +@@ -21392,6 +21549,9 @@ static __exception int json_next_token(JSParseState *s) break; } s->buf_ptr = p; @@ -517,7 +528,7 @@ index 79160139..3fb3c09e 100644 // dump_token(s, &s->token); return 0; -@@ -21569,6 +21731,11 @@ static void emit_atom(JSParseState *s, JSAtom name) +@@ -21599,6 +21759,11 @@ static void emit_atom(JSParseState *s, JSAtom name) emit_u32(s, JS_DupAtom(s->ctx, name)); } @@ -529,7 +540,7 @@ index 79160139..3fb3c09e 100644 static int update_label(JSFunctionDef *s, int label, int delta) { LabelSlot *ls; -@@ -22123,7 +22290,7 @@ static __exception int js_parse_function_decl(JSParseState *s, +@@ -22162,7 +22327,7 @@ static __exception int js_parse_function_decl(JSParseState *s, JSParseFunctionEnum func_type, JSFunctionKindEnum func_kind, JSAtom func_name, const uint8_t *ptr, @@ -538,7 +549,7 @@ index 79160139..3fb3c09e 100644 static JSFunctionDef *js_parse_function_class_fields_init(JSParseState *s); static __exception int js_parse_function_decl2(JSParseState *s, JSParseFunctionEnum func_type, -@@ -22131,6 +22298,7 @@ static __exception int js_parse_function_decl2(JSParseState *s, +@@ -22170,6 +22335,7 @@ static __exception int js_parse_function_decl2(JSParseState *s, JSAtom func_name, const uint8_t *ptr, int function_line_num, @@ -546,7 +557,7 @@ index 79160139..3fb3c09e 100644 JSParseExportEnum export_flag, JSFunctionDef **pfd); static __exception int js_parse_assign_expr2(JSParseState *s, int parse_flags); -@@ -22424,12 +22592,18 @@ typedef struct JSParsePos { +@@ -22463,12 +22629,18 @@ typedef struct JSParsePos { int line_num; BOOL got_lf; const uint8_t *ptr; @@ -565,7 +576,7 @@ index 79160139..3fb3c09e 100644 sp->ptr = s->token.ptr; sp->got_lf = s->got_lf; return 0; -@@ -22439,6 +22613,9 @@ static __exception int js_parse_seek_token(JSParseState *s, const JSParsePos *sp +@@ -22478,6 +22650,9 @@ static __exception int js_parse_seek_token(JSParseState *s, const JSParsePos *sp { s->token.line_num = sp->last_line_num; s->line_num = sp->line_num; @@ -575,7 +586,7 @@ index 79160139..3fb3c09e 100644 s->buf_ptr = sp->ptr; s->got_lf = sp->got_lf; return next_token(s); -@@ -22644,7 +22821,7 @@ static __exception int js_parse_object_literal(JSParseState *s) +@@ -22683,7 +22858,7 @@ static __exception int js_parse_object_literal(JSParseState *s) { JSAtom name = JS_ATOM_NULL; const uint8_t *start_ptr; @@ -584,17 +595,15 @@ index 79160139..3fb3c09e 100644 BOOL has_proto; if (next_token(s)) -@@ -22655,7 +22832,8 @@ static __exception int js_parse_object_literal(JSParseState *s) - while (s->token.val != '}') { +@@ -22695,6 +22870,7 @@ static __exception int js_parse_object_literal(JSParseState *s) /* specific case for getter/setter */ start_ptr = s->token.ptr; -- start_line = s->token.line_num; -+ start_line = s->token.line_num; + start_line = s->token.line_num; + start_column = s->token.column_num; if (s->token.val == TOK_ELLIPSIS) { if (next_token(s)) -@@ -22701,7 +22879,7 @@ static __exception int js_parse_object_literal(JSParseState *s) +@@ -22740,7 +22916,7 @@ static __exception int js_parse_object_literal(JSParseState *s) func_kind = JS_FUNC_ASYNC_GENERATOR; } if (js_parse_function_decl(s, func_type, func_kind, JS_ATOM_NULL, @@ -603,7 +612,7 @@ index 79160139..3fb3c09e 100644 goto fail; if (name == JS_ATOM_NULL) { emit_op(s, OP_define_method_computed); -@@ -22779,7 +22957,7 @@ static __exception int js_parse_class_default_ctor(JSParseState *s, +@@ -22816,7 +22992,7 @@ static __exception int js_parse_class_default_ctor(JSParseState *s, { JSParsePos pos; const char *str; @@ -611,69 +620,77 @@ index 79160139..3fb3c09e 100644 + int ret, line_num, column_num; JSParseFunctionEnum func_type; const uint8_t *saved_buf_end; - -@@ -22793,14 +22971,17 @@ static __exception int js_parse_class_default_ctor(JSParseState *s, + +@@ -22830,14 +23006,17 @@ static __exception int js_parse_class_default_ctor(JSParseState *s, func_type = JS_PARSE_FUNC_CLASS_CONSTRUCTOR; } line_num = s->token.line_num; + column_num = s->token.column_num; saved_buf_end = s->buf_end; s->buf_ptr = (uint8_t *)str; -- s->buf_end = (uint8_t *)(str + strlen(str)); -+ s->buf_end = (uint8_t *)(str + strlen(str)); + s->buf_end = (uint8_t *)(str + strlen(str)); + s->column_last_ptr = s->buf_ptr; ret = next_token(s); if (!ret) { ret = js_parse_function_decl2(s, func_type, JS_FUNC_NORMAL, JS_ATOM_NULL, (uint8_t *)str, - line_num, JS_PARSE_EXPORT_NONE, pfd); -+ line_num, column_num, ++ line_num, column_num, + JS_PARSE_EXPORT_NONE, pfd); } s->buf_end = saved_buf_end; ret |= js_parse_seek_token(s, &pos); -@@ -23084,7 +23265,8 @@ static __exception int js_parse_class(JSParseState *s, BOOL is_class_expr, +@@ -23070,7 +23249,7 @@ static __exception int js_parse_class(JSParseState *s, BOOL is_class_expr, + // stack is now: + if (js_parse_function_decl2(s, JS_PARSE_FUNC_CLASS_STATIC_INIT, + JS_FUNC_NORMAL, JS_ATOM_NULL, +- s->token.ptr, s->token.line_num, ++ s->token.ptr, s->token.line_num,s->token.column_num, + JS_PARSE_EXPORT_NONE, &init) < 0) { + goto fail; + } +@@ -23146,7 +23325,8 @@ static __exception int js_parse_class(JSParseState *s, BOOL is_class_expr, if (js_parse_function_decl2(s, JS_PARSE_FUNC_GETTER + is_set, JS_FUNC_NORMAL, JS_ATOM_NULL, start_ptr, s->token.line_num, - JS_PARSE_EXPORT_NONE, &method_fd)) -+ s->token.column_num, JS_PARSE_EXPORT_NONE, ++ s->token.column_num, JS_PARSE_EXPORT_NONE, + &method_fd)) goto fail; if (is_private) { method_fd->need_home_object = TRUE; /* needed for brand check */ -@@ -23228,7 +23410,7 @@ static __exception int js_parse_class(JSParseState *s, BOOL is_class_expr, - if (add_brand(s, &class_fields[is_static]) < 0) - goto fail; +@@ -23289,7 +23469,7 @@ static __exception int js_parse_class(JSParseState *s, BOOL is_class_expr, + if (is_private) { + class_fields[is_static].need_brand = TRUE; } - if (js_parse_function_decl2(s, func_type, func_kind, JS_ATOM_NULL, start_ptr, s->token.line_num, JS_PARSE_EXPORT_NONE, &method_fd)) + if (js_parse_function_decl2(s, func_type, func_kind, JS_ATOM_NULL, start_ptr, s->token.line_num, s->token.column_num, JS_PARSE_EXPORT_NONE, &method_fd)) goto fail; if (func_type == JS_PARSE_FUNC_DERIVED_CLASS_CONSTRUCTOR || func_type == JS_PARSE_FUNC_CLASS_CONSTRUCTOR) { -@@ -23893,6 +24075,7 @@ static int js_parse_destructuring_element(JSParseState *s, int tok, int is_arg, +@@ -23979,6 +24159,7 @@ static int js_parse_destructuring_element(JSParseState *s, int tok, int is_arg, JSAtom prop_name, var_name; int opcode, scope, tok1, skip_bits; BOOL has_initializer; + emit_column(s, s->token.column_num); - + if (has_ellipsis < 0) { /* pre-parse destructuration target for spread detection */ -@@ -24330,10 +24513,12 @@ static void optional_chain_test(JSParseState *s, int *poptional_chaining_label, +@@ -24416,10 +24597,12 @@ static void optional_chain_test(JSParseState *s, int *poptional_chaining_label, static __exception int js_parse_postfix_expr(JSParseState *s, int parse_flags) { FuncCallType call_type; - int optional_chaining_label; + int optional_chaining_label, column_num; BOOL accept_lparen = (parse_flags & PF_POSTFIX_CALL) != 0; - + call_type = FUNC_CALL_NORMAL; + column_num = s->token.column_num; + emit_column(s, column_num); switch(s->token.val) { case TOK_NUMBER: { -@@ -24413,7 +24598,7 @@ static __exception int js_parse_postfix_expr(JSParseState *s, int parse_flags) +@@ -24499,7 +24682,7 @@ static __exception int js_parse_postfix_expr(JSParseState *s, int parse_flags) backtrace_flags = JS_BACKTRACE_FLAG_SINGLE_LEVEL; build_backtrace(s->ctx, s->ctx->rt->current_exception, s->filename, s->token.line_num, @@ -682,17 +699,7 @@ index 79160139..3fb3c09e 100644 return -1; } ret = emit_push_const(s, str, 0); -@@ -24433,7 +24618,8 @@ static __exception int js_parse_postfix_expr(JSParseState *s, int parse_flags) - js_parse_skip_parens_token(s, NULL, TRUE) == TOK_ARROW) { - if (js_parse_function_decl(s, JS_PARSE_FUNC_ARROW, - JS_FUNC_NORMAL, JS_ATOM_NULL, -- s->token.ptr, s->token.line_num)) -+ s->token.ptr, s->token.line_num, -+ s->token.column_num)) - return -1; - } else { - if (js_parse_expr_paren(s)) -@@ -24443,7 +24629,8 @@ static __exception int js_parse_postfix_expr(JSParseState *s, int parse_flags) +@@ -24521,7 +24704,8 @@ static __exception int js_parse_postfix_expr(JSParseState *s, int parse_flags) case TOK_FUNCTION: if (js_parse_function_decl(s, JS_PARSE_FUNC_EXPR, JS_FUNC_NORMAL, JS_ATOM_NULL, @@ -702,16 +709,8 @@ index 79160139..3fb3c09e 100644 return -1; break; case TOK_CLASS: -@@ -24482,21 +24669,25 @@ static __exception int js_parse_postfix_expr(JSParseState *s, int parse_flags) - peek_token(s, TRUE) == TOK_ARROW) { - if (js_parse_function_decl(s, JS_PARSE_FUNC_ARROW, - JS_FUNC_NORMAL, JS_ATOM_NULL, -- s->token.ptr, s->token.line_num)) -+ s->token.ptr, s->token.line_num, -+ s->token.column_num)) - return -1; - } else if (token_is_pseudo_keyword(s, JS_ATOM_async) && - peek_token(s, TRUE) != '\n') { +@@ -24560,15 +24744,18 @@ static __exception int js_parse_postfix_expr(JSParseState *s, int parse_flags) + peek_token(s, TRUE) != '\n') { const uint8_t *source_ptr; int source_line_num; + int source_column_num; @@ -726,21 +725,11 @@ index 79160139..3fb3c09e 100644 JS_FUNC_ASYNC, JS_ATOM_NULL, - source_ptr, source_line_num)) + source_ptr, source_line_num, -+ source_column_num)) - return -1; - } else if ((parse_flags & PF_ARROW_FUNC) && - ((s->token.val == '(' && -@@ -24505,7 +24696,8 @@ static __exception int js_parse_postfix_expr(JSParseState *s, int parse_flags) - peek_token(s, TRUE) == TOK_ARROW))) { - if (js_parse_function_decl(s, JS_PARSE_FUNC_ARROW, - JS_FUNC_ASYNC, JS_ATOM_NULL, -- source_ptr, source_line_num)) -+ source_ptr, source_line_num, + source_column_num)) return -1; } else { name = JS_DupAtom(s->ctx, JS_ATOM_async); -@@ -24857,6 +25049,7 @@ static __exception int js_parse_postfix_expr(JSParseState *s, int parse_flags) +@@ -24960,6 +25147,7 @@ static __exception int js_parse_postfix_expr(JSParseState *s, int parse_flags) break; } } else { @@ -748,7 +737,7 @@ index 79160139..3fb3c09e 100644 if (next_token(s)) return -1; emit_func_call: -@@ -24900,6 +25093,8 @@ static __exception int js_parse_postfix_expr(JSParseState *s, int parse_flags) +@@ -25003,6 +25191,8 @@ static __exception int js_parse_postfix_expr(JSParseState *s, int parse_flags) } else if (s->token.val == '.') { if (next_token(s)) return -1; @@ -757,7 +746,7 @@ index 79160139..3fb3c09e 100644 parse_property: if (s->token.val == TOK_PRIVATE_NAME) { /* private class field */ -@@ -24968,6 +25163,7 @@ static __exception int js_parse_delete(JSParseState *s) +@@ -25086,6 +25276,7 @@ static __exception int js_parse_delete(JSParseState *s) JSFunctionDef *fd = s->cur_func; JSAtom name; int opcode; @@ -765,25 +754,15 @@ index 79160139..3fb3c09e 100644 if (next_token(s)) return -1; -@@ -25342,6 +25538,7 @@ static __exception int js_parse_logical_and_or(JSParseState *s, int op, - emit_op(s, OP_drop); - - if (op == TOK_LAND) { -+ emit_column(s, s->token.column_num); - if (js_parse_expr_binary(s, 8, parse_flags & ~PF_ARROW_FUNC)) - return -1; - } else { -@@ -25377,7 +25574,8 @@ static __exception int js_parse_coalesce_expr(JSParseState *s, int parse_flags) +@@ -25549,6 +25740,7 @@ static __exception int js_parse_coalesce_expr(JSParseState *s, int parse_flags) emit_op(s, OP_is_undefined_or_null); emit_goto(s, OP_if_false, label1); emit_op(s, OP_drop); -- + emit_column(s, s->token.column_num); -+ - if (js_parse_expr_binary(s, 8, parse_flags & ~PF_ARROW_FUNC)) + + if (js_parse_expr_binary(s, 8, parse_flags)) return -1; - if (s->token.val != TOK_DOUBLE_QUESTION_MARK) -@@ -25425,6 +25623,7 @@ static __exception int js_parse_assign_expr2(JSParseState *s, int parse_flags) +@@ -25597,6 +25789,7 @@ static __exception int js_parse_assign_expr2(JSParseState *s, int parse_flags) int opcode, op, scope; JSAtom name0 = JS_ATOM_NULL; JSAtom name; @@ -791,7 +770,46 @@ index 79160139..3fb3c09e 100644 if (s->token.val == TOK_YIELD) { BOOL is_star = FALSE, is_async; -@@ -26289,6 +26488,7 @@ static __exception int js_parse_statement_or_decl(JSParseState *s, +@@ -25739,10 +25932,10 @@ static __exception int js_parse_assign_expr2(JSParseState *s, int parse_flags) + js_parse_skip_parens_token(s, NULL, TRUE) == TOK_ARROW) { + return js_parse_function_decl(s, JS_PARSE_FUNC_ARROW, + JS_FUNC_NORMAL, JS_ATOM_NULL, +- s->token.ptr, s->token.line_num); ++ s->token.ptr, s->token.line_num, s->token.column_num); + } else if (token_is_pseudo_keyword(s, JS_ATOM_async)) { + const uint8_t *source_ptr; +- int source_line_num, tok; ++ int source_line_num, source_column_num, tok; + JSParsePos pos; + + /* fast test */ +@@ -25752,6 +25945,7 @@ static __exception int js_parse_assign_expr2(JSParseState *s, int parse_flags) + + source_ptr = s->token.ptr; + source_line_num = s->token.line_num; ++ source_column_num = s->token.column_num; + js_parse_get_pos(s, &pos); + if (next_token(s)) + return -1; +@@ -25761,7 +25955,7 @@ static __exception int js_parse_assign_expr2(JSParseState *s, int parse_flags) + peek_token(s, TRUE) == TOK_ARROW)) { + return js_parse_function_decl(s, JS_PARSE_FUNC_ARROW, + JS_FUNC_ASYNC, JS_ATOM_NULL, +- source_ptr, source_line_num); ++ source_ptr, source_line_num, source_column_num); + } else { + /* undo the token parsing */ + if (js_parse_seek_token(s, &pos)) +@@ -25771,7 +25965,7 @@ static __exception int js_parse_assign_expr2(JSParseState *s, int parse_flags) + peek_token(s, TRUE) == TOK_ARROW) { + return js_parse_function_decl(s, JS_PARSE_FUNC_ARROW, + JS_FUNC_NORMAL, JS_ATOM_NULL, +- s->token.ptr, s->token.line_num); ++ s->token.ptr, s->token.line_num, s->token.column_num); + } + next: + if (s->token.val == TOK_IDENT) { +@@ -26496,6 +26690,7 @@ static __exception int js_parse_statement_or_decl(JSParseState *s, JSContext *ctx = s->ctx; JSAtom label_name; int tok; @@ -799,7 +817,7 @@ index 79160139..3fb3c09e 100644 /* specific label handling */ /* XXX: support multiple labels on loop statements */ -@@ -26973,7 +27173,8 @@ static __exception int js_parse_statement_or_decl(JSParseState *s, +@@ -27185,7 +27380,8 @@ static __exception int js_parse_statement_or_decl(JSParseState *s, parse_func_var: if (js_parse_function_decl(s, JS_PARSE_FUNC_VAR, JS_FUNC_NORMAL, JS_ATOM_NULL, @@ -809,7 +827,7 @@ index 79160139..3fb3c09e 100644 goto fail; break; } -@@ -28387,7 +28588,8 @@ static __exception int js_parse_export(JSParseState *s) +@@ -29096,7 +29292,8 @@ static __exception int js_parse_export(JSParseState *s) return js_parse_function_decl2(s, JS_PARSE_FUNC_STATEMENT, JS_FUNC_NORMAL, JS_ATOM_NULL, s->token.ptr, s->token.line_num, @@ -819,7 +837,7 @@ index 79160139..3fb3c09e 100644 } if (next_token(s)) -@@ -28497,7 +28699,8 @@ static __exception int js_parse_export(JSParseState *s) +@@ -29206,7 +29403,8 @@ static __exception int js_parse_export(JSParseState *s) return js_parse_function_decl2(s, JS_PARSE_FUNC_STATEMENT, JS_FUNC_NORMAL, JS_ATOM_NULL, s->token.ptr, s->token.line_num, @@ -829,7 +847,7 @@ index 79160139..3fb3c09e 100644 } else { if (js_parse_assign_expr(s)) return -1; -@@ -28694,7 +28897,8 @@ static __exception int js_parse_source_element(JSParseState *s) +@@ -29403,7 +29601,8 @@ static __exception int js_parse_source_element(JSParseState *s) peek_token(s, TRUE) == TOK_FUNCTION)) { if (js_parse_function_decl(s, JS_PARSE_FUNC_STATEMENT, JS_FUNC_NORMAL, JS_ATOM_NULL, @@ -839,18 +857,18 @@ index 79160139..3fb3c09e 100644 return -1; } else if (s->token.val == TOK_EXPORT && fd->module) { if (js_parse_export(s)) -@@ -28716,7 +28920,9 @@ static JSFunctionDef *js_new_function_def(JSContext *ctx, +@@ -29425,7 +29624,9 @@ static JSFunctionDef *js_new_function_def(JSContext *ctx, JSFunctionDef *parent, BOOL is_eval, BOOL is_func_expr, - const char *filename, int line_num) -+ const char *filename, ++ const char *filename, + int line_num, + int column_num) { JSFunctionDef *fd; -@@ -28764,8 +28970,10 @@ static JSFunctionDef *js_new_function_def(JSContext *ctx, +@@ -29473,8 +29674,10 @@ static JSFunctionDef *js_new_function_def(JSContext *ctx, fd->filename = JS_NewAtom(ctx, filename); fd->line_num = line_num; @@ -861,7 +879,7 @@ index 79160139..3fb3c09e 100644 //fd->pc2line_last_line_num = line_num; //fd->pc2line_last_pc = 0; fd->last_opcode_line_num = line_num; -@@ -28824,6 +29032,7 @@ static void js_free_function_def(JSContext *ctx, JSFunctionDef *fd) +@@ -29533,6 +29736,7 @@ static void js_free_function_def(JSContext *ctx, JSFunctionDef *fd) js_free(ctx, fd->jump_slots); js_free(ctx, fd->label_slots); js_free(ctx, fd->line_number_slots); @@ -869,7 +887,7 @@ index 79160139..3fb3c09e 100644 for(i = 0; i < fd->cpool_count; i++) { JS_FreeValue(ctx, fd->cpool[i]); -@@ -28857,6 +29066,7 @@ static void js_free_function_def(JSContext *ctx, JSFunctionDef *fd) +@@ -29566,6 +29770,7 @@ static void js_free_function_def(JSContext *ctx, JSFunctionDef *fd) JS_FreeAtom(ctx, fd->filename); dbuf_free(&fd->pc2line); @@ -877,7 +895,7 @@ index 79160139..3fb3c09e 100644 js_free(ctx, fd->source); -@@ -30842,6 +31052,10 @@ static __exception int resolve_variables(JSContext *ctx, JSFunctionDef *s) +@@ -31563,6 +31768,10 @@ static __exception int resolve_variables(JSContext *ctx, JSFunctionDef *s) s->line_number_size++; goto no_change; @@ -888,12 +906,12 @@ index 79160139..3fb3c09e 100644 case OP_eval: /* convert scope index to adjusted variable index */ { int call_argc = get_u16(bc_buf + pos + 1); -@@ -31143,6 +31357,21 @@ static void add_pc2line_info(JSFunctionDef *s, uint32_t pc, int line_num) +@@ -31877,6 +32086,21 @@ static void add_pc2line_info(JSFunctionDef *s, uint32_t pc, int line_num) } } +/* the pc2col table gives a column number for each PC value */ -+static void add_pc2col_info(JSFunctionDef *s, uint32_t pc, int column_num) ++static void add_pc2col_info(JSFunctionDef *s, uint32_t pc, int column_num) +{ + if(s->column_number_slots != NULL + && s->column_number_count < s->column_number_size @@ -910,11 +928,11 @@ index 79160139..3fb3c09e 100644 static void compute_pc2line_info(JSFunctionDef *s) { if (!(s->js_mode & JS_MODE_STRIP) && s->line_number_slots) { -@@ -31181,6 +31410,45 @@ static void compute_pc2line_info(JSFunctionDef *s) +@@ -31915,6 +32139,45 @@ static void compute_pc2line_info(JSFunctionDef *s) } } -+static void compute_pc2column_info(JSFunctionDef *s) ++static void compute_pc2column_info(JSFunctionDef *s) +{ + if(!(s->js_mode & JS_MODE_STRIP) && s->column_number_slots) { + int last_column_num = s->column_num; @@ -956,7 +974,7 @@ index 79160139..3fb3c09e 100644 static RelocEntry *add_reloc(JSContext *ctx, LabelSlot *ls, uint32_t addr, int size) { RelocEntry *re; -@@ -31345,7 +31613,7 @@ static void put_short_code(DynBuf *bc_out, int op, int idx) +@@ -32079,7 +32342,7 @@ static void put_short_code(DynBuf *bc_out, int op, int idx) /* peephole optimizations and resolve goto/labels */ static __exception int resolve_labels(JSContext *ctx, JSFunctionDef *s) { @@ -965,7 +983,7 @@ index 79160139..3fb3c09e 100644 const uint8_t *bc_buf; DynBuf bc_out; LabelSlot *label_slots, *ls; -@@ -31359,7 +31627,7 @@ static __exception int resolve_labels(JSContext *ctx, JSFunctionDef *s) +@@ -32093,7 +32356,7 @@ static __exception int resolve_labels(JSContext *ctx, JSFunctionDef *s) label_slots = s->label_slots; line_num = s->line_num; @@ -974,7 +992,7 @@ index 79160139..3fb3c09e 100644 cc.bc_buf = bc_buf = s->byte_code.buf; cc.bc_len = bc_len = s->byte_code.size; js_dbuf_init(ctx, &bc_out); -@@ -31380,6 +31648,14 @@ static __exception int resolve_labels(JSContext *ctx, JSFunctionDef *s) +@@ -32114,6 +32377,14 @@ static __exception int resolve_labels(JSContext *ctx, JSFunctionDef *s) s->line_number_last_pc = 0; } @@ -989,7 +1007,7 @@ index 79160139..3fb3c09e 100644 /* initialize the 'home_object' variable if needed */ if (s->home_object_var_idx >= 0) { dbuf_putc(&bc_out, OP_special_object); -@@ -31453,6 +31729,12 @@ static __exception int resolve_labels(JSContext *ctx, JSFunctionDef *s) +@@ -32187,6 +32458,12 @@ static __exception int resolve_labels(JSContext *ctx, JSFunctionDef *s) line_num = get_u32(bc_buf + pos + 1); break; @@ -1002,7 +1020,7 @@ index 79160139..3fb3c09e 100644 case OP_label: { label = get_u32(bc_buf + pos + 1); -@@ -32176,6 +32458,11 @@ static __exception int resolve_labels(JSContext *ctx, JSFunctionDef *s) +@@ -32910,6 +33187,11 @@ static __exception int resolve_labels(JSContext *ctx, JSFunctionDef *s) if (s->line_number_slots[j].pc > pos) s->line_number_slots[j].pc -= delta; } @@ -1014,7 +1032,7 @@ index 79160139..3fb3c09e 100644 continue; } break; -@@ -32207,8 +32494,11 @@ static __exception int resolve_labels(JSContext *ctx, JSFunctionDef *s) +@@ -32941,8 +33223,11 @@ static __exception int resolve_labels(JSContext *ctx, JSFunctionDef *s) s->label_slots = NULL; /* XXX: should delay until copying to runtime bytecode function */ compute_pc2line_info(s); @@ -1026,7 +1044,7 @@ index 79160139..3fb3c09e 100644 /* set the new byte code */ dbuf_free(&s->byte_code); s->byte_code = bc_out; -@@ -32615,6 +32905,7 @@ static JSValue js_create_function(JSContext *ctx, JSFunctionDef *fd) +@@ -33413,6 +33698,7 @@ static JSValue js_create_function(JSContext *ctx, JSFunctionDef *fd) if (fd->js_mode & JS_MODE_STRIP) { JS_FreeAtom(ctx, fd->filename); dbuf_free(&fd->pc2line); // probably useless @@ -1034,7 +1052,7 @@ index 79160139..3fb3c09e 100644 } else { /* XXX: source and pc2line info should be packed at the end of the JSFunctionBytecode structure, avoiding allocation overhead -@@ -32622,14 +32913,20 @@ static JSValue js_create_function(JSContext *ctx, JSFunctionDef *fd) +@@ -33420,14 +33706,19 @@ static JSValue js_create_function(JSContext *ctx, JSFunctionDef *fd) b->has_debug = 1; b->debug.filename = fd->filename; b->debug.line_num = fd->line_num; @@ -1047,15 +1065,14 @@ index 79160139..3fb3c09e 100644 + b->debug.pc2column_buf = js_realloc(ctx, fd->pc2column.buf, fd->pc2column.size); if (!b->debug.pc2line_buf) b->debug.pc2line_buf = fd->pc2line.buf; -+ if(!b->debug.pc2column_buf) { ++ if(!b->debug.pc2column_buf) + b->debug.pc2column_buf = fd->pc2column.buf; -+ } b->debug.pc2line_len = fd->pc2line.size; + b->debug.pc2column_len = fd->pc2column.size; b->debug.source = fd->source; b->debug.source_len = fd->source_len; } -@@ -32710,6 +33007,7 @@ static void free_function_bytecode(JSRuntime *rt, JSFunctionBytecode *b) +@@ -33510,6 +33801,7 @@ static void free_function_bytecode(JSRuntime *rt, JSFunctionBytecode *b) if (b->has_debug) { JS_FreeAtomRT(rt, b->debug.filename); js_free_rt(rt, b->debug.pc2line_buf); @@ -1063,16 +1080,16 @@ index 79160139..3fb3c09e 100644 js_free_rt(rt, b->debug.source); } -@@ -32873,7 +33171,7 @@ static JSFunctionDef *js_parse_function_class_fields_init(JSParseState *s) +@@ -33673,7 +33965,7 @@ static JSFunctionDef *js_parse_function_class_fields_init(JSParseState *s) JSFunctionDef *fd; - + fd = js_new_function_def(s->ctx, s->cur_func, FALSE, FALSE, - s->filename, 0); + s->filename, 0, 0); if (!fd) return NULL; fd->func_name = JS_ATOM_NULL; -@@ -32901,6 +33199,7 @@ static __exception int js_parse_function_decl2(JSParseState *s, +@@ -33701,6 +33993,7 @@ static __exception int js_parse_function_decl2(JSParseState *s, JSAtom func_name, const uint8_t *ptr, int function_line_num, @@ -1080,7 +1097,7 @@ index 79160139..3fb3c09e 100644 JSParseExportEnum export_flag, JSFunctionDef **pfd) { -@@ -33014,7 +33313,8 @@ static __exception int js_parse_function_decl2(JSParseState *s, +@@ -33815,7 +34108,8 @@ static __exception int js_parse_function_decl2(JSParseState *s, } fd = js_new_function_def(ctx, fd, FALSE, is_expr, @@ -1090,7 +1107,7 @@ index 79160139..3fb3c09e 100644 if (!fd) { JS_FreeAtom(ctx, func_name); return -1; -@@ -33448,11 +33748,12 @@ static __exception int js_parse_function_decl(JSParseState *s, +@@ -34265,11 +34559,12 @@ static __exception int js_parse_function_decl(JSParseState *s, JSFunctionKindEnum func_kind, JSAtom func_name, const uint8_t *ptr, @@ -1101,12 +1118,12 @@ index 79160139..3fb3c09e 100644 return js_parse_function_decl2(s, func_type, func_kind, func_name, ptr, - function_line_num, JS_PARSE_EXPORT_NONE, - NULL); -+ function_line_num, function_column_num, ++ function_line_num, function_column_num, + JS_PARSE_EXPORT_NONE, NULL); } static __exception int js_parse_program(JSParseState *s) -@@ -33503,10 +33804,14 @@ static void js_parse_init(JSContext *ctx, JSParseState *s, +@@ -34332,10 +34627,14 @@ static void js_parse_init(JSContext *ctx, JSParseState *s, s->ctx = ctx; s->filename = filename; s->line_num = 1; @@ -1121,7 +1138,7 @@ index 79160139..3fb3c09e 100644 } static JSValue JS_EvalFunctionInternal(JSContext *ctx, JSValue fun_obj, -@@ -33620,7 +33925,7 @@ static JSValue __JS_EvalInternal(JSContext *ctx, JSValueConst this_obj, +@@ -34423,7 +34722,7 @@ static JSValue __JS_EvalInternal(JSContext *ctx, JSValueConst this_obj, js_mode |= JS_MODE_STRICT; } } @@ -1130,7 +1147,7 @@ index 79160139..3fb3c09e 100644 if (!fd) goto fail1; s->cur_func = fd; -@@ -34363,6 +34668,9 @@ static int JS_WriteFunctionTag(BCWriterState *s, JSValueConst obj) +@@ -35174,6 +35473,9 @@ static int JS_WriteFunctionTag(BCWriterState *s, JSValueConst obj) bc_put_leb128(s, b->debug.line_num); bc_put_leb128(s, b->debug.pc2line_len); dbuf_put(&s->dbuf, b->debug.pc2line_buf, b->debug.pc2line_len); @@ -1138,9 +1155,9 @@ index 79160139..3fb3c09e 100644 + bc_put_leb128(s, b->debug.pc2column_len); + dbuf_put(&s->dbuf, b->debug.pc2column_buf, b->debug.pc2column_len); } - + for(i = 0; i < b->cpool_count; i++) { -@@ -35385,6 +35693,17 @@ static JSValue JS_ReadFunctionTag(BCReaderState *s) +@@ -36216,6 +36518,17 @@ static JSValue JS_ReadFunctionTag(BCReaderState *s) if (bc_get_buf(s, b->debug.pc2line_buf, b->debug.pc2line_len)) goto fail; } @@ -1158,7 +1175,7 @@ index 79160139..3fb3c09e 100644 #ifdef DUMP_READ_OBJECT bc_read_trace(s, "filename: "); print_atom(s->ctx, b->debug.filename); printf("\n"); #endif -@@ -37839,6 +38158,7 @@ static const JSCFunctionListEntry js_function_proto_funcs[] = { +@@ -38674,6 +38987,7 @@ static const JSCFunctionListEntry js_function_proto_funcs[] = { JS_CFUNC_DEF("[Symbol.hasInstance]", 1, js_function_hasInstance ), JS_CGETSET_DEF("fileName", js_function_proto_fileName, NULL ), JS_CGETSET_DEF("lineNumber", js_function_proto_lineNumber, NULL ), @@ -1166,7 +1183,7 @@ index 79160139..3fb3c09e 100644 }; /* Error class */ -@@ -37934,7 +38254,7 @@ static JSValue js_error_constructor(JSContext *ctx, JSValueConst new_target, +@@ -38783,7 +39097,7 @@ static JSValue js_error_constructor(JSContext *ctx, JSValueConst new_target, } /* skip the Error() function in the backtrace */ @@ -1176,10 +1193,10 @@ index 79160139..3fb3c09e 100644 exception: JS_FreeValue(ctx, obj); diff --git a/quickjs.h b/quickjs.h -index d4a5cd31..61630280 100644 +index 7199936..1986647 100644 --- a/quickjs.h +++ b/quickjs.h -@@ -407,6 +407,7 @@ typedef struct JSMemoryUsage { +@@ -410,6 +410,7 @@ typedef struct JSMemoryUsage { int64_t shape_count, shape_size; int64_t js_func_count, js_func_size, js_func_code_size; int64_t js_func_pc2line_count, js_func_pc2line_size; @@ -1189,7 +1206,7 @@ index d4a5cd31..61630280 100644 int64_t binary_object_count, binary_object_size; diff --git a/tests/test_line_column.js b/tests/test_line_column.js new file mode 100644 -index 00000000..d1c5989c +index 0000000..4301ee0 --- /dev/null +++ b/tests/test_line_column.js @@ -0,0 +1,240 @@ @@ -1294,9 +1311,9 @@ index 00000000..d1c5989c + } +} + -+/** -+ * if comment is first line, -+ * the line number of one line should be locate at next line ++/** ++ * if comment is first line, ++ * the line number of one line should be locate at next line + */ +function test_line_column8() { + try { @@ -1434,58 +1451,3 @@ index 00000000..d1c5989c +test_line_column12(); +test_line_column13(); \ No newline at end of file - -From c5b00eea281d7bad49277c4878279171370b8dc6 Mon Sep 17 00:00:00 2001 -From: ErosZy -Date: Sat, 12 Nov 2022 23:25:18 +0800 -Subject: [PATCH 2/3] fix: comments parse error because of column number - ---- - quickjs.c | 2 -- - 1 file changed, 2 deletions(-) - -diff --git a/quickjs.c b/quickjs.c -index 3fb3c09e..f99b3e57 100644 ---- a/quickjs.c -+++ b/quickjs.c -@@ -20877,7 +20877,6 @@ static __exception int next_token(JSParseState *s) - s->got_lf = TRUE; /* considered as LF for ASI */ - s->column_ptr = ++p; - s->column_num_count = 0; -- p++; - } else if (*p == '\r') { - s->got_lf = TRUE; /* considered as LF for ASI */ - p++; -@@ -21438,7 +21437,6 @@ static __exception int json_next_token(JSParseState *s) - s->line_num++; - s->column_ptr = ++p; - s->column_num_count = 0; -- p++; - } else if (*p == '\r') { - p++; - } else if (*p >= 0x80) { - -From 5a1c24872dbaa44cbd6c2df5081e94aedf0f2aec Mon Sep 17 00:00:00 2001 -From: ErosZy -Date: Sat, 12 Nov 2022 23:59:49 +0800 -Subject: [PATCH 3/3] fix: format line - ---- - quickjs.c | 3 +-- - 1 file changed, 1 insertion(+), 2 deletions(-) - -diff --git a/quickjs.c b/quickjs.c -index f99b3e57..49f30bae 100644 ---- a/quickjs.c -+++ b/quickjs.c -@@ -32920,9 +32920,8 @@ static JSValue js_create_function(JSContext *ctx, JSFunctionDef *fd) - b->debug.pc2column_buf = js_realloc(ctx, fd->pc2column.buf, fd->pc2column.size); - if (!b->debug.pc2line_buf) - b->debug.pc2line_buf = fd->pc2line.buf; -- if(!b->debug.pc2column_buf) { -+ if(!b->debug.pc2column_buf) - b->debug.pc2column_buf = fd->pc2column.buf; -- } - b->debug.pc2line_len = fd->pc2line.size; - b->debug.pc2column_len = fd->pc2column.size; - b->debug.source = fd->source; diff --git a/sys/patches/get_function_proto.patch b/sys/patches/get_function_proto.patch index dcdaa5d77..549233944 100644 --- a/sys/patches/get_function_proto.patch +++ b/sys/patches/get_function_proto.patch @@ -1,27 +1,28 @@ diff --git a/quickjs.c b/quickjs.c -index 48aeffc..fc145b8 100644 +index e8fdd8a..fbd48bd 100644 --- a/quickjs.c +++ b/quickjs.c -@@ -6322,6 +6322,10 @@ JSValue JS_GetGlobalObject(JSContext *ctx) - return JS_DupValue(ctx, ctx->global_obj); +@@ -2215,6 +2215,11 @@ JSValue JS_GetClassProto(JSContext *ctx, JSClassID class_id) + return JS_DupValue(ctx, ctx->class_proto[class_id]); } -+JSValueConst JS_GetFunctionProto(JSContext *ctx) { ++JSValueConst JS_GetFunctionProto(JSContext *ctx) ++{ + return ctx->function_proto; +} + - /* WARNING: obj is freed */ - JSValue JS_Throw(JSContext *ctx, JSValue obj) - { + typedef enum JSFreeModuleEnum { + JS_FREE_MODULE_ALL, + JS_FREE_MODULE_NOT_RESOLVED, diff --git a/quickjs.h b/quickjs.h -index d4a5cd3..c482686 100644 +index 7199936..d9e78ef 100644 --- a/quickjs.h +++ b/quickjs.h -@@ -785,6 +785,7 @@ JSValue JS_EvalThis(JSContext *ctx, JSValueConst this_obj, - const char *input, size_t input_len, - const char *filename, int eval_flags); - JSValue JS_GetGlobalObject(JSContext *ctx); +@@ -358,6 +358,7 @@ void JS_SetContextOpaque(JSContext *ctx, void *opaque); + JSRuntime *JS_GetRuntime(JSContext *ctx); + void JS_SetClassProto(JSContext *ctx, JSClassID class_id, JSValue obj); + JSValue JS_GetClassProto(JSContext *ctx, JSClassID class_id); +JSValueConst JS_GetFunctionProto(JSContext *ctx); - int JS_IsInstanceOf(JSContext *ctx, JSValueConst val, JSValueConst obj); - int JS_DefineProperty(JSContext *ctx, JSValueConst this_obj, - JSAtom prop, JSValueConst val, + + /* the following functions are used to select the intrinsic object to + save memory */ diff --git a/sys/patches/infinity_handling.patch b/sys/patches/infinity_handling.patch index 70e86df4f..464b4c3ef 100644 --- a/sys/patches/infinity_handling.patch +++ b/sys/patches/infinity_handling.patch @@ -1,8 +1,8 @@ diff --git a/quickjs.c b/quickjs.c -index b315256..ccf0916 100644 +index e8fdd8a..9e9b8db 100644 --- a/quickjs.c +++ b/quickjs.c -@@ -10239,7 +10239,7 @@ static JSValue js_atof(JSContext *ctx, const char *str, const char **pp, +@@ -10286,7 +10286,7 @@ static JSValue js_atof(JSContext *ctx, const char *str, const char **pp, } else #endif { @@ -11,7 +11,7 @@ index b315256..ccf0916 100644 if (is_neg) d = -d; val = JS_NewFloat64(ctx, d); -@@ -41736,7 +41736,7 @@ static JSValue js_math_min_max(JSContext *ctx, JSValueConst this_val, +@@ -43090,7 +43090,7 @@ static JSValue js_math_min_max(JSContext *ctx, JSValueConst this_val, uint32_t tag; if (unlikely(argc == 0)) { @@ -20,7 +20,7 @@ index b315256..ccf0916 100644 } tag = JS_VALUE_GET_TAG(argv[0]); -@@ -47843,7 +47843,7 @@ static const JSCFunctionListEntry js_global_funcs[] = { +@@ -49418,7 +49418,7 @@ static const JSCFunctionListEntry js_global_funcs[] = { JS_CFUNC_MAGIC_DEF("encodeURIComponent", 1, js_global_encodeURI, 1 ), JS_CFUNC_DEF("escape", 1, js_global_escape ), JS_CFUNC_DEF("unescape", 1, js_global_unescape ), @@ -28,4 +28,4 @@ index b315256..ccf0916 100644 + JS_PROP_DOUBLE_DEF("Infinity", INFINITY, 0 ), JS_PROP_DOUBLE_DEF("NaN", NAN, 0 ), JS_PROP_UNDEFINED_DEF("undefined", 0 ), - + JS_PROP_STRING_DEF("[Symbol.toStringTag]", "global", JS_PROP_CONFIGURABLE ), diff --git a/sys/patches/read_module_exports.patch b/sys/patches/read_module_exports.patch deleted file mode 100644 index f66ed6902..000000000 --- a/sys/patches/read_module_exports.patch +++ /dev/null @@ -1,64 +0,0 @@ -diff --git a/quickjs.c b/quickjs.c -index 5098719..04c9941 100644 ---- a/quickjs.c -+++ b/quickjs.c -@@ -27258,6 +27258,40 @@ void JS_SetModuleLoaderFunc(JSRuntime *rt, - rt->module_loader_opaque = opaque; - } - -+#ifdef CONFIG_MODULE_EXPORTS -+/* Hooks into module loading functions */ -+JSValueConst JS_GetModuleExport(JSContext *ctx, JSModuleDef *m, const char *export_name) { -+ JSExportEntry *me; -+ JSAtom name; -+ name = JS_NewAtom(ctx, export_name); -+ if (name == JS_ATOM_NULL) -+ goto fail; -+ me = find_export_entry(ctx, m, name); -+ JS_FreeAtom(ctx, name); -+ if (!me) -+ goto fail; -+ return JS_DupValue(ctx, me->u.local.var_ref->value); -+ fail: -+ return JS_UNDEFINED; -+} -+int JS_GetModuleExportEntriesCount(JSModuleDef *m) { -+ return m->export_entries_count; -+} -+ -+JSValue JS_GetModuleExportEntry(JSContext *ctx, JSModuleDef *m, int idx) { -+ if (idx >= m->export_entries_count || idx < 0) -+ return JS_UNDEFINED; -+ return JS_DupValue(ctx, m->export_entries[idx].u.local.var_ref->value); -+} -+ -+JSAtom JS_GetModuleExportEntryName(JSContext *ctx, JSModuleDef *m, int idx) { -+ if (idx >= m->export_entries_count || idx < 0) -+ return JS_ATOM_NULL; -+ return JS_DupAtom(ctx, m->export_entries[idx].export_name); -+} -+#endif -+ -+ - /* default module filename normalizer */ - static char *js_default_module_normalize_name(JSContext *ctx, - const char *base_name, -diff --git a/quickjs.h b/quickjs.h -index c482686..3d6e8c9 100644 ---- a/quickjs.h -+++ b/quickjs.h -@@ -1040,6 +1040,14 @@ int JS_SetModuleExport(JSContext *ctx, JSModuleDef *m, const char *export_name, - int JS_SetModuleExportList(JSContext *ctx, JSModuleDef *m, - const JSCFunctionListEntry *tab, int len); - -+#ifdef CONFIG_MODULE_EXPORTS -+JSValueConst JS_GetModuleExport(JSContext *ctx, JSModuleDef *m, const char *export_name); -+int JS_GetModuleExportEntriesCount(JSModuleDef *m); -+JSValue JS_GetModuleExportEntry(JSContext *ctx, JSModuleDef *m, int idx); -+JSAtom JS_GetModuleExportEntryName(JSContext *ctx, JSModuleDef *m, int idx); -+#endif -+ -+ - #undef js_unlikely - #undef js_force_inline - diff --git a/sys/quickjs b/sys/quickjs index b5e62895c..3b45d155c 160000 --- a/sys/quickjs +++ b/sys/quickjs @@ -1 +1 @@ -Subproject commit b5e62895c619d4ffc75c9d822c8d85f1ece77e5b +Subproject commit 3b45d155c77bbdfe9177b1e03db830d2aff0b2a8 diff --git a/sys/src/bindings/aarch64-apple-darwin.rs b/sys/src/bindings/aarch64-apple-darwin.rs index abe8edd1a..266b827b2 100644 --- a/sys/src/bindings/aarch64-apple-darwin.rs +++ b/sys/src/bindings/aarch64-apple-darwin.rs @@ -31,8 +31,10 @@ pub const JS_EVAL_FLAG_STRICT: u32 = 8; pub const JS_EVAL_FLAG_STRIP: u32 = 16; pub const JS_EVAL_FLAG_COMPILE_ONLY: u32 = 32; pub const JS_EVAL_FLAG_BACKTRACE_BARRIER: u32 = 64; +pub const JS_EVAL_FLAG_ASYNC: u32 = 128; pub const JS_ATOM_NULL: u32 = 0; pub const JS_CALL_FLAG_CONSTRUCTOR: u32 = 1; +pub const JS_INVALID_CLASS_ID: u32 = 0; pub const JS_GPN_STRING_MASK: u32 = 1; pub const JS_GPN_SYMBOL_MASK: u32 = 2; pub const JS_GPN_PRIVATE_MASK: u32 = 4; @@ -459,6 +461,9 @@ extern "C" { extern "C" { pub fn JS_GetClassProto(ctx: *mut JSContext, class_id: JSClassID) -> JSValue; } +extern "C" { + pub fn JS_GetFunctionProto(ctx: *mut JSContext) -> JSValue; +} extern "C" { pub fn JS_NewContextRaw(rt: *mut JSRuntime) -> *mut JSContext; } @@ -1289,6 +1294,9 @@ fn bindgen_test_layout_JSClassDef() { extern "C" { pub fn JS_NewClassID(pclass_id: *mut JSClassID) -> JSClassID; } +extern "C" { + pub fn JS_GetClassID(v: JSValue) -> JSClassID; +} extern "C" { pub fn JS_NewClass( rt: *mut JSRuntime, @@ -1459,6 +1467,9 @@ extern "C" { extern "C" { pub fn JS_IsArray(ctx: *mut JSContext, val: JSValue) -> ::std::os::raw::c_int; } +extern "C" { + pub fn JS_NewDate(ctx: *mut JSContext, epoch_ms: f64) -> JSValue; +} extern "C" { pub fn JS_GetPropertyInternal( ctx: *mut JSContext, @@ -1481,9 +1492,10 @@ extern "C" { extern "C" { pub fn JS_SetPropertyInternal( ctx: *mut JSContext, - this_obj: JSValue, + obj: JSValue, prop: JSAtom, val: JSValue, + this_obj: JSValue, flags: ::std::os::raw::c_int, ) -> ::std::os::raw::c_int; } @@ -1622,9 +1634,6 @@ extern "C" { extern "C" { pub fn JS_GetGlobalObject(ctx: *mut JSContext) -> JSValue; } -extern "C" { - pub fn JS_GetFunctionProto(ctx: *mut JSContext) -> JSValue; -} extern "C" { pub fn JS_IsInstanceOf( ctx: *mut JSContext, @@ -1832,9 +1841,19 @@ extern "C" { sf: *const JSSharedArrayBufferFunctions, ); } +pub const JSPromiseStateEnum_JS_PROMISE_PENDING: JSPromiseStateEnum = 0; +pub const JSPromiseStateEnum_JS_PROMISE_FULFILLED: JSPromiseStateEnum = 1; +pub const JSPromiseStateEnum_JS_PROMISE_REJECTED: JSPromiseStateEnum = 2; +pub type JSPromiseStateEnum = ::std::os::raw::c_uint; extern "C" { pub fn JS_NewPromiseCapability(ctx: *mut JSContext, resolving_funcs: *mut JSValue) -> JSValue; } +extern "C" { + pub fn JS_PromiseState(ctx: *mut JSContext, promise: JSValue) -> JSPromiseStateEnum; +} +extern "C" { + pub fn JS_PromiseResult(ctx: *mut JSContext, promise: JSValue) -> JSValue; +} pub type JSHostPromiseRejectionTracker = ::std::option::Option< unsafe extern "C" fn( ctx: *mut JSContext, @@ -1905,7 +1924,7 @@ extern "C" { pub fn JS_GetModuleName(ctx: *mut JSContext, m: *mut JSModuleDef) -> JSAtom; } extern "C" { - pub fn JS_FreeUnevaluatedModules(ctx: *mut JSContext); + pub fn JS_GetModuleNamespace(ctx: *mut JSContext, m: *mut JSModuleDef) -> JSValue; } pub type JSJobFunc = ::std::option::Option< unsafe extern "C" fn( @@ -1970,11 +1989,11 @@ extern "C" { ) -> JSAtom; } extern "C" { - pub fn JS_RunModule( + pub fn JS_LoadModule( ctx: *mut JSContext, basename: *const ::std::os::raw::c_char, filename: *const ::std::os::raw::c_char, - ) -> *mut JSModuleDef; + ) -> JSValue; } pub const JSCFunctionEnum_JS_CFUNC_generic: JSCFunctionEnum = 0; pub const JSCFunctionEnum_JS_CFUNC_generic_magic: JSCFunctionEnum = 1; @@ -2643,36 +2662,6 @@ extern "C" { len: ::std::os::raw::c_int, ) -> ::std::os::raw::c_int; } -extern "C" { - pub fn JS_DynamicImportSync( - ctx: *mut JSContext, - specifier: *const ::std::os::raw::c_char, - ) -> JSValue; -} -extern "C" { - pub fn JS_GetModuleExport( - ctx: *mut JSContext, - m: *mut JSModuleDef, - export_name: *const ::std::os::raw::c_char, - ) -> JSValue; -} -extern "C" { - pub fn JS_GetModuleExportEntriesCount(m: *mut JSModuleDef) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn JS_GetModuleExportEntry( - ctx: *mut JSContext, - m: *mut JSModuleDef, - idx: ::std::os::raw::c_int, - ) -> JSValue; -} -extern "C" { - pub fn JS_GetModuleExportEntryName( - ctx: *mut JSContext, - m: *mut JSModuleDef, - idx: ::std::os::raw::c_int, - ) -> JSAtom; -} pub const __JS_ATOM_NULL: _bindgen_ty_2 = 0; pub const JS_ATOM_null: _bindgen_ty_2 = 1; pub const JS_ATOM_false: _bindgen_ty_2 = 2; @@ -2726,178 +2715,180 @@ pub const JS_ATOM_fileName: _bindgen_ty_2 = 49; pub const JS_ATOM_lineNumber: _bindgen_ty_2 = 50; pub const JS_ATOM_columnNumber: _bindgen_ty_2 = 51; pub const JS_ATOM_message: _bindgen_ty_2 = 52; -pub const JS_ATOM_errors: _bindgen_ty_2 = 53; -pub const JS_ATOM_stack: _bindgen_ty_2 = 54; -pub const JS_ATOM_name: _bindgen_ty_2 = 55; -pub const JS_ATOM_toString: _bindgen_ty_2 = 56; -pub const JS_ATOM_toLocaleString: _bindgen_ty_2 = 57; -pub const JS_ATOM_valueOf: _bindgen_ty_2 = 58; -pub const JS_ATOM_eval: _bindgen_ty_2 = 59; -pub const JS_ATOM_prototype: _bindgen_ty_2 = 60; -pub const JS_ATOM_constructor: _bindgen_ty_2 = 61; -pub const JS_ATOM_configurable: _bindgen_ty_2 = 62; -pub const JS_ATOM_writable: _bindgen_ty_2 = 63; -pub const JS_ATOM_enumerable: _bindgen_ty_2 = 64; -pub const JS_ATOM_value: _bindgen_ty_2 = 65; -pub const JS_ATOM_get: _bindgen_ty_2 = 66; -pub const JS_ATOM_set: _bindgen_ty_2 = 67; -pub const JS_ATOM_of: _bindgen_ty_2 = 68; -pub const JS_ATOM___proto__: _bindgen_ty_2 = 69; -pub const JS_ATOM_undefined: _bindgen_ty_2 = 70; -pub const JS_ATOM_number: _bindgen_ty_2 = 71; -pub const JS_ATOM_boolean: _bindgen_ty_2 = 72; -pub const JS_ATOM_string: _bindgen_ty_2 = 73; -pub const JS_ATOM_object: _bindgen_ty_2 = 74; -pub const JS_ATOM_symbol: _bindgen_ty_2 = 75; -pub const JS_ATOM_integer: _bindgen_ty_2 = 76; -pub const JS_ATOM_unknown: _bindgen_ty_2 = 77; -pub const JS_ATOM_arguments: _bindgen_ty_2 = 78; -pub const JS_ATOM_callee: _bindgen_ty_2 = 79; -pub const JS_ATOM_caller: _bindgen_ty_2 = 80; -pub const JS_ATOM__eval_: _bindgen_ty_2 = 81; -pub const JS_ATOM__ret_: _bindgen_ty_2 = 82; -pub const JS_ATOM__var_: _bindgen_ty_2 = 83; -pub const JS_ATOM__arg_var_: _bindgen_ty_2 = 84; -pub const JS_ATOM__with_: _bindgen_ty_2 = 85; -pub const JS_ATOM_lastIndex: _bindgen_ty_2 = 86; -pub const JS_ATOM_target: _bindgen_ty_2 = 87; -pub const JS_ATOM_index: _bindgen_ty_2 = 88; -pub const JS_ATOM_input: _bindgen_ty_2 = 89; -pub const JS_ATOM_defineProperties: _bindgen_ty_2 = 90; -pub const JS_ATOM_apply: _bindgen_ty_2 = 91; -pub const JS_ATOM_join: _bindgen_ty_2 = 92; -pub const JS_ATOM_concat: _bindgen_ty_2 = 93; -pub const JS_ATOM_split: _bindgen_ty_2 = 94; -pub const JS_ATOM_construct: _bindgen_ty_2 = 95; -pub const JS_ATOM_getPrototypeOf: _bindgen_ty_2 = 96; -pub const JS_ATOM_setPrototypeOf: _bindgen_ty_2 = 97; -pub const JS_ATOM_isExtensible: _bindgen_ty_2 = 98; -pub const JS_ATOM_preventExtensions: _bindgen_ty_2 = 99; -pub const JS_ATOM_has: _bindgen_ty_2 = 100; -pub const JS_ATOM_deleteProperty: _bindgen_ty_2 = 101; -pub const JS_ATOM_defineProperty: _bindgen_ty_2 = 102; -pub const JS_ATOM_getOwnPropertyDescriptor: _bindgen_ty_2 = 103; -pub const JS_ATOM_ownKeys: _bindgen_ty_2 = 104; -pub const JS_ATOM_add: _bindgen_ty_2 = 105; -pub const JS_ATOM_done: _bindgen_ty_2 = 106; -pub const JS_ATOM_next: _bindgen_ty_2 = 107; -pub const JS_ATOM_values: _bindgen_ty_2 = 108; -pub const JS_ATOM_source: _bindgen_ty_2 = 109; -pub const JS_ATOM_flags: _bindgen_ty_2 = 110; -pub const JS_ATOM_global: _bindgen_ty_2 = 111; -pub const JS_ATOM_unicode: _bindgen_ty_2 = 112; -pub const JS_ATOM_raw: _bindgen_ty_2 = 113; -pub const JS_ATOM_new_target: _bindgen_ty_2 = 114; -pub const JS_ATOM_this_active_func: _bindgen_ty_2 = 115; -pub const JS_ATOM_home_object: _bindgen_ty_2 = 116; -pub const JS_ATOM_computed_field: _bindgen_ty_2 = 117; -pub const JS_ATOM_static_computed_field: _bindgen_ty_2 = 118; -pub const JS_ATOM_class_fields_init: _bindgen_ty_2 = 119; -pub const JS_ATOM_brand: _bindgen_ty_2 = 120; -pub const JS_ATOM_hash_constructor: _bindgen_ty_2 = 121; -pub const JS_ATOM_as: _bindgen_ty_2 = 122; -pub const JS_ATOM_from: _bindgen_ty_2 = 123; -pub const JS_ATOM_meta: _bindgen_ty_2 = 124; -pub const JS_ATOM__default_: _bindgen_ty_2 = 125; -pub const JS_ATOM__star_: _bindgen_ty_2 = 126; -pub const JS_ATOM_Module: _bindgen_ty_2 = 127; -pub const JS_ATOM_then: _bindgen_ty_2 = 128; -pub const JS_ATOM_resolve: _bindgen_ty_2 = 129; -pub const JS_ATOM_reject: _bindgen_ty_2 = 130; -pub const JS_ATOM_promise: _bindgen_ty_2 = 131; -pub const JS_ATOM_proxy: _bindgen_ty_2 = 132; -pub const JS_ATOM_revoke: _bindgen_ty_2 = 133; -pub const JS_ATOM_async: _bindgen_ty_2 = 134; -pub const JS_ATOM_exec: _bindgen_ty_2 = 135; -pub const JS_ATOM_groups: _bindgen_ty_2 = 136; -pub const JS_ATOM_status: _bindgen_ty_2 = 137; -pub const JS_ATOM_reason: _bindgen_ty_2 = 138; -pub const JS_ATOM_globalThis: _bindgen_ty_2 = 139; -pub const JS_ATOM_bigint: _bindgen_ty_2 = 140; -pub const JS_ATOM_bigfloat: _bindgen_ty_2 = 141; -pub const JS_ATOM_bigdecimal: _bindgen_ty_2 = 142; -pub const JS_ATOM_roundingMode: _bindgen_ty_2 = 143; -pub const JS_ATOM_maximumSignificantDigits: _bindgen_ty_2 = 144; -pub const JS_ATOM_maximumFractionDigits: _bindgen_ty_2 = 145; -pub const JS_ATOM_not_equal: _bindgen_ty_2 = 146; -pub const JS_ATOM_timed_out: _bindgen_ty_2 = 147; -pub const JS_ATOM_ok: _bindgen_ty_2 = 148; -pub const JS_ATOM_toJSON: _bindgen_ty_2 = 149; -pub const JS_ATOM_Object: _bindgen_ty_2 = 150; -pub const JS_ATOM_Array: _bindgen_ty_2 = 151; -pub const JS_ATOM_Error: _bindgen_ty_2 = 152; -pub const JS_ATOM_Number: _bindgen_ty_2 = 153; -pub const JS_ATOM_String: _bindgen_ty_2 = 154; -pub const JS_ATOM_Boolean: _bindgen_ty_2 = 155; -pub const JS_ATOM_Symbol: _bindgen_ty_2 = 156; -pub const JS_ATOM_Arguments: _bindgen_ty_2 = 157; -pub const JS_ATOM_Math: _bindgen_ty_2 = 158; -pub const JS_ATOM_JSON: _bindgen_ty_2 = 159; -pub const JS_ATOM_Date: _bindgen_ty_2 = 160; -pub const JS_ATOM_Function: _bindgen_ty_2 = 161; -pub const JS_ATOM_GeneratorFunction: _bindgen_ty_2 = 162; -pub const JS_ATOM_ForInIterator: _bindgen_ty_2 = 163; -pub const JS_ATOM_RegExp: _bindgen_ty_2 = 164; -pub const JS_ATOM_ArrayBuffer: _bindgen_ty_2 = 165; -pub const JS_ATOM_SharedArrayBuffer: _bindgen_ty_2 = 166; -pub const JS_ATOM_Uint8ClampedArray: _bindgen_ty_2 = 167; -pub const JS_ATOM_Int8Array: _bindgen_ty_2 = 168; -pub const JS_ATOM_Uint8Array: _bindgen_ty_2 = 169; -pub const JS_ATOM_Int16Array: _bindgen_ty_2 = 170; -pub const JS_ATOM_Uint16Array: _bindgen_ty_2 = 171; -pub const JS_ATOM_Int32Array: _bindgen_ty_2 = 172; -pub const JS_ATOM_Uint32Array: _bindgen_ty_2 = 173; -pub const JS_ATOM_BigInt64Array: _bindgen_ty_2 = 174; -pub const JS_ATOM_BigUint64Array: _bindgen_ty_2 = 175; -pub const JS_ATOM_Float32Array: _bindgen_ty_2 = 176; -pub const JS_ATOM_Float64Array: _bindgen_ty_2 = 177; -pub const JS_ATOM_DataView: _bindgen_ty_2 = 178; -pub const JS_ATOM_BigInt: _bindgen_ty_2 = 179; -pub const JS_ATOM_BigFloat: _bindgen_ty_2 = 180; -pub const JS_ATOM_BigFloatEnv: _bindgen_ty_2 = 181; -pub const JS_ATOM_BigDecimal: _bindgen_ty_2 = 182; -pub const JS_ATOM_OperatorSet: _bindgen_ty_2 = 183; -pub const JS_ATOM_Operators: _bindgen_ty_2 = 184; -pub const JS_ATOM_Map: _bindgen_ty_2 = 185; -pub const JS_ATOM_Set: _bindgen_ty_2 = 186; -pub const JS_ATOM_WeakMap: _bindgen_ty_2 = 187; -pub const JS_ATOM_WeakSet: _bindgen_ty_2 = 188; -pub const JS_ATOM_Map_Iterator: _bindgen_ty_2 = 189; -pub const JS_ATOM_Set_Iterator: _bindgen_ty_2 = 190; -pub const JS_ATOM_Array_Iterator: _bindgen_ty_2 = 191; -pub const JS_ATOM_String_Iterator: _bindgen_ty_2 = 192; -pub const JS_ATOM_RegExp_String_Iterator: _bindgen_ty_2 = 193; -pub const JS_ATOM_Generator: _bindgen_ty_2 = 194; -pub const JS_ATOM_Proxy: _bindgen_ty_2 = 195; -pub const JS_ATOM_Promise: _bindgen_ty_2 = 196; -pub const JS_ATOM_PromiseResolveFunction: _bindgen_ty_2 = 197; -pub const JS_ATOM_PromiseRejectFunction: _bindgen_ty_2 = 198; -pub const JS_ATOM_AsyncFunction: _bindgen_ty_2 = 199; -pub const JS_ATOM_AsyncFunctionResolve: _bindgen_ty_2 = 200; -pub const JS_ATOM_AsyncFunctionReject: _bindgen_ty_2 = 201; -pub const JS_ATOM_AsyncGeneratorFunction: _bindgen_ty_2 = 202; -pub const JS_ATOM_AsyncGenerator: _bindgen_ty_2 = 203; -pub const JS_ATOM_EvalError: _bindgen_ty_2 = 204; -pub const JS_ATOM_RangeError: _bindgen_ty_2 = 205; -pub const JS_ATOM_ReferenceError: _bindgen_ty_2 = 206; -pub const JS_ATOM_SyntaxError: _bindgen_ty_2 = 207; -pub const JS_ATOM_TypeError: _bindgen_ty_2 = 208; -pub const JS_ATOM_URIError: _bindgen_ty_2 = 209; -pub const JS_ATOM_InternalError: _bindgen_ty_2 = 210; -pub const JS_ATOM_Private_brand: _bindgen_ty_2 = 211; -pub const JS_ATOM_Symbol_toPrimitive: _bindgen_ty_2 = 212; -pub const JS_ATOM_Symbol_iterator: _bindgen_ty_2 = 213; -pub const JS_ATOM_Symbol_match: _bindgen_ty_2 = 214; -pub const JS_ATOM_Symbol_matchAll: _bindgen_ty_2 = 215; -pub const JS_ATOM_Symbol_replace: _bindgen_ty_2 = 216; -pub const JS_ATOM_Symbol_search: _bindgen_ty_2 = 217; -pub const JS_ATOM_Symbol_split: _bindgen_ty_2 = 218; -pub const JS_ATOM_Symbol_toStringTag: _bindgen_ty_2 = 219; -pub const JS_ATOM_Symbol_isConcatSpreadable: _bindgen_ty_2 = 220; -pub const JS_ATOM_Symbol_hasInstance: _bindgen_ty_2 = 221; -pub const JS_ATOM_Symbol_species: _bindgen_ty_2 = 222; -pub const JS_ATOM_Symbol_unscopables: _bindgen_ty_2 = 223; -pub const JS_ATOM_Symbol_asyncIterator: _bindgen_ty_2 = 224; -pub const JS_ATOM_Symbol_operatorSet: _bindgen_ty_2 = 225; -pub const JS_ATOM_END: _bindgen_ty_2 = 226; +pub const JS_ATOM_cause: _bindgen_ty_2 = 53; +pub const JS_ATOM_errors: _bindgen_ty_2 = 54; +pub const JS_ATOM_stack: _bindgen_ty_2 = 55; +pub const JS_ATOM_name: _bindgen_ty_2 = 56; +pub const JS_ATOM_toString: _bindgen_ty_2 = 57; +pub const JS_ATOM_toLocaleString: _bindgen_ty_2 = 58; +pub const JS_ATOM_valueOf: _bindgen_ty_2 = 59; +pub const JS_ATOM_eval: _bindgen_ty_2 = 60; +pub const JS_ATOM_prototype: _bindgen_ty_2 = 61; +pub const JS_ATOM_constructor: _bindgen_ty_2 = 62; +pub const JS_ATOM_configurable: _bindgen_ty_2 = 63; +pub const JS_ATOM_writable: _bindgen_ty_2 = 64; +pub const JS_ATOM_enumerable: _bindgen_ty_2 = 65; +pub const JS_ATOM_value: _bindgen_ty_2 = 66; +pub const JS_ATOM_get: _bindgen_ty_2 = 67; +pub const JS_ATOM_set: _bindgen_ty_2 = 68; +pub const JS_ATOM_of: _bindgen_ty_2 = 69; +pub const JS_ATOM___proto__: _bindgen_ty_2 = 70; +pub const JS_ATOM_undefined: _bindgen_ty_2 = 71; +pub const JS_ATOM_number: _bindgen_ty_2 = 72; +pub const JS_ATOM_boolean: _bindgen_ty_2 = 73; +pub const JS_ATOM_string: _bindgen_ty_2 = 74; +pub const JS_ATOM_object: _bindgen_ty_2 = 75; +pub const JS_ATOM_symbol: _bindgen_ty_2 = 76; +pub const JS_ATOM_integer: _bindgen_ty_2 = 77; +pub const JS_ATOM_unknown: _bindgen_ty_2 = 78; +pub const JS_ATOM_arguments: _bindgen_ty_2 = 79; +pub const JS_ATOM_callee: _bindgen_ty_2 = 80; +pub const JS_ATOM_caller: _bindgen_ty_2 = 81; +pub const JS_ATOM__eval_: _bindgen_ty_2 = 82; +pub const JS_ATOM__ret_: _bindgen_ty_2 = 83; +pub const JS_ATOM__var_: _bindgen_ty_2 = 84; +pub const JS_ATOM__arg_var_: _bindgen_ty_2 = 85; +pub const JS_ATOM__with_: _bindgen_ty_2 = 86; +pub const JS_ATOM_lastIndex: _bindgen_ty_2 = 87; +pub const JS_ATOM_target: _bindgen_ty_2 = 88; +pub const JS_ATOM_index: _bindgen_ty_2 = 89; +pub const JS_ATOM_input: _bindgen_ty_2 = 90; +pub const JS_ATOM_defineProperties: _bindgen_ty_2 = 91; +pub const JS_ATOM_apply: _bindgen_ty_2 = 92; +pub const JS_ATOM_join: _bindgen_ty_2 = 93; +pub const JS_ATOM_concat: _bindgen_ty_2 = 94; +pub const JS_ATOM_split: _bindgen_ty_2 = 95; +pub const JS_ATOM_construct: _bindgen_ty_2 = 96; +pub const JS_ATOM_getPrototypeOf: _bindgen_ty_2 = 97; +pub const JS_ATOM_setPrototypeOf: _bindgen_ty_2 = 98; +pub const JS_ATOM_isExtensible: _bindgen_ty_2 = 99; +pub const JS_ATOM_preventExtensions: _bindgen_ty_2 = 100; +pub const JS_ATOM_has: _bindgen_ty_2 = 101; +pub const JS_ATOM_deleteProperty: _bindgen_ty_2 = 102; +pub const JS_ATOM_defineProperty: _bindgen_ty_2 = 103; +pub const JS_ATOM_getOwnPropertyDescriptor: _bindgen_ty_2 = 104; +pub const JS_ATOM_ownKeys: _bindgen_ty_2 = 105; +pub const JS_ATOM_add: _bindgen_ty_2 = 106; +pub const JS_ATOM_done: _bindgen_ty_2 = 107; +pub const JS_ATOM_next: _bindgen_ty_2 = 108; +pub const JS_ATOM_values: _bindgen_ty_2 = 109; +pub const JS_ATOM_source: _bindgen_ty_2 = 110; +pub const JS_ATOM_flags: _bindgen_ty_2 = 111; +pub const JS_ATOM_global: _bindgen_ty_2 = 112; +pub const JS_ATOM_unicode: _bindgen_ty_2 = 113; +pub const JS_ATOM_raw: _bindgen_ty_2 = 114; +pub const JS_ATOM_new_target: _bindgen_ty_2 = 115; +pub const JS_ATOM_this_active_func: _bindgen_ty_2 = 116; +pub const JS_ATOM_home_object: _bindgen_ty_2 = 117; +pub const JS_ATOM_computed_field: _bindgen_ty_2 = 118; +pub const JS_ATOM_static_computed_field: _bindgen_ty_2 = 119; +pub const JS_ATOM_class_fields_init: _bindgen_ty_2 = 120; +pub const JS_ATOM_brand: _bindgen_ty_2 = 121; +pub const JS_ATOM_hash_constructor: _bindgen_ty_2 = 122; +pub const JS_ATOM_as: _bindgen_ty_2 = 123; +pub const JS_ATOM_from: _bindgen_ty_2 = 124; +pub const JS_ATOM_meta: _bindgen_ty_2 = 125; +pub const JS_ATOM__default_: _bindgen_ty_2 = 126; +pub const JS_ATOM__star_: _bindgen_ty_2 = 127; +pub const JS_ATOM_Module: _bindgen_ty_2 = 128; +pub const JS_ATOM_then: _bindgen_ty_2 = 129; +pub const JS_ATOM_resolve: _bindgen_ty_2 = 130; +pub const JS_ATOM_reject: _bindgen_ty_2 = 131; +pub const JS_ATOM_promise: _bindgen_ty_2 = 132; +pub const JS_ATOM_proxy: _bindgen_ty_2 = 133; +pub const JS_ATOM_revoke: _bindgen_ty_2 = 134; +pub const JS_ATOM_async: _bindgen_ty_2 = 135; +pub const JS_ATOM_exec: _bindgen_ty_2 = 136; +pub const JS_ATOM_groups: _bindgen_ty_2 = 137; +pub const JS_ATOM_indices: _bindgen_ty_2 = 138; +pub const JS_ATOM_status: _bindgen_ty_2 = 139; +pub const JS_ATOM_reason: _bindgen_ty_2 = 140; +pub const JS_ATOM_globalThis: _bindgen_ty_2 = 141; +pub const JS_ATOM_bigint: _bindgen_ty_2 = 142; +pub const JS_ATOM_bigfloat: _bindgen_ty_2 = 143; +pub const JS_ATOM_bigdecimal: _bindgen_ty_2 = 144; +pub const JS_ATOM_roundingMode: _bindgen_ty_2 = 145; +pub const JS_ATOM_maximumSignificantDigits: _bindgen_ty_2 = 146; +pub const JS_ATOM_maximumFractionDigits: _bindgen_ty_2 = 147; +pub const JS_ATOM_not_equal: _bindgen_ty_2 = 148; +pub const JS_ATOM_timed_out: _bindgen_ty_2 = 149; +pub const JS_ATOM_ok: _bindgen_ty_2 = 150; +pub const JS_ATOM_toJSON: _bindgen_ty_2 = 151; +pub const JS_ATOM_Object: _bindgen_ty_2 = 152; +pub const JS_ATOM_Array: _bindgen_ty_2 = 153; +pub const JS_ATOM_Error: _bindgen_ty_2 = 154; +pub const JS_ATOM_Number: _bindgen_ty_2 = 155; +pub const JS_ATOM_String: _bindgen_ty_2 = 156; +pub const JS_ATOM_Boolean: _bindgen_ty_2 = 157; +pub const JS_ATOM_Symbol: _bindgen_ty_2 = 158; +pub const JS_ATOM_Arguments: _bindgen_ty_2 = 159; +pub const JS_ATOM_Math: _bindgen_ty_2 = 160; +pub const JS_ATOM_JSON: _bindgen_ty_2 = 161; +pub const JS_ATOM_Date: _bindgen_ty_2 = 162; +pub const JS_ATOM_Function: _bindgen_ty_2 = 163; +pub const JS_ATOM_GeneratorFunction: _bindgen_ty_2 = 164; +pub const JS_ATOM_ForInIterator: _bindgen_ty_2 = 165; +pub const JS_ATOM_RegExp: _bindgen_ty_2 = 166; +pub const JS_ATOM_ArrayBuffer: _bindgen_ty_2 = 167; +pub const JS_ATOM_SharedArrayBuffer: _bindgen_ty_2 = 168; +pub const JS_ATOM_Uint8ClampedArray: _bindgen_ty_2 = 169; +pub const JS_ATOM_Int8Array: _bindgen_ty_2 = 170; +pub const JS_ATOM_Uint8Array: _bindgen_ty_2 = 171; +pub const JS_ATOM_Int16Array: _bindgen_ty_2 = 172; +pub const JS_ATOM_Uint16Array: _bindgen_ty_2 = 173; +pub const JS_ATOM_Int32Array: _bindgen_ty_2 = 174; +pub const JS_ATOM_Uint32Array: _bindgen_ty_2 = 175; +pub const JS_ATOM_BigInt64Array: _bindgen_ty_2 = 176; +pub const JS_ATOM_BigUint64Array: _bindgen_ty_2 = 177; +pub const JS_ATOM_Float32Array: _bindgen_ty_2 = 178; +pub const JS_ATOM_Float64Array: _bindgen_ty_2 = 179; +pub const JS_ATOM_DataView: _bindgen_ty_2 = 180; +pub const JS_ATOM_BigInt: _bindgen_ty_2 = 181; +pub const JS_ATOM_BigFloat: _bindgen_ty_2 = 182; +pub const JS_ATOM_BigFloatEnv: _bindgen_ty_2 = 183; +pub const JS_ATOM_BigDecimal: _bindgen_ty_2 = 184; +pub const JS_ATOM_OperatorSet: _bindgen_ty_2 = 185; +pub const JS_ATOM_Operators: _bindgen_ty_2 = 186; +pub const JS_ATOM_Map: _bindgen_ty_2 = 187; +pub const JS_ATOM_Set: _bindgen_ty_2 = 188; +pub const JS_ATOM_WeakMap: _bindgen_ty_2 = 189; +pub const JS_ATOM_WeakSet: _bindgen_ty_2 = 190; +pub const JS_ATOM_Map_Iterator: _bindgen_ty_2 = 191; +pub const JS_ATOM_Set_Iterator: _bindgen_ty_2 = 192; +pub const JS_ATOM_Array_Iterator: _bindgen_ty_2 = 193; +pub const JS_ATOM_String_Iterator: _bindgen_ty_2 = 194; +pub const JS_ATOM_RegExp_String_Iterator: _bindgen_ty_2 = 195; +pub const JS_ATOM_Generator: _bindgen_ty_2 = 196; +pub const JS_ATOM_Proxy: _bindgen_ty_2 = 197; +pub const JS_ATOM_Promise: _bindgen_ty_2 = 198; +pub const JS_ATOM_PromiseResolveFunction: _bindgen_ty_2 = 199; +pub const JS_ATOM_PromiseRejectFunction: _bindgen_ty_2 = 200; +pub const JS_ATOM_AsyncFunction: _bindgen_ty_2 = 201; +pub const JS_ATOM_AsyncFunctionResolve: _bindgen_ty_2 = 202; +pub const JS_ATOM_AsyncFunctionReject: _bindgen_ty_2 = 203; +pub const JS_ATOM_AsyncGeneratorFunction: _bindgen_ty_2 = 204; +pub const JS_ATOM_AsyncGenerator: _bindgen_ty_2 = 205; +pub const JS_ATOM_EvalError: _bindgen_ty_2 = 206; +pub const JS_ATOM_RangeError: _bindgen_ty_2 = 207; +pub const JS_ATOM_ReferenceError: _bindgen_ty_2 = 208; +pub const JS_ATOM_SyntaxError: _bindgen_ty_2 = 209; +pub const JS_ATOM_TypeError: _bindgen_ty_2 = 210; +pub const JS_ATOM_URIError: _bindgen_ty_2 = 211; +pub const JS_ATOM_InternalError: _bindgen_ty_2 = 212; +pub const JS_ATOM_Private_brand: _bindgen_ty_2 = 213; +pub const JS_ATOM_Symbol_toPrimitive: _bindgen_ty_2 = 214; +pub const JS_ATOM_Symbol_iterator: _bindgen_ty_2 = 215; +pub const JS_ATOM_Symbol_match: _bindgen_ty_2 = 216; +pub const JS_ATOM_Symbol_matchAll: _bindgen_ty_2 = 217; +pub const JS_ATOM_Symbol_replace: _bindgen_ty_2 = 218; +pub const JS_ATOM_Symbol_search: _bindgen_ty_2 = 219; +pub const JS_ATOM_Symbol_split: _bindgen_ty_2 = 220; +pub const JS_ATOM_Symbol_toStringTag: _bindgen_ty_2 = 221; +pub const JS_ATOM_Symbol_isConcatSpreadable: _bindgen_ty_2 = 222; +pub const JS_ATOM_Symbol_hasInstance: _bindgen_ty_2 = 223; +pub const JS_ATOM_Symbol_species: _bindgen_ty_2 = 224; +pub const JS_ATOM_Symbol_unscopables: _bindgen_ty_2 = 225; +pub const JS_ATOM_Symbol_asyncIterator: _bindgen_ty_2 = 226; +pub const JS_ATOM_Symbol_operatorSet: _bindgen_ty_2 = 227; +pub const JS_ATOM_END: _bindgen_ty_2 = 228; pub type _bindgen_ty_2 = ::std::os::raw::c_uint; diff --git a/sys/src/bindings/aarch64-unknown-linux-gnu.rs b/sys/src/bindings/aarch64-unknown-linux-gnu.rs index f9679c0e7..ef69496a3 100644 --- a/sys/src/bindings/aarch64-unknown-linux-gnu.rs +++ b/sys/src/bindings/aarch64-unknown-linux-gnu.rs @@ -31,8 +31,10 @@ pub const JS_EVAL_FLAG_STRICT: u32 = 8; pub const JS_EVAL_FLAG_STRIP: u32 = 16; pub const JS_EVAL_FLAG_COMPILE_ONLY: u32 = 32; pub const JS_EVAL_FLAG_BACKTRACE_BARRIER: u32 = 64; +pub const JS_EVAL_FLAG_ASYNC: u32 = 128; pub const JS_ATOM_NULL: u32 = 0; pub const JS_CALL_FLAG_CONSTRUCTOR: u32 = 1; +pub const JS_INVALID_CLASS_ID: u32 = 0; pub const JS_GPN_STRING_MASK: u32 = 1; pub const JS_GPN_SYMBOL_MASK: u32 = 2; pub const JS_GPN_PRIVATE_MASK: u32 = 4; @@ -458,6 +460,9 @@ extern "C" { extern "C" { pub fn JS_GetClassProto(ctx: *mut JSContext, class_id: JSClassID) -> JSValue; } +extern "C" { + pub fn JS_GetFunctionProto(ctx: *mut JSContext) -> JSValue; +} extern "C" { pub fn JS_NewContextRaw(rt: *mut JSRuntime) -> *mut JSContext; } @@ -1288,6 +1293,9 @@ fn bindgen_test_layout_JSClassDef() { extern "C" { pub fn JS_NewClassID(pclass_id: *mut JSClassID) -> JSClassID; } +extern "C" { + pub fn JS_GetClassID(v: JSValue) -> JSClassID; +} extern "C" { pub fn JS_NewClass( rt: *mut JSRuntime, @@ -1458,6 +1466,9 @@ extern "C" { extern "C" { pub fn JS_IsArray(ctx: *mut JSContext, val: JSValue) -> ::std::os::raw::c_int; } +extern "C" { + pub fn JS_NewDate(ctx: *mut JSContext, epoch_ms: f64) -> JSValue; +} extern "C" { pub fn JS_GetPropertyInternal( ctx: *mut JSContext, @@ -1480,9 +1491,10 @@ extern "C" { extern "C" { pub fn JS_SetPropertyInternal( ctx: *mut JSContext, - this_obj: JSValue, + obj: JSValue, prop: JSAtom, val: JSValue, + this_obj: JSValue, flags: ::std::os::raw::c_int, ) -> ::std::os::raw::c_int; } @@ -1621,9 +1633,6 @@ extern "C" { extern "C" { pub fn JS_GetGlobalObject(ctx: *mut JSContext) -> JSValue; } -extern "C" { - pub fn JS_GetFunctionProto(ctx: *mut JSContext) -> JSValue; -} extern "C" { pub fn JS_IsInstanceOf( ctx: *mut JSContext, @@ -1831,9 +1840,19 @@ extern "C" { sf: *const JSSharedArrayBufferFunctions, ); } +pub const JSPromiseStateEnum_JS_PROMISE_PENDING: JSPromiseStateEnum = 0; +pub const JSPromiseStateEnum_JS_PROMISE_FULFILLED: JSPromiseStateEnum = 1; +pub const JSPromiseStateEnum_JS_PROMISE_REJECTED: JSPromiseStateEnum = 2; +pub type JSPromiseStateEnum = ::std::os::raw::c_uint; extern "C" { pub fn JS_NewPromiseCapability(ctx: *mut JSContext, resolving_funcs: *mut JSValue) -> JSValue; } +extern "C" { + pub fn JS_PromiseState(ctx: *mut JSContext, promise: JSValue) -> JSPromiseStateEnum; +} +extern "C" { + pub fn JS_PromiseResult(ctx: *mut JSContext, promise: JSValue) -> JSValue; +} pub type JSHostPromiseRejectionTracker = ::std::option::Option< unsafe extern "C" fn( ctx: *mut JSContext, @@ -1904,7 +1923,7 @@ extern "C" { pub fn JS_GetModuleName(ctx: *mut JSContext, m: *mut JSModuleDef) -> JSAtom; } extern "C" { - pub fn JS_FreeUnevaluatedModules(ctx: *mut JSContext); + pub fn JS_GetModuleNamespace(ctx: *mut JSContext, m: *mut JSModuleDef) -> JSValue; } pub type JSJobFunc = ::std::option::Option< unsafe extern "C" fn( @@ -1969,11 +1988,11 @@ extern "C" { ) -> JSAtom; } extern "C" { - pub fn JS_RunModule( + pub fn JS_LoadModule( ctx: *mut JSContext, basename: *const ::std::os::raw::c_char, filename: *const ::std::os::raw::c_char, - ) -> *mut JSModuleDef; + ) -> JSValue; } pub const JSCFunctionEnum_JS_CFUNC_generic: JSCFunctionEnum = 0; pub const JSCFunctionEnum_JS_CFUNC_generic_magic: JSCFunctionEnum = 1; @@ -2642,36 +2661,6 @@ extern "C" { len: ::std::os::raw::c_int, ) -> ::std::os::raw::c_int; } -extern "C" { - pub fn JS_DynamicImportSync( - ctx: *mut JSContext, - specifier: *const ::std::os::raw::c_char, - ) -> JSValue; -} -extern "C" { - pub fn JS_GetModuleExport( - ctx: *mut JSContext, - m: *mut JSModuleDef, - export_name: *const ::std::os::raw::c_char, - ) -> JSValue; -} -extern "C" { - pub fn JS_GetModuleExportEntriesCount(m: *mut JSModuleDef) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn JS_GetModuleExportEntry( - ctx: *mut JSContext, - m: *mut JSModuleDef, - idx: ::std::os::raw::c_int, - ) -> JSValue; -} -extern "C" { - pub fn JS_GetModuleExportEntryName( - ctx: *mut JSContext, - m: *mut JSModuleDef, - idx: ::std::os::raw::c_int, - ) -> JSAtom; -} pub const __JS_ATOM_NULL: _bindgen_ty_2 = 0; pub const JS_ATOM_null: _bindgen_ty_2 = 1; pub const JS_ATOM_false: _bindgen_ty_2 = 2; @@ -2725,178 +2714,180 @@ pub const JS_ATOM_fileName: _bindgen_ty_2 = 49; pub const JS_ATOM_lineNumber: _bindgen_ty_2 = 50; pub const JS_ATOM_columnNumber: _bindgen_ty_2 = 51; pub const JS_ATOM_message: _bindgen_ty_2 = 52; -pub const JS_ATOM_errors: _bindgen_ty_2 = 53; -pub const JS_ATOM_stack: _bindgen_ty_2 = 54; -pub const JS_ATOM_name: _bindgen_ty_2 = 55; -pub const JS_ATOM_toString: _bindgen_ty_2 = 56; -pub const JS_ATOM_toLocaleString: _bindgen_ty_2 = 57; -pub const JS_ATOM_valueOf: _bindgen_ty_2 = 58; -pub const JS_ATOM_eval: _bindgen_ty_2 = 59; -pub const JS_ATOM_prototype: _bindgen_ty_2 = 60; -pub const JS_ATOM_constructor: _bindgen_ty_2 = 61; -pub const JS_ATOM_configurable: _bindgen_ty_2 = 62; -pub const JS_ATOM_writable: _bindgen_ty_2 = 63; -pub const JS_ATOM_enumerable: _bindgen_ty_2 = 64; -pub const JS_ATOM_value: _bindgen_ty_2 = 65; -pub const JS_ATOM_get: _bindgen_ty_2 = 66; -pub const JS_ATOM_set: _bindgen_ty_2 = 67; -pub const JS_ATOM_of: _bindgen_ty_2 = 68; -pub const JS_ATOM___proto__: _bindgen_ty_2 = 69; -pub const JS_ATOM_undefined: _bindgen_ty_2 = 70; -pub const JS_ATOM_number: _bindgen_ty_2 = 71; -pub const JS_ATOM_boolean: _bindgen_ty_2 = 72; -pub const JS_ATOM_string: _bindgen_ty_2 = 73; -pub const JS_ATOM_object: _bindgen_ty_2 = 74; -pub const JS_ATOM_symbol: _bindgen_ty_2 = 75; -pub const JS_ATOM_integer: _bindgen_ty_2 = 76; -pub const JS_ATOM_unknown: _bindgen_ty_2 = 77; -pub const JS_ATOM_arguments: _bindgen_ty_2 = 78; -pub const JS_ATOM_callee: _bindgen_ty_2 = 79; -pub const JS_ATOM_caller: _bindgen_ty_2 = 80; -pub const JS_ATOM__eval_: _bindgen_ty_2 = 81; -pub const JS_ATOM__ret_: _bindgen_ty_2 = 82; -pub const JS_ATOM__var_: _bindgen_ty_2 = 83; -pub const JS_ATOM__arg_var_: _bindgen_ty_2 = 84; -pub const JS_ATOM__with_: _bindgen_ty_2 = 85; -pub const JS_ATOM_lastIndex: _bindgen_ty_2 = 86; -pub const JS_ATOM_target: _bindgen_ty_2 = 87; -pub const JS_ATOM_index: _bindgen_ty_2 = 88; -pub const JS_ATOM_input: _bindgen_ty_2 = 89; -pub const JS_ATOM_defineProperties: _bindgen_ty_2 = 90; -pub const JS_ATOM_apply: _bindgen_ty_2 = 91; -pub const JS_ATOM_join: _bindgen_ty_2 = 92; -pub const JS_ATOM_concat: _bindgen_ty_2 = 93; -pub const JS_ATOM_split: _bindgen_ty_2 = 94; -pub const JS_ATOM_construct: _bindgen_ty_2 = 95; -pub const JS_ATOM_getPrototypeOf: _bindgen_ty_2 = 96; -pub const JS_ATOM_setPrototypeOf: _bindgen_ty_2 = 97; -pub const JS_ATOM_isExtensible: _bindgen_ty_2 = 98; -pub const JS_ATOM_preventExtensions: _bindgen_ty_2 = 99; -pub const JS_ATOM_has: _bindgen_ty_2 = 100; -pub const JS_ATOM_deleteProperty: _bindgen_ty_2 = 101; -pub const JS_ATOM_defineProperty: _bindgen_ty_2 = 102; -pub const JS_ATOM_getOwnPropertyDescriptor: _bindgen_ty_2 = 103; -pub const JS_ATOM_ownKeys: _bindgen_ty_2 = 104; -pub const JS_ATOM_add: _bindgen_ty_2 = 105; -pub const JS_ATOM_done: _bindgen_ty_2 = 106; -pub const JS_ATOM_next: _bindgen_ty_2 = 107; -pub const JS_ATOM_values: _bindgen_ty_2 = 108; -pub const JS_ATOM_source: _bindgen_ty_2 = 109; -pub const JS_ATOM_flags: _bindgen_ty_2 = 110; -pub const JS_ATOM_global: _bindgen_ty_2 = 111; -pub const JS_ATOM_unicode: _bindgen_ty_2 = 112; -pub const JS_ATOM_raw: _bindgen_ty_2 = 113; -pub const JS_ATOM_new_target: _bindgen_ty_2 = 114; -pub const JS_ATOM_this_active_func: _bindgen_ty_2 = 115; -pub const JS_ATOM_home_object: _bindgen_ty_2 = 116; -pub const JS_ATOM_computed_field: _bindgen_ty_2 = 117; -pub const JS_ATOM_static_computed_field: _bindgen_ty_2 = 118; -pub const JS_ATOM_class_fields_init: _bindgen_ty_2 = 119; -pub const JS_ATOM_brand: _bindgen_ty_2 = 120; -pub const JS_ATOM_hash_constructor: _bindgen_ty_2 = 121; -pub const JS_ATOM_as: _bindgen_ty_2 = 122; -pub const JS_ATOM_from: _bindgen_ty_2 = 123; -pub const JS_ATOM_meta: _bindgen_ty_2 = 124; -pub const JS_ATOM__default_: _bindgen_ty_2 = 125; -pub const JS_ATOM__star_: _bindgen_ty_2 = 126; -pub const JS_ATOM_Module: _bindgen_ty_2 = 127; -pub const JS_ATOM_then: _bindgen_ty_2 = 128; -pub const JS_ATOM_resolve: _bindgen_ty_2 = 129; -pub const JS_ATOM_reject: _bindgen_ty_2 = 130; -pub const JS_ATOM_promise: _bindgen_ty_2 = 131; -pub const JS_ATOM_proxy: _bindgen_ty_2 = 132; -pub const JS_ATOM_revoke: _bindgen_ty_2 = 133; -pub const JS_ATOM_async: _bindgen_ty_2 = 134; -pub const JS_ATOM_exec: _bindgen_ty_2 = 135; -pub const JS_ATOM_groups: _bindgen_ty_2 = 136; -pub const JS_ATOM_status: _bindgen_ty_2 = 137; -pub const JS_ATOM_reason: _bindgen_ty_2 = 138; -pub const JS_ATOM_globalThis: _bindgen_ty_2 = 139; -pub const JS_ATOM_bigint: _bindgen_ty_2 = 140; -pub const JS_ATOM_bigfloat: _bindgen_ty_2 = 141; -pub const JS_ATOM_bigdecimal: _bindgen_ty_2 = 142; -pub const JS_ATOM_roundingMode: _bindgen_ty_2 = 143; -pub const JS_ATOM_maximumSignificantDigits: _bindgen_ty_2 = 144; -pub const JS_ATOM_maximumFractionDigits: _bindgen_ty_2 = 145; -pub const JS_ATOM_not_equal: _bindgen_ty_2 = 146; -pub const JS_ATOM_timed_out: _bindgen_ty_2 = 147; -pub const JS_ATOM_ok: _bindgen_ty_2 = 148; -pub const JS_ATOM_toJSON: _bindgen_ty_2 = 149; -pub const JS_ATOM_Object: _bindgen_ty_2 = 150; -pub const JS_ATOM_Array: _bindgen_ty_2 = 151; -pub const JS_ATOM_Error: _bindgen_ty_2 = 152; -pub const JS_ATOM_Number: _bindgen_ty_2 = 153; -pub const JS_ATOM_String: _bindgen_ty_2 = 154; -pub const JS_ATOM_Boolean: _bindgen_ty_2 = 155; -pub const JS_ATOM_Symbol: _bindgen_ty_2 = 156; -pub const JS_ATOM_Arguments: _bindgen_ty_2 = 157; -pub const JS_ATOM_Math: _bindgen_ty_2 = 158; -pub const JS_ATOM_JSON: _bindgen_ty_2 = 159; -pub const JS_ATOM_Date: _bindgen_ty_2 = 160; -pub const JS_ATOM_Function: _bindgen_ty_2 = 161; -pub const JS_ATOM_GeneratorFunction: _bindgen_ty_2 = 162; -pub const JS_ATOM_ForInIterator: _bindgen_ty_2 = 163; -pub const JS_ATOM_RegExp: _bindgen_ty_2 = 164; -pub const JS_ATOM_ArrayBuffer: _bindgen_ty_2 = 165; -pub const JS_ATOM_SharedArrayBuffer: _bindgen_ty_2 = 166; -pub const JS_ATOM_Uint8ClampedArray: _bindgen_ty_2 = 167; -pub const JS_ATOM_Int8Array: _bindgen_ty_2 = 168; -pub const JS_ATOM_Uint8Array: _bindgen_ty_2 = 169; -pub const JS_ATOM_Int16Array: _bindgen_ty_2 = 170; -pub const JS_ATOM_Uint16Array: _bindgen_ty_2 = 171; -pub const JS_ATOM_Int32Array: _bindgen_ty_2 = 172; -pub const JS_ATOM_Uint32Array: _bindgen_ty_2 = 173; -pub const JS_ATOM_BigInt64Array: _bindgen_ty_2 = 174; -pub const JS_ATOM_BigUint64Array: _bindgen_ty_2 = 175; -pub const JS_ATOM_Float32Array: _bindgen_ty_2 = 176; -pub const JS_ATOM_Float64Array: _bindgen_ty_2 = 177; -pub const JS_ATOM_DataView: _bindgen_ty_2 = 178; -pub const JS_ATOM_BigInt: _bindgen_ty_2 = 179; -pub const JS_ATOM_BigFloat: _bindgen_ty_2 = 180; -pub const JS_ATOM_BigFloatEnv: _bindgen_ty_2 = 181; -pub const JS_ATOM_BigDecimal: _bindgen_ty_2 = 182; -pub const JS_ATOM_OperatorSet: _bindgen_ty_2 = 183; -pub const JS_ATOM_Operators: _bindgen_ty_2 = 184; -pub const JS_ATOM_Map: _bindgen_ty_2 = 185; -pub const JS_ATOM_Set: _bindgen_ty_2 = 186; -pub const JS_ATOM_WeakMap: _bindgen_ty_2 = 187; -pub const JS_ATOM_WeakSet: _bindgen_ty_2 = 188; -pub const JS_ATOM_Map_Iterator: _bindgen_ty_2 = 189; -pub const JS_ATOM_Set_Iterator: _bindgen_ty_2 = 190; -pub const JS_ATOM_Array_Iterator: _bindgen_ty_2 = 191; -pub const JS_ATOM_String_Iterator: _bindgen_ty_2 = 192; -pub const JS_ATOM_RegExp_String_Iterator: _bindgen_ty_2 = 193; -pub const JS_ATOM_Generator: _bindgen_ty_2 = 194; -pub const JS_ATOM_Proxy: _bindgen_ty_2 = 195; -pub const JS_ATOM_Promise: _bindgen_ty_2 = 196; -pub const JS_ATOM_PromiseResolveFunction: _bindgen_ty_2 = 197; -pub const JS_ATOM_PromiseRejectFunction: _bindgen_ty_2 = 198; -pub const JS_ATOM_AsyncFunction: _bindgen_ty_2 = 199; -pub const JS_ATOM_AsyncFunctionResolve: _bindgen_ty_2 = 200; -pub const JS_ATOM_AsyncFunctionReject: _bindgen_ty_2 = 201; -pub const JS_ATOM_AsyncGeneratorFunction: _bindgen_ty_2 = 202; -pub const JS_ATOM_AsyncGenerator: _bindgen_ty_2 = 203; -pub const JS_ATOM_EvalError: _bindgen_ty_2 = 204; -pub const JS_ATOM_RangeError: _bindgen_ty_2 = 205; -pub const JS_ATOM_ReferenceError: _bindgen_ty_2 = 206; -pub const JS_ATOM_SyntaxError: _bindgen_ty_2 = 207; -pub const JS_ATOM_TypeError: _bindgen_ty_2 = 208; -pub const JS_ATOM_URIError: _bindgen_ty_2 = 209; -pub const JS_ATOM_InternalError: _bindgen_ty_2 = 210; -pub const JS_ATOM_Private_brand: _bindgen_ty_2 = 211; -pub const JS_ATOM_Symbol_toPrimitive: _bindgen_ty_2 = 212; -pub const JS_ATOM_Symbol_iterator: _bindgen_ty_2 = 213; -pub const JS_ATOM_Symbol_match: _bindgen_ty_2 = 214; -pub const JS_ATOM_Symbol_matchAll: _bindgen_ty_2 = 215; -pub const JS_ATOM_Symbol_replace: _bindgen_ty_2 = 216; -pub const JS_ATOM_Symbol_search: _bindgen_ty_2 = 217; -pub const JS_ATOM_Symbol_split: _bindgen_ty_2 = 218; -pub const JS_ATOM_Symbol_toStringTag: _bindgen_ty_2 = 219; -pub const JS_ATOM_Symbol_isConcatSpreadable: _bindgen_ty_2 = 220; -pub const JS_ATOM_Symbol_hasInstance: _bindgen_ty_2 = 221; -pub const JS_ATOM_Symbol_species: _bindgen_ty_2 = 222; -pub const JS_ATOM_Symbol_unscopables: _bindgen_ty_2 = 223; -pub const JS_ATOM_Symbol_asyncIterator: _bindgen_ty_2 = 224; -pub const JS_ATOM_Symbol_operatorSet: _bindgen_ty_2 = 225; -pub const JS_ATOM_END: _bindgen_ty_2 = 226; +pub const JS_ATOM_cause: _bindgen_ty_2 = 53; +pub const JS_ATOM_errors: _bindgen_ty_2 = 54; +pub const JS_ATOM_stack: _bindgen_ty_2 = 55; +pub const JS_ATOM_name: _bindgen_ty_2 = 56; +pub const JS_ATOM_toString: _bindgen_ty_2 = 57; +pub const JS_ATOM_toLocaleString: _bindgen_ty_2 = 58; +pub const JS_ATOM_valueOf: _bindgen_ty_2 = 59; +pub const JS_ATOM_eval: _bindgen_ty_2 = 60; +pub const JS_ATOM_prototype: _bindgen_ty_2 = 61; +pub const JS_ATOM_constructor: _bindgen_ty_2 = 62; +pub const JS_ATOM_configurable: _bindgen_ty_2 = 63; +pub const JS_ATOM_writable: _bindgen_ty_2 = 64; +pub const JS_ATOM_enumerable: _bindgen_ty_2 = 65; +pub const JS_ATOM_value: _bindgen_ty_2 = 66; +pub const JS_ATOM_get: _bindgen_ty_2 = 67; +pub const JS_ATOM_set: _bindgen_ty_2 = 68; +pub const JS_ATOM_of: _bindgen_ty_2 = 69; +pub const JS_ATOM___proto__: _bindgen_ty_2 = 70; +pub const JS_ATOM_undefined: _bindgen_ty_2 = 71; +pub const JS_ATOM_number: _bindgen_ty_2 = 72; +pub const JS_ATOM_boolean: _bindgen_ty_2 = 73; +pub const JS_ATOM_string: _bindgen_ty_2 = 74; +pub const JS_ATOM_object: _bindgen_ty_2 = 75; +pub const JS_ATOM_symbol: _bindgen_ty_2 = 76; +pub const JS_ATOM_integer: _bindgen_ty_2 = 77; +pub const JS_ATOM_unknown: _bindgen_ty_2 = 78; +pub const JS_ATOM_arguments: _bindgen_ty_2 = 79; +pub const JS_ATOM_callee: _bindgen_ty_2 = 80; +pub const JS_ATOM_caller: _bindgen_ty_2 = 81; +pub const JS_ATOM__eval_: _bindgen_ty_2 = 82; +pub const JS_ATOM__ret_: _bindgen_ty_2 = 83; +pub const JS_ATOM__var_: _bindgen_ty_2 = 84; +pub const JS_ATOM__arg_var_: _bindgen_ty_2 = 85; +pub const JS_ATOM__with_: _bindgen_ty_2 = 86; +pub const JS_ATOM_lastIndex: _bindgen_ty_2 = 87; +pub const JS_ATOM_target: _bindgen_ty_2 = 88; +pub const JS_ATOM_index: _bindgen_ty_2 = 89; +pub const JS_ATOM_input: _bindgen_ty_2 = 90; +pub const JS_ATOM_defineProperties: _bindgen_ty_2 = 91; +pub const JS_ATOM_apply: _bindgen_ty_2 = 92; +pub const JS_ATOM_join: _bindgen_ty_2 = 93; +pub const JS_ATOM_concat: _bindgen_ty_2 = 94; +pub const JS_ATOM_split: _bindgen_ty_2 = 95; +pub const JS_ATOM_construct: _bindgen_ty_2 = 96; +pub const JS_ATOM_getPrototypeOf: _bindgen_ty_2 = 97; +pub const JS_ATOM_setPrototypeOf: _bindgen_ty_2 = 98; +pub const JS_ATOM_isExtensible: _bindgen_ty_2 = 99; +pub const JS_ATOM_preventExtensions: _bindgen_ty_2 = 100; +pub const JS_ATOM_has: _bindgen_ty_2 = 101; +pub const JS_ATOM_deleteProperty: _bindgen_ty_2 = 102; +pub const JS_ATOM_defineProperty: _bindgen_ty_2 = 103; +pub const JS_ATOM_getOwnPropertyDescriptor: _bindgen_ty_2 = 104; +pub const JS_ATOM_ownKeys: _bindgen_ty_2 = 105; +pub const JS_ATOM_add: _bindgen_ty_2 = 106; +pub const JS_ATOM_done: _bindgen_ty_2 = 107; +pub const JS_ATOM_next: _bindgen_ty_2 = 108; +pub const JS_ATOM_values: _bindgen_ty_2 = 109; +pub const JS_ATOM_source: _bindgen_ty_2 = 110; +pub const JS_ATOM_flags: _bindgen_ty_2 = 111; +pub const JS_ATOM_global: _bindgen_ty_2 = 112; +pub const JS_ATOM_unicode: _bindgen_ty_2 = 113; +pub const JS_ATOM_raw: _bindgen_ty_2 = 114; +pub const JS_ATOM_new_target: _bindgen_ty_2 = 115; +pub const JS_ATOM_this_active_func: _bindgen_ty_2 = 116; +pub const JS_ATOM_home_object: _bindgen_ty_2 = 117; +pub const JS_ATOM_computed_field: _bindgen_ty_2 = 118; +pub const JS_ATOM_static_computed_field: _bindgen_ty_2 = 119; +pub const JS_ATOM_class_fields_init: _bindgen_ty_2 = 120; +pub const JS_ATOM_brand: _bindgen_ty_2 = 121; +pub const JS_ATOM_hash_constructor: _bindgen_ty_2 = 122; +pub const JS_ATOM_as: _bindgen_ty_2 = 123; +pub const JS_ATOM_from: _bindgen_ty_2 = 124; +pub const JS_ATOM_meta: _bindgen_ty_2 = 125; +pub const JS_ATOM__default_: _bindgen_ty_2 = 126; +pub const JS_ATOM__star_: _bindgen_ty_2 = 127; +pub const JS_ATOM_Module: _bindgen_ty_2 = 128; +pub const JS_ATOM_then: _bindgen_ty_2 = 129; +pub const JS_ATOM_resolve: _bindgen_ty_2 = 130; +pub const JS_ATOM_reject: _bindgen_ty_2 = 131; +pub const JS_ATOM_promise: _bindgen_ty_2 = 132; +pub const JS_ATOM_proxy: _bindgen_ty_2 = 133; +pub const JS_ATOM_revoke: _bindgen_ty_2 = 134; +pub const JS_ATOM_async: _bindgen_ty_2 = 135; +pub const JS_ATOM_exec: _bindgen_ty_2 = 136; +pub const JS_ATOM_groups: _bindgen_ty_2 = 137; +pub const JS_ATOM_indices: _bindgen_ty_2 = 138; +pub const JS_ATOM_status: _bindgen_ty_2 = 139; +pub const JS_ATOM_reason: _bindgen_ty_2 = 140; +pub const JS_ATOM_globalThis: _bindgen_ty_2 = 141; +pub const JS_ATOM_bigint: _bindgen_ty_2 = 142; +pub const JS_ATOM_bigfloat: _bindgen_ty_2 = 143; +pub const JS_ATOM_bigdecimal: _bindgen_ty_2 = 144; +pub const JS_ATOM_roundingMode: _bindgen_ty_2 = 145; +pub const JS_ATOM_maximumSignificantDigits: _bindgen_ty_2 = 146; +pub const JS_ATOM_maximumFractionDigits: _bindgen_ty_2 = 147; +pub const JS_ATOM_not_equal: _bindgen_ty_2 = 148; +pub const JS_ATOM_timed_out: _bindgen_ty_2 = 149; +pub const JS_ATOM_ok: _bindgen_ty_2 = 150; +pub const JS_ATOM_toJSON: _bindgen_ty_2 = 151; +pub const JS_ATOM_Object: _bindgen_ty_2 = 152; +pub const JS_ATOM_Array: _bindgen_ty_2 = 153; +pub const JS_ATOM_Error: _bindgen_ty_2 = 154; +pub const JS_ATOM_Number: _bindgen_ty_2 = 155; +pub const JS_ATOM_String: _bindgen_ty_2 = 156; +pub const JS_ATOM_Boolean: _bindgen_ty_2 = 157; +pub const JS_ATOM_Symbol: _bindgen_ty_2 = 158; +pub const JS_ATOM_Arguments: _bindgen_ty_2 = 159; +pub const JS_ATOM_Math: _bindgen_ty_2 = 160; +pub const JS_ATOM_JSON: _bindgen_ty_2 = 161; +pub const JS_ATOM_Date: _bindgen_ty_2 = 162; +pub const JS_ATOM_Function: _bindgen_ty_2 = 163; +pub const JS_ATOM_GeneratorFunction: _bindgen_ty_2 = 164; +pub const JS_ATOM_ForInIterator: _bindgen_ty_2 = 165; +pub const JS_ATOM_RegExp: _bindgen_ty_2 = 166; +pub const JS_ATOM_ArrayBuffer: _bindgen_ty_2 = 167; +pub const JS_ATOM_SharedArrayBuffer: _bindgen_ty_2 = 168; +pub const JS_ATOM_Uint8ClampedArray: _bindgen_ty_2 = 169; +pub const JS_ATOM_Int8Array: _bindgen_ty_2 = 170; +pub const JS_ATOM_Uint8Array: _bindgen_ty_2 = 171; +pub const JS_ATOM_Int16Array: _bindgen_ty_2 = 172; +pub const JS_ATOM_Uint16Array: _bindgen_ty_2 = 173; +pub const JS_ATOM_Int32Array: _bindgen_ty_2 = 174; +pub const JS_ATOM_Uint32Array: _bindgen_ty_2 = 175; +pub const JS_ATOM_BigInt64Array: _bindgen_ty_2 = 176; +pub const JS_ATOM_BigUint64Array: _bindgen_ty_2 = 177; +pub const JS_ATOM_Float32Array: _bindgen_ty_2 = 178; +pub const JS_ATOM_Float64Array: _bindgen_ty_2 = 179; +pub const JS_ATOM_DataView: _bindgen_ty_2 = 180; +pub const JS_ATOM_BigInt: _bindgen_ty_2 = 181; +pub const JS_ATOM_BigFloat: _bindgen_ty_2 = 182; +pub const JS_ATOM_BigFloatEnv: _bindgen_ty_2 = 183; +pub const JS_ATOM_BigDecimal: _bindgen_ty_2 = 184; +pub const JS_ATOM_OperatorSet: _bindgen_ty_2 = 185; +pub const JS_ATOM_Operators: _bindgen_ty_2 = 186; +pub const JS_ATOM_Map: _bindgen_ty_2 = 187; +pub const JS_ATOM_Set: _bindgen_ty_2 = 188; +pub const JS_ATOM_WeakMap: _bindgen_ty_2 = 189; +pub const JS_ATOM_WeakSet: _bindgen_ty_2 = 190; +pub const JS_ATOM_Map_Iterator: _bindgen_ty_2 = 191; +pub const JS_ATOM_Set_Iterator: _bindgen_ty_2 = 192; +pub const JS_ATOM_Array_Iterator: _bindgen_ty_2 = 193; +pub const JS_ATOM_String_Iterator: _bindgen_ty_2 = 194; +pub const JS_ATOM_RegExp_String_Iterator: _bindgen_ty_2 = 195; +pub const JS_ATOM_Generator: _bindgen_ty_2 = 196; +pub const JS_ATOM_Proxy: _bindgen_ty_2 = 197; +pub const JS_ATOM_Promise: _bindgen_ty_2 = 198; +pub const JS_ATOM_PromiseResolveFunction: _bindgen_ty_2 = 199; +pub const JS_ATOM_PromiseRejectFunction: _bindgen_ty_2 = 200; +pub const JS_ATOM_AsyncFunction: _bindgen_ty_2 = 201; +pub const JS_ATOM_AsyncFunctionResolve: _bindgen_ty_2 = 202; +pub const JS_ATOM_AsyncFunctionReject: _bindgen_ty_2 = 203; +pub const JS_ATOM_AsyncGeneratorFunction: _bindgen_ty_2 = 204; +pub const JS_ATOM_AsyncGenerator: _bindgen_ty_2 = 205; +pub const JS_ATOM_EvalError: _bindgen_ty_2 = 206; +pub const JS_ATOM_RangeError: _bindgen_ty_2 = 207; +pub const JS_ATOM_ReferenceError: _bindgen_ty_2 = 208; +pub const JS_ATOM_SyntaxError: _bindgen_ty_2 = 209; +pub const JS_ATOM_TypeError: _bindgen_ty_2 = 210; +pub const JS_ATOM_URIError: _bindgen_ty_2 = 211; +pub const JS_ATOM_InternalError: _bindgen_ty_2 = 212; +pub const JS_ATOM_Private_brand: _bindgen_ty_2 = 213; +pub const JS_ATOM_Symbol_toPrimitive: _bindgen_ty_2 = 214; +pub const JS_ATOM_Symbol_iterator: _bindgen_ty_2 = 215; +pub const JS_ATOM_Symbol_match: _bindgen_ty_2 = 216; +pub const JS_ATOM_Symbol_matchAll: _bindgen_ty_2 = 217; +pub const JS_ATOM_Symbol_replace: _bindgen_ty_2 = 218; +pub const JS_ATOM_Symbol_search: _bindgen_ty_2 = 219; +pub const JS_ATOM_Symbol_split: _bindgen_ty_2 = 220; +pub const JS_ATOM_Symbol_toStringTag: _bindgen_ty_2 = 221; +pub const JS_ATOM_Symbol_isConcatSpreadable: _bindgen_ty_2 = 222; +pub const JS_ATOM_Symbol_hasInstance: _bindgen_ty_2 = 223; +pub const JS_ATOM_Symbol_species: _bindgen_ty_2 = 224; +pub const JS_ATOM_Symbol_unscopables: _bindgen_ty_2 = 225; +pub const JS_ATOM_Symbol_asyncIterator: _bindgen_ty_2 = 226; +pub const JS_ATOM_Symbol_operatorSet: _bindgen_ty_2 = 227; +pub const JS_ATOM_END: _bindgen_ty_2 = 228; pub type _bindgen_ty_2 = ::std::os::raw::c_uint; diff --git a/sys/src/bindings/aarch64-unknown-linux-musl.rs b/sys/src/bindings/aarch64-unknown-linux-musl.rs index f9679c0e7..ef69496a3 100644 --- a/sys/src/bindings/aarch64-unknown-linux-musl.rs +++ b/sys/src/bindings/aarch64-unknown-linux-musl.rs @@ -31,8 +31,10 @@ pub const JS_EVAL_FLAG_STRICT: u32 = 8; pub const JS_EVAL_FLAG_STRIP: u32 = 16; pub const JS_EVAL_FLAG_COMPILE_ONLY: u32 = 32; pub const JS_EVAL_FLAG_BACKTRACE_BARRIER: u32 = 64; +pub const JS_EVAL_FLAG_ASYNC: u32 = 128; pub const JS_ATOM_NULL: u32 = 0; pub const JS_CALL_FLAG_CONSTRUCTOR: u32 = 1; +pub const JS_INVALID_CLASS_ID: u32 = 0; pub const JS_GPN_STRING_MASK: u32 = 1; pub const JS_GPN_SYMBOL_MASK: u32 = 2; pub const JS_GPN_PRIVATE_MASK: u32 = 4; @@ -458,6 +460,9 @@ extern "C" { extern "C" { pub fn JS_GetClassProto(ctx: *mut JSContext, class_id: JSClassID) -> JSValue; } +extern "C" { + pub fn JS_GetFunctionProto(ctx: *mut JSContext) -> JSValue; +} extern "C" { pub fn JS_NewContextRaw(rt: *mut JSRuntime) -> *mut JSContext; } @@ -1288,6 +1293,9 @@ fn bindgen_test_layout_JSClassDef() { extern "C" { pub fn JS_NewClassID(pclass_id: *mut JSClassID) -> JSClassID; } +extern "C" { + pub fn JS_GetClassID(v: JSValue) -> JSClassID; +} extern "C" { pub fn JS_NewClass( rt: *mut JSRuntime, @@ -1458,6 +1466,9 @@ extern "C" { extern "C" { pub fn JS_IsArray(ctx: *mut JSContext, val: JSValue) -> ::std::os::raw::c_int; } +extern "C" { + pub fn JS_NewDate(ctx: *mut JSContext, epoch_ms: f64) -> JSValue; +} extern "C" { pub fn JS_GetPropertyInternal( ctx: *mut JSContext, @@ -1480,9 +1491,10 @@ extern "C" { extern "C" { pub fn JS_SetPropertyInternal( ctx: *mut JSContext, - this_obj: JSValue, + obj: JSValue, prop: JSAtom, val: JSValue, + this_obj: JSValue, flags: ::std::os::raw::c_int, ) -> ::std::os::raw::c_int; } @@ -1621,9 +1633,6 @@ extern "C" { extern "C" { pub fn JS_GetGlobalObject(ctx: *mut JSContext) -> JSValue; } -extern "C" { - pub fn JS_GetFunctionProto(ctx: *mut JSContext) -> JSValue; -} extern "C" { pub fn JS_IsInstanceOf( ctx: *mut JSContext, @@ -1831,9 +1840,19 @@ extern "C" { sf: *const JSSharedArrayBufferFunctions, ); } +pub const JSPromiseStateEnum_JS_PROMISE_PENDING: JSPromiseStateEnum = 0; +pub const JSPromiseStateEnum_JS_PROMISE_FULFILLED: JSPromiseStateEnum = 1; +pub const JSPromiseStateEnum_JS_PROMISE_REJECTED: JSPromiseStateEnum = 2; +pub type JSPromiseStateEnum = ::std::os::raw::c_uint; extern "C" { pub fn JS_NewPromiseCapability(ctx: *mut JSContext, resolving_funcs: *mut JSValue) -> JSValue; } +extern "C" { + pub fn JS_PromiseState(ctx: *mut JSContext, promise: JSValue) -> JSPromiseStateEnum; +} +extern "C" { + pub fn JS_PromiseResult(ctx: *mut JSContext, promise: JSValue) -> JSValue; +} pub type JSHostPromiseRejectionTracker = ::std::option::Option< unsafe extern "C" fn( ctx: *mut JSContext, @@ -1904,7 +1923,7 @@ extern "C" { pub fn JS_GetModuleName(ctx: *mut JSContext, m: *mut JSModuleDef) -> JSAtom; } extern "C" { - pub fn JS_FreeUnevaluatedModules(ctx: *mut JSContext); + pub fn JS_GetModuleNamespace(ctx: *mut JSContext, m: *mut JSModuleDef) -> JSValue; } pub type JSJobFunc = ::std::option::Option< unsafe extern "C" fn( @@ -1969,11 +1988,11 @@ extern "C" { ) -> JSAtom; } extern "C" { - pub fn JS_RunModule( + pub fn JS_LoadModule( ctx: *mut JSContext, basename: *const ::std::os::raw::c_char, filename: *const ::std::os::raw::c_char, - ) -> *mut JSModuleDef; + ) -> JSValue; } pub const JSCFunctionEnum_JS_CFUNC_generic: JSCFunctionEnum = 0; pub const JSCFunctionEnum_JS_CFUNC_generic_magic: JSCFunctionEnum = 1; @@ -2642,36 +2661,6 @@ extern "C" { len: ::std::os::raw::c_int, ) -> ::std::os::raw::c_int; } -extern "C" { - pub fn JS_DynamicImportSync( - ctx: *mut JSContext, - specifier: *const ::std::os::raw::c_char, - ) -> JSValue; -} -extern "C" { - pub fn JS_GetModuleExport( - ctx: *mut JSContext, - m: *mut JSModuleDef, - export_name: *const ::std::os::raw::c_char, - ) -> JSValue; -} -extern "C" { - pub fn JS_GetModuleExportEntriesCount(m: *mut JSModuleDef) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn JS_GetModuleExportEntry( - ctx: *mut JSContext, - m: *mut JSModuleDef, - idx: ::std::os::raw::c_int, - ) -> JSValue; -} -extern "C" { - pub fn JS_GetModuleExportEntryName( - ctx: *mut JSContext, - m: *mut JSModuleDef, - idx: ::std::os::raw::c_int, - ) -> JSAtom; -} pub const __JS_ATOM_NULL: _bindgen_ty_2 = 0; pub const JS_ATOM_null: _bindgen_ty_2 = 1; pub const JS_ATOM_false: _bindgen_ty_2 = 2; @@ -2725,178 +2714,180 @@ pub const JS_ATOM_fileName: _bindgen_ty_2 = 49; pub const JS_ATOM_lineNumber: _bindgen_ty_2 = 50; pub const JS_ATOM_columnNumber: _bindgen_ty_2 = 51; pub const JS_ATOM_message: _bindgen_ty_2 = 52; -pub const JS_ATOM_errors: _bindgen_ty_2 = 53; -pub const JS_ATOM_stack: _bindgen_ty_2 = 54; -pub const JS_ATOM_name: _bindgen_ty_2 = 55; -pub const JS_ATOM_toString: _bindgen_ty_2 = 56; -pub const JS_ATOM_toLocaleString: _bindgen_ty_2 = 57; -pub const JS_ATOM_valueOf: _bindgen_ty_2 = 58; -pub const JS_ATOM_eval: _bindgen_ty_2 = 59; -pub const JS_ATOM_prototype: _bindgen_ty_2 = 60; -pub const JS_ATOM_constructor: _bindgen_ty_2 = 61; -pub const JS_ATOM_configurable: _bindgen_ty_2 = 62; -pub const JS_ATOM_writable: _bindgen_ty_2 = 63; -pub const JS_ATOM_enumerable: _bindgen_ty_2 = 64; -pub const JS_ATOM_value: _bindgen_ty_2 = 65; -pub const JS_ATOM_get: _bindgen_ty_2 = 66; -pub const JS_ATOM_set: _bindgen_ty_2 = 67; -pub const JS_ATOM_of: _bindgen_ty_2 = 68; -pub const JS_ATOM___proto__: _bindgen_ty_2 = 69; -pub const JS_ATOM_undefined: _bindgen_ty_2 = 70; -pub const JS_ATOM_number: _bindgen_ty_2 = 71; -pub const JS_ATOM_boolean: _bindgen_ty_2 = 72; -pub const JS_ATOM_string: _bindgen_ty_2 = 73; -pub const JS_ATOM_object: _bindgen_ty_2 = 74; -pub const JS_ATOM_symbol: _bindgen_ty_2 = 75; -pub const JS_ATOM_integer: _bindgen_ty_2 = 76; -pub const JS_ATOM_unknown: _bindgen_ty_2 = 77; -pub const JS_ATOM_arguments: _bindgen_ty_2 = 78; -pub const JS_ATOM_callee: _bindgen_ty_2 = 79; -pub const JS_ATOM_caller: _bindgen_ty_2 = 80; -pub const JS_ATOM__eval_: _bindgen_ty_2 = 81; -pub const JS_ATOM__ret_: _bindgen_ty_2 = 82; -pub const JS_ATOM__var_: _bindgen_ty_2 = 83; -pub const JS_ATOM__arg_var_: _bindgen_ty_2 = 84; -pub const JS_ATOM__with_: _bindgen_ty_2 = 85; -pub const JS_ATOM_lastIndex: _bindgen_ty_2 = 86; -pub const JS_ATOM_target: _bindgen_ty_2 = 87; -pub const JS_ATOM_index: _bindgen_ty_2 = 88; -pub const JS_ATOM_input: _bindgen_ty_2 = 89; -pub const JS_ATOM_defineProperties: _bindgen_ty_2 = 90; -pub const JS_ATOM_apply: _bindgen_ty_2 = 91; -pub const JS_ATOM_join: _bindgen_ty_2 = 92; -pub const JS_ATOM_concat: _bindgen_ty_2 = 93; -pub const JS_ATOM_split: _bindgen_ty_2 = 94; -pub const JS_ATOM_construct: _bindgen_ty_2 = 95; -pub const JS_ATOM_getPrototypeOf: _bindgen_ty_2 = 96; -pub const JS_ATOM_setPrototypeOf: _bindgen_ty_2 = 97; -pub const JS_ATOM_isExtensible: _bindgen_ty_2 = 98; -pub const JS_ATOM_preventExtensions: _bindgen_ty_2 = 99; -pub const JS_ATOM_has: _bindgen_ty_2 = 100; -pub const JS_ATOM_deleteProperty: _bindgen_ty_2 = 101; -pub const JS_ATOM_defineProperty: _bindgen_ty_2 = 102; -pub const JS_ATOM_getOwnPropertyDescriptor: _bindgen_ty_2 = 103; -pub const JS_ATOM_ownKeys: _bindgen_ty_2 = 104; -pub const JS_ATOM_add: _bindgen_ty_2 = 105; -pub const JS_ATOM_done: _bindgen_ty_2 = 106; -pub const JS_ATOM_next: _bindgen_ty_2 = 107; -pub const JS_ATOM_values: _bindgen_ty_2 = 108; -pub const JS_ATOM_source: _bindgen_ty_2 = 109; -pub const JS_ATOM_flags: _bindgen_ty_2 = 110; -pub const JS_ATOM_global: _bindgen_ty_2 = 111; -pub const JS_ATOM_unicode: _bindgen_ty_2 = 112; -pub const JS_ATOM_raw: _bindgen_ty_2 = 113; -pub const JS_ATOM_new_target: _bindgen_ty_2 = 114; -pub const JS_ATOM_this_active_func: _bindgen_ty_2 = 115; -pub const JS_ATOM_home_object: _bindgen_ty_2 = 116; -pub const JS_ATOM_computed_field: _bindgen_ty_2 = 117; -pub const JS_ATOM_static_computed_field: _bindgen_ty_2 = 118; -pub const JS_ATOM_class_fields_init: _bindgen_ty_2 = 119; -pub const JS_ATOM_brand: _bindgen_ty_2 = 120; -pub const JS_ATOM_hash_constructor: _bindgen_ty_2 = 121; -pub const JS_ATOM_as: _bindgen_ty_2 = 122; -pub const JS_ATOM_from: _bindgen_ty_2 = 123; -pub const JS_ATOM_meta: _bindgen_ty_2 = 124; -pub const JS_ATOM__default_: _bindgen_ty_2 = 125; -pub const JS_ATOM__star_: _bindgen_ty_2 = 126; -pub const JS_ATOM_Module: _bindgen_ty_2 = 127; -pub const JS_ATOM_then: _bindgen_ty_2 = 128; -pub const JS_ATOM_resolve: _bindgen_ty_2 = 129; -pub const JS_ATOM_reject: _bindgen_ty_2 = 130; -pub const JS_ATOM_promise: _bindgen_ty_2 = 131; -pub const JS_ATOM_proxy: _bindgen_ty_2 = 132; -pub const JS_ATOM_revoke: _bindgen_ty_2 = 133; -pub const JS_ATOM_async: _bindgen_ty_2 = 134; -pub const JS_ATOM_exec: _bindgen_ty_2 = 135; -pub const JS_ATOM_groups: _bindgen_ty_2 = 136; -pub const JS_ATOM_status: _bindgen_ty_2 = 137; -pub const JS_ATOM_reason: _bindgen_ty_2 = 138; -pub const JS_ATOM_globalThis: _bindgen_ty_2 = 139; -pub const JS_ATOM_bigint: _bindgen_ty_2 = 140; -pub const JS_ATOM_bigfloat: _bindgen_ty_2 = 141; -pub const JS_ATOM_bigdecimal: _bindgen_ty_2 = 142; -pub const JS_ATOM_roundingMode: _bindgen_ty_2 = 143; -pub const JS_ATOM_maximumSignificantDigits: _bindgen_ty_2 = 144; -pub const JS_ATOM_maximumFractionDigits: _bindgen_ty_2 = 145; -pub const JS_ATOM_not_equal: _bindgen_ty_2 = 146; -pub const JS_ATOM_timed_out: _bindgen_ty_2 = 147; -pub const JS_ATOM_ok: _bindgen_ty_2 = 148; -pub const JS_ATOM_toJSON: _bindgen_ty_2 = 149; -pub const JS_ATOM_Object: _bindgen_ty_2 = 150; -pub const JS_ATOM_Array: _bindgen_ty_2 = 151; -pub const JS_ATOM_Error: _bindgen_ty_2 = 152; -pub const JS_ATOM_Number: _bindgen_ty_2 = 153; -pub const JS_ATOM_String: _bindgen_ty_2 = 154; -pub const JS_ATOM_Boolean: _bindgen_ty_2 = 155; -pub const JS_ATOM_Symbol: _bindgen_ty_2 = 156; -pub const JS_ATOM_Arguments: _bindgen_ty_2 = 157; -pub const JS_ATOM_Math: _bindgen_ty_2 = 158; -pub const JS_ATOM_JSON: _bindgen_ty_2 = 159; -pub const JS_ATOM_Date: _bindgen_ty_2 = 160; -pub const JS_ATOM_Function: _bindgen_ty_2 = 161; -pub const JS_ATOM_GeneratorFunction: _bindgen_ty_2 = 162; -pub const JS_ATOM_ForInIterator: _bindgen_ty_2 = 163; -pub const JS_ATOM_RegExp: _bindgen_ty_2 = 164; -pub const JS_ATOM_ArrayBuffer: _bindgen_ty_2 = 165; -pub const JS_ATOM_SharedArrayBuffer: _bindgen_ty_2 = 166; -pub const JS_ATOM_Uint8ClampedArray: _bindgen_ty_2 = 167; -pub const JS_ATOM_Int8Array: _bindgen_ty_2 = 168; -pub const JS_ATOM_Uint8Array: _bindgen_ty_2 = 169; -pub const JS_ATOM_Int16Array: _bindgen_ty_2 = 170; -pub const JS_ATOM_Uint16Array: _bindgen_ty_2 = 171; -pub const JS_ATOM_Int32Array: _bindgen_ty_2 = 172; -pub const JS_ATOM_Uint32Array: _bindgen_ty_2 = 173; -pub const JS_ATOM_BigInt64Array: _bindgen_ty_2 = 174; -pub const JS_ATOM_BigUint64Array: _bindgen_ty_2 = 175; -pub const JS_ATOM_Float32Array: _bindgen_ty_2 = 176; -pub const JS_ATOM_Float64Array: _bindgen_ty_2 = 177; -pub const JS_ATOM_DataView: _bindgen_ty_2 = 178; -pub const JS_ATOM_BigInt: _bindgen_ty_2 = 179; -pub const JS_ATOM_BigFloat: _bindgen_ty_2 = 180; -pub const JS_ATOM_BigFloatEnv: _bindgen_ty_2 = 181; -pub const JS_ATOM_BigDecimal: _bindgen_ty_2 = 182; -pub const JS_ATOM_OperatorSet: _bindgen_ty_2 = 183; -pub const JS_ATOM_Operators: _bindgen_ty_2 = 184; -pub const JS_ATOM_Map: _bindgen_ty_2 = 185; -pub const JS_ATOM_Set: _bindgen_ty_2 = 186; -pub const JS_ATOM_WeakMap: _bindgen_ty_2 = 187; -pub const JS_ATOM_WeakSet: _bindgen_ty_2 = 188; -pub const JS_ATOM_Map_Iterator: _bindgen_ty_2 = 189; -pub const JS_ATOM_Set_Iterator: _bindgen_ty_2 = 190; -pub const JS_ATOM_Array_Iterator: _bindgen_ty_2 = 191; -pub const JS_ATOM_String_Iterator: _bindgen_ty_2 = 192; -pub const JS_ATOM_RegExp_String_Iterator: _bindgen_ty_2 = 193; -pub const JS_ATOM_Generator: _bindgen_ty_2 = 194; -pub const JS_ATOM_Proxy: _bindgen_ty_2 = 195; -pub const JS_ATOM_Promise: _bindgen_ty_2 = 196; -pub const JS_ATOM_PromiseResolveFunction: _bindgen_ty_2 = 197; -pub const JS_ATOM_PromiseRejectFunction: _bindgen_ty_2 = 198; -pub const JS_ATOM_AsyncFunction: _bindgen_ty_2 = 199; -pub const JS_ATOM_AsyncFunctionResolve: _bindgen_ty_2 = 200; -pub const JS_ATOM_AsyncFunctionReject: _bindgen_ty_2 = 201; -pub const JS_ATOM_AsyncGeneratorFunction: _bindgen_ty_2 = 202; -pub const JS_ATOM_AsyncGenerator: _bindgen_ty_2 = 203; -pub const JS_ATOM_EvalError: _bindgen_ty_2 = 204; -pub const JS_ATOM_RangeError: _bindgen_ty_2 = 205; -pub const JS_ATOM_ReferenceError: _bindgen_ty_2 = 206; -pub const JS_ATOM_SyntaxError: _bindgen_ty_2 = 207; -pub const JS_ATOM_TypeError: _bindgen_ty_2 = 208; -pub const JS_ATOM_URIError: _bindgen_ty_2 = 209; -pub const JS_ATOM_InternalError: _bindgen_ty_2 = 210; -pub const JS_ATOM_Private_brand: _bindgen_ty_2 = 211; -pub const JS_ATOM_Symbol_toPrimitive: _bindgen_ty_2 = 212; -pub const JS_ATOM_Symbol_iterator: _bindgen_ty_2 = 213; -pub const JS_ATOM_Symbol_match: _bindgen_ty_2 = 214; -pub const JS_ATOM_Symbol_matchAll: _bindgen_ty_2 = 215; -pub const JS_ATOM_Symbol_replace: _bindgen_ty_2 = 216; -pub const JS_ATOM_Symbol_search: _bindgen_ty_2 = 217; -pub const JS_ATOM_Symbol_split: _bindgen_ty_2 = 218; -pub const JS_ATOM_Symbol_toStringTag: _bindgen_ty_2 = 219; -pub const JS_ATOM_Symbol_isConcatSpreadable: _bindgen_ty_2 = 220; -pub const JS_ATOM_Symbol_hasInstance: _bindgen_ty_2 = 221; -pub const JS_ATOM_Symbol_species: _bindgen_ty_2 = 222; -pub const JS_ATOM_Symbol_unscopables: _bindgen_ty_2 = 223; -pub const JS_ATOM_Symbol_asyncIterator: _bindgen_ty_2 = 224; -pub const JS_ATOM_Symbol_operatorSet: _bindgen_ty_2 = 225; -pub const JS_ATOM_END: _bindgen_ty_2 = 226; +pub const JS_ATOM_cause: _bindgen_ty_2 = 53; +pub const JS_ATOM_errors: _bindgen_ty_2 = 54; +pub const JS_ATOM_stack: _bindgen_ty_2 = 55; +pub const JS_ATOM_name: _bindgen_ty_2 = 56; +pub const JS_ATOM_toString: _bindgen_ty_2 = 57; +pub const JS_ATOM_toLocaleString: _bindgen_ty_2 = 58; +pub const JS_ATOM_valueOf: _bindgen_ty_2 = 59; +pub const JS_ATOM_eval: _bindgen_ty_2 = 60; +pub const JS_ATOM_prototype: _bindgen_ty_2 = 61; +pub const JS_ATOM_constructor: _bindgen_ty_2 = 62; +pub const JS_ATOM_configurable: _bindgen_ty_2 = 63; +pub const JS_ATOM_writable: _bindgen_ty_2 = 64; +pub const JS_ATOM_enumerable: _bindgen_ty_2 = 65; +pub const JS_ATOM_value: _bindgen_ty_2 = 66; +pub const JS_ATOM_get: _bindgen_ty_2 = 67; +pub const JS_ATOM_set: _bindgen_ty_2 = 68; +pub const JS_ATOM_of: _bindgen_ty_2 = 69; +pub const JS_ATOM___proto__: _bindgen_ty_2 = 70; +pub const JS_ATOM_undefined: _bindgen_ty_2 = 71; +pub const JS_ATOM_number: _bindgen_ty_2 = 72; +pub const JS_ATOM_boolean: _bindgen_ty_2 = 73; +pub const JS_ATOM_string: _bindgen_ty_2 = 74; +pub const JS_ATOM_object: _bindgen_ty_2 = 75; +pub const JS_ATOM_symbol: _bindgen_ty_2 = 76; +pub const JS_ATOM_integer: _bindgen_ty_2 = 77; +pub const JS_ATOM_unknown: _bindgen_ty_2 = 78; +pub const JS_ATOM_arguments: _bindgen_ty_2 = 79; +pub const JS_ATOM_callee: _bindgen_ty_2 = 80; +pub const JS_ATOM_caller: _bindgen_ty_2 = 81; +pub const JS_ATOM__eval_: _bindgen_ty_2 = 82; +pub const JS_ATOM__ret_: _bindgen_ty_2 = 83; +pub const JS_ATOM__var_: _bindgen_ty_2 = 84; +pub const JS_ATOM__arg_var_: _bindgen_ty_2 = 85; +pub const JS_ATOM__with_: _bindgen_ty_2 = 86; +pub const JS_ATOM_lastIndex: _bindgen_ty_2 = 87; +pub const JS_ATOM_target: _bindgen_ty_2 = 88; +pub const JS_ATOM_index: _bindgen_ty_2 = 89; +pub const JS_ATOM_input: _bindgen_ty_2 = 90; +pub const JS_ATOM_defineProperties: _bindgen_ty_2 = 91; +pub const JS_ATOM_apply: _bindgen_ty_2 = 92; +pub const JS_ATOM_join: _bindgen_ty_2 = 93; +pub const JS_ATOM_concat: _bindgen_ty_2 = 94; +pub const JS_ATOM_split: _bindgen_ty_2 = 95; +pub const JS_ATOM_construct: _bindgen_ty_2 = 96; +pub const JS_ATOM_getPrototypeOf: _bindgen_ty_2 = 97; +pub const JS_ATOM_setPrototypeOf: _bindgen_ty_2 = 98; +pub const JS_ATOM_isExtensible: _bindgen_ty_2 = 99; +pub const JS_ATOM_preventExtensions: _bindgen_ty_2 = 100; +pub const JS_ATOM_has: _bindgen_ty_2 = 101; +pub const JS_ATOM_deleteProperty: _bindgen_ty_2 = 102; +pub const JS_ATOM_defineProperty: _bindgen_ty_2 = 103; +pub const JS_ATOM_getOwnPropertyDescriptor: _bindgen_ty_2 = 104; +pub const JS_ATOM_ownKeys: _bindgen_ty_2 = 105; +pub const JS_ATOM_add: _bindgen_ty_2 = 106; +pub const JS_ATOM_done: _bindgen_ty_2 = 107; +pub const JS_ATOM_next: _bindgen_ty_2 = 108; +pub const JS_ATOM_values: _bindgen_ty_2 = 109; +pub const JS_ATOM_source: _bindgen_ty_2 = 110; +pub const JS_ATOM_flags: _bindgen_ty_2 = 111; +pub const JS_ATOM_global: _bindgen_ty_2 = 112; +pub const JS_ATOM_unicode: _bindgen_ty_2 = 113; +pub const JS_ATOM_raw: _bindgen_ty_2 = 114; +pub const JS_ATOM_new_target: _bindgen_ty_2 = 115; +pub const JS_ATOM_this_active_func: _bindgen_ty_2 = 116; +pub const JS_ATOM_home_object: _bindgen_ty_2 = 117; +pub const JS_ATOM_computed_field: _bindgen_ty_2 = 118; +pub const JS_ATOM_static_computed_field: _bindgen_ty_2 = 119; +pub const JS_ATOM_class_fields_init: _bindgen_ty_2 = 120; +pub const JS_ATOM_brand: _bindgen_ty_2 = 121; +pub const JS_ATOM_hash_constructor: _bindgen_ty_2 = 122; +pub const JS_ATOM_as: _bindgen_ty_2 = 123; +pub const JS_ATOM_from: _bindgen_ty_2 = 124; +pub const JS_ATOM_meta: _bindgen_ty_2 = 125; +pub const JS_ATOM__default_: _bindgen_ty_2 = 126; +pub const JS_ATOM__star_: _bindgen_ty_2 = 127; +pub const JS_ATOM_Module: _bindgen_ty_2 = 128; +pub const JS_ATOM_then: _bindgen_ty_2 = 129; +pub const JS_ATOM_resolve: _bindgen_ty_2 = 130; +pub const JS_ATOM_reject: _bindgen_ty_2 = 131; +pub const JS_ATOM_promise: _bindgen_ty_2 = 132; +pub const JS_ATOM_proxy: _bindgen_ty_2 = 133; +pub const JS_ATOM_revoke: _bindgen_ty_2 = 134; +pub const JS_ATOM_async: _bindgen_ty_2 = 135; +pub const JS_ATOM_exec: _bindgen_ty_2 = 136; +pub const JS_ATOM_groups: _bindgen_ty_2 = 137; +pub const JS_ATOM_indices: _bindgen_ty_2 = 138; +pub const JS_ATOM_status: _bindgen_ty_2 = 139; +pub const JS_ATOM_reason: _bindgen_ty_2 = 140; +pub const JS_ATOM_globalThis: _bindgen_ty_2 = 141; +pub const JS_ATOM_bigint: _bindgen_ty_2 = 142; +pub const JS_ATOM_bigfloat: _bindgen_ty_2 = 143; +pub const JS_ATOM_bigdecimal: _bindgen_ty_2 = 144; +pub const JS_ATOM_roundingMode: _bindgen_ty_2 = 145; +pub const JS_ATOM_maximumSignificantDigits: _bindgen_ty_2 = 146; +pub const JS_ATOM_maximumFractionDigits: _bindgen_ty_2 = 147; +pub const JS_ATOM_not_equal: _bindgen_ty_2 = 148; +pub const JS_ATOM_timed_out: _bindgen_ty_2 = 149; +pub const JS_ATOM_ok: _bindgen_ty_2 = 150; +pub const JS_ATOM_toJSON: _bindgen_ty_2 = 151; +pub const JS_ATOM_Object: _bindgen_ty_2 = 152; +pub const JS_ATOM_Array: _bindgen_ty_2 = 153; +pub const JS_ATOM_Error: _bindgen_ty_2 = 154; +pub const JS_ATOM_Number: _bindgen_ty_2 = 155; +pub const JS_ATOM_String: _bindgen_ty_2 = 156; +pub const JS_ATOM_Boolean: _bindgen_ty_2 = 157; +pub const JS_ATOM_Symbol: _bindgen_ty_2 = 158; +pub const JS_ATOM_Arguments: _bindgen_ty_2 = 159; +pub const JS_ATOM_Math: _bindgen_ty_2 = 160; +pub const JS_ATOM_JSON: _bindgen_ty_2 = 161; +pub const JS_ATOM_Date: _bindgen_ty_2 = 162; +pub const JS_ATOM_Function: _bindgen_ty_2 = 163; +pub const JS_ATOM_GeneratorFunction: _bindgen_ty_2 = 164; +pub const JS_ATOM_ForInIterator: _bindgen_ty_2 = 165; +pub const JS_ATOM_RegExp: _bindgen_ty_2 = 166; +pub const JS_ATOM_ArrayBuffer: _bindgen_ty_2 = 167; +pub const JS_ATOM_SharedArrayBuffer: _bindgen_ty_2 = 168; +pub const JS_ATOM_Uint8ClampedArray: _bindgen_ty_2 = 169; +pub const JS_ATOM_Int8Array: _bindgen_ty_2 = 170; +pub const JS_ATOM_Uint8Array: _bindgen_ty_2 = 171; +pub const JS_ATOM_Int16Array: _bindgen_ty_2 = 172; +pub const JS_ATOM_Uint16Array: _bindgen_ty_2 = 173; +pub const JS_ATOM_Int32Array: _bindgen_ty_2 = 174; +pub const JS_ATOM_Uint32Array: _bindgen_ty_2 = 175; +pub const JS_ATOM_BigInt64Array: _bindgen_ty_2 = 176; +pub const JS_ATOM_BigUint64Array: _bindgen_ty_2 = 177; +pub const JS_ATOM_Float32Array: _bindgen_ty_2 = 178; +pub const JS_ATOM_Float64Array: _bindgen_ty_2 = 179; +pub const JS_ATOM_DataView: _bindgen_ty_2 = 180; +pub const JS_ATOM_BigInt: _bindgen_ty_2 = 181; +pub const JS_ATOM_BigFloat: _bindgen_ty_2 = 182; +pub const JS_ATOM_BigFloatEnv: _bindgen_ty_2 = 183; +pub const JS_ATOM_BigDecimal: _bindgen_ty_2 = 184; +pub const JS_ATOM_OperatorSet: _bindgen_ty_2 = 185; +pub const JS_ATOM_Operators: _bindgen_ty_2 = 186; +pub const JS_ATOM_Map: _bindgen_ty_2 = 187; +pub const JS_ATOM_Set: _bindgen_ty_2 = 188; +pub const JS_ATOM_WeakMap: _bindgen_ty_2 = 189; +pub const JS_ATOM_WeakSet: _bindgen_ty_2 = 190; +pub const JS_ATOM_Map_Iterator: _bindgen_ty_2 = 191; +pub const JS_ATOM_Set_Iterator: _bindgen_ty_2 = 192; +pub const JS_ATOM_Array_Iterator: _bindgen_ty_2 = 193; +pub const JS_ATOM_String_Iterator: _bindgen_ty_2 = 194; +pub const JS_ATOM_RegExp_String_Iterator: _bindgen_ty_2 = 195; +pub const JS_ATOM_Generator: _bindgen_ty_2 = 196; +pub const JS_ATOM_Proxy: _bindgen_ty_2 = 197; +pub const JS_ATOM_Promise: _bindgen_ty_2 = 198; +pub const JS_ATOM_PromiseResolveFunction: _bindgen_ty_2 = 199; +pub const JS_ATOM_PromiseRejectFunction: _bindgen_ty_2 = 200; +pub const JS_ATOM_AsyncFunction: _bindgen_ty_2 = 201; +pub const JS_ATOM_AsyncFunctionResolve: _bindgen_ty_2 = 202; +pub const JS_ATOM_AsyncFunctionReject: _bindgen_ty_2 = 203; +pub const JS_ATOM_AsyncGeneratorFunction: _bindgen_ty_2 = 204; +pub const JS_ATOM_AsyncGenerator: _bindgen_ty_2 = 205; +pub const JS_ATOM_EvalError: _bindgen_ty_2 = 206; +pub const JS_ATOM_RangeError: _bindgen_ty_2 = 207; +pub const JS_ATOM_ReferenceError: _bindgen_ty_2 = 208; +pub const JS_ATOM_SyntaxError: _bindgen_ty_2 = 209; +pub const JS_ATOM_TypeError: _bindgen_ty_2 = 210; +pub const JS_ATOM_URIError: _bindgen_ty_2 = 211; +pub const JS_ATOM_InternalError: _bindgen_ty_2 = 212; +pub const JS_ATOM_Private_brand: _bindgen_ty_2 = 213; +pub const JS_ATOM_Symbol_toPrimitive: _bindgen_ty_2 = 214; +pub const JS_ATOM_Symbol_iterator: _bindgen_ty_2 = 215; +pub const JS_ATOM_Symbol_match: _bindgen_ty_2 = 216; +pub const JS_ATOM_Symbol_matchAll: _bindgen_ty_2 = 217; +pub const JS_ATOM_Symbol_replace: _bindgen_ty_2 = 218; +pub const JS_ATOM_Symbol_search: _bindgen_ty_2 = 219; +pub const JS_ATOM_Symbol_split: _bindgen_ty_2 = 220; +pub const JS_ATOM_Symbol_toStringTag: _bindgen_ty_2 = 221; +pub const JS_ATOM_Symbol_isConcatSpreadable: _bindgen_ty_2 = 222; +pub const JS_ATOM_Symbol_hasInstance: _bindgen_ty_2 = 223; +pub const JS_ATOM_Symbol_species: _bindgen_ty_2 = 224; +pub const JS_ATOM_Symbol_unscopables: _bindgen_ty_2 = 225; +pub const JS_ATOM_Symbol_asyncIterator: _bindgen_ty_2 = 226; +pub const JS_ATOM_Symbol_operatorSet: _bindgen_ty_2 = 227; +pub const JS_ATOM_END: _bindgen_ty_2 = 228; pub type _bindgen_ty_2 = ::std::os::raw::c_uint; diff --git a/sys/src/bindings/i686-pc-windows-gnu.rs b/sys/src/bindings/i686-pc-windows-gnu.rs index c6a500c4e..426eb241f 100644 --- a/sys/src/bindings/i686-pc-windows-gnu.rs +++ b/sys/src/bindings/i686-pc-windows-gnu.rs @@ -31,8 +31,10 @@ pub const JS_EVAL_FLAG_STRICT: u32 = 8; pub const JS_EVAL_FLAG_STRIP: u32 = 16; pub const JS_EVAL_FLAG_COMPILE_ONLY: u32 = 32; pub const JS_EVAL_FLAG_BACKTRACE_BARRIER: u32 = 64; +pub const JS_EVAL_FLAG_ASYNC: u32 = 128; pub const JS_ATOM_NULL: u32 = 0; pub const JS_CALL_FLAG_CONSTRUCTOR: u32 = 1; +pub const JS_INVALID_CLASS_ID: u32 = 0; pub const JS_GPN_STRING_MASK: u32 = 1; pub const JS_GPN_SYMBOL_MASK: u32 = 2; pub const JS_GPN_PRIVATE_MASK: u32 = 4; @@ -366,6 +368,9 @@ extern "C" { extern "C" { pub fn JS_GetClassProto(ctx: *mut JSContext, class_id: JSClassID) -> JSValue; } +extern "C" { + pub fn JS_GetFunctionProto(ctx: *mut JSContext) -> JSValue; +} extern "C" { pub fn JS_NewContextRaw(rt: *mut JSRuntime) -> *mut JSContext; } @@ -1196,6 +1201,9 @@ fn bindgen_test_layout_JSClassDef() { extern "C" { pub fn JS_NewClassID(pclass_id: *mut JSClassID) -> JSClassID; } +extern "C" { + pub fn JS_GetClassID(v: JSValue) -> JSClassID; +} extern "C" { pub fn JS_NewClass( rt: *mut JSRuntime, @@ -1366,6 +1374,9 @@ extern "C" { extern "C" { pub fn JS_IsArray(ctx: *mut JSContext, val: JSValue) -> ::std::os::raw::c_int; } +extern "C" { + pub fn JS_NewDate(ctx: *mut JSContext, epoch_ms: f64) -> JSValue; +} extern "C" { pub fn JS_GetPropertyInternal( ctx: *mut JSContext, @@ -1388,9 +1399,10 @@ extern "C" { extern "C" { pub fn JS_SetPropertyInternal( ctx: *mut JSContext, - this_obj: JSValue, + obj: JSValue, prop: JSAtom, val: JSValue, + this_obj: JSValue, flags: ::std::os::raw::c_int, ) -> ::std::os::raw::c_int; } @@ -1529,9 +1541,6 @@ extern "C" { extern "C" { pub fn JS_GetGlobalObject(ctx: *mut JSContext) -> JSValue; } -extern "C" { - pub fn JS_GetFunctionProto(ctx: *mut JSContext) -> JSValue; -} extern "C" { pub fn JS_IsInstanceOf( ctx: *mut JSContext, @@ -1739,9 +1748,19 @@ extern "C" { sf: *const JSSharedArrayBufferFunctions, ); } +pub const JSPromiseStateEnum_JS_PROMISE_PENDING: JSPromiseStateEnum = 0; +pub const JSPromiseStateEnum_JS_PROMISE_FULFILLED: JSPromiseStateEnum = 1; +pub const JSPromiseStateEnum_JS_PROMISE_REJECTED: JSPromiseStateEnum = 2; +pub type JSPromiseStateEnum = ::std::os::raw::c_uint; extern "C" { pub fn JS_NewPromiseCapability(ctx: *mut JSContext, resolving_funcs: *mut JSValue) -> JSValue; } +extern "C" { + pub fn JS_PromiseState(ctx: *mut JSContext, promise: JSValue) -> JSPromiseStateEnum; +} +extern "C" { + pub fn JS_PromiseResult(ctx: *mut JSContext, promise: JSValue) -> JSValue; +} pub type JSHostPromiseRejectionTracker = ::std::option::Option< unsafe extern "C" fn( ctx: *mut JSContext, @@ -1812,7 +1831,7 @@ extern "C" { pub fn JS_GetModuleName(ctx: *mut JSContext, m: *mut JSModuleDef) -> JSAtom; } extern "C" { - pub fn JS_FreeUnevaluatedModules(ctx: *mut JSContext); + pub fn JS_GetModuleNamespace(ctx: *mut JSContext, m: *mut JSModuleDef) -> JSValue; } pub type JSJobFunc = ::std::option::Option< unsafe extern "C" fn( @@ -1877,11 +1896,11 @@ extern "C" { ) -> JSAtom; } extern "C" { - pub fn JS_RunModule( + pub fn JS_LoadModule( ctx: *mut JSContext, basename: *const ::std::os::raw::c_char, filename: *const ::std::os::raw::c_char, - ) -> *mut JSModuleDef; + ) -> JSValue; } pub const JSCFunctionEnum_JS_CFUNC_generic: JSCFunctionEnum = 0; pub const JSCFunctionEnum_JS_CFUNC_generic_magic: JSCFunctionEnum = 1; @@ -2550,36 +2569,6 @@ extern "C" { len: ::std::os::raw::c_int, ) -> ::std::os::raw::c_int; } -extern "C" { - pub fn JS_DynamicImportSync( - ctx: *mut JSContext, - specifier: *const ::std::os::raw::c_char, - ) -> JSValue; -} -extern "C" { - pub fn JS_GetModuleExport( - ctx: *mut JSContext, - m: *mut JSModuleDef, - export_name: *const ::std::os::raw::c_char, - ) -> JSValue; -} -extern "C" { - pub fn JS_GetModuleExportEntriesCount(m: *mut JSModuleDef) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn JS_GetModuleExportEntry( - ctx: *mut JSContext, - m: *mut JSModuleDef, - idx: ::std::os::raw::c_int, - ) -> JSValue; -} -extern "C" { - pub fn JS_GetModuleExportEntryName( - ctx: *mut JSContext, - m: *mut JSModuleDef, - idx: ::std::os::raw::c_int, - ) -> JSAtom; -} pub const __JS_ATOM_NULL: _bindgen_ty_2 = 0; pub const JS_ATOM_null: _bindgen_ty_2 = 1; pub const JS_ATOM_false: _bindgen_ty_2 = 2; @@ -2633,178 +2622,180 @@ pub const JS_ATOM_fileName: _bindgen_ty_2 = 49; pub const JS_ATOM_lineNumber: _bindgen_ty_2 = 50; pub const JS_ATOM_columnNumber: _bindgen_ty_2 = 51; pub const JS_ATOM_message: _bindgen_ty_2 = 52; -pub const JS_ATOM_errors: _bindgen_ty_2 = 53; -pub const JS_ATOM_stack: _bindgen_ty_2 = 54; -pub const JS_ATOM_name: _bindgen_ty_2 = 55; -pub const JS_ATOM_toString: _bindgen_ty_2 = 56; -pub const JS_ATOM_toLocaleString: _bindgen_ty_2 = 57; -pub const JS_ATOM_valueOf: _bindgen_ty_2 = 58; -pub const JS_ATOM_eval: _bindgen_ty_2 = 59; -pub const JS_ATOM_prototype: _bindgen_ty_2 = 60; -pub const JS_ATOM_constructor: _bindgen_ty_2 = 61; -pub const JS_ATOM_configurable: _bindgen_ty_2 = 62; -pub const JS_ATOM_writable: _bindgen_ty_2 = 63; -pub const JS_ATOM_enumerable: _bindgen_ty_2 = 64; -pub const JS_ATOM_value: _bindgen_ty_2 = 65; -pub const JS_ATOM_get: _bindgen_ty_2 = 66; -pub const JS_ATOM_set: _bindgen_ty_2 = 67; -pub const JS_ATOM_of: _bindgen_ty_2 = 68; -pub const JS_ATOM___proto__: _bindgen_ty_2 = 69; -pub const JS_ATOM_undefined: _bindgen_ty_2 = 70; -pub const JS_ATOM_number: _bindgen_ty_2 = 71; -pub const JS_ATOM_boolean: _bindgen_ty_2 = 72; -pub const JS_ATOM_string: _bindgen_ty_2 = 73; -pub const JS_ATOM_object: _bindgen_ty_2 = 74; -pub const JS_ATOM_symbol: _bindgen_ty_2 = 75; -pub const JS_ATOM_integer: _bindgen_ty_2 = 76; -pub const JS_ATOM_unknown: _bindgen_ty_2 = 77; -pub const JS_ATOM_arguments: _bindgen_ty_2 = 78; -pub const JS_ATOM_callee: _bindgen_ty_2 = 79; -pub const JS_ATOM_caller: _bindgen_ty_2 = 80; -pub const JS_ATOM__eval_: _bindgen_ty_2 = 81; -pub const JS_ATOM__ret_: _bindgen_ty_2 = 82; -pub const JS_ATOM__var_: _bindgen_ty_2 = 83; -pub const JS_ATOM__arg_var_: _bindgen_ty_2 = 84; -pub const JS_ATOM__with_: _bindgen_ty_2 = 85; -pub const JS_ATOM_lastIndex: _bindgen_ty_2 = 86; -pub const JS_ATOM_target: _bindgen_ty_2 = 87; -pub const JS_ATOM_index: _bindgen_ty_2 = 88; -pub const JS_ATOM_input: _bindgen_ty_2 = 89; -pub const JS_ATOM_defineProperties: _bindgen_ty_2 = 90; -pub const JS_ATOM_apply: _bindgen_ty_2 = 91; -pub const JS_ATOM_join: _bindgen_ty_2 = 92; -pub const JS_ATOM_concat: _bindgen_ty_2 = 93; -pub const JS_ATOM_split: _bindgen_ty_2 = 94; -pub const JS_ATOM_construct: _bindgen_ty_2 = 95; -pub const JS_ATOM_getPrototypeOf: _bindgen_ty_2 = 96; -pub const JS_ATOM_setPrototypeOf: _bindgen_ty_2 = 97; -pub const JS_ATOM_isExtensible: _bindgen_ty_2 = 98; -pub const JS_ATOM_preventExtensions: _bindgen_ty_2 = 99; -pub const JS_ATOM_has: _bindgen_ty_2 = 100; -pub const JS_ATOM_deleteProperty: _bindgen_ty_2 = 101; -pub const JS_ATOM_defineProperty: _bindgen_ty_2 = 102; -pub const JS_ATOM_getOwnPropertyDescriptor: _bindgen_ty_2 = 103; -pub const JS_ATOM_ownKeys: _bindgen_ty_2 = 104; -pub const JS_ATOM_add: _bindgen_ty_2 = 105; -pub const JS_ATOM_done: _bindgen_ty_2 = 106; -pub const JS_ATOM_next: _bindgen_ty_2 = 107; -pub const JS_ATOM_values: _bindgen_ty_2 = 108; -pub const JS_ATOM_source: _bindgen_ty_2 = 109; -pub const JS_ATOM_flags: _bindgen_ty_2 = 110; -pub const JS_ATOM_global: _bindgen_ty_2 = 111; -pub const JS_ATOM_unicode: _bindgen_ty_2 = 112; -pub const JS_ATOM_raw: _bindgen_ty_2 = 113; -pub const JS_ATOM_new_target: _bindgen_ty_2 = 114; -pub const JS_ATOM_this_active_func: _bindgen_ty_2 = 115; -pub const JS_ATOM_home_object: _bindgen_ty_2 = 116; -pub const JS_ATOM_computed_field: _bindgen_ty_2 = 117; -pub const JS_ATOM_static_computed_field: _bindgen_ty_2 = 118; -pub const JS_ATOM_class_fields_init: _bindgen_ty_2 = 119; -pub const JS_ATOM_brand: _bindgen_ty_2 = 120; -pub const JS_ATOM_hash_constructor: _bindgen_ty_2 = 121; -pub const JS_ATOM_as: _bindgen_ty_2 = 122; -pub const JS_ATOM_from: _bindgen_ty_2 = 123; -pub const JS_ATOM_meta: _bindgen_ty_2 = 124; -pub const JS_ATOM__default_: _bindgen_ty_2 = 125; -pub const JS_ATOM__star_: _bindgen_ty_2 = 126; -pub const JS_ATOM_Module: _bindgen_ty_2 = 127; -pub const JS_ATOM_then: _bindgen_ty_2 = 128; -pub const JS_ATOM_resolve: _bindgen_ty_2 = 129; -pub const JS_ATOM_reject: _bindgen_ty_2 = 130; -pub const JS_ATOM_promise: _bindgen_ty_2 = 131; -pub const JS_ATOM_proxy: _bindgen_ty_2 = 132; -pub const JS_ATOM_revoke: _bindgen_ty_2 = 133; -pub const JS_ATOM_async: _bindgen_ty_2 = 134; -pub const JS_ATOM_exec: _bindgen_ty_2 = 135; -pub const JS_ATOM_groups: _bindgen_ty_2 = 136; -pub const JS_ATOM_status: _bindgen_ty_2 = 137; -pub const JS_ATOM_reason: _bindgen_ty_2 = 138; -pub const JS_ATOM_globalThis: _bindgen_ty_2 = 139; -pub const JS_ATOM_bigint: _bindgen_ty_2 = 140; -pub const JS_ATOM_bigfloat: _bindgen_ty_2 = 141; -pub const JS_ATOM_bigdecimal: _bindgen_ty_2 = 142; -pub const JS_ATOM_roundingMode: _bindgen_ty_2 = 143; -pub const JS_ATOM_maximumSignificantDigits: _bindgen_ty_2 = 144; -pub const JS_ATOM_maximumFractionDigits: _bindgen_ty_2 = 145; -pub const JS_ATOM_not_equal: _bindgen_ty_2 = 146; -pub const JS_ATOM_timed_out: _bindgen_ty_2 = 147; -pub const JS_ATOM_ok: _bindgen_ty_2 = 148; -pub const JS_ATOM_toJSON: _bindgen_ty_2 = 149; -pub const JS_ATOM_Object: _bindgen_ty_2 = 150; -pub const JS_ATOM_Array: _bindgen_ty_2 = 151; -pub const JS_ATOM_Error: _bindgen_ty_2 = 152; -pub const JS_ATOM_Number: _bindgen_ty_2 = 153; -pub const JS_ATOM_String: _bindgen_ty_2 = 154; -pub const JS_ATOM_Boolean: _bindgen_ty_2 = 155; -pub const JS_ATOM_Symbol: _bindgen_ty_2 = 156; -pub const JS_ATOM_Arguments: _bindgen_ty_2 = 157; -pub const JS_ATOM_Math: _bindgen_ty_2 = 158; -pub const JS_ATOM_JSON: _bindgen_ty_2 = 159; -pub const JS_ATOM_Date: _bindgen_ty_2 = 160; -pub const JS_ATOM_Function: _bindgen_ty_2 = 161; -pub const JS_ATOM_GeneratorFunction: _bindgen_ty_2 = 162; -pub const JS_ATOM_ForInIterator: _bindgen_ty_2 = 163; -pub const JS_ATOM_RegExp: _bindgen_ty_2 = 164; -pub const JS_ATOM_ArrayBuffer: _bindgen_ty_2 = 165; -pub const JS_ATOM_SharedArrayBuffer: _bindgen_ty_2 = 166; -pub const JS_ATOM_Uint8ClampedArray: _bindgen_ty_2 = 167; -pub const JS_ATOM_Int8Array: _bindgen_ty_2 = 168; -pub const JS_ATOM_Uint8Array: _bindgen_ty_2 = 169; -pub const JS_ATOM_Int16Array: _bindgen_ty_2 = 170; -pub const JS_ATOM_Uint16Array: _bindgen_ty_2 = 171; -pub const JS_ATOM_Int32Array: _bindgen_ty_2 = 172; -pub const JS_ATOM_Uint32Array: _bindgen_ty_2 = 173; -pub const JS_ATOM_BigInt64Array: _bindgen_ty_2 = 174; -pub const JS_ATOM_BigUint64Array: _bindgen_ty_2 = 175; -pub const JS_ATOM_Float32Array: _bindgen_ty_2 = 176; -pub const JS_ATOM_Float64Array: _bindgen_ty_2 = 177; -pub const JS_ATOM_DataView: _bindgen_ty_2 = 178; -pub const JS_ATOM_BigInt: _bindgen_ty_2 = 179; -pub const JS_ATOM_BigFloat: _bindgen_ty_2 = 180; -pub const JS_ATOM_BigFloatEnv: _bindgen_ty_2 = 181; -pub const JS_ATOM_BigDecimal: _bindgen_ty_2 = 182; -pub const JS_ATOM_OperatorSet: _bindgen_ty_2 = 183; -pub const JS_ATOM_Operators: _bindgen_ty_2 = 184; -pub const JS_ATOM_Map: _bindgen_ty_2 = 185; -pub const JS_ATOM_Set: _bindgen_ty_2 = 186; -pub const JS_ATOM_WeakMap: _bindgen_ty_2 = 187; -pub const JS_ATOM_WeakSet: _bindgen_ty_2 = 188; -pub const JS_ATOM_Map_Iterator: _bindgen_ty_2 = 189; -pub const JS_ATOM_Set_Iterator: _bindgen_ty_2 = 190; -pub const JS_ATOM_Array_Iterator: _bindgen_ty_2 = 191; -pub const JS_ATOM_String_Iterator: _bindgen_ty_2 = 192; -pub const JS_ATOM_RegExp_String_Iterator: _bindgen_ty_2 = 193; -pub const JS_ATOM_Generator: _bindgen_ty_2 = 194; -pub const JS_ATOM_Proxy: _bindgen_ty_2 = 195; -pub const JS_ATOM_Promise: _bindgen_ty_2 = 196; -pub const JS_ATOM_PromiseResolveFunction: _bindgen_ty_2 = 197; -pub const JS_ATOM_PromiseRejectFunction: _bindgen_ty_2 = 198; -pub const JS_ATOM_AsyncFunction: _bindgen_ty_2 = 199; -pub const JS_ATOM_AsyncFunctionResolve: _bindgen_ty_2 = 200; -pub const JS_ATOM_AsyncFunctionReject: _bindgen_ty_2 = 201; -pub const JS_ATOM_AsyncGeneratorFunction: _bindgen_ty_2 = 202; -pub const JS_ATOM_AsyncGenerator: _bindgen_ty_2 = 203; -pub const JS_ATOM_EvalError: _bindgen_ty_2 = 204; -pub const JS_ATOM_RangeError: _bindgen_ty_2 = 205; -pub const JS_ATOM_ReferenceError: _bindgen_ty_2 = 206; -pub const JS_ATOM_SyntaxError: _bindgen_ty_2 = 207; -pub const JS_ATOM_TypeError: _bindgen_ty_2 = 208; -pub const JS_ATOM_URIError: _bindgen_ty_2 = 209; -pub const JS_ATOM_InternalError: _bindgen_ty_2 = 210; -pub const JS_ATOM_Private_brand: _bindgen_ty_2 = 211; -pub const JS_ATOM_Symbol_toPrimitive: _bindgen_ty_2 = 212; -pub const JS_ATOM_Symbol_iterator: _bindgen_ty_2 = 213; -pub const JS_ATOM_Symbol_match: _bindgen_ty_2 = 214; -pub const JS_ATOM_Symbol_matchAll: _bindgen_ty_2 = 215; -pub const JS_ATOM_Symbol_replace: _bindgen_ty_2 = 216; -pub const JS_ATOM_Symbol_search: _bindgen_ty_2 = 217; -pub const JS_ATOM_Symbol_split: _bindgen_ty_2 = 218; -pub const JS_ATOM_Symbol_toStringTag: _bindgen_ty_2 = 219; -pub const JS_ATOM_Symbol_isConcatSpreadable: _bindgen_ty_2 = 220; -pub const JS_ATOM_Symbol_hasInstance: _bindgen_ty_2 = 221; -pub const JS_ATOM_Symbol_species: _bindgen_ty_2 = 222; -pub const JS_ATOM_Symbol_unscopables: _bindgen_ty_2 = 223; -pub const JS_ATOM_Symbol_asyncIterator: _bindgen_ty_2 = 224; -pub const JS_ATOM_Symbol_operatorSet: _bindgen_ty_2 = 225; -pub const JS_ATOM_END: _bindgen_ty_2 = 226; +pub const JS_ATOM_cause: _bindgen_ty_2 = 53; +pub const JS_ATOM_errors: _bindgen_ty_2 = 54; +pub const JS_ATOM_stack: _bindgen_ty_2 = 55; +pub const JS_ATOM_name: _bindgen_ty_2 = 56; +pub const JS_ATOM_toString: _bindgen_ty_2 = 57; +pub const JS_ATOM_toLocaleString: _bindgen_ty_2 = 58; +pub const JS_ATOM_valueOf: _bindgen_ty_2 = 59; +pub const JS_ATOM_eval: _bindgen_ty_2 = 60; +pub const JS_ATOM_prototype: _bindgen_ty_2 = 61; +pub const JS_ATOM_constructor: _bindgen_ty_2 = 62; +pub const JS_ATOM_configurable: _bindgen_ty_2 = 63; +pub const JS_ATOM_writable: _bindgen_ty_2 = 64; +pub const JS_ATOM_enumerable: _bindgen_ty_2 = 65; +pub const JS_ATOM_value: _bindgen_ty_2 = 66; +pub const JS_ATOM_get: _bindgen_ty_2 = 67; +pub const JS_ATOM_set: _bindgen_ty_2 = 68; +pub const JS_ATOM_of: _bindgen_ty_2 = 69; +pub const JS_ATOM___proto__: _bindgen_ty_2 = 70; +pub const JS_ATOM_undefined: _bindgen_ty_2 = 71; +pub const JS_ATOM_number: _bindgen_ty_2 = 72; +pub const JS_ATOM_boolean: _bindgen_ty_2 = 73; +pub const JS_ATOM_string: _bindgen_ty_2 = 74; +pub const JS_ATOM_object: _bindgen_ty_2 = 75; +pub const JS_ATOM_symbol: _bindgen_ty_2 = 76; +pub const JS_ATOM_integer: _bindgen_ty_2 = 77; +pub const JS_ATOM_unknown: _bindgen_ty_2 = 78; +pub const JS_ATOM_arguments: _bindgen_ty_2 = 79; +pub const JS_ATOM_callee: _bindgen_ty_2 = 80; +pub const JS_ATOM_caller: _bindgen_ty_2 = 81; +pub const JS_ATOM__eval_: _bindgen_ty_2 = 82; +pub const JS_ATOM__ret_: _bindgen_ty_2 = 83; +pub const JS_ATOM__var_: _bindgen_ty_2 = 84; +pub const JS_ATOM__arg_var_: _bindgen_ty_2 = 85; +pub const JS_ATOM__with_: _bindgen_ty_2 = 86; +pub const JS_ATOM_lastIndex: _bindgen_ty_2 = 87; +pub const JS_ATOM_target: _bindgen_ty_2 = 88; +pub const JS_ATOM_index: _bindgen_ty_2 = 89; +pub const JS_ATOM_input: _bindgen_ty_2 = 90; +pub const JS_ATOM_defineProperties: _bindgen_ty_2 = 91; +pub const JS_ATOM_apply: _bindgen_ty_2 = 92; +pub const JS_ATOM_join: _bindgen_ty_2 = 93; +pub const JS_ATOM_concat: _bindgen_ty_2 = 94; +pub const JS_ATOM_split: _bindgen_ty_2 = 95; +pub const JS_ATOM_construct: _bindgen_ty_2 = 96; +pub const JS_ATOM_getPrototypeOf: _bindgen_ty_2 = 97; +pub const JS_ATOM_setPrototypeOf: _bindgen_ty_2 = 98; +pub const JS_ATOM_isExtensible: _bindgen_ty_2 = 99; +pub const JS_ATOM_preventExtensions: _bindgen_ty_2 = 100; +pub const JS_ATOM_has: _bindgen_ty_2 = 101; +pub const JS_ATOM_deleteProperty: _bindgen_ty_2 = 102; +pub const JS_ATOM_defineProperty: _bindgen_ty_2 = 103; +pub const JS_ATOM_getOwnPropertyDescriptor: _bindgen_ty_2 = 104; +pub const JS_ATOM_ownKeys: _bindgen_ty_2 = 105; +pub const JS_ATOM_add: _bindgen_ty_2 = 106; +pub const JS_ATOM_done: _bindgen_ty_2 = 107; +pub const JS_ATOM_next: _bindgen_ty_2 = 108; +pub const JS_ATOM_values: _bindgen_ty_2 = 109; +pub const JS_ATOM_source: _bindgen_ty_2 = 110; +pub const JS_ATOM_flags: _bindgen_ty_2 = 111; +pub const JS_ATOM_global: _bindgen_ty_2 = 112; +pub const JS_ATOM_unicode: _bindgen_ty_2 = 113; +pub const JS_ATOM_raw: _bindgen_ty_2 = 114; +pub const JS_ATOM_new_target: _bindgen_ty_2 = 115; +pub const JS_ATOM_this_active_func: _bindgen_ty_2 = 116; +pub const JS_ATOM_home_object: _bindgen_ty_2 = 117; +pub const JS_ATOM_computed_field: _bindgen_ty_2 = 118; +pub const JS_ATOM_static_computed_field: _bindgen_ty_2 = 119; +pub const JS_ATOM_class_fields_init: _bindgen_ty_2 = 120; +pub const JS_ATOM_brand: _bindgen_ty_2 = 121; +pub const JS_ATOM_hash_constructor: _bindgen_ty_2 = 122; +pub const JS_ATOM_as: _bindgen_ty_2 = 123; +pub const JS_ATOM_from: _bindgen_ty_2 = 124; +pub const JS_ATOM_meta: _bindgen_ty_2 = 125; +pub const JS_ATOM__default_: _bindgen_ty_2 = 126; +pub const JS_ATOM__star_: _bindgen_ty_2 = 127; +pub const JS_ATOM_Module: _bindgen_ty_2 = 128; +pub const JS_ATOM_then: _bindgen_ty_2 = 129; +pub const JS_ATOM_resolve: _bindgen_ty_2 = 130; +pub const JS_ATOM_reject: _bindgen_ty_2 = 131; +pub const JS_ATOM_promise: _bindgen_ty_2 = 132; +pub const JS_ATOM_proxy: _bindgen_ty_2 = 133; +pub const JS_ATOM_revoke: _bindgen_ty_2 = 134; +pub const JS_ATOM_async: _bindgen_ty_2 = 135; +pub const JS_ATOM_exec: _bindgen_ty_2 = 136; +pub const JS_ATOM_groups: _bindgen_ty_2 = 137; +pub const JS_ATOM_indices: _bindgen_ty_2 = 138; +pub const JS_ATOM_status: _bindgen_ty_2 = 139; +pub const JS_ATOM_reason: _bindgen_ty_2 = 140; +pub const JS_ATOM_globalThis: _bindgen_ty_2 = 141; +pub const JS_ATOM_bigint: _bindgen_ty_2 = 142; +pub const JS_ATOM_bigfloat: _bindgen_ty_2 = 143; +pub const JS_ATOM_bigdecimal: _bindgen_ty_2 = 144; +pub const JS_ATOM_roundingMode: _bindgen_ty_2 = 145; +pub const JS_ATOM_maximumSignificantDigits: _bindgen_ty_2 = 146; +pub const JS_ATOM_maximumFractionDigits: _bindgen_ty_2 = 147; +pub const JS_ATOM_not_equal: _bindgen_ty_2 = 148; +pub const JS_ATOM_timed_out: _bindgen_ty_2 = 149; +pub const JS_ATOM_ok: _bindgen_ty_2 = 150; +pub const JS_ATOM_toJSON: _bindgen_ty_2 = 151; +pub const JS_ATOM_Object: _bindgen_ty_2 = 152; +pub const JS_ATOM_Array: _bindgen_ty_2 = 153; +pub const JS_ATOM_Error: _bindgen_ty_2 = 154; +pub const JS_ATOM_Number: _bindgen_ty_2 = 155; +pub const JS_ATOM_String: _bindgen_ty_2 = 156; +pub const JS_ATOM_Boolean: _bindgen_ty_2 = 157; +pub const JS_ATOM_Symbol: _bindgen_ty_2 = 158; +pub const JS_ATOM_Arguments: _bindgen_ty_2 = 159; +pub const JS_ATOM_Math: _bindgen_ty_2 = 160; +pub const JS_ATOM_JSON: _bindgen_ty_2 = 161; +pub const JS_ATOM_Date: _bindgen_ty_2 = 162; +pub const JS_ATOM_Function: _bindgen_ty_2 = 163; +pub const JS_ATOM_GeneratorFunction: _bindgen_ty_2 = 164; +pub const JS_ATOM_ForInIterator: _bindgen_ty_2 = 165; +pub const JS_ATOM_RegExp: _bindgen_ty_2 = 166; +pub const JS_ATOM_ArrayBuffer: _bindgen_ty_2 = 167; +pub const JS_ATOM_SharedArrayBuffer: _bindgen_ty_2 = 168; +pub const JS_ATOM_Uint8ClampedArray: _bindgen_ty_2 = 169; +pub const JS_ATOM_Int8Array: _bindgen_ty_2 = 170; +pub const JS_ATOM_Uint8Array: _bindgen_ty_2 = 171; +pub const JS_ATOM_Int16Array: _bindgen_ty_2 = 172; +pub const JS_ATOM_Uint16Array: _bindgen_ty_2 = 173; +pub const JS_ATOM_Int32Array: _bindgen_ty_2 = 174; +pub const JS_ATOM_Uint32Array: _bindgen_ty_2 = 175; +pub const JS_ATOM_BigInt64Array: _bindgen_ty_2 = 176; +pub const JS_ATOM_BigUint64Array: _bindgen_ty_2 = 177; +pub const JS_ATOM_Float32Array: _bindgen_ty_2 = 178; +pub const JS_ATOM_Float64Array: _bindgen_ty_2 = 179; +pub const JS_ATOM_DataView: _bindgen_ty_2 = 180; +pub const JS_ATOM_BigInt: _bindgen_ty_2 = 181; +pub const JS_ATOM_BigFloat: _bindgen_ty_2 = 182; +pub const JS_ATOM_BigFloatEnv: _bindgen_ty_2 = 183; +pub const JS_ATOM_BigDecimal: _bindgen_ty_2 = 184; +pub const JS_ATOM_OperatorSet: _bindgen_ty_2 = 185; +pub const JS_ATOM_Operators: _bindgen_ty_2 = 186; +pub const JS_ATOM_Map: _bindgen_ty_2 = 187; +pub const JS_ATOM_Set: _bindgen_ty_2 = 188; +pub const JS_ATOM_WeakMap: _bindgen_ty_2 = 189; +pub const JS_ATOM_WeakSet: _bindgen_ty_2 = 190; +pub const JS_ATOM_Map_Iterator: _bindgen_ty_2 = 191; +pub const JS_ATOM_Set_Iterator: _bindgen_ty_2 = 192; +pub const JS_ATOM_Array_Iterator: _bindgen_ty_2 = 193; +pub const JS_ATOM_String_Iterator: _bindgen_ty_2 = 194; +pub const JS_ATOM_RegExp_String_Iterator: _bindgen_ty_2 = 195; +pub const JS_ATOM_Generator: _bindgen_ty_2 = 196; +pub const JS_ATOM_Proxy: _bindgen_ty_2 = 197; +pub const JS_ATOM_Promise: _bindgen_ty_2 = 198; +pub const JS_ATOM_PromiseResolveFunction: _bindgen_ty_2 = 199; +pub const JS_ATOM_PromiseRejectFunction: _bindgen_ty_2 = 200; +pub const JS_ATOM_AsyncFunction: _bindgen_ty_2 = 201; +pub const JS_ATOM_AsyncFunctionResolve: _bindgen_ty_2 = 202; +pub const JS_ATOM_AsyncFunctionReject: _bindgen_ty_2 = 203; +pub const JS_ATOM_AsyncGeneratorFunction: _bindgen_ty_2 = 204; +pub const JS_ATOM_AsyncGenerator: _bindgen_ty_2 = 205; +pub const JS_ATOM_EvalError: _bindgen_ty_2 = 206; +pub const JS_ATOM_RangeError: _bindgen_ty_2 = 207; +pub const JS_ATOM_ReferenceError: _bindgen_ty_2 = 208; +pub const JS_ATOM_SyntaxError: _bindgen_ty_2 = 209; +pub const JS_ATOM_TypeError: _bindgen_ty_2 = 210; +pub const JS_ATOM_URIError: _bindgen_ty_2 = 211; +pub const JS_ATOM_InternalError: _bindgen_ty_2 = 212; +pub const JS_ATOM_Private_brand: _bindgen_ty_2 = 213; +pub const JS_ATOM_Symbol_toPrimitive: _bindgen_ty_2 = 214; +pub const JS_ATOM_Symbol_iterator: _bindgen_ty_2 = 215; +pub const JS_ATOM_Symbol_match: _bindgen_ty_2 = 216; +pub const JS_ATOM_Symbol_matchAll: _bindgen_ty_2 = 217; +pub const JS_ATOM_Symbol_replace: _bindgen_ty_2 = 218; +pub const JS_ATOM_Symbol_search: _bindgen_ty_2 = 219; +pub const JS_ATOM_Symbol_split: _bindgen_ty_2 = 220; +pub const JS_ATOM_Symbol_toStringTag: _bindgen_ty_2 = 221; +pub const JS_ATOM_Symbol_isConcatSpreadable: _bindgen_ty_2 = 222; +pub const JS_ATOM_Symbol_hasInstance: _bindgen_ty_2 = 223; +pub const JS_ATOM_Symbol_species: _bindgen_ty_2 = 224; +pub const JS_ATOM_Symbol_unscopables: _bindgen_ty_2 = 225; +pub const JS_ATOM_Symbol_asyncIterator: _bindgen_ty_2 = 226; +pub const JS_ATOM_Symbol_operatorSet: _bindgen_ty_2 = 227; +pub const JS_ATOM_END: _bindgen_ty_2 = 228; pub type _bindgen_ty_2 = ::std::os::raw::c_uint; diff --git a/sys/src/bindings/i686-pc-windows-msvc.rs b/sys/src/bindings/i686-pc-windows-msvc.rs index 17e58615d..36cacfb8b 100644 --- a/sys/src/bindings/i686-pc-windows-msvc.rs +++ b/sys/src/bindings/i686-pc-windows-msvc.rs @@ -31,8 +31,10 @@ pub const JS_EVAL_FLAG_STRICT: u32 = 8; pub const JS_EVAL_FLAG_STRIP: u32 = 16; pub const JS_EVAL_FLAG_COMPILE_ONLY: u32 = 32; pub const JS_EVAL_FLAG_BACKTRACE_BARRIER: u32 = 64; +pub const JS_EVAL_FLAG_ASYNC: u32 = 128; pub const JS_ATOM_NULL: u32 = 0; pub const JS_CALL_FLAG_CONSTRUCTOR: u32 = 1; +pub const JS_INVALID_CLASS_ID: u32 = 0; pub const JS_GPN_STRING_MASK: u32 = 1; pub const JS_GPN_SYMBOL_MASK: u32 = 2; pub const JS_GPN_PRIVATE_MASK: u32 = 4; @@ -366,6 +368,9 @@ extern "C" { extern "C" { pub fn JS_GetClassProto(ctx: *mut JSContext, class_id: JSClassID) -> JSValue; } +extern "C" { + pub fn JS_GetFunctionProto(ctx: *mut JSContext) -> JSValue; +} extern "C" { pub fn JS_NewContextRaw(rt: *mut JSRuntime) -> *mut JSContext; } @@ -1196,6 +1201,9 @@ fn bindgen_test_layout_JSClassDef() { extern "C" { pub fn JS_NewClassID(pclass_id: *mut JSClassID) -> JSClassID; } +extern "C" { + pub fn JS_GetClassID(v: JSValue) -> JSClassID; +} extern "C" { pub fn JS_NewClass( rt: *mut JSRuntime, @@ -1366,6 +1374,9 @@ extern "C" { extern "C" { pub fn JS_IsArray(ctx: *mut JSContext, val: JSValue) -> ::std::os::raw::c_int; } +extern "C" { + pub fn JS_NewDate(ctx: *mut JSContext, epoch_ms: f64) -> JSValue; +} extern "C" { pub fn JS_GetPropertyInternal( ctx: *mut JSContext, @@ -1388,9 +1399,10 @@ extern "C" { extern "C" { pub fn JS_SetPropertyInternal( ctx: *mut JSContext, - this_obj: JSValue, + obj: JSValue, prop: JSAtom, val: JSValue, + this_obj: JSValue, flags: ::std::os::raw::c_int, ) -> ::std::os::raw::c_int; } @@ -1529,9 +1541,6 @@ extern "C" { extern "C" { pub fn JS_GetGlobalObject(ctx: *mut JSContext) -> JSValue; } -extern "C" { - pub fn JS_GetFunctionProto(ctx: *mut JSContext) -> JSValue; -} extern "C" { pub fn JS_IsInstanceOf( ctx: *mut JSContext, @@ -1739,9 +1748,19 @@ extern "C" { sf: *const JSSharedArrayBufferFunctions, ); } +pub const JSPromiseStateEnum_JS_PROMISE_PENDING: JSPromiseStateEnum = 0; +pub const JSPromiseStateEnum_JS_PROMISE_FULFILLED: JSPromiseStateEnum = 1; +pub const JSPromiseStateEnum_JS_PROMISE_REJECTED: JSPromiseStateEnum = 2; +pub type JSPromiseStateEnum = ::std::os::raw::c_int; extern "C" { pub fn JS_NewPromiseCapability(ctx: *mut JSContext, resolving_funcs: *mut JSValue) -> JSValue; } +extern "C" { + pub fn JS_PromiseState(ctx: *mut JSContext, promise: JSValue) -> JSPromiseStateEnum; +} +extern "C" { + pub fn JS_PromiseResult(ctx: *mut JSContext, promise: JSValue) -> JSValue; +} pub type JSHostPromiseRejectionTracker = ::std::option::Option< unsafe extern "C" fn( ctx: *mut JSContext, @@ -1812,7 +1831,7 @@ extern "C" { pub fn JS_GetModuleName(ctx: *mut JSContext, m: *mut JSModuleDef) -> JSAtom; } extern "C" { - pub fn JS_FreeUnevaluatedModules(ctx: *mut JSContext); + pub fn JS_GetModuleNamespace(ctx: *mut JSContext, m: *mut JSModuleDef) -> JSValue; } pub type JSJobFunc = ::std::option::Option< unsafe extern "C" fn( @@ -1877,11 +1896,11 @@ extern "C" { ) -> JSAtom; } extern "C" { - pub fn JS_RunModule( + pub fn JS_LoadModule( ctx: *mut JSContext, basename: *const ::std::os::raw::c_char, filename: *const ::std::os::raw::c_char, - ) -> *mut JSModuleDef; + ) -> JSValue; } pub const JSCFunctionEnum_JS_CFUNC_generic: JSCFunctionEnum = 0; pub const JSCFunctionEnum_JS_CFUNC_generic_magic: JSCFunctionEnum = 1; @@ -2550,36 +2569,6 @@ extern "C" { len: ::std::os::raw::c_int, ) -> ::std::os::raw::c_int; } -extern "C" { - pub fn JS_DynamicImportSync( - ctx: *mut JSContext, - specifier: *const ::std::os::raw::c_char, - ) -> JSValue; -} -extern "C" { - pub fn JS_GetModuleExport( - ctx: *mut JSContext, - m: *mut JSModuleDef, - export_name: *const ::std::os::raw::c_char, - ) -> JSValue; -} -extern "C" { - pub fn JS_GetModuleExportEntriesCount(m: *mut JSModuleDef) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn JS_GetModuleExportEntry( - ctx: *mut JSContext, - m: *mut JSModuleDef, - idx: ::std::os::raw::c_int, - ) -> JSValue; -} -extern "C" { - pub fn JS_GetModuleExportEntryName( - ctx: *mut JSContext, - m: *mut JSModuleDef, - idx: ::std::os::raw::c_int, - ) -> JSAtom; -} pub const __JS_ATOM_NULL: _bindgen_ty_2 = 0; pub const JS_ATOM_null: _bindgen_ty_2 = 1; pub const JS_ATOM_false: _bindgen_ty_2 = 2; @@ -2633,175 +2622,180 @@ pub const JS_ATOM_fileName: _bindgen_ty_2 = 49; pub const JS_ATOM_lineNumber: _bindgen_ty_2 = 50; pub const JS_ATOM_columnNumber: _bindgen_ty_2 = 51; pub const JS_ATOM_message: _bindgen_ty_2 = 52; -pub const JS_ATOM_errors: _bindgen_ty_2 = 53; -pub const JS_ATOM_stack: _bindgen_ty_2 = 54; -pub const JS_ATOM_name: _bindgen_ty_2 = 55; -pub const JS_ATOM_toString: _bindgen_ty_2 = 56; -pub const JS_ATOM_toLocaleString: _bindgen_ty_2 = 57; -pub const JS_ATOM_valueOf: _bindgen_ty_2 = 58; -pub const JS_ATOM_eval: _bindgen_ty_2 = 59; -pub const JS_ATOM_prototype: _bindgen_ty_2 = 60; -pub const JS_ATOM_constructor: _bindgen_ty_2 = 61; -pub const JS_ATOM_configurable: _bindgen_ty_2 = 62; -pub const JS_ATOM_writable: _bindgen_ty_2 = 63; -pub const JS_ATOM_enumerable: _bindgen_ty_2 = 64; -pub const JS_ATOM_value: _bindgen_ty_2 = 65; -pub const JS_ATOM_get: _bindgen_ty_2 = 66; -pub const JS_ATOM_set: _bindgen_ty_2 = 67; -pub const JS_ATOM_of: _bindgen_ty_2 = 68; -pub const JS_ATOM___proto__: _bindgen_ty_2 = 69; -pub const JS_ATOM_undefined: _bindgen_ty_2 = 70; -pub const JS_ATOM_number: _bindgen_ty_2 = 71; -pub const JS_ATOM_boolean: _bindgen_ty_2 = 72; -pub const JS_ATOM_string: _bindgen_ty_2 = 73; -pub const JS_ATOM_object: _bindgen_ty_2 = 74; -pub const JS_ATOM_symbol: _bindgen_ty_2 = 75; -pub const JS_ATOM_integer: _bindgen_ty_2 = 76; -pub const JS_ATOM_unknown: _bindgen_ty_2 = 77; -pub const JS_ATOM_arguments: _bindgen_ty_2 = 78; -pub const JS_ATOM_callee: _bindgen_ty_2 = 79; -pub const JS_ATOM_caller: _bindgen_ty_2 = 80; -pub const JS_ATOM__eval_: _bindgen_ty_2 = 81; -pub const JS_ATOM__ret_: _bindgen_ty_2 = 82; -pub const JS_ATOM__var_: _bindgen_ty_2 = 83; -pub const JS_ATOM__arg_var_: _bindgen_ty_2 = 84; -pub const JS_ATOM__with_: _bindgen_ty_2 = 85; -pub const JS_ATOM_lastIndex: _bindgen_ty_2 = 86; -pub const JS_ATOM_target: _bindgen_ty_2 = 87; -pub const JS_ATOM_index: _bindgen_ty_2 = 88; -pub const JS_ATOM_input: _bindgen_ty_2 = 89; -pub const JS_ATOM_defineProperties: _bindgen_ty_2 = 90; -pub const JS_ATOM_apply: _bindgen_ty_2 = 91; -pub const JS_ATOM_join: _bindgen_ty_2 = 92; -pub const JS_ATOM_concat: _bindgen_ty_2 = 93; -pub const JS_ATOM_split: _bindgen_ty_2 = 94; -pub const JS_ATOM_construct: _bindgen_ty_2 = 95; -pub const JS_ATOM_getPrototypeOf: _bindgen_ty_2 = 96; -pub const JS_ATOM_setPrototypeOf: _bindgen_ty_2 = 97; -pub const JS_ATOM_isExtensible: _bindgen_ty_2 = 98; -pub const JS_ATOM_preventExtensions: _bindgen_ty_2 = 99; -pub const JS_ATOM_has: _bindgen_ty_2 = 100; -pub const JS_ATOM_deleteProperty: _bindgen_ty_2 = 101; -pub const JS_ATOM_defineProperty: _bindgen_ty_2 = 102; -pub const JS_ATOM_getOwnPropertyDescriptor: _bindgen_ty_2 = 103; -pub const JS_ATOM_ownKeys: _bindgen_ty_2 = 104; -pub const JS_ATOM_add: _bindgen_ty_2 = 105; -pub const JS_ATOM_done: _bindgen_ty_2 = 106; -pub const JS_ATOM_next: _bindgen_ty_2 = 107; -pub const JS_ATOM_values: _bindgen_ty_2 = 108; -pub const JS_ATOM_source: _bindgen_ty_2 = 109; -pub const JS_ATOM_flags: _bindgen_ty_2 = 110; -pub const JS_ATOM_global: _bindgen_ty_2 = 111; -pub const JS_ATOM_unicode: _bindgen_ty_2 = 112; -pub const JS_ATOM_raw: _bindgen_ty_2 = 113; -pub const JS_ATOM_new_target: _bindgen_ty_2 = 114; -pub const JS_ATOM_this_active_func: _bindgen_ty_2 = 115; -pub const JS_ATOM_home_object: _bindgen_ty_2 = 116; -pub const JS_ATOM_computed_field: _bindgen_ty_2 = 117; -pub const JS_ATOM_static_computed_field: _bindgen_ty_2 = 118; -pub const JS_ATOM_class_fields_init: _bindgen_ty_2 = 119; -pub const JS_ATOM_brand: _bindgen_ty_2 = 120; -pub const JS_ATOM_hash_constructor: _bindgen_ty_2 = 121; -pub const JS_ATOM_as: _bindgen_ty_2 = 122; -pub const JS_ATOM_from: _bindgen_ty_2 = 123; -pub const JS_ATOM_meta: _bindgen_ty_2 = 124; -pub const JS_ATOM__default_: _bindgen_ty_2 = 125; -pub const JS_ATOM__star_: _bindgen_ty_2 = 126; -pub const JS_ATOM_Module: _bindgen_ty_2 = 127; -pub const JS_ATOM_then: _bindgen_ty_2 = 128; -pub const JS_ATOM_resolve: _bindgen_ty_2 = 129; -pub const JS_ATOM_reject: _bindgen_ty_2 = 130; -pub const JS_ATOM_promise: _bindgen_ty_2 = 131; -pub const JS_ATOM_proxy: _bindgen_ty_2 = 132; -pub const JS_ATOM_revoke: _bindgen_ty_2 = 133; -pub const JS_ATOM_async: _bindgen_ty_2 = 134; -pub const JS_ATOM_exec: _bindgen_ty_2 = 135; -pub const JS_ATOM_groups: _bindgen_ty_2 = 136; -pub const JS_ATOM_status: _bindgen_ty_2 = 137; -pub const JS_ATOM_reason: _bindgen_ty_2 = 138; -pub const JS_ATOM_globalThis: _bindgen_ty_2 = 139; -pub const JS_ATOM_bigint: _bindgen_ty_2 = 140; -pub const JS_ATOM_bigfloat: _bindgen_ty_2 = 141; -pub const JS_ATOM_bigdecimal: _bindgen_ty_2 = 142; -pub const JS_ATOM_roundingMode: _bindgen_ty_2 = 143; -pub const JS_ATOM_maximumSignificantDigits: _bindgen_ty_2 = 144; -pub const JS_ATOM_maximumFractionDigits: _bindgen_ty_2 = 145; -pub const JS_ATOM_toJSON: _bindgen_ty_2 = 146; -pub const JS_ATOM_Object: _bindgen_ty_2 = 147; -pub const JS_ATOM_Array: _bindgen_ty_2 = 148; -pub const JS_ATOM_Error: _bindgen_ty_2 = 149; -pub const JS_ATOM_Number: _bindgen_ty_2 = 150; -pub const JS_ATOM_String: _bindgen_ty_2 = 151; -pub const JS_ATOM_Boolean: _bindgen_ty_2 = 152; -pub const JS_ATOM_Symbol: _bindgen_ty_2 = 153; -pub const JS_ATOM_Arguments: _bindgen_ty_2 = 154; -pub const JS_ATOM_Math: _bindgen_ty_2 = 155; -pub const JS_ATOM_JSON: _bindgen_ty_2 = 156; -pub const JS_ATOM_Date: _bindgen_ty_2 = 157; -pub const JS_ATOM_Function: _bindgen_ty_2 = 158; -pub const JS_ATOM_GeneratorFunction: _bindgen_ty_2 = 159; -pub const JS_ATOM_ForInIterator: _bindgen_ty_2 = 160; -pub const JS_ATOM_RegExp: _bindgen_ty_2 = 161; -pub const JS_ATOM_ArrayBuffer: _bindgen_ty_2 = 162; -pub const JS_ATOM_SharedArrayBuffer: _bindgen_ty_2 = 163; -pub const JS_ATOM_Uint8ClampedArray: _bindgen_ty_2 = 164; -pub const JS_ATOM_Int8Array: _bindgen_ty_2 = 165; -pub const JS_ATOM_Uint8Array: _bindgen_ty_2 = 166; -pub const JS_ATOM_Int16Array: _bindgen_ty_2 = 167; -pub const JS_ATOM_Uint16Array: _bindgen_ty_2 = 168; -pub const JS_ATOM_Int32Array: _bindgen_ty_2 = 169; -pub const JS_ATOM_Uint32Array: _bindgen_ty_2 = 170; -pub const JS_ATOM_BigInt64Array: _bindgen_ty_2 = 171; -pub const JS_ATOM_BigUint64Array: _bindgen_ty_2 = 172; -pub const JS_ATOM_Float32Array: _bindgen_ty_2 = 173; -pub const JS_ATOM_Float64Array: _bindgen_ty_2 = 174; -pub const JS_ATOM_DataView: _bindgen_ty_2 = 175; -pub const JS_ATOM_BigInt: _bindgen_ty_2 = 176; -pub const JS_ATOM_BigFloat: _bindgen_ty_2 = 177; -pub const JS_ATOM_BigFloatEnv: _bindgen_ty_2 = 178; -pub const JS_ATOM_BigDecimal: _bindgen_ty_2 = 179; -pub const JS_ATOM_OperatorSet: _bindgen_ty_2 = 180; -pub const JS_ATOM_Operators: _bindgen_ty_2 = 181; -pub const JS_ATOM_Map: _bindgen_ty_2 = 182; -pub const JS_ATOM_Set: _bindgen_ty_2 = 183; -pub const JS_ATOM_WeakMap: _bindgen_ty_2 = 184; -pub const JS_ATOM_WeakSet: _bindgen_ty_2 = 185; -pub const JS_ATOM_Map_Iterator: _bindgen_ty_2 = 186; -pub const JS_ATOM_Set_Iterator: _bindgen_ty_2 = 187; -pub const JS_ATOM_Array_Iterator: _bindgen_ty_2 = 188; -pub const JS_ATOM_String_Iterator: _bindgen_ty_2 = 189; -pub const JS_ATOM_RegExp_String_Iterator: _bindgen_ty_2 = 190; -pub const JS_ATOM_Generator: _bindgen_ty_2 = 191; -pub const JS_ATOM_Proxy: _bindgen_ty_2 = 192; -pub const JS_ATOM_Promise: _bindgen_ty_2 = 193; -pub const JS_ATOM_PromiseResolveFunction: _bindgen_ty_2 = 194; -pub const JS_ATOM_PromiseRejectFunction: _bindgen_ty_2 = 195; -pub const JS_ATOM_AsyncFunction: _bindgen_ty_2 = 196; -pub const JS_ATOM_AsyncFunctionResolve: _bindgen_ty_2 = 197; -pub const JS_ATOM_AsyncFunctionReject: _bindgen_ty_2 = 198; -pub const JS_ATOM_AsyncGeneratorFunction: _bindgen_ty_2 = 199; -pub const JS_ATOM_AsyncGenerator: _bindgen_ty_2 = 200; -pub const JS_ATOM_EvalError: _bindgen_ty_2 = 201; -pub const JS_ATOM_RangeError: _bindgen_ty_2 = 202; -pub const JS_ATOM_ReferenceError: _bindgen_ty_2 = 203; -pub const JS_ATOM_SyntaxError: _bindgen_ty_2 = 204; -pub const JS_ATOM_TypeError: _bindgen_ty_2 = 205; -pub const JS_ATOM_URIError: _bindgen_ty_2 = 206; -pub const JS_ATOM_InternalError: _bindgen_ty_2 = 207; -pub const JS_ATOM_Private_brand: _bindgen_ty_2 = 208; -pub const JS_ATOM_Symbol_toPrimitive: _bindgen_ty_2 = 209; -pub const JS_ATOM_Symbol_iterator: _bindgen_ty_2 = 210; -pub const JS_ATOM_Symbol_match: _bindgen_ty_2 = 211; -pub const JS_ATOM_Symbol_matchAll: _bindgen_ty_2 = 212; -pub const JS_ATOM_Symbol_replace: _bindgen_ty_2 = 213; -pub const JS_ATOM_Symbol_search: _bindgen_ty_2 = 214; -pub const JS_ATOM_Symbol_split: _bindgen_ty_2 = 215; -pub const JS_ATOM_Symbol_toStringTag: _bindgen_ty_2 = 216; -pub const JS_ATOM_Symbol_isConcatSpreadable: _bindgen_ty_2 = 217; -pub const JS_ATOM_Symbol_hasInstance: _bindgen_ty_2 = 218; -pub const JS_ATOM_Symbol_species: _bindgen_ty_2 = 219; -pub const JS_ATOM_Symbol_unscopables: _bindgen_ty_2 = 220; -pub const JS_ATOM_Symbol_asyncIterator: _bindgen_ty_2 = 221; -pub const JS_ATOM_Symbol_operatorSet: _bindgen_ty_2 = 222; -pub const JS_ATOM_END: _bindgen_ty_2 = 223; +pub const JS_ATOM_cause: _bindgen_ty_2 = 53; +pub const JS_ATOM_errors: _bindgen_ty_2 = 54; +pub const JS_ATOM_stack: _bindgen_ty_2 = 55; +pub const JS_ATOM_name: _bindgen_ty_2 = 56; +pub const JS_ATOM_toString: _bindgen_ty_2 = 57; +pub const JS_ATOM_toLocaleString: _bindgen_ty_2 = 58; +pub const JS_ATOM_valueOf: _bindgen_ty_2 = 59; +pub const JS_ATOM_eval: _bindgen_ty_2 = 60; +pub const JS_ATOM_prototype: _bindgen_ty_2 = 61; +pub const JS_ATOM_constructor: _bindgen_ty_2 = 62; +pub const JS_ATOM_configurable: _bindgen_ty_2 = 63; +pub const JS_ATOM_writable: _bindgen_ty_2 = 64; +pub const JS_ATOM_enumerable: _bindgen_ty_2 = 65; +pub const JS_ATOM_value: _bindgen_ty_2 = 66; +pub const JS_ATOM_get: _bindgen_ty_2 = 67; +pub const JS_ATOM_set: _bindgen_ty_2 = 68; +pub const JS_ATOM_of: _bindgen_ty_2 = 69; +pub const JS_ATOM___proto__: _bindgen_ty_2 = 70; +pub const JS_ATOM_undefined: _bindgen_ty_2 = 71; +pub const JS_ATOM_number: _bindgen_ty_2 = 72; +pub const JS_ATOM_boolean: _bindgen_ty_2 = 73; +pub const JS_ATOM_string: _bindgen_ty_2 = 74; +pub const JS_ATOM_object: _bindgen_ty_2 = 75; +pub const JS_ATOM_symbol: _bindgen_ty_2 = 76; +pub const JS_ATOM_integer: _bindgen_ty_2 = 77; +pub const JS_ATOM_unknown: _bindgen_ty_2 = 78; +pub const JS_ATOM_arguments: _bindgen_ty_2 = 79; +pub const JS_ATOM_callee: _bindgen_ty_2 = 80; +pub const JS_ATOM_caller: _bindgen_ty_2 = 81; +pub const JS_ATOM__eval_: _bindgen_ty_2 = 82; +pub const JS_ATOM__ret_: _bindgen_ty_2 = 83; +pub const JS_ATOM__var_: _bindgen_ty_2 = 84; +pub const JS_ATOM__arg_var_: _bindgen_ty_2 = 85; +pub const JS_ATOM__with_: _bindgen_ty_2 = 86; +pub const JS_ATOM_lastIndex: _bindgen_ty_2 = 87; +pub const JS_ATOM_target: _bindgen_ty_2 = 88; +pub const JS_ATOM_index: _bindgen_ty_2 = 89; +pub const JS_ATOM_input: _bindgen_ty_2 = 90; +pub const JS_ATOM_defineProperties: _bindgen_ty_2 = 91; +pub const JS_ATOM_apply: _bindgen_ty_2 = 92; +pub const JS_ATOM_join: _bindgen_ty_2 = 93; +pub const JS_ATOM_concat: _bindgen_ty_2 = 94; +pub const JS_ATOM_split: _bindgen_ty_2 = 95; +pub const JS_ATOM_construct: _bindgen_ty_2 = 96; +pub const JS_ATOM_getPrototypeOf: _bindgen_ty_2 = 97; +pub const JS_ATOM_setPrototypeOf: _bindgen_ty_2 = 98; +pub const JS_ATOM_isExtensible: _bindgen_ty_2 = 99; +pub const JS_ATOM_preventExtensions: _bindgen_ty_2 = 100; +pub const JS_ATOM_has: _bindgen_ty_2 = 101; +pub const JS_ATOM_deleteProperty: _bindgen_ty_2 = 102; +pub const JS_ATOM_defineProperty: _bindgen_ty_2 = 103; +pub const JS_ATOM_getOwnPropertyDescriptor: _bindgen_ty_2 = 104; +pub const JS_ATOM_ownKeys: _bindgen_ty_2 = 105; +pub const JS_ATOM_add: _bindgen_ty_2 = 106; +pub const JS_ATOM_done: _bindgen_ty_2 = 107; +pub const JS_ATOM_next: _bindgen_ty_2 = 108; +pub const JS_ATOM_values: _bindgen_ty_2 = 109; +pub const JS_ATOM_source: _bindgen_ty_2 = 110; +pub const JS_ATOM_flags: _bindgen_ty_2 = 111; +pub const JS_ATOM_global: _bindgen_ty_2 = 112; +pub const JS_ATOM_unicode: _bindgen_ty_2 = 113; +pub const JS_ATOM_raw: _bindgen_ty_2 = 114; +pub const JS_ATOM_new_target: _bindgen_ty_2 = 115; +pub const JS_ATOM_this_active_func: _bindgen_ty_2 = 116; +pub const JS_ATOM_home_object: _bindgen_ty_2 = 117; +pub const JS_ATOM_computed_field: _bindgen_ty_2 = 118; +pub const JS_ATOM_static_computed_field: _bindgen_ty_2 = 119; +pub const JS_ATOM_class_fields_init: _bindgen_ty_2 = 120; +pub const JS_ATOM_brand: _bindgen_ty_2 = 121; +pub const JS_ATOM_hash_constructor: _bindgen_ty_2 = 122; +pub const JS_ATOM_as: _bindgen_ty_2 = 123; +pub const JS_ATOM_from: _bindgen_ty_2 = 124; +pub const JS_ATOM_meta: _bindgen_ty_2 = 125; +pub const JS_ATOM__default_: _bindgen_ty_2 = 126; +pub const JS_ATOM__star_: _bindgen_ty_2 = 127; +pub const JS_ATOM_Module: _bindgen_ty_2 = 128; +pub const JS_ATOM_then: _bindgen_ty_2 = 129; +pub const JS_ATOM_resolve: _bindgen_ty_2 = 130; +pub const JS_ATOM_reject: _bindgen_ty_2 = 131; +pub const JS_ATOM_promise: _bindgen_ty_2 = 132; +pub const JS_ATOM_proxy: _bindgen_ty_2 = 133; +pub const JS_ATOM_revoke: _bindgen_ty_2 = 134; +pub const JS_ATOM_async: _bindgen_ty_2 = 135; +pub const JS_ATOM_exec: _bindgen_ty_2 = 136; +pub const JS_ATOM_groups: _bindgen_ty_2 = 137; +pub const JS_ATOM_indices: _bindgen_ty_2 = 138; +pub const JS_ATOM_status: _bindgen_ty_2 = 139; +pub const JS_ATOM_reason: _bindgen_ty_2 = 140; +pub const JS_ATOM_globalThis: _bindgen_ty_2 = 141; +pub const JS_ATOM_bigint: _bindgen_ty_2 = 142; +pub const JS_ATOM_bigfloat: _bindgen_ty_2 = 143; +pub const JS_ATOM_bigdecimal: _bindgen_ty_2 = 144; +pub const JS_ATOM_roundingMode: _bindgen_ty_2 = 145; +pub const JS_ATOM_maximumSignificantDigits: _bindgen_ty_2 = 146; +pub const JS_ATOM_maximumFractionDigits: _bindgen_ty_2 = 147; +pub const JS_ATOM_not_equal: _bindgen_ty_2 = 148; +pub const JS_ATOM_timed_out: _bindgen_ty_2 = 149; +pub const JS_ATOM_ok: _bindgen_ty_2 = 150; +pub const JS_ATOM_toJSON: _bindgen_ty_2 = 151; +pub const JS_ATOM_Object: _bindgen_ty_2 = 152; +pub const JS_ATOM_Array: _bindgen_ty_2 = 153; +pub const JS_ATOM_Error: _bindgen_ty_2 = 154; +pub const JS_ATOM_Number: _bindgen_ty_2 = 155; +pub const JS_ATOM_String: _bindgen_ty_2 = 156; +pub const JS_ATOM_Boolean: _bindgen_ty_2 = 157; +pub const JS_ATOM_Symbol: _bindgen_ty_2 = 158; +pub const JS_ATOM_Arguments: _bindgen_ty_2 = 159; +pub const JS_ATOM_Math: _bindgen_ty_2 = 160; +pub const JS_ATOM_JSON: _bindgen_ty_2 = 161; +pub const JS_ATOM_Date: _bindgen_ty_2 = 162; +pub const JS_ATOM_Function: _bindgen_ty_2 = 163; +pub const JS_ATOM_GeneratorFunction: _bindgen_ty_2 = 164; +pub const JS_ATOM_ForInIterator: _bindgen_ty_2 = 165; +pub const JS_ATOM_RegExp: _bindgen_ty_2 = 166; +pub const JS_ATOM_ArrayBuffer: _bindgen_ty_2 = 167; +pub const JS_ATOM_SharedArrayBuffer: _bindgen_ty_2 = 168; +pub const JS_ATOM_Uint8ClampedArray: _bindgen_ty_2 = 169; +pub const JS_ATOM_Int8Array: _bindgen_ty_2 = 170; +pub const JS_ATOM_Uint8Array: _bindgen_ty_2 = 171; +pub const JS_ATOM_Int16Array: _bindgen_ty_2 = 172; +pub const JS_ATOM_Uint16Array: _bindgen_ty_2 = 173; +pub const JS_ATOM_Int32Array: _bindgen_ty_2 = 174; +pub const JS_ATOM_Uint32Array: _bindgen_ty_2 = 175; +pub const JS_ATOM_BigInt64Array: _bindgen_ty_2 = 176; +pub const JS_ATOM_BigUint64Array: _bindgen_ty_2 = 177; +pub const JS_ATOM_Float32Array: _bindgen_ty_2 = 178; +pub const JS_ATOM_Float64Array: _bindgen_ty_2 = 179; +pub const JS_ATOM_DataView: _bindgen_ty_2 = 180; +pub const JS_ATOM_BigInt: _bindgen_ty_2 = 181; +pub const JS_ATOM_BigFloat: _bindgen_ty_2 = 182; +pub const JS_ATOM_BigFloatEnv: _bindgen_ty_2 = 183; +pub const JS_ATOM_BigDecimal: _bindgen_ty_2 = 184; +pub const JS_ATOM_OperatorSet: _bindgen_ty_2 = 185; +pub const JS_ATOM_Operators: _bindgen_ty_2 = 186; +pub const JS_ATOM_Map: _bindgen_ty_2 = 187; +pub const JS_ATOM_Set: _bindgen_ty_2 = 188; +pub const JS_ATOM_WeakMap: _bindgen_ty_2 = 189; +pub const JS_ATOM_WeakSet: _bindgen_ty_2 = 190; +pub const JS_ATOM_Map_Iterator: _bindgen_ty_2 = 191; +pub const JS_ATOM_Set_Iterator: _bindgen_ty_2 = 192; +pub const JS_ATOM_Array_Iterator: _bindgen_ty_2 = 193; +pub const JS_ATOM_String_Iterator: _bindgen_ty_2 = 194; +pub const JS_ATOM_RegExp_String_Iterator: _bindgen_ty_2 = 195; +pub const JS_ATOM_Generator: _bindgen_ty_2 = 196; +pub const JS_ATOM_Proxy: _bindgen_ty_2 = 197; +pub const JS_ATOM_Promise: _bindgen_ty_2 = 198; +pub const JS_ATOM_PromiseResolveFunction: _bindgen_ty_2 = 199; +pub const JS_ATOM_PromiseRejectFunction: _bindgen_ty_2 = 200; +pub const JS_ATOM_AsyncFunction: _bindgen_ty_2 = 201; +pub const JS_ATOM_AsyncFunctionResolve: _bindgen_ty_2 = 202; +pub const JS_ATOM_AsyncFunctionReject: _bindgen_ty_2 = 203; +pub const JS_ATOM_AsyncGeneratorFunction: _bindgen_ty_2 = 204; +pub const JS_ATOM_AsyncGenerator: _bindgen_ty_2 = 205; +pub const JS_ATOM_EvalError: _bindgen_ty_2 = 206; +pub const JS_ATOM_RangeError: _bindgen_ty_2 = 207; +pub const JS_ATOM_ReferenceError: _bindgen_ty_2 = 208; +pub const JS_ATOM_SyntaxError: _bindgen_ty_2 = 209; +pub const JS_ATOM_TypeError: _bindgen_ty_2 = 210; +pub const JS_ATOM_URIError: _bindgen_ty_2 = 211; +pub const JS_ATOM_InternalError: _bindgen_ty_2 = 212; +pub const JS_ATOM_Private_brand: _bindgen_ty_2 = 213; +pub const JS_ATOM_Symbol_toPrimitive: _bindgen_ty_2 = 214; +pub const JS_ATOM_Symbol_iterator: _bindgen_ty_2 = 215; +pub const JS_ATOM_Symbol_match: _bindgen_ty_2 = 216; +pub const JS_ATOM_Symbol_matchAll: _bindgen_ty_2 = 217; +pub const JS_ATOM_Symbol_replace: _bindgen_ty_2 = 218; +pub const JS_ATOM_Symbol_search: _bindgen_ty_2 = 219; +pub const JS_ATOM_Symbol_split: _bindgen_ty_2 = 220; +pub const JS_ATOM_Symbol_toStringTag: _bindgen_ty_2 = 221; +pub const JS_ATOM_Symbol_isConcatSpreadable: _bindgen_ty_2 = 222; +pub const JS_ATOM_Symbol_hasInstance: _bindgen_ty_2 = 223; +pub const JS_ATOM_Symbol_species: _bindgen_ty_2 = 224; +pub const JS_ATOM_Symbol_unscopables: _bindgen_ty_2 = 225; +pub const JS_ATOM_Symbol_asyncIterator: _bindgen_ty_2 = 226; +pub const JS_ATOM_Symbol_operatorSet: _bindgen_ty_2 = 227; +pub const JS_ATOM_END: _bindgen_ty_2 = 228; pub type _bindgen_ty_2 = ::std::os::raw::c_int; diff --git a/sys/src/bindings/i686-unknown-linux-gnu.rs b/sys/src/bindings/i686-unknown-linux-gnu.rs index 9e67d6cf7..cba450ece 100644 --- a/sys/src/bindings/i686-unknown-linux-gnu.rs +++ b/sys/src/bindings/i686-unknown-linux-gnu.rs @@ -31,8 +31,10 @@ pub const JS_EVAL_FLAG_STRICT: u32 = 8; pub const JS_EVAL_FLAG_STRIP: u32 = 16; pub const JS_EVAL_FLAG_COMPILE_ONLY: u32 = 32; pub const JS_EVAL_FLAG_BACKTRACE_BARRIER: u32 = 64; +pub const JS_EVAL_FLAG_ASYNC: u32 = 128; pub const JS_ATOM_NULL: u32 = 0; pub const JS_CALL_FLAG_CONSTRUCTOR: u32 = 1; +pub const JS_INVALID_CLASS_ID: u32 = 0; pub const JS_GPN_STRING_MASK: u32 = 1; pub const JS_GPN_SYMBOL_MASK: u32 = 2; pub const JS_GPN_PRIVATE_MASK: u32 = 4; @@ -366,6 +368,9 @@ extern "C" { extern "C" { pub fn JS_GetClassProto(ctx: *mut JSContext, class_id: JSClassID) -> JSValue; } +extern "C" { + pub fn JS_GetFunctionProto(ctx: *mut JSContext) -> JSValue; +} extern "C" { pub fn JS_NewContextRaw(rt: *mut JSRuntime) -> *mut JSContext; } @@ -1196,6 +1201,9 @@ fn bindgen_test_layout_JSClassDef() { extern "C" { pub fn JS_NewClassID(pclass_id: *mut JSClassID) -> JSClassID; } +extern "C" { + pub fn JS_GetClassID(v: JSValue) -> JSClassID; +} extern "C" { pub fn JS_NewClass( rt: *mut JSRuntime, @@ -1366,6 +1374,9 @@ extern "C" { extern "C" { pub fn JS_IsArray(ctx: *mut JSContext, val: JSValue) -> ::std::os::raw::c_int; } +extern "C" { + pub fn JS_NewDate(ctx: *mut JSContext, epoch_ms: f64) -> JSValue; +} extern "C" { pub fn JS_GetPropertyInternal( ctx: *mut JSContext, @@ -1388,9 +1399,10 @@ extern "C" { extern "C" { pub fn JS_SetPropertyInternal( ctx: *mut JSContext, - this_obj: JSValue, + obj: JSValue, prop: JSAtom, val: JSValue, + this_obj: JSValue, flags: ::std::os::raw::c_int, ) -> ::std::os::raw::c_int; } @@ -1529,9 +1541,6 @@ extern "C" { extern "C" { pub fn JS_GetGlobalObject(ctx: *mut JSContext) -> JSValue; } -extern "C" { - pub fn JS_GetFunctionProto(ctx: *mut JSContext) -> JSValue; -} extern "C" { pub fn JS_IsInstanceOf( ctx: *mut JSContext, @@ -1739,9 +1748,19 @@ extern "C" { sf: *const JSSharedArrayBufferFunctions, ); } +pub const JSPromiseStateEnum_JS_PROMISE_PENDING: JSPromiseStateEnum = 0; +pub const JSPromiseStateEnum_JS_PROMISE_FULFILLED: JSPromiseStateEnum = 1; +pub const JSPromiseStateEnum_JS_PROMISE_REJECTED: JSPromiseStateEnum = 2; +pub type JSPromiseStateEnum = ::std::os::raw::c_uint; extern "C" { pub fn JS_NewPromiseCapability(ctx: *mut JSContext, resolving_funcs: *mut JSValue) -> JSValue; } +extern "C" { + pub fn JS_PromiseState(ctx: *mut JSContext, promise: JSValue) -> JSPromiseStateEnum; +} +extern "C" { + pub fn JS_PromiseResult(ctx: *mut JSContext, promise: JSValue) -> JSValue; +} pub type JSHostPromiseRejectionTracker = ::std::option::Option< unsafe extern "C" fn( ctx: *mut JSContext, @@ -1812,7 +1831,7 @@ extern "C" { pub fn JS_GetModuleName(ctx: *mut JSContext, m: *mut JSModuleDef) -> JSAtom; } extern "C" { - pub fn JS_FreeUnevaluatedModules(ctx: *mut JSContext); + pub fn JS_GetModuleNamespace(ctx: *mut JSContext, m: *mut JSModuleDef) -> JSValue; } pub type JSJobFunc = ::std::option::Option< unsafe extern "C" fn( @@ -1877,11 +1896,11 @@ extern "C" { ) -> JSAtom; } extern "C" { - pub fn JS_RunModule( + pub fn JS_LoadModule( ctx: *mut JSContext, basename: *const ::std::os::raw::c_char, filename: *const ::std::os::raw::c_char, - ) -> *mut JSModuleDef; + ) -> JSValue; } pub const JSCFunctionEnum_JS_CFUNC_generic: JSCFunctionEnum = 0; pub const JSCFunctionEnum_JS_CFUNC_generic_magic: JSCFunctionEnum = 1; @@ -2550,36 +2569,6 @@ extern "C" { len: ::std::os::raw::c_int, ) -> ::std::os::raw::c_int; } -extern "C" { - pub fn JS_DynamicImportSync( - ctx: *mut JSContext, - specifier: *const ::std::os::raw::c_char, - ) -> JSValue; -} -extern "C" { - pub fn JS_GetModuleExport( - ctx: *mut JSContext, - m: *mut JSModuleDef, - export_name: *const ::std::os::raw::c_char, - ) -> JSValue; -} -extern "C" { - pub fn JS_GetModuleExportEntriesCount(m: *mut JSModuleDef) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn JS_GetModuleExportEntry( - ctx: *mut JSContext, - m: *mut JSModuleDef, - idx: ::std::os::raw::c_int, - ) -> JSValue; -} -extern "C" { - pub fn JS_GetModuleExportEntryName( - ctx: *mut JSContext, - m: *mut JSModuleDef, - idx: ::std::os::raw::c_int, - ) -> JSAtom; -} pub const __JS_ATOM_NULL: _bindgen_ty_2 = 0; pub const JS_ATOM_null: _bindgen_ty_2 = 1; pub const JS_ATOM_false: _bindgen_ty_2 = 2; @@ -2633,178 +2622,180 @@ pub const JS_ATOM_fileName: _bindgen_ty_2 = 49; pub const JS_ATOM_lineNumber: _bindgen_ty_2 = 50; pub const JS_ATOM_columnNumber: _bindgen_ty_2 = 51; pub const JS_ATOM_message: _bindgen_ty_2 = 52; -pub const JS_ATOM_errors: _bindgen_ty_2 = 53; -pub const JS_ATOM_stack: _bindgen_ty_2 = 54; -pub const JS_ATOM_name: _bindgen_ty_2 = 55; -pub const JS_ATOM_toString: _bindgen_ty_2 = 56; -pub const JS_ATOM_toLocaleString: _bindgen_ty_2 = 57; -pub const JS_ATOM_valueOf: _bindgen_ty_2 = 58; -pub const JS_ATOM_eval: _bindgen_ty_2 = 59; -pub const JS_ATOM_prototype: _bindgen_ty_2 = 60; -pub const JS_ATOM_constructor: _bindgen_ty_2 = 61; -pub const JS_ATOM_configurable: _bindgen_ty_2 = 62; -pub const JS_ATOM_writable: _bindgen_ty_2 = 63; -pub const JS_ATOM_enumerable: _bindgen_ty_2 = 64; -pub const JS_ATOM_value: _bindgen_ty_2 = 65; -pub const JS_ATOM_get: _bindgen_ty_2 = 66; -pub const JS_ATOM_set: _bindgen_ty_2 = 67; -pub const JS_ATOM_of: _bindgen_ty_2 = 68; -pub const JS_ATOM___proto__: _bindgen_ty_2 = 69; -pub const JS_ATOM_undefined: _bindgen_ty_2 = 70; -pub const JS_ATOM_number: _bindgen_ty_2 = 71; -pub const JS_ATOM_boolean: _bindgen_ty_2 = 72; -pub const JS_ATOM_string: _bindgen_ty_2 = 73; -pub const JS_ATOM_object: _bindgen_ty_2 = 74; -pub const JS_ATOM_symbol: _bindgen_ty_2 = 75; -pub const JS_ATOM_integer: _bindgen_ty_2 = 76; -pub const JS_ATOM_unknown: _bindgen_ty_2 = 77; -pub const JS_ATOM_arguments: _bindgen_ty_2 = 78; -pub const JS_ATOM_callee: _bindgen_ty_2 = 79; -pub const JS_ATOM_caller: _bindgen_ty_2 = 80; -pub const JS_ATOM__eval_: _bindgen_ty_2 = 81; -pub const JS_ATOM__ret_: _bindgen_ty_2 = 82; -pub const JS_ATOM__var_: _bindgen_ty_2 = 83; -pub const JS_ATOM__arg_var_: _bindgen_ty_2 = 84; -pub const JS_ATOM__with_: _bindgen_ty_2 = 85; -pub const JS_ATOM_lastIndex: _bindgen_ty_2 = 86; -pub const JS_ATOM_target: _bindgen_ty_2 = 87; -pub const JS_ATOM_index: _bindgen_ty_2 = 88; -pub const JS_ATOM_input: _bindgen_ty_2 = 89; -pub const JS_ATOM_defineProperties: _bindgen_ty_2 = 90; -pub const JS_ATOM_apply: _bindgen_ty_2 = 91; -pub const JS_ATOM_join: _bindgen_ty_2 = 92; -pub const JS_ATOM_concat: _bindgen_ty_2 = 93; -pub const JS_ATOM_split: _bindgen_ty_2 = 94; -pub const JS_ATOM_construct: _bindgen_ty_2 = 95; -pub const JS_ATOM_getPrototypeOf: _bindgen_ty_2 = 96; -pub const JS_ATOM_setPrototypeOf: _bindgen_ty_2 = 97; -pub const JS_ATOM_isExtensible: _bindgen_ty_2 = 98; -pub const JS_ATOM_preventExtensions: _bindgen_ty_2 = 99; -pub const JS_ATOM_has: _bindgen_ty_2 = 100; -pub const JS_ATOM_deleteProperty: _bindgen_ty_2 = 101; -pub const JS_ATOM_defineProperty: _bindgen_ty_2 = 102; -pub const JS_ATOM_getOwnPropertyDescriptor: _bindgen_ty_2 = 103; -pub const JS_ATOM_ownKeys: _bindgen_ty_2 = 104; -pub const JS_ATOM_add: _bindgen_ty_2 = 105; -pub const JS_ATOM_done: _bindgen_ty_2 = 106; -pub const JS_ATOM_next: _bindgen_ty_2 = 107; -pub const JS_ATOM_values: _bindgen_ty_2 = 108; -pub const JS_ATOM_source: _bindgen_ty_2 = 109; -pub const JS_ATOM_flags: _bindgen_ty_2 = 110; -pub const JS_ATOM_global: _bindgen_ty_2 = 111; -pub const JS_ATOM_unicode: _bindgen_ty_2 = 112; -pub const JS_ATOM_raw: _bindgen_ty_2 = 113; -pub const JS_ATOM_new_target: _bindgen_ty_2 = 114; -pub const JS_ATOM_this_active_func: _bindgen_ty_2 = 115; -pub const JS_ATOM_home_object: _bindgen_ty_2 = 116; -pub const JS_ATOM_computed_field: _bindgen_ty_2 = 117; -pub const JS_ATOM_static_computed_field: _bindgen_ty_2 = 118; -pub const JS_ATOM_class_fields_init: _bindgen_ty_2 = 119; -pub const JS_ATOM_brand: _bindgen_ty_2 = 120; -pub const JS_ATOM_hash_constructor: _bindgen_ty_2 = 121; -pub const JS_ATOM_as: _bindgen_ty_2 = 122; -pub const JS_ATOM_from: _bindgen_ty_2 = 123; -pub const JS_ATOM_meta: _bindgen_ty_2 = 124; -pub const JS_ATOM__default_: _bindgen_ty_2 = 125; -pub const JS_ATOM__star_: _bindgen_ty_2 = 126; -pub const JS_ATOM_Module: _bindgen_ty_2 = 127; -pub const JS_ATOM_then: _bindgen_ty_2 = 128; -pub const JS_ATOM_resolve: _bindgen_ty_2 = 129; -pub const JS_ATOM_reject: _bindgen_ty_2 = 130; -pub const JS_ATOM_promise: _bindgen_ty_2 = 131; -pub const JS_ATOM_proxy: _bindgen_ty_2 = 132; -pub const JS_ATOM_revoke: _bindgen_ty_2 = 133; -pub const JS_ATOM_async: _bindgen_ty_2 = 134; -pub const JS_ATOM_exec: _bindgen_ty_2 = 135; -pub const JS_ATOM_groups: _bindgen_ty_2 = 136; -pub const JS_ATOM_status: _bindgen_ty_2 = 137; -pub const JS_ATOM_reason: _bindgen_ty_2 = 138; -pub const JS_ATOM_globalThis: _bindgen_ty_2 = 139; -pub const JS_ATOM_bigint: _bindgen_ty_2 = 140; -pub const JS_ATOM_bigfloat: _bindgen_ty_2 = 141; -pub const JS_ATOM_bigdecimal: _bindgen_ty_2 = 142; -pub const JS_ATOM_roundingMode: _bindgen_ty_2 = 143; -pub const JS_ATOM_maximumSignificantDigits: _bindgen_ty_2 = 144; -pub const JS_ATOM_maximumFractionDigits: _bindgen_ty_2 = 145; -pub const JS_ATOM_not_equal: _bindgen_ty_2 = 146; -pub const JS_ATOM_timed_out: _bindgen_ty_2 = 147; -pub const JS_ATOM_ok: _bindgen_ty_2 = 148; -pub const JS_ATOM_toJSON: _bindgen_ty_2 = 149; -pub const JS_ATOM_Object: _bindgen_ty_2 = 150; -pub const JS_ATOM_Array: _bindgen_ty_2 = 151; -pub const JS_ATOM_Error: _bindgen_ty_2 = 152; -pub const JS_ATOM_Number: _bindgen_ty_2 = 153; -pub const JS_ATOM_String: _bindgen_ty_2 = 154; -pub const JS_ATOM_Boolean: _bindgen_ty_2 = 155; -pub const JS_ATOM_Symbol: _bindgen_ty_2 = 156; -pub const JS_ATOM_Arguments: _bindgen_ty_2 = 157; -pub const JS_ATOM_Math: _bindgen_ty_2 = 158; -pub const JS_ATOM_JSON: _bindgen_ty_2 = 159; -pub const JS_ATOM_Date: _bindgen_ty_2 = 160; -pub const JS_ATOM_Function: _bindgen_ty_2 = 161; -pub const JS_ATOM_GeneratorFunction: _bindgen_ty_2 = 162; -pub const JS_ATOM_ForInIterator: _bindgen_ty_2 = 163; -pub const JS_ATOM_RegExp: _bindgen_ty_2 = 164; -pub const JS_ATOM_ArrayBuffer: _bindgen_ty_2 = 165; -pub const JS_ATOM_SharedArrayBuffer: _bindgen_ty_2 = 166; -pub const JS_ATOM_Uint8ClampedArray: _bindgen_ty_2 = 167; -pub const JS_ATOM_Int8Array: _bindgen_ty_2 = 168; -pub const JS_ATOM_Uint8Array: _bindgen_ty_2 = 169; -pub const JS_ATOM_Int16Array: _bindgen_ty_2 = 170; -pub const JS_ATOM_Uint16Array: _bindgen_ty_2 = 171; -pub const JS_ATOM_Int32Array: _bindgen_ty_2 = 172; -pub const JS_ATOM_Uint32Array: _bindgen_ty_2 = 173; -pub const JS_ATOM_BigInt64Array: _bindgen_ty_2 = 174; -pub const JS_ATOM_BigUint64Array: _bindgen_ty_2 = 175; -pub const JS_ATOM_Float32Array: _bindgen_ty_2 = 176; -pub const JS_ATOM_Float64Array: _bindgen_ty_2 = 177; -pub const JS_ATOM_DataView: _bindgen_ty_2 = 178; -pub const JS_ATOM_BigInt: _bindgen_ty_2 = 179; -pub const JS_ATOM_BigFloat: _bindgen_ty_2 = 180; -pub const JS_ATOM_BigFloatEnv: _bindgen_ty_2 = 181; -pub const JS_ATOM_BigDecimal: _bindgen_ty_2 = 182; -pub const JS_ATOM_OperatorSet: _bindgen_ty_2 = 183; -pub const JS_ATOM_Operators: _bindgen_ty_2 = 184; -pub const JS_ATOM_Map: _bindgen_ty_2 = 185; -pub const JS_ATOM_Set: _bindgen_ty_2 = 186; -pub const JS_ATOM_WeakMap: _bindgen_ty_2 = 187; -pub const JS_ATOM_WeakSet: _bindgen_ty_2 = 188; -pub const JS_ATOM_Map_Iterator: _bindgen_ty_2 = 189; -pub const JS_ATOM_Set_Iterator: _bindgen_ty_2 = 190; -pub const JS_ATOM_Array_Iterator: _bindgen_ty_2 = 191; -pub const JS_ATOM_String_Iterator: _bindgen_ty_2 = 192; -pub const JS_ATOM_RegExp_String_Iterator: _bindgen_ty_2 = 193; -pub const JS_ATOM_Generator: _bindgen_ty_2 = 194; -pub const JS_ATOM_Proxy: _bindgen_ty_2 = 195; -pub const JS_ATOM_Promise: _bindgen_ty_2 = 196; -pub const JS_ATOM_PromiseResolveFunction: _bindgen_ty_2 = 197; -pub const JS_ATOM_PromiseRejectFunction: _bindgen_ty_2 = 198; -pub const JS_ATOM_AsyncFunction: _bindgen_ty_2 = 199; -pub const JS_ATOM_AsyncFunctionResolve: _bindgen_ty_2 = 200; -pub const JS_ATOM_AsyncFunctionReject: _bindgen_ty_2 = 201; -pub const JS_ATOM_AsyncGeneratorFunction: _bindgen_ty_2 = 202; -pub const JS_ATOM_AsyncGenerator: _bindgen_ty_2 = 203; -pub const JS_ATOM_EvalError: _bindgen_ty_2 = 204; -pub const JS_ATOM_RangeError: _bindgen_ty_2 = 205; -pub const JS_ATOM_ReferenceError: _bindgen_ty_2 = 206; -pub const JS_ATOM_SyntaxError: _bindgen_ty_2 = 207; -pub const JS_ATOM_TypeError: _bindgen_ty_2 = 208; -pub const JS_ATOM_URIError: _bindgen_ty_2 = 209; -pub const JS_ATOM_InternalError: _bindgen_ty_2 = 210; -pub const JS_ATOM_Private_brand: _bindgen_ty_2 = 211; -pub const JS_ATOM_Symbol_toPrimitive: _bindgen_ty_2 = 212; -pub const JS_ATOM_Symbol_iterator: _bindgen_ty_2 = 213; -pub const JS_ATOM_Symbol_match: _bindgen_ty_2 = 214; -pub const JS_ATOM_Symbol_matchAll: _bindgen_ty_2 = 215; -pub const JS_ATOM_Symbol_replace: _bindgen_ty_2 = 216; -pub const JS_ATOM_Symbol_search: _bindgen_ty_2 = 217; -pub const JS_ATOM_Symbol_split: _bindgen_ty_2 = 218; -pub const JS_ATOM_Symbol_toStringTag: _bindgen_ty_2 = 219; -pub const JS_ATOM_Symbol_isConcatSpreadable: _bindgen_ty_2 = 220; -pub const JS_ATOM_Symbol_hasInstance: _bindgen_ty_2 = 221; -pub const JS_ATOM_Symbol_species: _bindgen_ty_2 = 222; -pub const JS_ATOM_Symbol_unscopables: _bindgen_ty_2 = 223; -pub const JS_ATOM_Symbol_asyncIterator: _bindgen_ty_2 = 224; -pub const JS_ATOM_Symbol_operatorSet: _bindgen_ty_2 = 225; -pub const JS_ATOM_END: _bindgen_ty_2 = 226; +pub const JS_ATOM_cause: _bindgen_ty_2 = 53; +pub const JS_ATOM_errors: _bindgen_ty_2 = 54; +pub const JS_ATOM_stack: _bindgen_ty_2 = 55; +pub const JS_ATOM_name: _bindgen_ty_2 = 56; +pub const JS_ATOM_toString: _bindgen_ty_2 = 57; +pub const JS_ATOM_toLocaleString: _bindgen_ty_2 = 58; +pub const JS_ATOM_valueOf: _bindgen_ty_2 = 59; +pub const JS_ATOM_eval: _bindgen_ty_2 = 60; +pub const JS_ATOM_prototype: _bindgen_ty_2 = 61; +pub const JS_ATOM_constructor: _bindgen_ty_2 = 62; +pub const JS_ATOM_configurable: _bindgen_ty_2 = 63; +pub const JS_ATOM_writable: _bindgen_ty_2 = 64; +pub const JS_ATOM_enumerable: _bindgen_ty_2 = 65; +pub const JS_ATOM_value: _bindgen_ty_2 = 66; +pub const JS_ATOM_get: _bindgen_ty_2 = 67; +pub const JS_ATOM_set: _bindgen_ty_2 = 68; +pub const JS_ATOM_of: _bindgen_ty_2 = 69; +pub const JS_ATOM___proto__: _bindgen_ty_2 = 70; +pub const JS_ATOM_undefined: _bindgen_ty_2 = 71; +pub const JS_ATOM_number: _bindgen_ty_2 = 72; +pub const JS_ATOM_boolean: _bindgen_ty_2 = 73; +pub const JS_ATOM_string: _bindgen_ty_2 = 74; +pub const JS_ATOM_object: _bindgen_ty_2 = 75; +pub const JS_ATOM_symbol: _bindgen_ty_2 = 76; +pub const JS_ATOM_integer: _bindgen_ty_2 = 77; +pub const JS_ATOM_unknown: _bindgen_ty_2 = 78; +pub const JS_ATOM_arguments: _bindgen_ty_2 = 79; +pub const JS_ATOM_callee: _bindgen_ty_2 = 80; +pub const JS_ATOM_caller: _bindgen_ty_2 = 81; +pub const JS_ATOM__eval_: _bindgen_ty_2 = 82; +pub const JS_ATOM__ret_: _bindgen_ty_2 = 83; +pub const JS_ATOM__var_: _bindgen_ty_2 = 84; +pub const JS_ATOM__arg_var_: _bindgen_ty_2 = 85; +pub const JS_ATOM__with_: _bindgen_ty_2 = 86; +pub const JS_ATOM_lastIndex: _bindgen_ty_2 = 87; +pub const JS_ATOM_target: _bindgen_ty_2 = 88; +pub const JS_ATOM_index: _bindgen_ty_2 = 89; +pub const JS_ATOM_input: _bindgen_ty_2 = 90; +pub const JS_ATOM_defineProperties: _bindgen_ty_2 = 91; +pub const JS_ATOM_apply: _bindgen_ty_2 = 92; +pub const JS_ATOM_join: _bindgen_ty_2 = 93; +pub const JS_ATOM_concat: _bindgen_ty_2 = 94; +pub const JS_ATOM_split: _bindgen_ty_2 = 95; +pub const JS_ATOM_construct: _bindgen_ty_2 = 96; +pub const JS_ATOM_getPrototypeOf: _bindgen_ty_2 = 97; +pub const JS_ATOM_setPrototypeOf: _bindgen_ty_2 = 98; +pub const JS_ATOM_isExtensible: _bindgen_ty_2 = 99; +pub const JS_ATOM_preventExtensions: _bindgen_ty_2 = 100; +pub const JS_ATOM_has: _bindgen_ty_2 = 101; +pub const JS_ATOM_deleteProperty: _bindgen_ty_2 = 102; +pub const JS_ATOM_defineProperty: _bindgen_ty_2 = 103; +pub const JS_ATOM_getOwnPropertyDescriptor: _bindgen_ty_2 = 104; +pub const JS_ATOM_ownKeys: _bindgen_ty_2 = 105; +pub const JS_ATOM_add: _bindgen_ty_2 = 106; +pub const JS_ATOM_done: _bindgen_ty_2 = 107; +pub const JS_ATOM_next: _bindgen_ty_2 = 108; +pub const JS_ATOM_values: _bindgen_ty_2 = 109; +pub const JS_ATOM_source: _bindgen_ty_2 = 110; +pub const JS_ATOM_flags: _bindgen_ty_2 = 111; +pub const JS_ATOM_global: _bindgen_ty_2 = 112; +pub const JS_ATOM_unicode: _bindgen_ty_2 = 113; +pub const JS_ATOM_raw: _bindgen_ty_2 = 114; +pub const JS_ATOM_new_target: _bindgen_ty_2 = 115; +pub const JS_ATOM_this_active_func: _bindgen_ty_2 = 116; +pub const JS_ATOM_home_object: _bindgen_ty_2 = 117; +pub const JS_ATOM_computed_field: _bindgen_ty_2 = 118; +pub const JS_ATOM_static_computed_field: _bindgen_ty_2 = 119; +pub const JS_ATOM_class_fields_init: _bindgen_ty_2 = 120; +pub const JS_ATOM_brand: _bindgen_ty_2 = 121; +pub const JS_ATOM_hash_constructor: _bindgen_ty_2 = 122; +pub const JS_ATOM_as: _bindgen_ty_2 = 123; +pub const JS_ATOM_from: _bindgen_ty_2 = 124; +pub const JS_ATOM_meta: _bindgen_ty_2 = 125; +pub const JS_ATOM__default_: _bindgen_ty_2 = 126; +pub const JS_ATOM__star_: _bindgen_ty_2 = 127; +pub const JS_ATOM_Module: _bindgen_ty_2 = 128; +pub const JS_ATOM_then: _bindgen_ty_2 = 129; +pub const JS_ATOM_resolve: _bindgen_ty_2 = 130; +pub const JS_ATOM_reject: _bindgen_ty_2 = 131; +pub const JS_ATOM_promise: _bindgen_ty_2 = 132; +pub const JS_ATOM_proxy: _bindgen_ty_2 = 133; +pub const JS_ATOM_revoke: _bindgen_ty_2 = 134; +pub const JS_ATOM_async: _bindgen_ty_2 = 135; +pub const JS_ATOM_exec: _bindgen_ty_2 = 136; +pub const JS_ATOM_groups: _bindgen_ty_2 = 137; +pub const JS_ATOM_indices: _bindgen_ty_2 = 138; +pub const JS_ATOM_status: _bindgen_ty_2 = 139; +pub const JS_ATOM_reason: _bindgen_ty_2 = 140; +pub const JS_ATOM_globalThis: _bindgen_ty_2 = 141; +pub const JS_ATOM_bigint: _bindgen_ty_2 = 142; +pub const JS_ATOM_bigfloat: _bindgen_ty_2 = 143; +pub const JS_ATOM_bigdecimal: _bindgen_ty_2 = 144; +pub const JS_ATOM_roundingMode: _bindgen_ty_2 = 145; +pub const JS_ATOM_maximumSignificantDigits: _bindgen_ty_2 = 146; +pub const JS_ATOM_maximumFractionDigits: _bindgen_ty_2 = 147; +pub const JS_ATOM_not_equal: _bindgen_ty_2 = 148; +pub const JS_ATOM_timed_out: _bindgen_ty_2 = 149; +pub const JS_ATOM_ok: _bindgen_ty_2 = 150; +pub const JS_ATOM_toJSON: _bindgen_ty_2 = 151; +pub const JS_ATOM_Object: _bindgen_ty_2 = 152; +pub const JS_ATOM_Array: _bindgen_ty_2 = 153; +pub const JS_ATOM_Error: _bindgen_ty_2 = 154; +pub const JS_ATOM_Number: _bindgen_ty_2 = 155; +pub const JS_ATOM_String: _bindgen_ty_2 = 156; +pub const JS_ATOM_Boolean: _bindgen_ty_2 = 157; +pub const JS_ATOM_Symbol: _bindgen_ty_2 = 158; +pub const JS_ATOM_Arguments: _bindgen_ty_2 = 159; +pub const JS_ATOM_Math: _bindgen_ty_2 = 160; +pub const JS_ATOM_JSON: _bindgen_ty_2 = 161; +pub const JS_ATOM_Date: _bindgen_ty_2 = 162; +pub const JS_ATOM_Function: _bindgen_ty_2 = 163; +pub const JS_ATOM_GeneratorFunction: _bindgen_ty_2 = 164; +pub const JS_ATOM_ForInIterator: _bindgen_ty_2 = 165; +pub const JS_ATOM_RegExp: _bindgen_ty_2 = 166; +pub const JS_ATOM_ArrayBuffer: _bindgen_ty_2 = 167; +pub const JS_ATOM_SharedArrayBuffer: _bindgen_ty_2 = 168; +pub const JS_ATOM_Uint8ClampedArray: _bindgen_ty_2 = 169; +pub const JS_ATOM_Int8Array: _bindgen_ty_2 = 170; +pub const JS_ATOM_Uint8Array: _bindgen_ty_2 = 171; +pub const JS_ATOM_Int16Array: _bindgen_ty_2 = 172; +pub const JS_ATOM_Uint16Array: _bindgen_ty_2 = 173; +pub const JS_ATOM_Int32Array: _bindgen_ty_2 = 174; +pub const JS_ATOM_Uint32Array: _bindgen_ty_2 = 175; +pub const JS_ATOM_BigInt64Array: _bindgen_ty_2 = 176; +pub const JS_ATOM_BigUint64Array: _bindgen_ty_2 = 177; +pub const JS_ATOM_Float32Array: _bindgen_ty_2 = 178; +pub const JS_ATOM_Float64Array: _bindgen_ty_2 = 179; +pub const JS_ATOM_DataView: _bindgen_ty_2 = 180; +pub const JS_ATOM_BigInt: _bindgen_ty_2 = 181; +pub const JS_ATOM_BigFloat: _bindgen_ty_2 = 182; +pub const JS_ATOM_BigFloatEnv: _bindgen_ty_2 = 183; +pub const JS_ATOM_BigDecimal: _bindgen_ty_2 = 184; +pub const JS_ATOM_OperatorSet: _bindgen_ty_2 = 185; +pub const JS_ATOM_Operators: _bindgen_ty_2 = 186; +pub const JS_ATOM_Map: _bindgen_ty_2 = 187; +pub const JS_ATOM_Set: _bindgen_ty_2 = 188; +pub const JS_ATOM_WeakMap: _bindgen_ty_2 = 189; +pub const JS_ATOM_WeakSet: _bindgen_ty_2 = 190; +pub const JS_ATOM_Map_Iterator: _bindgen_ty_2 = 191; +pub const JS_ATOM_Set_Iterator: _bindgen_ty_2 = 192; +pub const JS_ATOM_Array_Iterator: _bindgen_ty_2 = 193; +pub const JS_ATOM_String_Iterator: _bindgen_ty_2 = 194; +pub const JS_ATOM_RegExp_String_Iterator: _bindgen_ty_2 = 195; +pub const JS_ATOM_Generator: _bindgen_ty_2 = 196; +pub const JS_ATOM_Proxy: _bindgen_ty_2 = 197; +pub const JS_ATOM_Promise: _bindgen_ty_2 = 198; +pub const JS_ATOM_PromiseResolveFunction: _bindgen_ty_2 = 199; +pub const JS_ATOM_PromiseRejectFunction: _bindgen_ty_2 = 200; +pub const JS_ATOM_AsyncFunction: _bindgen_ty_2 = 201; +pub const JS_ATOM_AsyncFunctionResolve: _bindgen_ty_2 = 202; +pub const JS_ATOM_AsyncFunctionReject: _bindgen_ty_2 = 203; +pub const JS_ATOM_AsyncGeneratorFunction: _bindgen_ty_2 = 204; +pub const JS_ATOM_AsyncGenerator: _bindgen_ty_2 = 205; +pub const JS_ATOM_EvalError: _bindgen_ty_2 = 206; +pub const JS_ATOM_RangeError: _bindgen_ty_2 = 207; +pub const JS_ATOM_ReferenceError: _bindgen_ty_2 = 208; +pub const JS_ATOM_SyntaxError: _bindgen_ty_2 = 209; +pub const JS_ATOM_TypeError: _bindgen_ty_2 = 210; +pub const JS_ATOM_URIError: _bindgen_ty_2 = 211; +pub const JS_ATOM_InternalError: _bindgen_ty_2 = 212; +pub const JS_ATOM_Private_brand: _bindgen_ty_2 = 213; +pub const JS_ATOM_Symbol_toPrimitive: _bindgen_ty_2 = 214; +pub const JS_ATOM_Symbol_iterator: _bindgen_ty_2 = 215; +pub const JS_ATOM_Symbol_match: _bindgen_ty_2 = 216; +pub const JS_ATOM_Symbol_matchAll: _bindgen_ty_2 = 217; +pub const JS_ATOM_Symbol_replace: _bindgen_ty_2 = 218; +pub const JS_ATOM_Symbol_search: _bindgen_ty_2 = 219; +pub const JS_ATOM_Symbol_split: _bindgen_ty_2 = 220; +pub const JS_ATOM_Symbol_toStringTag: _bindgen_ty_2 = 221; +pub const JS_ATOM_Symbol_isConcatSpreadable: _bindgen_ty_2 = 222; +pub const JS_ATOM_Symbol_hasInstance: _bindgen_ty_2 = 223; +pub const JS_ATOM_Symbol_species: _bindgen_ty_2 = 224; +pub const JS_ATOM_Symbol_unscopables: _bindgen_ty_2 = 225; +pub const JS_ATOM_Symbol_asyncIterator: _bindgen_ty_2 = 226; +pub const JS_ATOM_Symbol_operatorSet: _bindgen_ty_2 = 227; +pub const JS_ATOM_END: _bindgen_ty_2 = 228; pub type _bindgen_ty_2 = ::std::os::raw::c_uint; diff --git a/sys/src/bindings/x86_64-apple-darwin.rs b/sys/src/bindings/x86_64-apple-darwin.rs index abe8edd1a..266b827b2 100644 --- a/sys/src/bindings/x86_64-apple-darwin.rs +++ b/sys/src/bindings/x86_64-apple-darwin.rs @@ -31,8 +31,10 @@ pub const JS_EVAL_FLAG_STRICT: u32 = 8; pub const JS_EVAL_FLAG_STRIP: u32 = 16; pub const JS_EVAL_FLAG_COMPILE_ONLY: u32 = 32; pub const JS_EVAL_FLAG_BACKTRACE_BARRIER: u32 = 64; +pub const JS_EVAL_FLAG_ASYNC: u32 = 128; pub const JS_ATOM_NULL: u32 = 0; pub const JS_CALL_FLAG_CONSTRUCTOR: u32 = 1; +pub const JS_INVALID_CLASS_ID: u32 = 0; pub const JS_GPN_STRING_MASK: u32 = 1; pub const JS_GPN_SYMBOL_MASK: u32 = 2; pub const JS_GPN_PRIVATE_MASK: u32 = 4; @@ -459,6 +461,9 @@ extern "C" { extern "C" { pub fn JS_GetClassProto(ctx: *mut JSContext, class_id: JSClassID) -> JSValue; } +extern "C" { + pub fn JS_GetFunctionProto(ctx: *mut JSContext) -> JSValue; +} extern "C" { pub fn JS_NewContextRaw(rt: *mut JSRuntime) -> *mut JSContext; } @@ -1289,6 +1294,9 @@ fn bindgen_test_layout_JSClassDef() { extern "C" { pub fn JS_NewClassID(pclass_id: *mut JSClassID) -> JSClassID; } +extern "C" { + pub fn JS_GetClassID(v: JSValue) -> JSClassID; +} extern "C" { pub fn JS_NewClass( rt: *mut JSRuntime, @@ -1459,6 +1467,9 @@ extern "C" { extern "C" { pub fn JS_IsArray(ctx: *mut JSContext, val: JSValue) -> ::std::os::raw::c_int; } +extern "C" { + pub fn JS_NewDate(ctx: *mut JSContext, epoch_ms: f64) -> JSValue; +} extern "C" { pub fn JS_GetPropertyInternal( ctx: *mut JSContext, @@ -1481,9 +1492,10 @@ extern "C" { extern "C" { pub fn JS_SetPropertyInternal( ctx: *mut JSContext, - this_obj: JSValue, + obj: JSValue, prop: JSAtom, val: JSValue, + this_obj: JSValue, flags: ::std::os::raw::c_int, ) -> ::std::os::raw::c_int; } @@ -1622,9 +1634,6 @@ extern "C" { extern "C" { pub fn JS_GetGlobalObject(ctx: *mut JSContext) -> JSValue; } -extern "C" { - pub fn JS_GetFunctionProto(ctx: *mut JSContext) -> JSValue; -} extern "C" { pub fn JS_IsInstanceOf( ctx: *mut JSContext, @@ -1832,9 +1841,19 @@ extern "C" { sf: *const JSSharedArrayBufferFunctions, ); } +pub const JSPromiseStateEnum_JS_PROMISE_PENDING: JSPromiseStateEnum = 0; +pub const JSPromiseStateEnum_JS_PROMISE_FULFILLED: JSPromiseStateEnum = 1; +pub const JSPromiseStateEnum_JS_PROMISE_REJECTED: JSPromiseStateEnum = 2; +pub type JSPromiseStateEnum = ::std::os::raw::c_uint; extern "C" { pub fn JS_NewPromiseCapability(ctx: *mut JSContext, resolving_funcs: *mut JSValue) -> JSValue; } +extern "C" { + pub fn JS_PromiseState(ctx: *mut JSContext, promise: JSValue) -> JSPromiseStateEnum; +} +extern "C" { + pub fn JS_PromiseResult(ctx: *mut JSContext, promise: JSValue) -> JSValue; +} pub type JSHostPromiseRejectionTracker = ::std::option::Option< unsafe extern "C" fn( ctx: *mut JSContext, @@ -1905,7 +1924,7 @@ extern "C" { pub fn JS_GetModuleName(ctx: *mut JSContext, m: *mut JSModuleDef) -> JSAtom; } extern "C" { - pub fn JS_FreeUnevaluatedModules(ctx: *mut JSContext); + pub fn JS_GetModuleNamespace(ctx: *mut JSContext, m: *mut JSModuleDef) -> JSValue; } pub type JSJobFunc = ::std::option::Option< unsafe extern "C" fn( @@ -1970,11 +1989,11 @@ extern "C" { ) -> JSAtom; } extern "C" { - pub fn JS_RunModule( + pub fn JS_LoadModule( ctx: *mut JSContext, basename: *const ::std::os::raw::c_char, filename: *const ::std::os::raw::c_char, - ) -> *mut JSModuleDef; + ) -> JSValue; } pub const JSCFunctionEnum_JS_CFUNC_generic: JSCFunctionEnum = 0; pub const JSCFunctionEnum_JS_CFUNC_generic_magic: JSCFunctionEnum = 1; @@ -2643,36 +2662,6 @@ extern "C" { len: ::std::os::raw::c_int, ) -> ::std::os::raw::c_int; } -extern "C" { - pub fn JS_DynamicImportSync( - ctx: *mut JSContext, - specifier: *const ::std::os::raw::c_char, - ) -> JSValue; -} -extern "C" { - pub fn JS_GetModuleExport( - ctx: *mut JSContext, - m: *mut JSModuleDef, - export_name: *const ::std::os::raw::c_char, - ) -> JSValue; -} -extern "C" { - pub fn JS_GetModuleExportEntriesCount(m: *mut JSModuleDef) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn JS_GetModuleExportEntry( - ctx: *mut JSContext, - m: *mut JSModuleDef, - idx: ::std::os::raw::c_int, - ) -> JSValue; -} -extern "C" { - pub fn JS_GetModuleExportEntryName( - ctx: *mut JSContext, - m: *mut JSModuleDef, - idx: ::std::os::raw::c_int, - ) -> JSAtom; -} pub const __JS_ATOM_NULL: _bindgen_ty_2 = 0; pub const JS_ATOM_null: _bindgen_ty_2 = 1; pub const JS_ATOM_false: _bindgen_ty_2 = 2; @@ -2726,178 +2715,180 @@ pub const JS_ATOM_fileName: _bindgen_ty_2 = 49; pub const JS_ATOM_lineNumber: _bindgen_ty_2 = 50; pub const JS_ATOM_columnNumber: _bindgen_ty_2 = 51; pub const JS_ATOM_message: _bindgen_ty_2 = 52; -pub const JS_ATOM_errors: _bindgen_ty_2 = 53; -pub const JS_ATOM_stack: _bindgen_ty_2 = 54; -pub const JS_ATOM_name: _bindgen_ty_2 = 55; -pub const JS_ATOM_toString: _bindgen_ty_2 = 56; -pub const JS_ATOM_toLocaleString: _bindgen_ty_2 = 57; -pub const JS_ATOM_valueOf: _bindgen_ty_2 = 58; -pub const JS_ATOM_eval: _bindgen_ty_2 = 59; -pub const JS_ATOM_prototype: _bindgen_ty_2 = 60; -pub const JS_ATOM_constructor: _bindgen_ty_2 = 61; -pub const JS_ATOM_configurable: _bindgen_ty_2 = 62; -pub const JS_ATOM_writable: _bindgen_ty_2 = 63; -pub const JS_ATOM_enumerable: _bindgen_ty_2 = 64; -pub const JS_ATOM_value: _bindgen_ty_2 = 65; -pub const JS_ATOM_get: _bindgen_ty_2 = 66; -pub const JS_ATOM_set: _bindgen_ty_2 = 67; -pub const JS_ATOM_of: _bindgen_ty_2 = 68; -pub const JS_ATOM___proto__: _bindgen_ty_2 = 69; -pub const JS_ATOM_undefined: _bindgen_ty_2 = 70; -pub const JS_ATOM_number: _bindgen_ty_2 = 71; -pub const JS_ATOM_boolean: _bindgen_ty_2 = 72; -pub const JS_ATOM_string: _bindgen_ty_2 = 73; -pub const JS_ATOM_object: _bindgen_ty_2 = 74; -pub const JS_ATOM_symbol: _bindgen_ty_2 = 75; -pub const JS_ATOM_integer: _bindgen_ty_2 = 76; -pub const JS_ATOM_unknown: _bindgen_ty_2 = 77; -pub const JS_ATOM_arguments: _bindgen_ty_2 = 78; -pub const JS_ATOM_callee: _bindgen_ty_2 = 79; -pub const JS_ATOM_caller: _bindgen_ty_2 = 80; -pub const JS_ATOM__eval_: _bindgen_ty_2 = 81; -pub const JS_ATOM__ret_: _bindgen_ty_2 = 82; -pub const JS_ATOM__var_: _bindgen_ty_2 = 83; -pub const JS_ATOM__arg_var_: _bindgen_ty_2 = 84; -pub const JS_ATOM__with_: _bindgen_ty_2 = 85; -pub const JS_ATOM_lastIndex: _bindgen_ty_2 = 86; -pub const JS_ATOM_target: _bindgen_ty_2 = 87; -pub const JS_ATOM_index: _bindgen_ty_2 = 88; -pub const JS_ATOM_input: _bindgen_ty_2 = 89; -pub const JS_ATOM_defineProperties: _bindgen_ty_2 = 90; -pub const JS_ATOM_apply: _bindgen_ty_2 = 91; -pub const JS_ATOM_join: _bindgen_ty_2 = 92; -pub const JS_ATOM_concat: _bindgen_ty_2 = 93; -pub const JS_ATOM_split: _bindgen_ty_2 = 94; -pub const JS_ATOM_construct: _bindgen_ty_2 = 95; -pub const JS_ATOM_getPrototypeOf: _bindgen_ty_2 = 96; -pub const JS_ATOM_setPrototypeOf: _bindgen_ty_2 = 97; -pub const JS_ATOM_isExtensible: _bindgen_ty_2 = 98; -pub const JS_ATOM_preventExtensions: _bindgen_ty_2 = 99; -pub const JS_ATOM_has: _bindgen_ty_2 = 100; -pub const JS_ATOM_deleteProperty: _bindgen_ty_2 = 101; -pub const JS_ATOM_defineProperty: _bindgen_ty_2 = 102; -pub const JS_ATOM_getOwnPropertyDescriptor: _bindgen_ty_2 = 103; -pub const JS_ATOM_ownKeys: _bindgen_ty_2 = 104; -pub const JS_ATOM_add: _bindgen_ty_2 = 105; -pub const JS_ATOM_done: _bindgen_ty_2 = 106; -pub const JS_ATOM_next: _bindgen_ty_2 = 107; -pub const JS_ATOM_values: _bindgen_ty_2 = 108; -pub const JS_ATOM_source: _bindgen_ty_2 = 109; -pub const JS_ATOM_flags: _bindgen_ty_2 = 110; -pub const JS_ATOM_global: _bindgen_ty_2 = 111; -pub const JS_ATOM_unicode: _bindgen_ty_2 = 112; -pub const JS_ATOM_raw: _bindgen_ty_2 = 113; -pub const JS_ATOM_new_target: _bindgen_ty_2 = 114; -pub const JS_ATOM_this_active_func: _bindgen_ty_2 = 115; -pub const JS_ATOM_home_object: _bindgen_ty_2 = 116; -pub const JS_ATOM_computed_field: _bindgen_ty_2 = 117; -pub const JS_ATOM_static_computed_field: _bindgen_ty_2 = 118; -pub const JS_ATOM_class_fields_init: _bindgen_ty_2 = 119; -pub const JS_ATOM_brand: _bindgen_ty_2 = 120; -pub const JS_ATOM_hash_constructor: _bindgen_ty_2 = 121; -pub const JS_ATOM_as: _bindgen_ty_2 = 122; -pub const JS_ATOM_from: _bindgen_ty_2 = 123; -pub const JS_ATOM_meta: _bindgen_ty_2 = 124; -pub const JS_ATOM__default_: _bindgen_ty_2 = 125; -pub const JS_ATOM__star_: _bindgen_ty_2 = 126; -pub const JS_ATOM_Module: _bindgen_ty_2 = 127; -pub const JS_ATOM_then: _bindgen_ty_2 = 128; -pub const JS_ATOM_resolve: _bindgen_ty_2 = 129; -pub const JS_ATOM_reject: _bindgen_ty_2 = 130; -pub const JS_ATOM_promise: _bindgen_ty_2 = 131; -pub const JS_ATOM_proxy: _bindgen_ty_2 = 132; -pub const JS_ATOM_revoke: _bindgen_ty_2 = 133; -pub const JS_ATOM_async: _bindgen_ty_2 = 134; -pub const JS_ATOM_exec: _bindgen_ty_2 = 135; -pub const JS_ATOM_groups: _bindgen_ty_2 = 136; -pub const JS_ATOM_status: _bindgen_ty_2 = 137; -pub const JS_ATOM_reason: _bindgen_ty_2 = 138; -pub const JS_ATOM_globalThis: _bindgen_ty_2 = 139; -pub const JS_ATOM_bigint: _bindgen_ty_2 = 140; -pub const JS_ATOM_bigfloat: _bindgen_ty_2 = 141; -pub const JS_ATOM_bigdecimal: _bindgen_ty_2 = 142; -pub const JS_ATOM_roundingMode: _bindgen_ty_2 = 143; -pub const JS_ATOM_maximumSignificantDigits: _bindgen_ty_2 = 144; -pub const JS_ATOM_maximumFractionDigits: _bindgen_ty_2 = 145; -pub const JS_ATOM_not_equal: _bindgen_ty_2 = 146; -pub const JS_ATOM_timed_out: _bindgen_ty_2 = 147; -pub const JS_ATOM_ok: _bindgen_ty_2 = 148; -pub const JS_ATOM_toJSON: _bindgen_ty_2 = 149; -pub const JS_ATOM_Object: _bindgen_ty_2 = 150; -pub const JS_ATOM_Array: _bindgen_ty_2 = 151; -pub const JS_ATOM_Error: _bindgen_ty_2 = 152; -pub const JS_ATOM_Number: _bindgen_ty_2 = 153; -pub const JS_ATOM_String: _bindgen_ty_2 = 154; -pub const JS_ATOM_Boolean: _bindgen_ty_2 = 155; -pub const JS_ATOM_Symbol: _bindgen_ty_2 = 156; -pub const JS_ATOM_Arguments: _bindgen_ty_2 = 157; -pub const JS_ATOM_Math: _bindgen_ty_2 = 158; -pub const JS_ATOM_JSON: _bindgen_ty_2 = 159; -pub const JS_ATOM_Date: _bindgen_ty_2 = 160; -pub const JS_ATOM_Function: _bindgen_ty_2 = 161; -pub const JS_ATOM_GeneratorFunction: _bindgen_ty_2 = 162; -pub const JS_ATOM_ForInIterator: _bindgen_ty_2 = 163; -pub const JS_ATOM_RegExp: _bindgen_ty_2 = 164; -pub const JS_ATOM_ArrayBuffer: _bindgen_ty_2 = 165; -pub const JS_ATOM_SharedArrayBuffer: _bindgen_ty_2 = 166; -pub const JS_ATOM_Uint8ClampedArray: _bindgen_ty_2 = 167; -pub const JS_ATOM_Int8Array: _bindgen_ty_2 = 168; -pub const JS_ATOM_Uint8Array: _bindgen_ty_2 = 169; -pub const JS_ATOM_Int16Array: _bindgen_ty_2 = 170; -pub const JS_ATOM_Uint16Array: _bindgen_ty_2 = 171; -pub const JS_ATOM_Int32Array: _bindgen_ty_2 = 172; -pub const JS_ATOM_Uint32Array: _bindgen_ty_2 = 173; -pub const JS_ATOM_BigInt64Array: _bindgen_ty_2 = 174; -pub const JS_ATOM_BigUint64Array: _bindgen_ty_2 = 175; -pub const JS_ATOM_Float32Array: _bindgen_ty_2 = 176; -pub const JS_ATOM_Float64Array: _bindgen_ty_2 = 177; -pub const JS_ATOM_DataView: _bindgen_ty_2 = 178; -pub const JS_ATOM_BigInt: _bindgen_ty_2 = 179; -pub const JS_ATOM_BigFloat: _bindgen_ty_2 = 180; -pub const JS_ATOM_BigFloatEnv: _bindgen_ty_2 = 181; -pub const JS_ATOM_BigDecimal: _bindgen_ty_2 = 182; -pub const JS_ATOM_OperatorSet: _bindgen_ty_2 = 183; -pub const JS_ATOM_Operators: _bindgen_ty_2 = 184; -pub const JS_ATOM_Map: _bindgen_ty_2 = 185; -pub const JS_ATOM_Set: _bindgen_ty_2 = 186; -pub const JS_ATOM_WeakMap: _bindgen_ty_2 = 187; -pub const JS_ATOM_WeakSet: _bindgen_ty_2 = 188; -pub const JS_ATOM_Map_Iterator: _bindgen_ty_2 = 189; -pub const JS_ATOM_Set_Iterator: _bindgen_ty_2 = 190; -pub const JS_ATOM_Array_Iterator: _bindgen_ty_2 = 191; -pub const JS_ATOM_String_Iterator: _bindgen_ty_2 = 192; -pub const JS_ATOM_RegExp_String_Iterator: _bindgen_ty_2 = 193; -pub const JS_ATOM_Generator: _bindgen_ty_2 = 194; -pub const JS_ATOM_Proxy: _bindgen_ty_2 = 195; -pub const JS_ATOM_Promise: _bindgen_ty_2 = 196; -pub const JS_ATOM_PromiseResolveFunction: _bindgen_ty_2 = 197; -pub const JS_ATOM_PromiseRejectFunction: _bindgen_ty_2 = 198; -pub const JS_ATOM_AsyncFunction: _bindgen_ty_2 = 199; -pub const JS_ATOM_AsyncFunctionResolve: _bindgen_ty_2 = 200; -pub const JS_ATOM_AsyncFunctionReject: _bindgen_ty_2 = 201; -pub const JS_ATOM_AsyncGeneratorFunction: _bindgen_ty_2 = 202; -pub const JS_ATOM_AsyncGenerator: _bindgen_ty_2 = 203; -pub const JS_ATOM_EvalError: _bindgen_ty_2 = 204; -pub const JS_ATOM_RangeError: _bindgen_ty_2 = 205; -pub const JS_ATOM_ReferenceError: _bindgen_ty_2 = 206; -pub const JS_ATOM_SyntaxError: _bindgen_ty_2 = 207; -pub const JS_ATOM_TypeError: _bindgen_ty_2 = 208; -pub const JS_ATOM_URIError: _bindgen_ty_2 = 209; -pub const JS_ATOM_InternalError: _bindgen_ty_2 = 210; -pub const JS_ATOM_Private_brand: _bindgen_ty_2 = 211; -pub const JS_ATOM_Symbol_toPrimitive: _bindgen_ty_2 = 212; -pub const JS_ATOM_Symbol_iterator: _bindgen_ty_2 = 213; -pub const JS_ATOM_Symbol_match: _bindgen_ty_2 = 214; -pub const JS_ATOM_Symbol_matchAll: _bindgen_ty_2 = 215; -pub const JS_ATOM_Symbol_replace: _bindgen_ty_2 = 216; -pub const JS_ATOM_Symbol_search: _bindgen_ty_2 = 217; -pub const JS_ATOM_Symbol_split: _bindgen_ty_2 = 218; -pub const JS_ATOM_Symbol_toStringTag: _bindgen_ty_2 = 219; -pub const JS_ATOM_Symbol_isConcatSpreadable: _bindgen_ty_2 = 220; -pub const JS_ATOM_Symbol_hasInstance: _bindgen_ty_2 = 221; -pub const JS_ATOM_Symbol_species: _bindgen_ty_2 = 222; -pub const JS_ATOM_Symbol_unscopables: _bindgen_ty_2 = 223; -pub const JS_ATOM_Symbol_asyncIterator: _bindgen_ty_2 = 224; -pub const JS_ATOM_Symbol_operatorSet: _bindgen_ty_2 = 225; -pub const JS_ATOM_END: _bindgen_ty_2 = 226; +pub const JS_ATOM_cause: _bindgen_ty_2 = 53; +pub const JS_ATOM_errors: _bindgen_ty_2 = 54; +pub const JS_ATOM_stack: _bindgen_ty_2 = 55; +pub const JS_ATOM_name: _bindgen_ty_2 = 56; +pub const JS_ATOM_toString: _bindgen_ty_2 = 57; +pub const JS_ATOM_toLocaleString: _bindgen_ty_2 = 58; +pub const JS_ATOM_valueOf: _bindgen_ty_2 = 59; +pub const JS_ATOM_eval: _bindgen_ty_2 = 60; +pub const JS_ATOM_prototype: _bindgen_ty_2 = 61; +pub const JS_ATOM_constructor: _bindgen_ty_2 = 62; +pub const JS_ATOM_configurable: _bindgen_ty_2 = 63; +pub const JS_ATOM_writable: _bindgen_ty_2 = 64; +pub const JS_ATOM_enumerable: _bindgen_ty_2 = 65; +pub const JS_ATOM_value: _bindgen_ty_2 = 66; +pub const JS_ATOM_get: _bindgen_ty_2 = 67; +pub const JS_ATOM_set: _bindgen_ty_2 = 68; +pub const JS_ATOM_of: _bindgen_ty_2 = 69; +pub const JS_ATOM___proto__: _bindgen_ty_2 = 70; +pub const JS_ATOM_undefined: _bindgen_ty_2 = 71; +pub const JS_ATOM_number: _bindgen_ty_2 = 72; +pub const JS_ATOM_boolean: _bindgen_ty_2 = 73; +pub const JS_ATOM_string: _bindgen_ty_2 = 74; +pub const JS_ATOM_object: _bindgen_ty_2 = 75; +pub const JS_ATOM_symbol: _bindgen_ty_2 = 76; +pub const JS_ATOM_integer: _bindgen_ty_2 = 77; +pub const JS_ATOM_unknown: _bindgen_ty_2 = 78; +pub const JS_ATOM_arguments: _bindgen_ty_2 = 79; +pub const JS_ATOM_callee: _bindgen_ty_2 = 80; +pub const JS_ATOM_caller: _bindgen_ty_2 = 81; +pub const JS_ATOM__eval_: _bindgen_ty_2 = 82; +pub const JS_ATOM__ret_: _bindgen_ty_2 = 83; +pub const JS_ATOM__var_: _bindgen_ty_2 = 84; +pub const JS_ATOM__arg_var_: _bindgen_ty_2 = 85; +pub const JS_ATOM__with_: _bindgen_ty_2 = 86; +pub const JS_ATOM_lastIndex: _bindgen_ty_2 = 87; +pub const JS_ATOM_target: _bindgen_ty_2 = 88; +pub const JS_ATOM_index: _bindgen_ty_2 = 89; +pub const JS_ATOM_input: _bindgen_ty_2 = 90; +pub const JS_ATOM_defineProperties: _bindgen_ty_2 = 91; +pub const JS_ATOM_apply: _bindgen_ty_2 = 92; +pub const JS_ATOM_join: _bindgen_ty_2 = 93; +pub const JS_ATOM_concat: _bindgen_ty_2 = 94; +pub const JS_ATOM_split: _bindgen_ty_2 = 95; +pub const JS_ATOM_construct: _bindgen_ty_2 = 96; +pub const JS_ATOM_getPrototypeOf: _bindgen_ty_2 = 97; +pub const JS_ATOM_setPrototypeOf: _bindgen_ty_2 = 98; +pub const JS_ATOM_isExtensible: _bindgen_ty_2 = 99; +pub const JS_ATOM_preventExtensions: _bindgen_ty_2 = 100; +pub const JS_ATOM_has: _bindgen_ty_2 = 101; +pub const JS_ATOM_deleteProperty: _bindgen_ty_2 = 102; +pub const JS_ATOM_defineProperty: _bindgen_ty_2 = 103; +pub const JS_ATOM_getOwnPropertyDescriptor: _bindgen_ty_2 = 104; +pub const JS_ATOM_ownKeys: _bindgen_ty_2 = 105; +pub const JS_ATOM_add: _bindgen_ty_2 = 106; +pub const JS_ATOM_done: _bindgen_ty_2 = 107; +pub const JS_ATOM_next: _bindgen_ty_2 = 108; +pub const JS_ATOM_values: _bindgen_ty_2 = 109; +pub const JS_ATOM_source: _bindgen_ty_2 = 110; +pub const JS_ATOM_flags: _bindgen_ty_2 = 111; +pub const JS_ATOM_global: _bindgen_ty_2 = 112; +pub const JS_ATOM_unicode: _bindgen_ty_2 = 113; +pub const JS_ATOM_raw: _bindgen_ty_2 = 114; +pub const JS_ATOM_new_target: _bindgen_ty_2 = 115; +pub const JS_ATOM_this_active_func: _bindgen_ty_2 = 116; +pub const JS_ATOM_home_object: _bindgen_ty_2 = 117; +pub const JS_ATOM_computed_field: _bindgen_ty_2 = 118; +pub const JS_ATOM_static_computed_field: _bindgen_ty_2 = 119; +pub const JS_ATOM_class_fields_init: _bindgen_ty_2 = 120; +pub const JS_ATOM_brand: _bindgen_ty_2 = 121; +pub const JS_ATOM_hash_constructor: _bindgen_ty_2 = 122; +pub const JS_ATOM_as: _bindgen_ty_2 = 123; +pub const JS_ATOM_from: _bindgen_ty_2 = 124; +pub const JS_ATOM_meta: _bindgen_ty_2 = 125; +pub const JS_ATOM__default_: _bindgen_ty_2 = 126; +pub const JS_ATOM__star_: _bindgen_ty_2 = 127; +pub const JS_ATOM_Module: _bindgen_ty_2 = 128; +pub const JS_ATOM_then: _bindgen_ty_2 = 129; +pub const JS_ATOM_resolve: _bindgen_ty_2 = 130; +pub const JS_ATOM_reject: _bindgen_ty_2 = 131; +pub const JS_ATOM_promise: _bindgen_ty_2 = 132; +pub const JS_ATOM_proxy: _bindgen_ty_2 = 133; +pub const JS_ATOM_revoke: _bindgen_ty_2 = 134; +pub const JS_ATOM_async: _bindgen_ty_2 = 135; +pub const JS_ATOM_exec: _bindgen_ty_2 = 136; +pub const JS_ATOM_groups: _bindgen_ty_2 = 137; +pub const JS_ATOM_indices: _bindgen_ty_2 = 138; +pub const JS_ATOM_status: _bindgen_ty_2 = 139; +pub const JS_ATOM_reason: _bindgen_ty_2 = 140; +pub const JS_ATOM_globalThis: _bindgen_ty_2 = 141; +pub const JS_ATOM_bigint: _bindgen_ty_2 = 142; +pub const JS_ATOM_bigfloat: _bindgen_ty_2 = 143; +pub const JS_ATOM_bigdecimal: _bindgen_ty_2 = 144; +pub const JS_ATOM_roundingMode: _bindgen_ty_2 = 145; +pub const JS_ATOM_maximumSignificantDigits: _bindgen_ty_2 = 146; +pub const JS_ATOM_maximumFractionDigits: _bindgen_ty_2 = 147; +pub const JS_ATOM_not_equal: _bindgen_ty_2 = 148; +pub const JS_ATOM_timed_out: _bindgen_ty_2 = 149; +pub const JS_ATOM_ok: _bindgen_ty_2 = 150; +pub const JS_ATOM_toJSON: _bindgen_ty_2 = 151; +pub const JS_ATOM_Object: _bindgen_ty_2 = 152; +pub const JS_ATOM_Array: _bindgen_ty_2 = 153; +pub const JS_ATOM_Error: _bindgen_ty_2 = 154; +pub const JS_ATOM_Number: _bindgen_ty_2 = 155; +pub const JS_ATOM_String: _bindgen_ty_2 = 156; +pub const JS_ATOM_Boolean: _bindgen_ty_2 = 157; +pub const JS_ATOM_Symbol: _bindgen_ty_2 = 158; +pub const JS_ATOM_Arguments: _bindgen_ty_2 = 159; +pub const JS_ATOM_Math: _bindgen_ty_2 = 160; +pub const JS_ATOM_JSON: _bindgen_ty_2 = 161; +pub const JS_ATOM_Date: _bindgen_ty_2 = 162; +pub const JS_ATOM_Function: _bindgen_ty_2 = 163; +pub const JS_ATOM_GeneratorFunction: _bindgen_ty_2 = 164; +pub const JS_ATOM_ForInIterator: _bindgen_ty_2 = 165; +pub const JS_ATOM_RegExp: _bindgen_ty_2 = 166; +pub const JS_ATOM_ArrayBuffer: _bindgen_ty_2 = 167; +pub const JS_ATOM_SharedArrayBuffer: _bindgen_ty_2 = 168; +pub const JS_ATOM_Uint8ClampedArray: _bindgen_ty_2 = 169; +pub const JS_ATOM_Int8Array: _bindgen_ty_2 = 170; +pub const JS_ATOM_Uint8Array: _bindgen_ty_2 = 171; +pub const JS_ATOM_Int16Array: _bindgen_ty_2 = 172; +pub const JS_ATOM_Uint16Array: _bindgen_ty_2 = 173; +pub const JS_ATOM_Int32Array: _bindgen_ty_2 = 174; +pub const JS_ATOM_Uint32Array: _bindgen_ty_2 = 175; +pub const JS_ATOM_BigInt64Array: _bindgen_ty_2 = 176; +pub const JS_ATOM_BigUint64Array: _bindgen_ty_2 = 177; +pub const JS_ATOM_Float32Array: _bindgen_ty_2 = 178; +pub const JS_ATOM_Float64Array: _bindgen_ty_2 = 179; +pub const JS_ATOM_DataView: _bindgen_ty_2 = 180; +pub const JS_ATOM_BigInt: _bindgen_ty_2 = 181; +pub const JS_ATOM_BigFloat: _bindgen_ty_2 = 182; +pub const JS_ATOM_BigFloatEnv: _bindgen_ty_2 = 183; +pub const JS_ATOM_BigDecimal: _bindgen_ty_2 = 184; +pub const JS_ATOM_OperatorSet: _bindgen_ty_2 = 185; +pub const JS_ATOM_Operators: _bindgen_ty_2 = 186; +pub const JS_ATOM_Map: _bindgen_ty_2 = 187; +pub const JS_ATOM_Set: _bindgen_ty_2 = 188; +pub const JS_ATOM_WeakMap: _bindgen_ty_2 = 189; +pub const JS_ATOM_WeakSet: _bindgen_ty_2 = 190; +pub const JS_ATOM_Map_Iterator: _bindgen_ty_2 = 191; +pub const JS_ATOM_Set_Iterator: _bindgen_ty_2 = 192; +pub const JS_ATOM_Array_Iterator: _bindgen_ty_2 = 193; +pub const JS_ATOM_String_Iterator: _bindgen_ty_2 = 194; +pub const JS_ATOM_RegExp_String_Iterator: _bindgen_ty_2 = 195; +pub const JS_ATOM_Generator: _bindgen_ty_2 = 196; +pub const JS_ATOM_Proxy: _bindgen_ty_2 = 197; +pub const JS_ATOM_Promise: _bindgen_ty_2 = 198; +pub const JS_ATOM_PromiseResolveFunction: _bindgen_ty_2 = 199; +pub const JS_ATOM_PromiseRejectFunction: _bindgen_ty_2 = 200; +pub const JS_ATOM_AsyncFunction: _bindgen_ty_2 = 201; +pub const JS_ATOM_AsyncFunctionResolve: _bindgen_ty_2 = 202; +pub const JS_ATOM_AsyncFunctionReject: _bindgen_ty_2 = 203; +pub const JS_ATOM_AsyncGeneratorFunction: _bindgen_ty_2 = 204; +pub const JS_ATOM_AsyncGenerator: _bindgen_ty_2 = 205; +pub const JS_ATOM_EvalError: _bindgen_ty_2 = 206; +pub const JS_ATOM_RangeError: _bindgen_ty_2 = 207; +pub const JS_ATOM_ReferenceError: _bindgen_ty_2 = 208; +pub const JS_ATOM_SyntaxError: _bindgen_ty_2 = 209; +pub const JS_ATOM_TypeError: _bindgen_ty_2 = 210; +pub const JS_ATOM_URIError: _bindgen_ty_2 = 211; +pub const JS_ATOM_InternalError: _bindgen_ty_2 = 212; +pub const JS_ATOM_Private_brand: _bindgen_ty_2 = 213; +pub const JS_ATOM_Symbol_toPrimitive: _bindgen_ty_2 = 214; +pub const JS_ATOM_Symbol_iterator: _bindgen_ty_2 = 215; +pub const JS_ATOM_Symbol_match: _bindgen_ty_2 = 216; +pub const JS_ATOM_Symbol_matchAll: _bindgen_ty_2 = 217; +pub const JS_ATOM_Symbol_replace: _bindgen_ty_2 = 218; +pub const JS_ATOM_Symbol_search: _bindgen_ty_2 = 219; +pub const JS_ATOM_Symbol_split: _bindgen_ty_2 = 220; +pub const JS_ATOM_Symbol_toStringTag: _bindgen_ty_2 = 221; +pub const JS_ATOM_Symbol_isConcatSpreadable: _bindgen_ty_2 = 222; +pub const JS_ATOM_Symbol_hasInstance: _bindgen_ty_2 = 223; +pub const JS_ATOM_Symbol_species: _bindgen_ty_2 = 224; +pub const JS_ATOM_Symbol_unscopables: _bindgen_ty_2 = 225; +pub const JS_ATOM_Symbol_asyncIterator: _bindgen_ty_2 = 226; +pub const JS_ATOM_Symbol_operatorSet: _bindgen_ty_2 = 227; +pub const JS_ATOM_END: _bindgen_ty_2 = 228; pub type _bindgen_ty_2 = ::std::os::raw::c_uint; diff --git a/sys/src/bindings/x86_64-pc-windows-gnu.rs b/sys/src/bindings/x86_64-pc-windows-gnu.rs index e87347cdf..88b62d837 100644 --- a/sys/src/bindings/x86_64-pc-windows-gnu.rs +++ b/sys/src/bindings/x86_64-pc-windows-gnu.rs @@ -31,8 +31,10 @@ pub const JS_EVAL_FLAG_STRICT: u32 = 8; pub const JS_EVAL_FLAG_STRIP: u32 = 16; pub const JS_EVAL_FLAG_COMPILE_ONLY: u32 = 32; pub const JS_EVAL_FLAG_BACKTRACE_BARRIER: u32 = 64; +pub const JS_EVAL_FLAG_ASYNC: u32 = 128; pub const JS_ATOM_NULL: u32 = 0; pub const JS_CALL_FLAG_CONSTRUCTOR: u32 = 1; +pub const JS_INVALID_CLASS_ID: u32 = 0; pub const JS_GPN_STRING_MASK: u32 = 1; pub const JS_GPN_SYMBOL_MASK: u32 = 2; pub const JS_GPN_PRIVATE_MASK: u32 = 4; @@ -458,6 +460,9 @@ extern "C" { extern "C" { pub fn JS_GetClassProto(ctx: *mut JSContext, class_id: JSClassID) -> JSValue; } +extern "C" { + pub fn JS_GetFunctionProto(ctx: *mut JSContext) -> JSValue; +} extern "C" { pub fn JS_NewContextRaw(rt: *mut JSRuntime) -> *mut JSContext; } @@ -1288,6 +1293,9 @@ fn bindgen_test_layout_JSClassDef() { extern "C" { pub fn JS_NewClassID(pclass_id: *mut JSClassID) -> JSClassID; } +extern "C" { + pub fn JS_GetClassID(v: JSValue) -> JSClassID; +} extern "C" { pub fn JS_NewClass( rt: *mut JSRuntime, @@ -1458,6 +1466,9 @@ extern "C" { extern "C" { pub fn JS_IsArray(ctx: *mut JSContext, val: JSValue) -> ::std::os::raw::c_int; } +extern "C" { + pub fn JS_NewDate(ctx: *mut JSContext, epoch_ms: f64) -> JSValue; +} extern "C" { pub fn JS_GetPropertyInternal( ctx: *mut JSContext, @@ -1480,9 +1491,10 @@ extern "C" { extern "C" { pub fn JS_SetPropertyInternal( ctx: *mut JSContext, - this_obj: JSValue, + obj: JSValue, prop: JSAtom, val: JSValue, + this_obj: JSValue, flags: ::std::os::raw::c_int, ) -> ::std::os::raw::c_int; } @@ -1621,9 +1633,6 @@ extern "C" { extern "C" { pub fn JS_GetGlobalObject(ctx: *mut JSContext) -> JSValue; } -extern "C" { - pub fn JS_GetFunctionProto(ctx: *mut JSContext) -> JSValue; -} extern "C" { pub fn JS_IsInstanceOf( ctx: *mut JSContext, @@ -1831,9 +1840,19 @@ extern "C" { sf: *const JSSharedArrayBufferFunctions, ); } +pub const JSPromiseStateEnum_JS_PROMISE_PENDING: JSPromiseStateEnum = 0; +pub const JSPromiseStateEnum_JS_PROMISE_FULFILLED: JSPromiseStateEnum = 1; +pub const JSPromiseStateEnum_JS_PROMISE_REJECTED: JSPromiseStateEnum = 2; +pub type JSPromiseStateEnum = ::std::os::raw::c_uint; extern "C" { pub fn JS_NewPromiseCapability(ctx: *mut JSContext, resolving_funcs: *mut JSValue) -> JSValue; } +extern "C" { + pub fn JS_PromiseState(ctx: *mut JSContext, promise: JSValue) -> JSPromiseStateEnum; +} +extern "C" { + pub fn JS_PromiseResult(ctx: *mut JSContext, promise: JSValue) -> JSValue; +} pub type JSHostPromiseRejectionTracker = ::std::option::Option< unsafe extern "C" fn( ctx: *mut JSContext, @@ -1904,7 +1923,7 @@ extern "C" { pub fn JS_GetModuleName(ctx: *mut JSContext, m: *mut JSModuleDef) -> JSAtom; } extern "C" { - pub fn JS_FreeUnevaluatedModules(ctx: *mut JSContext); + pub fn JS_GetModuleNamespace(ctx: *mut JSContext, m: *mut JSModuleDef) -> JSValue; } pub type JSJobFunc = ::std::option::Option< unsafe extern "C" fn( @@ -1969,11 +1988,11 @@ extern "C" { ) -> JSAtom; } extern "C" { - pub fn JS_RunModule( + pub fn JS_LoadModule( ctx: *mut JSContext, basename: *const ::std::os::raw::c_char, filename: *const ::std::os::raw::c_char, - ) -> *mut JSModuleDef; + ) -> JSValue; } pub const JSCFunctionEnum_JS_CFUNC_generic: JSCFunctionEnum = 0; pub const JSCFunctionEnum_JS_CFUNC_generic_magic: JSCFunctionEnum = 1; @@ -2642,36 +2661,6 @@ extern "C" { len: ::std::os::raw::c_int, ) -> ::std::os::raw::c_int; } -extern "C" { - pub fn JS_DynamicImportSync( - ctx: *mut JSContext, - specifier: *const ::std::os::raw::c_char, - ) -> JSValue; -} -extern "C" { - pub fn JS_GetModuleExport( - ctx: *mut JSContext, - m: *mut JSModuleDef, - export_name: *const ::std::os::raw::c_char, - ) -> JSValue; -} -extern "C" { - pub fn JS_GetModuleExportEntriesCount(m: *mut JSModuleDef) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn JS_GetModuleExportEntry( - ctx: *mut JSContext, - m: *mut JSModuleDef, - idx: ::std::os::raw::c_int, - ) -> JSValue; -} -extern "C" { - pub fn JS_GetModuleExportEntryName( - ctx: *mut JSContext, - m: *mut JSModuleDef, - idx: ::std::os::raw::c_int, - ) -> JSAtom; -} pub const __JS_ATOM_NULL: _bindgen_ty_2 = 0; pub const JS_ATOM_null: _bindgen_ty_2 = 1; pub const JS_ATOM_false: _bindgen_ty_2 = 2; @@ -2725,178 +2714,180 @@ pub const JS_ATOM_fileName: _bindgen_ty_2 = 49; pub const JS_ATOM_lineNumber: _bindgen_ty_2 = 50; pub const JS_ATOM_columnNumber: _bindgen_ty_2 = 51; pub const JS_ATOM_message: _bindgen_ty_2 = 52; -pub const JS_ATOM_errors: _bindgen_ty_2 = 53; -pub const JS_ATOM_stack: _bindgen_ty_2 = 54; -pub const JS_ATOM_name: _bindgen_ty_2 = 55; -pub const JS_ATOM_toString: _bindgen_ty_2 = 56; -pub const JS_ATOM_toLocaleString: _bindgen_ty_2 = 57; -pub const JS_ATOM_valueOf: _bindgen_ty_2 = 58; -pub const JS_ATOM_eval: _bindgen_ty_2 = 59; -pub const JS_ATOM_prototype: _bindgen_ty_2 = 60; -pub const JS_ATOM_constructor: _bindgen_ty_2 = 61; -pub const JS_ATOM_configurable: _bindgen_ty_2 = 62; -pub const JS_ATOM_writable: _bindgen_ty_2 = 63; -pub const JS_ATOM_enumerable: _bindgen_ty_2 = 64; -pub const JS_ATOM_value: _bindgen_ty_2 = 65; -pub const JS_ATOM_get: _bindgen_ty_2 = 66; -pub const JS_ATOM_set: _bindgen_ty_2 = 67; -pub const JS_ATOM_of: _bindgen_ty_2 = 68; -pub const JS_ATOM___proto__: _bindgen_ty_2 = 69; -pub const JS_ATOM_undefined: _bindgen_ty_2 = 70; -pub const JS_ATOM_number: _bindgen_ty_2 = 71; -pub const JS_ATOM_boolean: _bindgen_ty_2 = 72; -pub const JS_ATOM_string: _bindgen_ty_2 = 73; -pub const JS_ATOM_object: _bindgen_ty_2 = 74; -pub const JS_ATOM_symbol: _bindgen_ty_2 = 75; -pub const JS_ATOM_integer: _bindgen_ty_2 = 76; -pub const JS_ATOM_unknown: _bindgen_ty_2 = 77; -pub const JS_ATOM_arguments: _bindgen_ty_2 = 78; -pub const JS_ATOM_callee: _bindgen_ty_2 = 79; -pub const JS_ATOM_caller: _bindgen_ty_2 = 80; -pub const JS_ATOM__eval_: _bindgen_ty_2 = 81; -pub const JS_ATOM__ret_: _bindgen_ty_2 = 82; -pub const JS_ATOM__var_: _bindgen_ty_2 = 83; -pub const JS_ATOM__arg_var_: _bindgen_ty_2 = 84; -pub const JS_ATOM__with_: _bindgen_ty_2 = 85; -pub const JS_ATOM_lastIndex: _bindgen_ty_2 = 86; -pub const JS_ATOM_target: _bindgen_ty_2 = 87; -pub const JS_ATOM_index: _bindgen_ty_2 = 88; -pub const JS_ATOM_input: _bindgen_ty_2 = 89; -pub const JS_ATOM_defineProperties: _bindgen_ty_2 = 90; -pub const JS_ATOM_apply: _bindgen_ty_2 = 91; -pub const JS_ATOM_join: _bindgen_ty_2 = 92; -pub const JS_ATOM_concat: _bindgen_ty_2 = 93; -pub const JS_ATOM_split: _bindgen_ty_2 = 94; -pub const JS_ATOM_construct: _bindgen_ty_2 = 95; -pub const JS_ATOM_getPrototypeOf: _bindgen_ty_2 = 96; -pub const JS_ATOM_setPrototypeOf: _bindgen_ty_2 = 97; -pub const JS_ATOM_isExtensible: _bindgen_ty_2 = 98; -pub const JS_ATOM_preventExtensions: _bindgen_ty_2 = 99; -pub const JS_ATOM_has: _bindgen_ty_2 = 100; -pub const JS_ATOM_deleteProperty: _bindgen_ty_2 = 101; -pub const JS_ATOM_defineProperty: _bindgen_ty_2 = 102; -pub const JS_ATOM_getOwnPropertyDescriptor: _bindgen_ty_2 = 103; -pub const JS_ATOM_ownKeys: _bindgen_ty_2 = 104; -pub const JS_ATOM_add: _bindgen_ty_2 = 105; -pub const JS_ATOM_done: _bindgen_ty_2 = 106; -pub const JS_ATOM_next: _bindgen_ty_2 = 107; -pub const JS_ATOM_values: _bindgen_ty_2 = 108; -pub const JS_ATOM_source: _bindgen_ty_2 = 109; -pub const JS_ATOM_flags: _bindgen_ty_2 = 110; -pub const JS_ATOM_global: _bindgen_ty_2 = 111; -pub const JS_ATOM_unicode: _bindgen_ty_2 = 112; -pub const JS_ATOM_raw: _bindgen_ty_2 = 113; -pub const JS_ATOM_new_target: _bindgen_ty_2 = 114; -pub const JS_ATOM_this_active_func: _bindgen_ty_2 = 115; -pub const JS_ATOM_home_object: _bindgen_ty_2 = 116; -pub const JS_ATOM_computed_field: _bindgen_ty_2 = 117; -pub const JS_ATOM_static_computed_field: _bindgen_ty_2 = 118; -pub const JS_ATOM_class_fields_init: _bindgen_ty_2 = 119; -pub const JS_ATOM_brand: _bindgen_ty_2 = 120; -pub const JS_ATOM_hash_constructor: _bindgen_ty_2 = 121; -pub const JS_ATOM_as: _bindgen_ty_2 = 122; -pub const JS_ATOM_from: _bindgen_ty_2 = 123; -pub const JS_ATOM_meta: _bindgen_ty_2 = 124; -pub const JS_ATOM__default_: _bindgen_ty_2 = 125; -pub const JS_ATOM__star_: _bindgen_ty_2 = 126; -pub const JS_ATOM_Module: _bindgen_ty_2 = 127; -pub const JS_ATOM_then: _bindgen_ty_2 = 128; -pub const JS_ATOM_resolve: _bindgen_ty_2 = 129; -pub const JS_ATOM_reject: _bindgen_ty_2 = 130; -pub const JS_ATOM_promise: _bindgen_ty_2 = 131; -pub const JS_ATOM_proxy: _bindgen_ty_2 = 132; -pub const JS_ATOM_revoke: _bindgen_ty_2 = 133; -pub const JS_ATOM_async: _bindgen_ty_2 = 134; -pub const JS_ATOM_exec: _bindgen_ty_2 = 135; -pub const JS_ATOM_groups: _bindgen_ty_2 = 136; -pub const JS_ATOM_status: _bindgen_ty_2 = 137; -pub const JS_ATOM_reason: _bindgen_ty_2 = 138; -pub const JS_ATOM_globalThis: _bindgen_ty_2 = 139; -pub const JS_ATOM_bigint: _bindgen_ty_2 = 140; -pub const JS_ATOM_bigfloat: _bindgen_ty_2 = 141; -pub const JS_ATOM_bigdecimal: _bindgen_ty_2 = 142; -pub const JS_ATOM_roundingMode: _bindgen_ty_2 = 143; -pub const JS_ATOM_maximumSignificantDigits: _bindgen_ty_2 = 144; -pub const JS_ATOM_maximumFractionDigits: _bindgen_ty_2 = 145; -pub const JS_ATOM_not_equal: _bindgen_ty_2 = 146; -pub const JS_ATOM_timed_out: _bindgen_ty_2 = 147; -pub const JS_ATOM_ok: _bindgen_ty_2 = 148; -pub const JS_ATOM_toJSON: _bindgen_ty_2 = 149; -pub const JS_ATOM_Object: _bindgen_ty_2 = 150; -pub const JS_ATOM_Array: _bindgen_ty_2 = 151; -pub const JS_ATOM_Error: _bindgen_ty_2 = 152; -pub const JS_ATOM_Number: _bindgen_ty_2 = 153; -pub const JS_ATOM_String: _bindgen_ty_2 = 154; -pub const JS_ATOM_Boolean: _bindgen_ty_2 = 155; -pub const JS_ATOM_Symbol: _bindgen_ty_2 = 156; -pub const JS_ATOM_Arguments: _bindgen_ty_2 = 157; -pub const JS_ATOM_Math: _bindgen_ty_2 = 158; -pub const JS_ATOM_JSON: _bindgen_ty_2 = 159; -pub const JS_ATOM_Date: _bindgen_ty_2 = 160; -pub const JS_ATOM_Function: _bindgen_ty_2 = 161; -pub const JS_ATOM_GeneratorFunction: _bindgen_ty_2 = 162; -pub const JS_ATOM_ForInIterator: _bindgen_ty_2 = 163; -pub const JS_ATOM_RegExp: _bindgen_ty_2 = 164; -pub const JS_ATOM_ArrayBuffer: _bindgen_ty_2 = 165; -pub const JS_ATOM_SharedArrayBuffer: _bindgen_ty_2 = 166; -pub const JS_ATOM_Uint8ClampedArray: _bindgen_ty_2 = 167; -pub const JS_ATOM_Int8Array: _bindgen_ty_2 = 168; -pub const JS_ATOM_Uint8Array: _bindgen_ty_2 = 169; -pub const JS_ATOM_Int16Array: _bindgen_ty_2 = 170; -pub const JS_ATOM_Uint16Array: _bindgen_ty_2 = 171; -pub const JS_ATOM_Int32Array: _bindgen_ty_2 = 172; -pub const JS_ATOM_Uint32Array: _bindgen_ty_2 = 173; -pub const JS_ATOM_BigInt64Array: _bindgen_ty_2 = 174; -pub const JS_ATOM_BigUint64Array: _bindgen_ty_2 = 175; -pub const JS_ATOM_Float32Array: _bindgen_ty_2 = 176; -pub const JS_ATOM_Float64Array: _bindgen_ty_2 = 177; -pub const JS_ATOM_DataView: _bindgen_ty_2 = 178; -pub const JS_ATOM_BigInt: _bindgen_ty_2 = 179; -pub const JS_ATOM_BigFloat: _bindgen_ty_2 = 180; -pub const JS_ATOM_BigFloatEnv: _bindgen_ty_2 = 181; -pub const JS_ATOM_BigDecimal: _bindgen_ty_2 = 182; -pub const JS_ATOM_OperatorSet: _bindgen_ty_2 = 183; -pub const JS_ATOM_Operators: _bindgen_ty_2 = 184; -pub const JS_ATOM_Map: _bindgen_ty_2 = 185; -pub const JS_ATOM_Set: _bindgen_ty_2 = 186; -pub const JS_ATOM_WeakMap: _bindgen_ty_2 = 187; -pub const JS_ATOM_WeakSet: _bindgen_ty_2 = 188; -pub const JS_ATOM_Map_Iterator: _bindgen_ty_2 = 189; -pub const JS_ATOM_Set_Iterator: _bindgen_ty_2 = 190; -pub const JS_ATOM_Array_Iterator: _bindgen_ty_2 = 191; -pub const JS_ATOM_String_Iterator: _bindgen_ty_2 = 192; -pub const JS_ATOM_RegExp_String_Iterator: _bindgen_ty_2 = 193; -pub const JS_ATOM_Generator: _bindgen_ty_2 = 194; -pub const JS_ATOM_Proxy: _bindgen_ty_2 = 195; -pub const JS_ATOM_Promise: _bindgen_ty_2 = 196; -pub const JS_ATOM_PromiseResolveFunction: _bindgen_ty_2 = 197; -pub const JS_ATOM_PromiseRejectFunction: _bindgen_ty_2 = 198; -pub const JS_ATOM_AsyncFunction: _bindgen_ty_2 = 199; -pub const JS_ATOM_AsyncFunctionResolve: _bindgen_ty_2 = 200; -pub const JS_ATOM_AsyncFunctionReject: _bindgen_ty_2 = 201; -pub const JS_ATOM_AsyncGeneratorFunction: _bindgen_ty_2 = 202; -pub const JS_ATOM_AsyncGenerator: _bindgen_ty_2 = 203; -pub const JS_ATOM_EvalError: _bindgen_ty_2 = 204; -pub const JS_ATOM_RangeError: _bindgen_ty_2 = 205; -pub const JS_ATOM_ReferenceError: _bindgen_ty_2 = 206; -pub const JS_ATOM_SyntaxError: _bindgen_ty_2 = 207; -pub const JS_ATOM_TypeError: _bindgen_ty_2 = 208; -pub const JS_ATOM_URIError: _bindgen_ty_2 = 209; -pub const JS_ATOM_InternalError: _bindgen_ty_2 = 210; -pub const JS_ATOM_Private_brand: _bindgen_ty_2 = 211; -pub const JS_ATOM_Symbol_toPrimitive: _bindgen_ty_2 = 212; -pub const JS_ATOM_Symbol_iterator: _bindgen_ty_2 = 213; -pub const JS_ATOM_Symbol_match: _bindgen_ty_2 = 214; -pub const JS_ATOM_Symbol_matchAll: _bindgen_ty_2 = 215; -pub const JS_ATOM_Symbol_replace: _bindgen_ty_2 = 216; -pub const JS_ATOM_Symbol_search: _bindgen_ty_2 = 217; -pub const JS_ATOM_Symbol_split: _bindgen_ty_2 = 218; -pub const JS_ATOM_Symbol_toStringTag: _bindgen_ty_2 = 219; -pub const JS_ATOM_Symbol_isConcatSpreadable: _bindgen_ty_2 = 220; -pub const JS_ATOM_Symbol_hasInstance: _bindgen_ty_2 = 221; -pub const JS_ATOM_Symbol_species: _bindgen_ty_2 = 222; -pub const JS_ATOM_Symbol_unscopables: _bindgen_ty_2 = 223; -pub const JS_ATOM_Symbol_asyncIterator: _bindgen_ty_2 = 224; -pub const JS_ATOM_Symbol_operatorSet: _bindgen_ty_2 = 225; -pub const JS_ATOM_END: _bindgen_ty_2 = 226; +pub const JS_ATOM_cause: _bindgen_ty_2 = 53; +pub const JS_ATOM_errors: _bindgen_ty_2 = 54; +pub const JS_ATOM_stack: _bindgen_ty_2 = 55; +pub const JS_ATOM_name: _bindgen_ty_2 = 56; +pub const JS_ATOM_toString: _bindgen_ty_2 = 57; +pub const JS_ATOM_toLocaleString: _bindgen_ty_2 = 58; +pub const JS_ATOM_valueOf: _bindgen_ty_2 = 59; +pub const JS_ATOM_eval: _bindgen_ty_2 = 60; +pub const JS_ATOM_prototype: _bindgen_ty_2 = 61; +pub const JS_ATOM_constructor: _bindgen_ty_2 = 62; +pub const JS_ATOM_configurable: _bindgen_ty_2 = 63; +pub const JS_ATOM_writable: _bindgen_ty_2 = 64; +pub const JS_ATOM_enumerable: _bindgen_ty_2 = 65; +pub const JS_ATOM_value: _bindgen_ty_2 = 66; +pub const JS_ATOM_get: _bindgen_ty_2 = 67; +pub const JS_ATOM_set: _bindgen_ty_2 = 68; +pub const JS_ATOM_of: _bindgen_ty_2 = 69; +pub const JS_ATOM___proto__: _bindgen_ty_2 = 70; +pub const JS_ATOM_undefined: _bindgen_ty_2 = 71; +pub const JS_ATOM_number: _bindgen_ty_2 = 72; +pub const JS_ATOM_boolean: _bindgen_ty_2 = 73; +pub const JS_ATOM_string: _bindgen_ty_2 = 74; +pub const JS_ATOM_object: _bindgen_ty_2 = 75; +pub const JS_ATOM_symbol: _bindgen_ty_2 = 76; +pub const JS_ATOM_integer: _bindgen_ty_2 = 77; +pub const JS_ATOM_unknown: _bindgen_ty_2 = 78; +pub const JS_ATOM_arguments: _bindgen_ty_2 = 79; +pub const JS_ATOM_callee: _bindgen_ty_2 = 80; +pub const JS_ATOM_caller: _bindgen_ty_2 = 81; +pub const JS_ATOM__eval_: _bindgen_ty_2 = 82; +pub const JS_ATOM__ret_: _bindgen_ty_2 = 83; +pub const JS_ATOM__var_: _bindgen_ty_2 = 84; +pub const JS_ATOM__arg_var_: _bindgen_ty_2 = 85; +pub const JS_ATOM__with_: _bindgen_ty_2 = 86; +pub const JS_ATOM_lastIndex: _bindgen_ty_2 = 87; +pub const JS_ATOM_target: _bindgen_ty_2 = 88; +pub const JS_ATOM_index: _bindgen_ty_2 = 89; +pub const JS_ATOM_input: _bindgen_ty_2 = 90; +pub const JS_ATOM_defineProperties: _bindgen_ty_2 = 91; +pub const JS_ATOM_apply: _bindgen_ty_2 = 92; +pub const JS_ATOM_join: _bindgen_ty_2 = 93; +pub const JS_ATOM_concat: _bindgen_ty_2 = 94; +pub const JS_ATOM_split: _bindgen_ty_2 = 95; +pub const JS_ATOM_construct: _bindgen_ty_2 = 96; +pub const JS_ATOM_getPrototypeOf: _bindgen_ty_2 = 97; +pub const JS_ATOM_setPrototypeOf: _bindgen_ty_2 = 98; +pub const JS_ATOM_isExtensible: _bindgen_ty_2 = 99; +pub const JS_ATOM_preventExtensions: _bindgen_ty_2 = 100; +pub const JS_ATOM_has: _bindgen_ty_2 = 101; +pub const JS_ATOM_deleteProperty: _bindgen_ty_2 = 102; +pub const JS_ATOM_defineProperty: _bindgen_ty_2 = 103; +pub const JS_ATOM_getOwnPropertyDescriptor: _bindgen_ty_2 = 104; +pub const JS_ATOM_ownKeys: _bindgen_ty_2 = 105; +pub const JS_ATOM_add: _bindgen_ty_2 = 106; +pub const JS_ATOM_done: _bindgen_ty_2 = 107; +pub const JS_ATOM_next: _bindgen_ty_2 = 108; +pub const JS_ATOM_values: _bindgen_ty_2 = 109; +pub const JS_ATOM_source: _bindgen_ty_2 = 110; +pub const JS_ATOM_flags: _bindgen_ty_2 = 111; +pub const JS_ATOM_global: _bindgen_ty_2 = 112; +pub const JS_ATOM_unicode: _bindgen_ty_2 = 113; +pub const JS_ATOM_raw: _bindgen_ty_2 = 114; +pub const JS_ATOM_new_target: _bindgen_ty_2 = 115; +pub const JS_ATOM_this_active_func: _bindgen_ty_2 = 116; +pub const JS_ATOM_home_object: _bindgen_ty_2 = 117; +pub const JS_ATOM_computed_field: _bindgen_ty_2 = 118; +pub const JS_ATOM_static_computed_field: _bindgen_ty_2 = 119; +pub const JS_ATOM_class_fields_init: _bindgen_ty_2 = 120; +pub const JS_ATOM_brand: _bindgen_ty_2 = 121; +pub const JS_ATOM_hash_constructor: _bindgen_ty_2 = 122; +pub const JS_ATOM_as: _bindgen_ty_2 = 123; +pub const JS_ATOM_from: _bindgen_ty_2 = 124; +pub const JS_ATOM_meta: _bindgen_ty_2 = 125; +pub const JS_ATOM__default_: _bindgen_ty_2 = 126; +pub const JS_ATOM__star_: _bindgen_ty_2 = 127; +pub const JS_ATOM_Module: _bindgen_ty_2 = 128; +pub const JS_ATOM_then: _bindgen_ty_2 = 129; +pub const JS_ATOM_resolve: _bindgen_ty_2 = 130; +pub const JS_ATOM_reject: _bindgen_ty_2 = 131; +pub const JS_ATOM_promise: _bindgen_ty_2 = 132; +pub const JS_ATOM_proxy: _bindgen_ty_2 = 133; +pub const JS_ATOM_revoke: _bindgen_ty_2 = 134; +pub const JS_ATOM_async: _bindgen_ty_2 = 135; +pub const JS_ATOM_exec: _bindgen_ty_2 = 136; +pub const JS_ATOM_groups: _bindgen_ty_2 = 137; +pub const JS_ATOM_indices: _bindgen_ty_2 = 138; +pub const JS_ATOM_status: _bindgen_ty_2 = 139; +pub const JS_ATOM_reason: _bindgen_ty_2 = 140; +pub const JS_ATOM_globalThis: _bindgen_ty_2 = 141; +pub const JS_ATOM_bigint: _bindgen_ty_2 = 142; +pub const JS_ATOM_bigfloat: _bindgen_ty_2 = 143; +pub const JS_ATOM_bigdecimal: _bindgen_ty_2 = 144; +pub const JS_ATOM_roundingMode: _bindgen_ty_2 = 145; +pub const JS_ATOM_maximumSignificantDigits: _bindgen_ty_2 = 146; +pub const JS_ATOM_maximumFractionDigits: _bindgen_ty_2 = 147; +pub const JS_ATOM_not_equal: _bindgen_ty_2 = 148; +pub const JS_ATOM_timed_out: _bindgen_ty_2 = 149; +pub const JS_ATOM_ok: _bindgen_ty_2 = 150; +pub const JS_ATOM_toJSON: _bindgen_ty_2 = 151; +pub const JS_ATOM_Object: _bindgen_ty_2 = 152; +pub const JS_ATOM_Array: _bindgen_ty_2 = 153; +pub const JS_ATOM_Error: _bindgen_ty_2 = 154; +pub const JS_ATOM_Number: _bindgen_ty_2 = 155; +pub const JS_ATOM_String: _bindgen_ty_2 = 156; +pub const JS_ATOM_Boolean: _bindgen_ty_2 = 157; +pub const JS_ATOM_Symbol: _bindgen_ty_2 = 158; +pub const JS_ATOM_Arguments: _bindgen_ty_2 = 159; +pub const JS_ATOM_Math: _bindgen_ty_2 = 160; +pub const JS_ATOM_JSON: _bindgen_ty_2 = 161; +pub const JS_ATOM_Date: _bindgen_ty_2 = 162; +pub const JS_ATOM_Function: _bindgen_ty_2 = 163; +pub const JS_ATOM_GeneratorFunction: _bindgen_ty_2 = 164; +pub const JS_ATOM_ForInIterator: _bindgen_ty_2 = 165; +pub const JS_ATOM_RegExp: _bindgen_ty_2 = 166; +pub const JS_ATOM_ArrayBuffer: _bindgen_ty_2 = 167; +pub const JS_ATOM_SharedArrayBuffer: _bindgen_ty_2 = 168; +pub const JS_ATOM_Uint8ClampedArray: _bindgen_ty_2 = 169; +pub const JS_ATOM_Int8Array: _bindgen_ty_2 = 170; +pub const JS_ATOM_Uint8Array: _bindgen_ty_2 = 171; +pub const JS_ATOM_Int16Array: _bindgen_ty_2 = 172; +pub const JS_ATOM_Uint16Array: _bindgen_ty_2 = 173; +pub const JS_ATOM_Int32Array: _bindgen_ty_2 = 174; +pub const JS_ATOM_Uint32Array: _bindgen_ty_2 = 175; +pub const JS_ATOM_BigInt64Array: _bindgen_ty_2 = 176; +pub const JS_ATOM_BigUint64Array: _bindgen_ty_2 = 177; +pub const JS_ATOM_Float32Array: _bindgen_ty_2 = 178; +pub const JS_ATOM_Float64Array: _bindgen_ty_2 = 179; +pub const JS_ATOM_DataView: _bindgen_ty_2 = 180; +pub const JS_ATOM_BigInt: _bindgen_ty_2 = 181; +pub const JS_ATOM_BigFloat: _bindgen_ty_2 = 182; +pub const JS_ATOM_BigFloatEnv: _bindgen_ty_2 = 183; +pub const JS_ATOM_BigDecimal: _bindgen_ty_2 = 184; +pub const JS_ATOM_OperatorSet: _bindgen_ty_2 = 185; +pub const JS_ATOM_Operators: _bindgen_ty_2 = 186; +pub const JS_ATOM_Map: _bindgen_ty_2 = 187; +pub const JS_ATOM_Set: _bindgen_ty_2 = 188; +pub const JS_ATOM_WeakMap: _bindgen_ty_2 = 189; +pub const JS_ATOM_WeakSet: _bindgen_ty_2 = 190; +pub const JS_ATOM_Map_Iterator: _bindgen_ty_2 = 191; +pub const JS_ATOM_Set_Iterator: _bindgen_ty_2 = 192; +pub const JS_ATOM_Array_Iterator: _bindgen_ty_2 = 193; +pub const JS_ATOM_String_Iterator: _bindgen_ty_2 = 194; +pub const JS_ATOM_RegExp_String_Iterator: _bindgen_ty_2 = 195; +pub const JS_ATOM_Generator: _bindgen_ty_2 = 196; +pub const JS_ATOM_Proxy: _bindgen_ty_2 = 197; +pub const JS_ATOM_Promise: _bindgen_ty_2 = 198; +pub const JS_ATOM_PromiseResolveFunction: _bindgen_ty_2 = 199; +pub const JS_ATOM_PromiseRejectFunction: _bindgen_ty_2 = 200; +pub const JS_ATOM_AsyncFunction: _bindgen_ty_2 = 201; +pub const JS_ATOM_AsyncFunctionResolve: _bindgen_ty_2 = 202; +pub const JS_ATOM_AsyncFunctionReject: _bindgen_ty_2 = 203; +pub const JS_ATOM_AsyncGeneratorFunction: _bindgen_ty_2 = 204; +pub const JS_ATOM_AsyncGenerator: _bindgen_ty_2 = 205; +pub const JS_ATOM_EvalError: _bindgen_ty_2 = 206; +pub const JS_ATOM_RangeError: _bindgen_ty_2 = 207; +pub const JS_ATOM_ReferenceError: _bindgen_ty_2 = 208; +pub const JS_ATOM_SyntaxError: _bindgen_ty_2 = 209; +pub const JS_ATOM_TypeError: _bindgen_ty_2 = 210; +pub const JS_ATOM_URIError: _bindgen_ty_2 = 211; +pub const JS_ATOM_InternalError: _bindgen_ty_2 = 212; +pub const JS_ATOM_Private_brand: _bindgen_ty_2 = 213; +pub const JS_ATOM_Symbol_toPrimitive: _bindgen_ty_2 = 214; +pub const JS_ATOM_Symbol_iterator: _bindgen_ty_2 = 215; +pub const JS_ATOM_Symbol_match: _bindgen_ty_2 = 216; +pub const JS_ATOM_Symbol_matchAll: _bindgen_ty_2 = 217; +pub const JS_ATOM_Symbol_replace: _bindgen_ty_2 = 218; +pub const JS_ATOM_Symbol_search: _bindgen_ty_2 = 219; +pub const JS_ATOM_Symbol_split: _bindgen_ty_2 = 220; +pub const JS_ATOM_Symbol_toStringTag: _bindgen_ty_2 = 221; +pub const JS_ATOM_Symbol_isConcatSpreadable: _bindgen_ty_2 = 222; +pub const JS_ATOM_Symbol_hasInstance: _bindgen_ty_2 = 223; +pub const JS_ATOM_Symbol_species: _bindgen_ty_2 = 224; +pub const JS_ATOM_Symbol_unscopables: _bindgen_ty_2 = 225; +pub const JS_ATOM_Symbol_asyncIterator: _bindgen_ty_2 = 226; +pub const JS_ATOM_Symbol_operatorSet: _bindgen_ty_2 = 227; +pub const JS_ATOM_END: _bindgen_ty_2 = 228; pub type _bindgen_ty_2 = ::std::os::raw::c_uint; diff --git a/sys/src/bindings/x86_64-pc-windows-msvc.rs b/sys/src/bindings/x86_64-pc-windows-msvc.rs index 9a388bdb9..b13c5a6f6 100644 --- a/sys/src/bindings/x86_64-pc-windows-msvc.rs +++ b/sys/src/bindings/x86_64-pc-windows-msvc.rs @@ -31,8 +31,10 @@ pub const JS_EVAL_FLAG_STRICT: u32 = 8; pub const JS_EVAL_FLAG_STRIP: u32 = 16; pub const JS_EVAL_FLAG_COMPILE_ONLY: u32 = 32; pub const JS_EVAL_FLAG_BACKTRACE_BARRIER: u32 = 64; +pub const JS_EVAL_FLAG_ASYNC: u32 = 128; pub const JS_ATOM_NULL: u32 = 0; pub const JS_CALL_FLAG_CONSTRUCTOR: u32 = 1; +pub const JS_INVALID_CLASS_ID: u32 = 0; pub const JS_GPN_STRING_MASK: u32 = 1; pub const JS_GPN_SYMBOL_MASK: u32 = 2; pub const JS_GPN_PRIVATE_MASK: u32 = 4; @@ -458,6 +460,9 @@ extern "C" { extern "C" { pub fn JS_GetClassProto(ctx: *mut JSContext, class_id: JSClassID) -> JSValue; } +extern "C" { + pub fn JS_GetFunctionProto(ctx: *mut JSContext) -> JSValue; +} extern "C" { pub fn JS_NewContextRaw(rt: *mut JSRuntime) -> *mut JSContext; } @@ -1288,6 +1293,9 @@ fn bindgen_test_layout_JSClassDef() { extern "C" { pub fn JS_NewClassID(pclass_id: *mut JSClassID) -> JSClassID; } +extern "C" { + pub fn JS_GetClassID(v: JSValue) -> JSClassID; +} extern "C" { pub fn JS_NewClass( rt: *mut JSRuntime, @@ -1458,6 +1466,9 @@ extern "C" { extern "C" { pub fn JS_IsArray(ctx: *mut JSContext, val: JSValue) -> ::std::os::raw::c_int; } +extern "C" { + pub fn JS_NewDate(ctx: *mut JSContext, epoch_ms: f64) -> JSValue; +} extern "C" { pub fn JS_GetPropertyInternal( ctx: *mut JSContext, @@ -1480,9 +1491,10 @@ extern "C" { extern "C" { pub fn JS_SetPropertyInternal( ctx: *mut JSContext, - this_obj: JSValue, + obj: JSValue, prop: JSAtom, val: JSValue, + this_obj: JSValue, flags: ::std::os::raw::c_int, ) -> ::std::os::raw::c_int; } @@ -1621,9 +1633,6 @@ extern "C" { extern "C" { pub fn JS_GetGlobalObject(ctx: *mut JSContext) -> JSValue; } -extern "C" { - pub fn JS_GetFunctionProto(ctx: *mut JSContext) -> JSValue; -} extern "C" { pub fn JS_IsInstanceOf( ctx: *mut JSContext, @@ -1831,9 +1840,19 @@ extern "C" { sf: *const JSSharedArrayBufferFunctions, ); } +pub const JSPromiseStateEnum_JS_PROMISE_PENDING: JSPromiseStateEnum = 0; +pub const JSPromiseStateEnum_JS_PROMISE_FULFILLED: JSPromiseStateEnum = 1; +pub const JSPromiseStateEnum_JS_PROMISE_REJECTED: JSPromiseStateEnum = 2; +pub type JSPromiseStateEnum = ::std::os::raw::c_int; extern "C" { pub fn JS_NewPromiseCapability(ctx: *mut JSContext, resolving_funcs: *mut JSValue) -> JSValue; } +extern "C" { + pub fn JS_PromiseState(ctx: *mut JSContext, promise: JSValue) -> JSPromiseStateEnum; +} +extern "C" { + pub fn JS_PromiseResult(ctx: *mut JSContext, promise: JSValue) -> JSValue; +} pub type JSHostPromiseRejectionTracker = ::std::option::Option< unsafe extern "C" fn( ctx: *mut JSContext, @@ -1904,7 +1923,7 @@ extern "C" { pub fn JS_GetModuleName(ctx: *mut JSContext, m: *mut JSModuleDef) -> JSAtom; } extern "C" { - pub fn JS_FreeUnevaluatedModules(ctx: *mut JSContext); + pub fn JS_GetModuleNamespace(ctx: *mut JSContext, m: *mut JSModuleDef) -> JSValue; } pub type JSJobFunc = ::std::option::Option< unsafe extern "C" fn( @@ -1969,11 +1988,11 @@ extern "C" { ) -> JSAtom; } extern "C" { - pub fn JS_RunModule( + pub fn JS_LoadModule( ctx: *mut JSContext, basename: *const ::std::os::raw::c_char, filename: *const ::std::os::raw::c_char, - ) -> *mut JSModuleDef; + ) -> JSValue; } pub const JSCFunctionEnum_JS_CFUNC_generic: JSCFunctionEnum = 0; pub const JSCFunctionEnum_JS_CFUNC_generic_magic: JSCFunctionEnum = 1; @@ -2642,36 +2661,6 @@ extern "C" { len: ::std::os::raw::c_int, ) -> ::std::os::raw::c_int; } -extern "C" { - pub fn JS_DynamicImportSync( - ctx: *mut JSContext, - specifier: *const ::std::os::raw::c_char, - ) -> JSValue; -} -extern "C" { - pub fn JS_GetModuleExport( - ctx: *mut JSContext, - m: *mut JSModuleDef, - export_name: *const ::std::os::raw::c_char, - ) -> JSValue; -} -extern "C" { - pub fn JS_GetModuleExportEntriesCount(m: *mut JSModuleDef) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn JS_GetModuleExportEntry( - ctx: *mut JSContext, - m: *mut JSModuleDef, - idx: ::std::os::raw::c_int, - ) -> JSValue; -} -extern "C" { - pub fn JS_GetModuleExportEntryName( - ctx: *mut JSContext, - m: *mut JSModuleDef, - idx: ::std::os::raw::c_int, - ) -> JSAtom; -} pub const __JS_ATOM_NULL: _bindgen_ty_2 = 0; pub const JS_ATOM_null: _bindgen_ty_2 = 1; pub const JS_ATOM_false: _bindgen_ty_2 = 2; @@ -2725,175 +2714,180 @@ pub const JS_ATOM_fileName: _bindgen_ty_2 = 49; pub const JS_ATOM_lineNumber: _bindgen_ty_2 = 50; pub const JS_ATOM_columnNumber: _bindgen_ty_2 = 51; pub const JS_ATOM_message: _bindgen_ty_2 = 52; -pub const JS_ATOM_errors: _bindgen_ty_2 = 53; -pub const JS_ATOM_stack: _bindgen_ty_2 = 54; -pub const JS_ATOM_name: _bindgen_ty_2 = 55; -pub const JS_ATOM_toString: _bindgen_ty_2 = 56; -pub const JS_ATOM_toLocaleString: _bindgen_ty_2 = 57; -pub const JS_ATOM_valueOf: _bindgen_ty_2 = 58; -pub const JS_ATOM_eval: _bindgen_ty_2 = 59; -pub const JS_ATOM_prototype: _bindgen_ty_2 = 60; -pub const JS_ATOM_constructor: _bindgen_ty_2 = 61; -pub const JS_ATOM_configurable: _bindgen_ty_2 = 62; -pub const JS_ATOM_writable: _bindgen_ty_2 = 63; -pub const JS_ATOM_enumerable: _bindgen_ty_2 = 64; -pub const JS_ATOM_value: _bindgen_ty_2 = 65; -pub const JS_ATOM_get: _bindgen_ty_2 = 66; -pub const JS_ATOM_set: _bindgen_ty_2 = 67; -pub const JS_ATOM_of: _bindgen_ty_2 = 68; -pub const JS_ATOM___proto__: _bindgen_ty_2 = 69; -pub const JS_ATOM_undefined: _bindgen_ty_2 = 70; -pub const JS_ATOM_number: _bindgen_ty_2 = 71; -pub const JS_ATOM_boolean: _bindgen_ty_2 = 72; -pub const JS_ATOM_string: _bindgen_ty_2 = 73; -pub const JS_ATOM_object: _bindgen_ty_2 = 74; -pub const JS_ATOM_symbol: _bindgen_ty_2 = 75; -pub const JS_ATOM_integer: _bindgen_ty_2 = 76; -pub const JS_ATOM_unknown: _bindgen_ty_2 = 77; -pub const JS_ATOM_arguments: _bindgen_ty_2 = 78; -pub const JS_ATOM_callee: _bindgen_ty_2 = 79; -pub const JS_ATOM_caller: _bindgen_ty_2 = 80; -pub const JS_ATOM__eval_: _bindgen_ty_2 = 81; -pub const JS_ATOM__ret_: _bindgen_ty_2 = 82; -pub const JS_ATOM__var_: _bindgen_ty_2 = 83; -pub const JS_ATOM__arg_var_: _bindgen_ty_2 = 84; -pub const JS_ATOM__with_: _bindgen_ty_2 = 85; -pub const JS_ATOM_lastIndex: _bindgen_ty_2 = 86; -pub const JS_ATOM_target: _bindgen_ty_2 = 87; -pub const JS_ATOM_index: _bindgen_ty_2 = 88; -pub const JS_ATOM_input: _bindgen_ty_2 = 89; -pub const JS_ATOM_defineProperties: _bindgen_ty_2 = 90; -pub const JS_ATOM_apply: _bindgen_ty_2 = 91; -pub const JS_ATOM_join: _bindgen_ty_2 = 92; -pub const JS_ATOM_concat: _bindgen_ty_2 = 93; -pub const JS_ATOM_split: _bindgen_ty_2 = 94; -pub const JS_ATOM_construct: _bindgen_ty_2 = 95; -pub const JS_ATOM_getPrototypeOf: _bindgen_ty_2 = 96; -pub const JS_ATOM_setPrototypeOf: _bindgen_ty_2 = 97; -pub const JS_ATOM_isExtensible: _bindgen_ty_2 = 98; -pub const JS_ATOM_preventExtensions: _bindgen_ty_2 = 99; -pub const JS_ATOM_has: _bindgen_ty_2 = 100; -pub const JS_ATOM_deleteProperty: _bindgen_ty_2 = 101; -pub const JS_ATOM_defineProperty: _bindgen_ty_2 = 102; -pub const JS_ATOM_getOwnPropertyDescriptor: _bindgen_ty_2 = 103; -pub const JS_ATOM_ownKeys: _bindgen_ty_2 = 104; -pub const JS_ATOM_add: _bindgen_ty_2 = 105; -pub const JS_ATOM_done: _bindgen_ty_2 = 106; -pub const JS_ATOM_next: _bindgen_ty_2 = 107; -pub const JS_ATOM_values: _bindgen_ty_2 = 108; -pub const JS_ATOM_source: _bindgen_ty_2 = 109; -pub const JS_ATOM_flags: _bindgen_ty_2 = 110; -pub const JS_ATOM_global: _bindgen_ty_2 = 111; -pub const JS_ATOM_unicode: _bindgen_ty_2 = 112; -pub const JS_ATOM_raw: _bindgen_ty_2 = 113; -pub const JS_ATOM_new_target: _bindgen_ty_2 = 114; -pub const JS_ATOM_this_active_func: _bindgen_ty_2 = 115; -pub const JS_ATOM_home_object: _bindgen_ty_2 = 116; -pub const JS_ATOM_computed_field: _bindgen_ty_2 = 117; -pub const JS_ATOM_static_computed_field: _bindgen_ty_2 = 118; -pub const JS_ATOM_class_fields_init: _bindgen_ty_2 = 119; -pub const JS_ATOM_brand: _bindgen_ty_2 = 120; -pub const JS_ATOM_hash_constructor: _bindgen_ty_2 = 121; -pub const JS_ATOM_as: _bindgen_ty_2 = 122; -pub const JS_ATOM_from: _bindgen_ty_2 = 123; -pub const JS_ATOM_meta: _bindgen_ty_2 = 124; -pub const JS_ATOM__default_: _bindgen_ty_2 = 125; -pub const JS_ATOM__star_: _bindgen_ty_2 = 126; -pub const JS_ATOM_Module: _bindgen_ty_2 = 127; -pub const JS_ATOM_then: _bindgen_ty_2 = 128; -pub const JS_ATOM_resolve: _bindgen_ty_2 = 129; -pub const JS_ATOM_reject: _bindgen_ty_2 = 130; -pub const JS_ATOM_promise: _bindgen_ty_2 = 131; -pub const JS_ATOM_proxy: _bindgen_ty_2 = 132; -pub const JS_ATOM_revoke: _bindgen_ty_2 = 133; -pub const JS_ATOM_async: _bindgen_ty_2 = 134; -pub const JS_ATOM_exec: _bindgen_ty_2 = 135; -pub const JS_ATOM_groups: _bindgen_ty_2 = 136; -pub const JS_ATOM_status: _bindgen_ty_2 = 137; -pub const JS_ATOM_reason: _bindgen_ty_2 = 138; -pub const JS_ATOM_globalThis: _bindgen_ty_2 = 139; -pub const JS_ATOM_bigint: _bindgen_ty_2 = 140; -pub const JS_ATOM_bigfloat: _bindgen_ty_2 = 141; -pub const JS_ATOM_bigdecimal: _bindgen_ty_2 = 142; -pub const JS_ATOM_roundingMode: _bindgen_ty_2 = 143; -pub const JS_ATOM_maximumSignificantDigits: _bindgen_ty_2 = 144; -pub const JS_ATOM_maximumFractionDigits: _bindgen_ty_2 = 145; -pub const JS_ATOM_toJSON: _bindgen_ty_2 = 146; -pub const JS_ATOM_Object: _bindgen_ty_2 = 147; -pub const JS_ATOM_Array: _bindgen_ty_2 = 148; -pub const JS_ATOM_Error: _bindgen_ty_2 = 149; -pub const JS_ATOM_Number: _bindgen_ty_2 = 150; -pub const JS_ATOM_String: _bindgen_ty_2 = 151; -pub const JS_ATOM_Boolean: _bindgen_ty_2 = 152; -pub const JS_ATOM_Symbol: _bindgen_ty_2 = 153; -pub const JS_ATOM_Arguments: _bindgen_ty_2 = 154; -pub const JS_ATOM_Math: _bindgen_ty_2 = 155; -pub const JS_ATOM_JSON: _bindgen_ty_2 = 156; -pub const JS_ATOM_Date: _bindgen_ty_2 = 157; -pub const JS_ATOM_Function: _bindgen_ty_2 = 158; -pub const JS_ATOM_GeneratorFunction: _bindgen_ty_2 = 159; -pub const JS_ATOM_ForInIterator: _bindgen_ty_2 = 160; -pub const JS_ATOM_RegExp: _bindgen_ty_2 = 161; -pub const JS_ATOM_ArrayBuffer: _bindgen_ty_2 = 162; -pub const JS_ATOM_SharedArrayBuffer: _bindgen_ty_2 = 163; -pub const JS_ATOM_Uint8ClampedArray: _bindgen_ty_2 = 164; -pub const JS_ATOM_Int8Array: _bindgen_ty_2 = 165; -pub const JS_ATOM_Uint8Array: _bindgen_ty_2 = 166; -pub const JS_ATOM_Int16Array: _bindgen_ty_2 = 167; -pub const JS_ATOM_Uint16Array: _bindgen_ty_2 = 168; -pub const JS_ATOM_Int32Array: _bindgen_ty_2 = 169; -pub const JS_ATOM_Uint32Array: _bindgen_ty_2 = 170; -pub const JS_ATOM_BigInt64Array: _bindgen_ty_2 = 171; -pub const JS_ATOM_BigUint64Array: _bindgen_ty_2 = 172; -pub const JS_ATOM_Float32Array: _bindgen_ty_2 = 173; -pub const JS_ATOM_Float64Array: _bindgen_ty_2 = 174; -pub const JS_ATOM_DataView: _bindgen_ty_2 = 175; -pub const JS_ATOM_BigInt: _bindgen_ty_2 = 176; -pub const JS_ATOM_BigFloat: _bindgen_ty_2 = 177; -pub const JS_ATOM_BigFloatEnv: _bindgen_ty_2 = 178; -pub const JS_ATOM_BigDecimal: _bindgen_ty_2 = 179; -pub const JS_ATOM_OperatorSet: _bindgen_ty_2 = 180; -pub const JS_ATOM_Operators: _bindgen_ty_2 = 181; -pub const JS_ATOM_Map: _bindgen_ty_2 = 182; -pub const JS_ATOM_Set: _bindgen_ty_2 = 183; -pub const JS_ATOM_WeakMap: _bindgen_ty_2 = 184; -pub const JS_ATOM_WeakSet: _bindgen_ty_2 = 185; -pub const JS_ATOM_Map_Iterator: _bindgen_ty_2 = 186; -pub const JS_ATOM_Set_Iterator: _bindgen_ty_2 = 187; -pub const JS_ATOM_Array_Iterator: _bindgen_ty_2 = 188; -pub const JS_ATOM_String_Iterator: _bindgen_ty_2 = 189; -pub const JS_ATOM_RegExp_String_Iterator: _bindgen_ty_2 = 190; -pub const JS_ATOM_Generator: _bindgen_ty_2 = 191; -pub const JS_ATOM_Proxy: _bindgen_ty_2 = 192; -pub const JS_ATOM_Promise: _bindgen_ty_2 = 193; -pub const JS_ATOM_PromiseResolveFunction: _bindgen_ty_2 = 194; -pub const JS_ATOM_PromiseRejectFunction: _bindgen_ty_2 = 195; -pub const JS_ATOM_AsyncFunction: _bindgen_ty_2 = 196; -pub const JS_ATOM_AsyncFunctionResolve: _bindgen_ty_2 = 197; -pub const JS_ATOM_AsyncFunctionReject: _bindgen_ty_2 = 198; -pub const JS_ATOM_AsyncGeneratorFunction: _bindgen_ty_2 = 199; -pub const JS_ATOM_AsyncGenerator: _bindgen_ty_2 = 200; -pub const JS_ATOM_EvalError: _bindgen_ty_2 = 201; -pub const JS_ATOM_RangeError: _bindgen_ty_2 = 202; -pub const JS_ATOM_ReferenceError: _bindgen_ty_2 = 203; -pub const JS_ATOM_SyntaxError: _bindgen_ty_2 = 204; -pub const JS_ATOM_TypeError: _bindgen_ty_2 = 205; -pub const JS_ATOM_URIError: _bindgen_ty_2 = 206; -pub const JS_ATOM_InternalError: _bindgen_ty_2 = 207; -pub const JS_ATOM_Private_brand: _bindgen_ty_2 = 208; -pub const JS_ATOM_Symbol_toPrimitive: _bindgen_ty_2 = 209; -pub const JS_ATOM_Symbol_iterator: _bindgen_ty_2 = 210; -pub const JS_ATOM_Symbol_match: _bindgen_ty_2 = 211; -pub const JS_ATOM_Symbol_matchAll: _bindgen_ty_2 = 212; -pub const JS_ATOM_Symbol_replace: _bindgen_ty_2 = 213; -pub const JS_ATOM_Symbol_search: _bindgen_ty_2 = 214; -pub const JS_ATOM_Symbol_split: _bindgen_ty_2 = 215; -pub const JS_ATOM_Symbol_toStringTag: _bindgen_ty_2 = 216; -pub const JS_ATOM_Symbol_isConcatSpreadable: _bindgen_ty_2 = 217; -pub const JS_ATOM_Symbol_hasInstance: _bindgen_ty_2 = 218; -pub const JS_ATOM_Symbol_species: _bindgen_ty_2 = 219; -pub const JS_ATOM_Symbol_unscopables: _bindgen_ty_2 = 220; -pub const JS_ATOM_Symbol_asyncIterator: _bindgen_ty_2 = 221; -pub const JS_ATOM_Symbol_operatorSet: _bindgen_ty_2 = 222; -pub const JS_ATOM_END: _bindgen_ty_2 = 223; +pub const JS_ATOM_cause: _bindgen_ty_2 = 53; +pub const JS_ATOM_errors: _bindgen_ty_2 = 54; +pub const JS_ATOM_stack: _bindgen_ty_2 = 55; +pub const JS_ATOM_name: _bindgen_ty_2 = 56; +pub const JS_ATOM_toString: _bindgen_ty_2 = 57; +pub const JS_ATOM_toLocaleString: _bindgen_ty_2 = 58; +pub const JS_ATOM_valueOf: _bindgen_ty_2 = 59; +pub const JS_ATOM_eval: _bindgen_ty_2 = 60; +pub const JS_ATOM_prototype: _bindgen_ty_2 = 61; +pub const JS_ATOM_constructor: _bindgen_ty_2 = 62; +pub const JS_ATOM_configurable: _bindgen_ty_2 = 63; +pub const JS_ATOM_writable: _bindgen_ty_2 = 64; +pub const JS_ATOM_enumerable: _bindgen_ty_2 = 65; +pub const JS_ATOM_value: _bindgen_ty_2 = 66; +pub const JS_ATOM_get: _bindgen_ty_2 = 67; +pub const JS_ATOM_set: _bindgen_ty_2 = 68; +pub const JS_ATOM_of: _bindgen_ty_2 = 69; +pub const JS_ATOM___proto__: _bindgen_ty_2 = 70; +pub const JS_ATOM_undefined: _bindgen_ty_2 = 71; +pub const JS_ATOM_number: _bindgen_ty_2 = 72; +pub const JS_ATOM_boolean: _bindgen_ty_2 = 73; +pub const JS_ATOM_string: _bindgen_ty_2 = 74; +pub const JS_ATOM_object: _bindgen_ty_2 = 75; +pub const JS_ATOM_symbol: _bindgen_ty_2 = 76; +pub const JS_ATOM_integer: _bindgen_ty_2 = 77; +pub const JS_ATOM_unknown: _bindgen_ty_2 = 78; +pub const JS_ATOM_arguments: _bindgen_ty_2 = 79; +pub const JS_ATOM_callee: _bindgen_ty_2 = 80; +pub const JS_ATOM_caller: _bindgen_ty_2 = 81; +pub const JS_ATOM__eval_: _bindgen_ty_2 = 82; +pub const JS_ATOM__ret_: _bindgen_ty_2 = 83; +pub const JS_ATOM__var_: _bindgen_ty_2 = 84; +pub const JS_ATOM__arg_var_: _bindgen_ty_2 = 85; +pub const JS_ATOM__with_: _bindgen_ty_2 = 86; +pub const JS_ATOM_lastIndex: _bindgen_ty_2 = 87; +pub const JS_ATOM_target: _bindgen_ty_2 = 88; +pub const JS_ATOM_index: _bindgen_ty_2 = 89; +pub const JS_ATOM_input: _bindgen_ty_2 = 90; +pub const JS_ATOM_defineProperties: _bindgen_ty_2 = 91; +pub const JS_ATOM_apply: _bindgen_ty_2 = 92; +pub const JS_ATOM_join: _bindgen_ty_2 = 93; +pub const JS_ATOM_concat: _bindgen_ty_2 = 94; +pub const JS_ATOM_split: _bindgen_ty_2 = 95; +pub const JS_ATOM_construct: _bindgen_ty_2 = 96; +pub const JS_ATOM_getPrototypeOf: _bindgen_ty_2 = 97; +pub const JS_ATOM_setPrototypeOf: _bindgen_ty_2 = 98; +pub const JS_ATOM_isExtensible: _bindgen_ty_2 = 99; +pub const JS_ATOM_preventExtensions: _bindgen_ty_2 = 100; +pub const JS_ATOM_has: _bindgen_ty_2 = 101; +pub const JS_ATOM_deleteProperty: _bindgen_ty_2 = 102; +pub const JS_ATOM_defineProperty: _bindgen_ty_2 = 103; +pub const JS_ATOM_getOwnPropertyDescriptor: _bindgen_ty_2 = 104; +pub const JS_ATOM_ownKeys: _bindgen_ty_2 = 105; +pub const JS_ATOM_add: _bindgen_ty_2 = 106; +pub const JS_ATOM_done: _bindgen_ty_2 = 107; +pub const JS_ATOM_next: _bindgen_ty_2 = 108; +pub const JS_ATOM_values: _bindgen_ty_2 = 109; +pub const JS_ATOM_source: _bindgen_ty_2 = 110; +pub const JS_ATOM_flags: _bindgen_ty_2 = 111; +pub const JS_ATOM_global: _bindgen_ty_2 = 112; +pub const JS_ATOM_unicode: _bindgen_ty_2 = 113; +pub const JS_ATOM_raw: _bindgen_ty_2 = 114; +pub const JS_ATOM_new_target: _bindgen_ty_2 = 115; +pub const JS_ATOM_this_active_func: _bindgen_ty_2 = 116; +pub const JS_ATOM_home_object: _bindgen_ty_2 = 117; +pub const JS_ATOM_computed_field: _bindgen_ty_2 = 118; +pub const JS_ATOM_static_computed_field: _bindgen_ty_2 = 119; +pub const JS_ATOM_class_fields_init: _bindgen_ty_2 = 120; +pub const JS_ATOM_brand: _bindgen_ty_2 = 121; +pub const JS_ATOM_hash_constructor: _bindgen_ty_2 = 122; +pub const JS_ATOM_as: _bindgen_ty_2 = 123; +pub const JS_ATOM_from: _bindgen_ty_2 = 124; +pub const JS_ATOM_meta: _bindgen_ty_2 = 125; +pub const JS_ATOM__default_: _bindgen_ty_2 = 126; +pub const JS_ATOM__star_: _bindgen_ty_2 = 127; +pub const JS_ATOM_Module: _bindgen_ty_2 = 128; +pub const JS_ATOM_then: _bindgen_ty_2 = 129; +pub const JS_ATOM_resolve: _bindgen_ty_2 = 130; +pub const JS_ATOM_reject: _bindgen_ty_2 = 131; +pub const JS_ATOM_promise: _bindgen_ty_2 = 132; +pub const JS_ATOM_proxy: _bindgen_ty_2 = 133; +pub const JS_ATOM_revoke: _bindgen_ty_2 = 134; +pub const JS_ATOM_async: _bindgen_ty_2 = 135; +pub const JS_ATOM_exec: _bindgen_ty_2 = 136; +pub const JS_ATOM_groups: _bindgen_ty_2 = 137; +pub const JS_ATOM_indices: _bindgen_ty_2 = 138; +pub const JS_ATOM_status: _bindgen_ty_2 = 139; +pub const JS_ATOM_reason: _bindgen_ty_2 = 140; +pub const JS_ATOM_globalThis: _bindgen_ty_2 = 141; +pub const JS_ATOM_bigint: _bindgen_ty_2 = 142; +pub const JS_ATOM_bigfloat: _bindgen_ty_2 = 143; +pub const JS_ATOM_bigdecimal: _bindgen_ty_2 = 144; +pub const JS_ATOM_roundingMode: _bindgen_ty_2 = 145; +pub const JS_ATOM_maximumSignificantDigits: _bindgen_ty_2 = 146; +pub const JS_ATOM_maximumFractionDigits: _bindgen_ty_2 = 147; +pub const JS_ATOM_not_equal: _bindgen_ty_2 = 148; +pub const JS_ATOM_timed_out: _bindgen_ty_2 = 149; +pub const JS_ATOM_ok: _bindgen_ty_2 = 150; +pub const JS_ATOM_toJSON: _bindgen_ty_2 = 151; +pub const JS_ATOM_Object: _bindgen_ty_2 = 152; +pub const JS_ATOM_Array: _bindgen_ty_2 = 153; +pub const JS_ATOM_Error: _bindgen_ty_2 = 154; +pub const JS_ATOM_Number: _bindgen_ty_2 = 155; +pub const JS_ATOM_String: _bindgen_ty_2 = 156; +pub const JS_ATOM_Boolean: _bindgen_ty_2 = 157; +pub const JS_ATOM_Symbol: _bindgen_ty_2 = 158; +pub const JS_ATOM_Arguments: _bindgen_ty_2 = 159; +pub const JS_ATOM_Math: _bindgen_ty_2 = 160; +pub const JS_ATOM_JSON: _bindgen_ty_2 = 161; +pub const JS_ATOM_Date: _bindgen_ty_2 = 162; +pub const JS_ATOM_Function: _bindgen_ty_2 = 163; +pub const JS_ATOM_GeneratorFunction: _bindgen_ty_2 = 164; +pub const JS_ATOM_ForInIterator: _bindgen_ty_2 = 165; +pub const JS_ATOM_RegExp: _bindgen_ty_2 = 166; +pub const JS_ATOM_ArrayBuffer: _bindgen_ty_2 = 167; +pub const JS_ATOM_SharedArrayBuffer: _bindgen_ty_2 = 168; +pub const JS_ATOM_Uint8ClampedArray: _bindgen_ty_2 = 169; +pub const JS_ATOM_Int8Array: _bindgen_ty_2 = 170; +pub const JS_ATOM_Uint8Array: _bindgen_ty_2 = 171; +pub const JS_ATOM_Int16Array: _bindgen_ty_2 = 172; +pub const JS_ATOM_Uint16Array: _bindgen_ty_2 = 173; +pub const JS_ATOM_Int32Array: _bindgen_ty_2 = 174; +pub const JS_ATOM_Uint32Array: _bindgen_ty_2 = 175; +pub const JS_ATOM_BigInt64Array: _bindgen_ty_2 = 176; +pub const JS_ATOM_BigUint64Array: _bindgen_ty_2 = 177; +pub const JS_ATOM_Float32Array: _bindgen_ty_2 = 178; +pub const JS_ATOM_Float64Array: _bindgen_ty_2 = 179; +pub const JS_ATOM_DataView: _bindgen_ty_2 = 180; +pub const JS_ATOM_BigInt: _bindgen_ty_2 = 181; +pub const JS_ATOM_BigFloat: _bindgen_ty_2 = 182; +pub const JS_ATOM_BigFloatEnv: _bindgen_ty_2 = 183; +pub const JS_ATOM_BigDecimal: _bindgen_ty_2 = 184; +pub const JS_ATOM_OperatorSet: _bindgen_ty_2 = 185; +pub const JS_ATOM_Operators: _bindgen_ty_2 = 186; +pub const JS_ATOM_Map: _bindgen_ty_2 = 187; +pub const JS_ATOM_Set: _bindgen_ty_2 = 188; +pub const JS_ATOM_WeakMap: _bindgen_ty_2 = 189; +pub const JS_ATOM_WeakSet: _bindgen_ty_2 = 190; +pub const JS_ATOM_Map_Iterator: _bindgen_ty_2 = 191; +pub const JS_ATOM_Set_Iterator: _bindgen_ty_2 = 192; +pub const JS_ATOM_Array_Iterator: _bindgen_ty_2 = 193; +pub const JS_ATOM_String_Iterator: _bindgen_ty_2 = 194; +pub const JS_ATOM_RegExp_String_Iterator: _bindgen_ty_2 = 195; +pub const JS_ATOM_Generator: _bindgen_ty_2 = 196; +pub const JS_ATOM_Proxy: _bindgen_ty_2 = 197; +pub const JS_ATOM_Promise: _bindgen_ty_2 = 198; +pub const JS_ATOM_PromiseResolveFunction: _bindgen_ty_2 = 199; +pub const JS_ATOM_PromiseRejectFunction: _bindgen_ty_2 = 200; +pub const JS_ATOM_AsyncFunction: _bindgen_ty_2 = 201; +pub const JS_ATOM_AsyncFunctionResolve: _bindgen_ty_2 = 202; +pub const JS_ATOM_AsyncFunctionReject: _bindgen_ty_2 = 203; +pub const JS_ATOM_AsyncGeneratorFunction: _bindgen_ty_2 = 204; +pub const JS_ATOM_AsyncGenerator: _bindgen_ty_2 = 205; +pub const JS_ATOM_EvalError: _bindgen_ty_2 = 206; +pub const JS_ATOM_RangeError: _bindgen_ty_2 = 207; +pub const JS_ATOM_ReferenceError: _bindgen_ty_2 = 208; +pub const JS_ATOM_SyntaxError: _bindgen_ty_2 = 209; +pub const JS_ATOM_TypeError: _bindgen_ty_2 = 210; +pub const JS_ATOM_URIError: _bindgen_ty_2 = 211; +pub const JS_ATOM_InternalError: _bindgen_ty_2 = 212; +pub const JS_ATOM_Private_brand: _bindgen_ty_2 = 213; +pub const JS_ATOM_Symbol_toPrimitive: _bindgen_ty_2 = 214; +pub const JS_ATOM_Symbol_iterator: _bindgen_ty_2 = 215; +pub const JS_ATOM_Symbol_match: _bindgen_ty_2 = 216; +pub const JS_ATOM_Symbol_matchAll: _bindgen_ty_2 = 217; +pub const JS_ATOM_Symbol_replace: _bindgen_ty_2 = 218; +pub const JS_ATOM_Symbol_search: _bindgen_ty_2 = 219; +pub const JS_ATOM_Symbol_split: _bindgen_ty_2 = 220; +pub const JS_ATOM_Symbol_toStringTag: _bindgen_ty_2 = 221; +pub const JS_ATOM_Symbol_isConcatSpreadable: _bindgen_ty_2 = 222; +pub const JS_ATOM_Symbol_hasInstance: _bindgen_ty_2 = 223; +pub const JS_ATOM_Symbol_species: _bindgen_ty_2 = 224; +pub const JS_ATOM_Symbol_unscopables: _bindgen_ty_2 = 225; +pub const JS_ATOM_Symbol_asyncIterator: _bindgen_ty_2 = 226; +pub const JS_ATOM_Symbol_operatorSet: _bindgen_ty_2 = 227; +pub const JS_ATOM_END: _bindgen_ty_2 = 228; pub type _bindgen_ty_2 = ::std::os::raw::c_int; diff --git a/sys/src/bindings/x86_64-unknown-linux-gnu.rs b/sys/src/bindings/x86_64-unknown-linux-gnu.rs index f9679c0e7..ef69496a3 100644 --- a/sys/src/bindings/x86_64-unknown-linux-gnu.rs +++ b/sys/src/bindings/x86_64-unknown-linux-gnu.rs @@ -31,8 +31,10 @@ pub const JS_EVAL_FLAG_STRICT: u32 = 8; pub const JS_EVAL_FLAG_STRIP: u32 = 16; pub const JS_EVAL_FLAG_COMPILE_ONLY: u32 = 32; pub const JS_EVAL_FLAG_BACKTRACE_BARRIER: u32 = 64; +pub const JS_EVAL_FLAG_ASYNC: u32 = 128; pub const JS_ATOM_NULL: u32 = 0; pub const JS_CALL_FLAG_CONSTRUCTOR: u32 = 1; +pub const JS_INVALID_CLASS_ID: u32 = 0; pub const JS_GPN_STRING_MASK: u32 = 1; pub const JS_GPN_SYMBOL_MASK: u32 = 2; pub const JS_GPN_PRIVATE_MASK: u32 = 4; @@ -458,6 +460,9 @@ extern "C" { extern "C" { pub fn JS_GetClassProto(ctx: *mut JSContext, class_id: JSClassID) -> JSValue; } +extern "C" { + pub fn JS_GetFunctionProto(ctx: *mut JSContext) -> JSValue; +} extern "C" { pub fn JS_NewContextRaw(rt: *mut JSRuntime) -> *mut JSContext; } @@ -1288,6 +1293,9 @@ fn bindgen_test_layout_JSClassDef() { extern "C" { pub fn JS_NewClassID(pclass_id: *mut JSClassID) -> JSClassID; } +extern "C" { + pub fn JS_GetClassID(v: JSValue) -> JSClassID; +} extern "C" { pub fn JS_NewClass( rt: *mut JSRuntime, @@ -1458,6 +1466,9 @@ extern "C" { extern "C" { pub fn JS_IsArray(ctx: *mut JSContext, val: JSValue) -> ::std::os::raw::c_int; } +extern "C" { + pub fn JS_NewDate(ctx: *mut JSContext, epoch_ms: f64) -> JSValue; +} extern "C" { pub fn JS_GetPropertyInternal( ctx: *mut JSContext, @@ -1480,9 +1491,10 @@ extern "C" { extern "C" { pub fn JS_SetPropertyInternal( ctx: *mut JSContext, - this_obj: JSValue, + obj: JSValue, prop: JSAtom, val: JSValue, + this_obj: JSValue, flags: ::std::os::raw::c_int, ) -> ::std::os::raw::c_int; } @@ -1621,9 +1633,6 @@ extern "C" { extern "C" { pub fn JS_GetGlobalObject(ctx: *mut JSContext) -> JSValue; } -extern "C" { - pub fn JS_GetFunctionProto(ctx: *mut JSContext) -> JSValue; -} extern "C" { pub fn JS_IsInstanceOf( ctx: *mut JSContext, @@ -1831,9 +1840,19 @@ extern "C" { sf: *const JSSharedArrayBufferFunctions, ); } +pub const JSPromiseStateEnum_JS_PROMISE_PENDING: JSPromiseStateEnum = 0; +pub const JSPromiseStateEnum_JS_PROMISE_FULFILLED: JSPromiseStateEnum = 1; +pub const JSPromiseStateEnum_JS_PROMISE_REJECTED: JSPromiseStateEnum = 2; +pub type JSPromiseStateEnum = ::std::os::raw::c_uint; extern "C" { pub fn JS_NewPromiseCapability(ctx: *mut JSContext, resolving_funcs: *mut JSValue) -> JSValue; } +extern "C" { + pub fn JS_PromiseState(ctx: *mut JSContext, promise: JSValue) -> JSPromiseStateEnum; +} +extern "C" { + pub fn JS_PromiseResult(ctx: *mut JSContext, promise: JSValue) -> JSValue; +} pub type JSHostPromiseRejectionTracker = ::std::option::Option< unsafe extern "C" fn( ctx: *mut JSContext, @@ -1904,7 +1923,7 @@ extern "C" { pub fn JS_GetModuleName(ctx: *mut JSContext, m: *mut JSModuleDef) -> JSAtom; } extern "C" { - pub fn JS_FreeUnevaluatedModules(ctx: *mut JSContext); + pub fn JS_GetModuleNamespace(ctx: *mut JSContext, m: *mut JSModuleDef) -> JSValue; } pub type JSJobFunc = ::std::option::Option< unsafe extern "C" fn( @@ -1969,11 +1988,11 @@ extern "C" { ) -> JSAtom; } extern "C" { - pub fn JS_RunModule( + pub fn JS_LoadModule( ctx: *mut JSContext, basename: *const ::std::os::raw::c_char, filename: *const ::std::os::raw::c_char, - ) -> *mut JSModuleDef; + ) -> JSValue; } pub const JSCFunctionEnum_JS_CFUNC_generic: JSCFunctionEnum = 0; pub const JSCFunctionEnum_JS_CFUNC_generic_magic: JSCFunctionEnum = 1; @@ -2642,36 +2661,6 @@ extern "C" { len: ::std::os::raw::c_int, ) -> ::std::os::raw::c_int; } -extern "C" { - pub fn JS_DynamicImportSync( - ctx: *mut JSContext, - specifier: *const ::std::os::raw::c_char, - ) -> JSValue; -} -extern "C" { - pub fn JS_GetModuleExport( - ctx: *mut JSContext, - m: *mut JSModuleDef, - export_name: *const ::std::os::raw::c_char, - ) -> JSValue; -} -extern "C" { - pub fn JS_GetModuleExportEntriesCount(m: *mut JSModuleDef) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn JS_GetModuleExportEntry( - ctx: *mut JSContext, - m: *mut JSModuleDef, - idx: ::std::os::raw::c_int, - ) -> JSValue; -} -extern "C" { - pub fn JS_GetModuleExportEntryName( - ctx: *mut JSContext, - m: *mut JSModuleDef, - idx: ::std::os::raw::c_int, - ) -> JSAtom; -} pub const __JS_ATOM_NULL: _bindgen_ty_2 = 0; pub const JS_ATOM_null: _bindgen_ty_2 = 1; pub const JS_ATOM_false: _bindgen_ty_2 = 2; @@ -2725,178 +2714,180 @@ pub const JS_ATOM_fileName: _bindgen_ty_2 = 49; pub const JS_ATOM_lineNumber: _bindgen_ty_2 = 50; pub const JS_ATOM_columnNumber: _bindgen_ty_2 = 51; pub const JS_ATOM_message: _bindgen_ty_2 = 52; -pub const JS_ATOM_errors: _bindgen_ty_2 = 53; -pub const JS_ATOM_stack: _bindgen_ty_2 = 54; -pub const JS_ATOM_name: _bindgen_ty_2 = 55; -pub const JS_ATOM_toString: _bindgen_ty_2 = 56; -pub const JS_ATOM_toLocaleString: _bindgen_ty_2 = 57; -pub const JS_ATOM_valueOf: _bindgen_ty_2 = 58; -pub const JS_ATOM_eval: _bindgen_ty_2 = 59; -pub const JS_ATOM_prototype: _bindgen_ty_2 = 60; -pub const JS_ATOM_constructor: _bindgen_ty_2 = 61; -pub const JS_ATOM_configurable: _bindgen_ty_2 = 62; -pub const JS_ATOM_writable: _bindgen_ty_2 = 63; -pub const JS_ATOM_enumerable: _bindgen_ty_2 = 64; -pub const JS_ATOM_value: _bindgen_ty_2 = 65; -pub const JS_ATOM_get: _bindgen_ty_2 = 66; -pub const JS_ATOM_set: _bindgen_ty_2 = 67; -pub const JS_ATOM_of: _bindgen_ty_2 = 68; -pub const JS_ATOM___proto__: _bindgen_ty_2 = 69; -pub const JS_ATOM_undefined: _bindgen_ty_2 = 70; -pub const JS_ATOM_number: _bindgen_ty_2 = 71; -pub const JS_ATOM_boolean: _bindgen_ty_2 = 72; -pub const JS_ATOM_string: _bindgen_ty_2 = 73; -pub const JS_ATOM_object: _bindgen_ty_2 = 74; -pub const JS_ATOM_symbol: _bindgen_ty_2 = 75; -pub const JS_ATOM_integer: _bindgen_ty_2 = 76; -pub const JS_ATOM_unknown: _bindgen_ty_2 = 77; -pub const JS_ATOM_arguments: _bindgen_ty_2 = 78; -pub const JS_ATOM_callee: _bindgen_ty_2 = 79; -pub const JS_ATOM_caller: _bindgen_ty_2 = 80; -pub const JS_ATOM__eval_: _bindgen_ty_2 = 81; -pub const JS_ATOM__ret_: _bindgen_ty_2 = 82; -pub const JS_ATOM__var_: _bindgen_ty_2 = 83; -pub const JS_ATOM__arg_var_: _bindgen_ty_2 = 84; -pub const JS_ATOM__with_: _bindgen_ty_2 = 85; -pub const JS_ATOM_lastIndex: _bindgen_ty_2 = 86; -pub const JS_ATOM_target: _bindgen_ty_2 = 87; -pub const JS_ATOM_index: _bindgen_ty_2 = 88; -pub const JS_ATOM_input: _bindgen_ty_2 = 89; -pub const JS_ATOM_defineProperties: _bindgen_ty_2 = 90; -pub const JS_ATOM_apply: _bindgen_ty_2 = 91; -pub const JS_ATOM_join: _bindgen_ty_2 = 92; -pub const JS_ATOM_concat: _bindgen_ty_2 = 93; -pub const JS_ATOM_split: _bindgen_ty_2 = 94; -pub const JS_ATOM_construct: _bindgen_ty_2 = 95; -pub const JS_ATOM_getPrototypeOf: _bindgen_ty_2 = 96; -pub const JS_ATOM_setPrototypeOf: _bindgen_ty_2 = 97; -pub const JS_ATOM_isExtensible: _bindgen_ty_2 = 98; -pub const JS_ATOM_preventExtensions: _bindgen_ty_2 = 99; -pub const JS_ATOM_has: _bindgen_ty_2 = 100; -pub const JS_ATOM_deleteProperty: _bindgen_ty_2 = 101; -pub const JS_ATOM_defineProperty: _bindgen_ty_2 = 102; -pub const JS_ATOM_getOwnPropertyDescriptor: _bindgen_ty_2 = 103; -pub const JS_ATOM_ownKeys: _bindgen_ty_2 = 104; -pub const JS_ATOM_add: _bindgen_ty_2 = 105; -pub const JS_ATOM_done: _bindgen_ty_2 = 106; -pub const JS_ATOM_next: _bindgen_ty_2 = 107; -pub const JS_ATOM_values: _bindgen_ty_2 = 108; -pub const JS_ATOM_source: _bindgen_ty_2 = 109; -pub const JS_ATOM_flags: _bindgen_ty_2 = 110; -pub const JS_ATOM_global: _bindgen_ty_2 = 111; -pub const JS_ATOM_unicode: _bindgen_ty_2 = 112; -pub const JS_ATOM_raw: _bindgen_ty_2 = 113; -pub const JS_ATOM_new_target: _bindgen_ty_2 = 114; -pub const JS_ATOM_this_active_func: _bindgen_ty_2 = 115; -pub const JS_ATOM_home_object: _bindgen_ty_2 = 116; -pub const JS_ATOM_computed_field: _bindgen_ty_2 = 117; -pub const JS_ATOM_static_computed_field: _bindgen_ty_2 = 118; -pub const JS_ATOM_class_fields_init: _bindgen_ty_2 = 119; -pub const JS_ATOM_brand: _bindgen_ty_2 = 120; -pub const JS_ATOM_hash_constructor: _bindgen_ty_2 = 121; -pub const JS_ATOM_as: _bindgen_ty_2 = 122; -pub const JS_ATOM_from: _bindgen_ty_2 = 123; -pub const JS_ATOM_meta: _bindgen_ty_2 = 124; -pub const JS_ATOM__default_: _bindgen_ty_2 = 125; -pub const JS_ATOM__star_: _bindgen_ty_2 = 126; -pub const JS_ATOM_Module: _bindgen_ty_2 = 127; -pub const JS_ATOM_then: _bindgen_ty_2 = 128; -pub const JS_ATOM_resolve: _bindgen_ty_2 = 129; -pub const JS_ATOM_reject: _bindgen_ty_2 = 130; -pub const JS_ATOM_promise: _bindgen_ty_2 = 131; -pub const JS_ATOM_proxy: _bindgen_ty_2 = 132; -pub const JS_ATOM_revoke: _bindgen_ty_2 = 133; -pub const JS_ATOM_async: _bindgen_ty_2 = 134; -pub const JS_ATOM_exec: _bindgen_ty_2 = 135; -pub const JS_ATOM_groups: _bindgen_ty_2 = 136; -pub const JS_ATOM_status: _bindgen_ty_2 = 137; -pub const JS_ATOM_reason: _bindgen_ty_2 = 138; -pub const JS_ATOM_globalThis: _bindgen_ty_2 = 139; -pub const JS_ATOM_bigint: _bindgen_ty_2 = 140; -pub const JS_ATOM_bigfloat: _bindgen_ty_2 = 141; -pub const JS_ATOM_bigdecimal: _bindgen_ty_2 = 142; -pub const JS_ATOM_roundingMode: _bindgen_ty_2 = 143; -pub const JS_ATOM_maximumSignificantDigits: _bindgen_ty_2 = 144; -pub const JS_ATOM_maximumFractionDigits: _bindgen_ty_2 = 145; -pub const JS_ATOM_not_equal: _bindgen_ty_2 = 146; -pub const JS_ATOM_timed_out: _bindgen_ty_2 = 147; -pub const JS_ATOM_ok: _bindgen_ty_2 = 148; -pub const JS_ATOM_toJSON: _bindgen_ty_2 = 149; -pub const JS_ATOM_Object: _bindgen_ty_2 = 150; -pub const JS_ATOM_Array: _bindgen_ty_2 = 151; -pub const JS_ATOM_Error: _bindgen_ty_2 = 152; -pub const JS_ATOM_Number: _bindgen_ty_2 = 153; -pub const JS_ATOM_String: _bindgen_ty_2 = 154; -pub const JS_ATOM_Boolean: _bindgen_ty_2 = 155; -pub const JS_ATOM_Symbol: _bindgen_ty_2 = 156; -pub const JS_ATOM_Arguments: _bindgen_ty_2 = 157; -pub const JS_ATOM_Math: _bindgen_ty_2 = 158; -pub const JS_ATOM_JSON: _bindgen_ty_2 = 159; -pub const JS_ATOM_Date: _bindgen_ty_2 = 160; -pub const JS_ATOM_Function: _bindgen_ty_2 = 161; -pub const JS_ATOM_GeneratorFunction: _bindgen_ty_2 = 162; -pub const JS_ATOM_ForInIterator: _bindgen_ty_2 = 163; -pub const JS_ATOM_RegExp: _bindgen_ty_2 = 164; -pub const JS_ATOM_ArrayBuffer: _bindgen_ty_2 = 165; -pub const JS_ATOM_SharedArrayBuffer: _bindgen_ty_2 = 166; -pub const JS_ATOM_Uint8ClampedArray: _bindgen_ty_2 = 167; -pub const JS_ATOM_Int8Array: _bindgen_ty_2 = 168; -pub const JS_ATOM_Uint8Array: _bindgen_ty_2 = 169; -pub const JS_ATOM_Int16Array: _bindgen_ty_2 = 170; -pub const JS_ATOM_Uint16Array: _bindgen_ty_2 = 171; -pub const JS_ATOM_Int32Array: _bindgen_ty_2 = 172; -pub const JS_ATOM_Uint32Array: _bindgen_ty_2 = 173; -pub const JS_ATOM_BigInt64Array: _bindgen_ty_2 = 174; -pub const JS_ATOM_BigUint64Array: _bindgen_ty_2 = 175; -pub const JS_ATOM_Float32Array: _bindgen_ty_2 = 176; -pub const JS_ATOM_Float64Array: _bindgen_ty_2 = 177; -pub const JS_ATOM_DataView: _bindgen_ty_2 = 178; -pub const JS_ATOM_BigInt: _bindgen_ty_2 = 179; -pub const JS_ATOM_BigFloat: _bindgen_ty_2 = 180; -pub const JS_ATOM_BigFloatEnv: _bindgen_ty_2 = 181; -pub const JS_ATOM_BigDecimal: _bindgen_ty_2 = 182; -pub const JS_ATOM_OperatorSet: _bindgen_ty_2 = 183; -pub const JS_ATOM_Operators: _bindgen_ty_2 = 184; -pub const JS_ATOM_Map: _bindgen_ty_2 = 185; -pub const JS_ATOM_Set: _bindgen_ty_2 = 186; -pub const JS_ATOM_WeakMap: _bindgen_ty_2 = 187; -pub const JS_ATOM_WeakSet: _bindgen_ty_2 = 188; -pub const JS_ATOM_Map_Iterator: _bindgen_ty_2 = 189; -pub const JS_ATOM_Set_Iterator: _bindgen_ty_2 = 190; -pub const JS_ATOM_Array_Iterator: _bindgen_ty_2 = 191; -pub const JS_ATOM_String_Iterator: _bindgen_ty_2 = 192; -pub const JS_ATOM_RegExp_String_Iterator: _bindgen_ty_2 = 193; -pub const JS_ATOM_Generator: _bindgen_ty_2 = 194; -pub const JS_ATOM_Proxy: _bindgen_ty_2 = 195; -pub const JS_ATOM_Promise: _bindgen_ty_2 = 196; -pub const JS_ATOM_PromiseResolveFunction: _bindgen_ty_2 = 197; -pub const JS_ATOM_PromiseRejectFunction: _bindgen_ty_2 = 198; -pub const JS_ATOM_AsyncFunction: _bindgen_ty_2 = 199; -pub const JS_ATOM_AsyncFunctionResolve: _bindgen_ty_2 = 200; -pub const JS_ATOM_AsyncFunctionReject: _bindgen_ty_2 = 201; -pub const JS_ATOM_AsyncGeneratorFunction: _bindgen_ty_2 = 202; -pub const JS_ATOM_AsyncGenerator: _bindgen_ty_2 = 203; -pub const JS_ATOM_EvalError: _bindgen_ty_2 = 204; -pub const JS_ATOM_RangeError: _bindgen_ty_2 = 205; -pub const JS_ATOM_ReferenceError: _bindgen_ty_2 = 206; -pub const JS_ATOM_SyntaxError: _bindgen_ty_2 = 207; -pub const JS_ATOM_TypeError: _bindgen_ty_2 = 208; -pub const JS_ATOM_URIError: _bindgen_ty_2 = 209; -pub const JS_ATOM_InternalError: _bindgen_ty_2 = 210; -pub const JS_ATOM_Private_brand: _bindgen_ty_2 = 211; -pub const JS_ATOM_Symbol_toPrimitive: _bindgen_ty_2 = 212; -pub const JS_ATOM_Symbol_iterator: _bindgen_ty_2 = 213; -pub const JS_ATOM_Symbol_match: _bindgen_ty_2 = 214; -pub const JS_ATOM_Symbol_matchAll: _bindgen_ty_2 = 215; -pub const JS_ATOM_Symbol_replace: _bindgen_ty_2 = 216; -pub const JS_ATOM_Symbol_search: _bindgen_ty_2 = 217; -pub const JS_ATOM_Symbol_split: _bindgen_ty_2 = 218; -pub const JS_ATOM_Symbol_toStringTag: _bindgen_ty_2 = 219; -pub const JS_ATOM_Symbol_isConcatSpreadable: _bindgen_ty_2 = 220; -pub const JS_ATOM_Symbol_hasInstance: _bindgen_ty_2 = 221; -pub const JS_ATOM_Symbol_species: _bindgen_ty_2 = 222; -pub const JS_ATOM_Symbol_unscopables: _bindgen_ty_2 = 223; -pub const JS_ATOM_Symbol_asyncIterator: _bindgen_ty_2 = 224; -pub const JS_ATOM_Symbol_operatorSet: _bindgen_ty_2 = 225; -pub const JS_ATOM_END: _bindgen_ty_2 = 226; +pub const JS_ATOM_cause: _bindgen_ty_2 = 53; +pub const JS_ATOM_errors: _bindgen_ty_2 = 54; +pub const JS_ATOM_stack: _bindgen_ty_2 = 55; +pub const JS_ATOM_name: _bindgen_ty_2 = 56; +pub const JS_ATOM_toString: _bindgen_ty_2 = 57; +pub const JS_ATOM_toLocaleString: _bindgen_ty_2 = 58; +pub const JS_ATOM_valueOf: _bindgen_ty_2 = 59; +pub const JS_ATOM_eval: _bindgen_ty_2 = 60; +pub const JS_ATOM_prototype: _bindgen_ty_2 = 61; +pub const JS_ATOM_constructor: _bindgen_ty_2 = 62; +pub const JS_ATOM_configurable: _bindgen_ty_2 = 63; +pub const JS_ATOM_writable: _bindgen_ty_2 = 64; +pub const JS_ATOM_enumerable: _bindgen_ty_2 = 65; +pub const JS_ATOM_value: _bindgen_ty_2 = 66; +pub const JS_ATOM_get: _bindgen_ty_2 = 67; +pub const JS_ATOM_set: _bindgen_ty_2 = 68; +pub const JS_ATOM_of: _bindgen_ty_2 = 69; +pub const JS_ATOM___proto__: _bindgen_ty_2 = 70; +pub const JS_ATOM_undefined: _bindgen_ty_2 = 71; +pub const JS_ATOM_number: _bindgen_ty_2 = 72; +pub const JS_ATOM_boolean: _bindgen_ty_2 = 73; +pub const JS_ATOM_string: _bindgen_ty_2 = 74; +pub const JS_ATOM_object: _bindgen_ty_2 = 75; +pub const JS_ATOM_symbol: _bindgen_ty_2 = 76; +pub const JS_ATOM_integer: _bindgen_ty_2 = 77; +pub const JS_ATOM_unknown: _bindgen_ty_2 = 78; +pub const JS_ATOM_arguments: _bindgen_ty_2 = 79; +pub const JS_ATOM_callee: _bindgen_ty_2 = 80; +pub const JS_ATOM_caller: _bindgen_ty_2 = 81; +pub const JS_ATOM__eval_: _bindgen_ty_2 = 82; +pub const JS_ATOM__ret_: _bindgen_ty_2 = 83; +pub const JS_ATOM__var_: _bindgen_ty_2 = 84; +pub const JS_ATOM__arg_var_: _bindgen_ty_2 = 85; +pub const JS_ATOM__with_: _bindgen_ty_2 = 86; +pub const JS_ATOM_lastIndex: _bindgen_ty_2 = 87; +pub const JS_ATOM_target: _bindgen_ty_2 = 88; +pub const JS_ATOM_index: _bindgen_ty_2 = 89; +pub const JS_ATOM_input: _bindgen_ty_2 = 90; +pub const JS_ATOM_defineProperties: _bindgen_ty_2 = 91; +pub const JS_ATOM_apply: _bindgen_ty_2 = 92; +pub const JS_ATOM_join: _bindgen_ty_2 = 93; +pub const JS_ATOM_concat: _bindgen_ty_2 = 94; +pub const JS_ATOM_split: _bindgen_ty_2 = 95; +pub const JS_ATOM_construct: _bindgen_ty_2 = 96; +pub const JS_ATOM_getPrototypeOf: _bindgen_ty_2 = 97; +pub const JS_ATOM_setPrototypeOf: _bindgen_ty_2 = 98; +pub const JS_ATOM_isExtensible: _bindgen_ty_2 = 99; +pub const JS_ATOM_preventExtensions: _bindgen_ty_2 = 100; +pub const JS_ATOM_has: _bindgen_ty_2 = 101; +pub const JS_ATOM_deleteProperty: _bindgen_ty_2 = 102; +pub const JS_ATOM_defineProperty: _bindgen_ty_2 = 103; +pub const JS_ATOM_getOwnPropertyDescriptor: _bindgen_ty_2 = 104; +pub const JS_ATOM_ownKeys: _bindgen_ty_2 = 105; +pub const JS_ATOM_add: _bindgen_ty_2 = 106; +pub const JS_ATOM_done: _bindgen_ty_2 = 107; +pub const JS_ATOM_next: _bindgen_ty_2 = 108; +pub const JS_ATOM_values: _bindgen_ty_2 = 109; +pub const JS_ATOM_source: _bindgen_ty_2 = 110; +pub const JS_ATOM_flags: _bindgen_ty_2 = 111; +pub const JS_ATOM_global: _bindgen_ty_2 = 112; +pub const JS_ATOM_unicode: _bindgen_ty_2 = 113; +pub const JS_ATOM_raw: _bindgen_ty_2 = 114; +pub const JS_ATOM_new_target: _bindgen_ty_2 = 115; +pub const JS_ATOM_this_active_func: _bindgen_ty_2 = 116; +pub const JS_ATOM_home_object: _bindgen_ty_2 = 117; +pub const JS_ATOM_computed_field: _bindgen_ty_2 = 118; +pub const JS_ATOM_static_computed_field: _bindgen_ty_2 = 119; +pub const JS_ATOM_class_fields_init: _bindgen_ty_2 = 120; +pub const JS_ATOM_brand: _bindgen_ty_2 = 121; +pub const JS_ATOM_hash_constructor: _bindgen_ty_2 = 122; +pub const JS_ATOM_as: _bindgen_ty_2 = 123; +pub const JS_ATOM_from: _bindgen_ty_2 = 124; +pub const JS_ATOM_meta: _bindgen_ty_2 = 125; +pub const JS_ATOM__default_: _bindgen_ty_2 = 126; +pub const JS_ATOM__star_: _bindgen_ty_2 = 127; +pub const JS_ATOM_Module: _bindgen_ty_2 = 128; +pub const JS_ATOM_then: _bindgen_ty_2 = 129; +pub const JS_ATOM_resolve: _bindgen_ty_2 = 130; +pub const JS_ATOM_reject: _bindgen_ty_2 = 131; +pub const JS_ATOM_promise: _bindgen_ty_2 = 132; +pub const JS_ATOM_proxy: _bindgen_ty_2 = 133; +pub const JS_ATOM_revoke: _bindgen_ty_2 = 134; +pub const JS_ATOM_async: _bindgen_ty_2 = 135; +pub const JS_ATOM_exec: _bindgen_ty_2 = 136; +pub const JS_ATOM_groups: _bindgen_ty_2 = 137; +pub const JS_ATOM_indices: _bindgen_ty_2 = 138; +pub const JS_ATOM_status: _bindgen_ty_2 = 139; +pub const JS_ATOM_reason: _bindgen_ty_2 = 140; +pub const JS_ATOM_globalThis: _bindgen_ty_2 = 141; +pub const JS_ATOM_bigint: _bindgen_ty_2 = 142; +pub const JS_ATOM_bigfloat: _bindgen_ty_2 = 143; +pub const JS_ATOM_bigdecimal: _bindgen_ty_2 = 144; +pub const JS_ATOM_roundingMode: _bindgen_ty_2 = 145; +pub const JS_ATOM_maximumSignificantDigits: _bindgen_ty_2 = 146; +pub const JS_ATOM_maximumFractionDigits: _bindgen_ty_2 = 147; +pub const JS_ATOM_not_equal: _bindgen_ty_2 = 148; +pub const JS_ATOM_timed_out: _bindgen_ty_2 = 149; +pub const JS_ATOM_ok: _bindgen_ty_2 = 150; +pub const JS_ATOM_toJSON: _bindgen_ty_2 = 151; +pub const JS_ATOM_Object: _bindgen_ty_2 = 152; +pub const JS_ATOM_Array: _bindgen_ty_2 = 153; +pub const JS_ATOM_Error: _bindgen_ty_2 = 154; +pub const JS_ATOM_Number: _bindgen_ty_2 = 155; +pub const JS_ATOM_String: _bindgen_ty_2 = 156; +pub const JS_ATOM_Boolean: _bindgen_ty_2 = 157; +pub const JS_ATOM_Symbol: _bindgen_ty_2 = 158; +pub const JS_ATOM_Arguments: _bindgen_ty_2 = 159; +pub const JS_ATOM_Math: _bindgen_ty_2 = 160; +pub const JS_ATOM_JSON: _bindgen_ty_2 = 161; +pub const JS_ATOM_Date: _bindgen_ty_2 = 162; +pub const JS_ATOM_Function: _bindgen_ty_2 = 163; +pub const JS_ATOM_GeneratorFunction: _bindgen_ty_2 = 164; +pub const JS_ATOM_ForInIterator: _bindgen_ty_2 = 165; +pub const JS_ATOM_RegExp: _bindgen_ty_2 = 166; +pub const JS_ATOM_ArrayBuffer: _bindgen_ty_2 = 167; +pub const JS_ATOM_SharedArrayBuffer: _bindgen_ty_2 = 168; +pub const JS_ATOM_Uint8ClampedArray: _bindgen_ty_2 = 169; +pub const JS_ATOM_Int8Array: _bindgen_ty_2 = 170; +pub const JS_ATOM_Uint8Array: _bindgen_ty_2 = 171; +pub const JS_ATOM_Int16Array: _bindgen_ty_2 = 172; +pub const JS_ATOM_Uint16Array: _bindgen_ty_2 = 173; +pub const JS_ATOM_Int32Array: _bindgen_ty_2 = 174; +pub const JS_ATOM_Uint32Array: _bindgen_ty_2 = 175; +pub const JS_ATOM_BigInt64Array: _bindgen_ty_2 = 176; +pub const JS_ATOM_BigUint64Array: _bindgen_ty_2 = 177; +pub const JS_ATOM_Float32Array: _bindgen_ty_2 = 178; +pub const JS_ATOM_Float64Array: _bindgen_ty_2 = 179; +pub const JS_ATOM_DataView: _bindgen_ty_2 = 180; +pub const JS_ATOM_BigInt: _bindgen_ty_2 = 181; +pub const JS_ATOM_BigFloat: _bindgen_ty_2 = 182; +pub const JS_ATOM_BigFloatEnv: _bindgen_ty_2 = 183; +pub const JS_ATOM_BigDecimal: _bindgen_ty_2 = 184; +pub const JS_ATOM_OperatorSet: _bindgen_ty_2 = 185; +pub const JS_ATOM_Operators: _bindgen_ty_2 = 186; +pub const JS_ATOM_Map: _bindgen_ty_2 = 187; +pub const JS_ATOM_Set: _bindgen_ty_2 = 188; +pub const JS_ATOM_WeakMap: _bindgen_ty_2 = 189; +pub const JS_ATOM_WeakSet: _bindgen_ty_2 = 190; +pub const JS_ATOM_Map_Iterator: _bindgen_ty_2 = 191; +pub const JS_ATOM_Set_Iterator: _bindgen_ty_2 = 192; +pub const JS_ATOM_Array_Iterator: _bindgen_ty_2 = 193; +pub const JS_ATOM_String_Iterator: _bindgen_ty_2 = 194; +pub const JS_ATOM_RegExp_String_Iterator: _bindgen_ty_2 = 195; +pub const JS_ATOM_Generator: _bindgen_ty_2 = 196; +pub const JS_ATOM_Proxy: _bindgen_ty_2 = 197; +pub const JS_ATOM_Promise: _bindgen_ty_2 = 198; +pub const JS_ATOM_PromiseResolveFunction: _bindgen_ty_2 = 199; +pub const JS_ATOM_PromiseRejectFunction: _bindgen_ty_2 = 200; +pub const JS_ATOM_AsyncFunction: _bindgen_ty_2 = 201; +pub const JS_ATOM_AsyncFunctionResolve: _bindgen_ty_2 = 202; +pub const JS_ATOM_AsyncFunctionReject: _bindgen_ty_2 = 203; +pub const JS_ATOM_AsyncGeneratorFunction: _bindgen_ty_2 = 204; +pub const JS_ATOM_AsyncGenerator: _bindgen_ty_2 = 205; +pub const JS_ATOM_EvalError: _bindgen_ty_2 = 206; +pub const JS_ATOM_RangeError: _bindgen_ty_2 = 207; +pub const JS_ATOM_ReferenceError: _bindgen_ty_2 = 208; +pub const JS_ATOM_SyntaxError: _bindgen_ty_2 = 209; +pub const JS_ATOM_TypeError: _bindgen_ty_2 = 210; +pub const JS_ATOM_URIError: _bindgen_ty_2 = 211; +pub const JS_ATOM_InternalError: _bindgen_ty_2 = 212; +pub const JS_ATOM_Private_brand: _bindgen_ty_2 = 213; +pub const JS_ATOM_Symbol_toPrimitive: _bindgen_ty_2 = 214; +pub const JS_ATOM_Symbol_iterator: _bindgen_ty_2 = 215; +pub const JS_ATOM_Symbol_match: _bindgen_ty_2 = 216; +pub const JS_ATOM_Symbol_matchAll: _bindgen_ty_2 = 217; +pub const JS_ATOM_Symbol_replace: _bindgen_ty_2 = 218; +pub const JS_ATOM_Symbol_search: _bindgen_ty_2 = 219; +pub const JS_ATOM_Symbol_split: _bindgen_ty_2 = 220; +pub const JS_ATOM_Symbol_toStringTag: _bindgen_ty_2 = 221; +pub const JS_ATOM_Symbol_isConcatSpreadable: _bindgen_ty_2 = 222; +pub const JS_ATOM_Symbol_hasInstance: _bindgen_ty_2 = 223; +pub const JS_ATOM_Symbol_species: _bindgen_ty_2 = 224; +pub const JS_ATOM_Symbol_unscopables: _bindgen_ty_2 = 225; +pub const JS_ATOM_Symbol_asyncIterator: _bindgen_ty_2 = 226; +pub const JS_ATOM_Symbol_operatorSet: _bindgen_ty_2 = 227; +pub const JS_ATOM_END: _bindgen_ty_2 = 228; pub type _bindgen_ty_2 = ::std::os::raw::c_uint; diff --git a/sys/src/bindings/x86_64-unknown-linux-musl.rs b/sys/src/bindings/x86_64-unknown-linux-musl.rs index f9679c0e7..ef69496a3 100644 --- a/sys/src/bindings/x86_64-unknown-linux-musl.rs +++ b/sys/src/bindings/x86_64-unknown-linux-musl.rs @@ -31,8 +31,10 @@ pub const JS_EVAL_FLAG_STRICT: u32 = 8; pub const JS_EVAL_FLAG_STRIP: u32 = 16; pub const JS_EVAL_FLAG_COMPILE_ONLY: u32 = 32; pub const JS_EVAL_FLAG_BACKTRACE_BARRIER: u32 = 64; +pub const JS_EVAL_FLAG_ASYNC: u32 = 128; pub const JS_ATOM_NULL: u32 = 0; pub const JS_CALL_FLAG_CONSTRUCTOR: u32 = 1; +pub const JS_INVALID_CLASS_ID: u32 = 0; pub const JS_GPN_STRING_MASK: u32 = 1; pub const JS_GPN_SYMBOL_MASK: u32 = 2; pub const JS_GPN_PRIVATE_MASK: u32 = 4; @@ -458,6 +460,9 @@ extern "C" { extern "C" { pub fn JS_GetClassProto(ctx: *mut JSContext, class_id: JSClassID) -> JSValue; } +extern "C" { + pub fn JS_GetFunctionProto(ctx: *mut JSContext) -> JSValue; +} extern "C" { pub fn JS_NewContextRaw(rt: *mut JSRuntime) -> *mut JSContext; } @@ -1288,6 +1293,9 @@ fn bindgen_test_layout_JSClassDef() { extern "C" { pub fn JS_NewClassID(pclass_id: *mut JSClassID) -> JSClassID; } +extern "C" { + pub fn JS_GetClassID(v: JSValue) -> JSClassID; +} extern "C" { pub fn JS_NewClass( rt: *mut JSRuntime, @@ -1458,6 +1466,9 @@ extern "C" { extern "C" { pub fn JS_IsArray(ctx: *mut JSContext, val: JSValue) -> ::std::os::raw::c_int; } +extern "C" { + pub fn JS_NewDate(ctx: *mut JSContext, epoch_ms: f64) -> JSValue; +} extern "C" { pub fn JS_GetPropertyInternal( ctx: *mut JSContext, @@ -1480,9 +1491,10 @@ extern "C" { extern "C" { pub fn JS_SetPropertyInternal( ctx: *mut JSContext, - this_obj: JSValue, + obj: JSValue, prop: JSAtom, val: JSValue, + this_obj: JSValue, flags: ::std::os::raw::c_int, ) -> ::std::os::raw::c_int; } @@ -1621,9 +1633,6 @@ extern "C" { extern "C" { pub fn JS_GetGlobalObject(ctx: *mut JSContext) -> JSValue; } -extern "C" { - pub fn JS_GetFunctionProto(ctx: *mut JSContext) -> JSValue; -} extern "C" { pub fn JS_IsInstanceOf( ctx: *mut JSContext, @@ -1831,9 +1840,19 @@ extern "C" { sf: *const JSSharedArrayBufferFunctions, ); } +pub const JSPromiseStateEnum_JS_PROMISE_PENDING: JSPromiseStateEnum = 0; +pub const JSPromiseStateEnum_JS_PROMISE_FULFILLED: JSPromiseStateEnum = 1; +pub const JSPromiseStateEnum_JS_PROMISE_REJECTED: JSPromiseStateEnum = 2; +pub type JSPromiseStateEnum = ::std::os::raw::c_uint; extern "C" { pub fn JS_NewPromiseCapability(ctx: *mut JSContext, resolving_funcs: *mut JSValue) -> JSValue; } +extern "C" { + pub fn JS_PromiseState(ctx: *mut JSContext, promise: JSValue) -> JSPromiseStateEnum; +} +extern "C" { + pub fn JS_PromiseResult(ctx: *mut JSContext, promise: JSValue) -> JSValue; +} pub type JSHostPromiseRejectionTracker = ::std::option::Option< unsafe extern "C" fn( ctx: *mut JSContext, @@ -1904,7 +1923,7 @@ extern "C" { pub fn JS_GetModuleName(ctx: *mut JSContext, m: *mut JSModuleDef) -> JSAtom; } extern "C" { - pub fn JS_FreeUnevaluatedModules(ctx: *mut JSContext); + pub fn JS_GetModuleNamespace(ctx: *mut JSContext, m: *mut JSModuleDef) -> JSValue; } pub type JSJobFunc = ::std::option::Option< unsafe extern "C" fn( @@ -1969,11 +1988,11 @@ extern "C" { ) -> JSAtom; } extern "C" { - pub fn JS_RunModule( + pub fn JS_LoadModule( ctx: *mut JSContext, basename: *const ::std::os::raw::c_char, filename: *const ::std::os::raw::c_char, - ) -> *mut JSModuleDef; + ) -> JSValue; } pub const JSCFunctionEnum_JS_CFUNC_generic: JSCFunctionEnum = 0; pub const JSCFunctionEnum_JS_CFUNC_generic_magic: JSCFunctionEnum = 1; @@ -2642,36 +2661,6 @@ extern "C" { len: ::std::os::raw::c_int, ) -> ::std::os::raw::c_int; } -extern "C" { - pub fn JS_DynamicImportSync( - ctx: *mut JSContext, - specifier: *const ::std::os::raw::c_char, - ) -> JSValue; -} -extern "C" { - pub fn JS_GetModuleExport( - ctx: *mut JSContext, - m: *mut JSModuleDef, - export_name: *const ::std::os::raw::c_char, - ) -> JSValue; -} -extern "C" { - pub fn JS_GetModuleExportEntriesCount(m: *mut JSModuleDef) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn JS_GetModuleExportEntry( - ctx: *mut JSContext, - m: *mut JSModuleDef, - idx: ::std::os::raw::c_int, - ) -> JSValue; -} -extern "C" { - pub fn JS_GetModuleExportEntryName( - ctx: *mut JSContext, - m: *mut JSModuleDef, - idx: ::std::os::raw::c_int, - ) -> JSAtom; -} pub const __JS_ATOM_NULL: _bindgen_ty_2 = 0; pub const JS_ATOM_null: _bindgen_ty_2 = 1; pub const JS_ATOM_false: _bindgen_ty_2 = 2; @@ -2725,178 +2714,180 @@ pub const JS_ATOM_fileName: _bindgen_ty_2 = 49; pub const JS_ATOM_lineNumber: _bindgen_ty_2 = 50; pub const JS_ATOM_columnNumber: _bindgen_ty_2 = 51; pub const JS_ATOM_message: _bindgen_ty_2 = 52; -pub const JS_ATOM_errors: _bindgen_ty_2 = 53; -pub const JS_ATOM_stack: _bindgen_ty_2 = 54; -pub const JS_ATOM_name: _bindgen_ty_2 = 55; -pub const JS_ATOM_toString: _bindgen_ty_2 = 56; -pub const JS_ATOM_toLocaleString: _bindgen_ty_2 = 57; -pub const JS_ATOM_valueOf: _bindgen_ty_2 = 58; -pub const JS_ATOM_eval: _bindgen_ty_2 = 59; -pub const JS_ATOM_prototype: _bindgen_ty_2 = 60; -pub const JS_ATOM_constructor: _bindgen_ty_2 = 61; -pub const JS_ATOM_configurable: _bindgen_ty_2 = 62; -pub const JS_ATOM_writable: _bindgen_ty_2 = 63; -pub const JS_ATOM_enumerable: _bindgen_ty_2 = 64; -pub const JS_ATOM_value: _bindgen_ty_2 = 65; -pub const JS_ATOM_get: _bindgen_ty_2 = 66; -pub const JS_ATOM_set: _bindgen_ty_2 = 67; -pub const JS_ATOM_of: _bindgen_ty_2 = 68; -pub const JS_ATOM___proto__: _bindgen_ty_2 = 69; -pub const JS_ATOM_undefined: _bindgen_ty_2 = 70; -pub const JS_ATOM_number: _bindgen_ty_2 = 71; -pub const JS_ATOM_boolean: _bindgen_ty_2 = 72; -pub const JS_ATOM_string: _bindgen_ty_2 = 73; -pub const JS_ATOM_object: _bindgen_ty_2 = 74; -pub const JS_ATOM_symbol: _bindgen_ty_2 = 75; -pub const JS_ATOM_integer: _bindgen_ty_2 = 76; -pub const JS_ATOM_unknown: _bindgen_ty_2 = 77; -pub const JS_ATOM_arguments: _bindgen_ty_2 = 78; -pub const JS_ATOM_callee: _bindgen_ty_2 = 79; -pub const JS_ATOM_caller: _bindgen_ty_2 = 80; -pub const JS_ATOM__eval_: _bindgen_ty_2 = 81; -pub const JS_ATOM__ret_: _bindgen_ty_2 = 82; -pub const JS_ATOM__var_: _bindgen_ty_2 = 83; -pub const JS_ATOM__arg_var_: _bindgen_ty_2 = 84; -pub const JS_ATOM__with_: _bindgen_ty_2 = 85; -pub const JS_ATOM_lastIndex: _bindgen_ty_2 = 86; -pub const JS_ATOM_target: _bindgen_ty_2 = 87; -pub const JS_ATOM_index: _bindgen_ty_2 = 88; -pub const JS_ATOM_input: _bindgen_ty_2 = 89; -pub const JS_ATOM_defineProperties: _bindgen_ty_2 = 90; -pub const JS_ATOM_apply: _bindgen_ty_2 = 91; -pub const JS_ATOM_join: _bindgen_ty_2 = 92; -pub const JS_ATOM_concat: _bindgen_ty_2 = 93; -pub const JS_ATOM_split: _bindgen_ty_2 = 94; -pub const JS_ATOM_construct: _bindgen_ty_2 = 95; -pub const JS_ATOM_getPrototypeOf: _bindgen_ty_2 = 96; -pub const JS_ATOM_setPrototypeOf: _bindgen_ty_2 = 97; -pub const JS_ATOM_isExtensible: _bindgen_ty_2 = 98; -pub const JS_ATOM_preventExtensions: _bindgen_ty_2 = 99; -pub const JS_ATOM_has: _bindgen_ty_2 = 100; -pub const JS_ATOM_deleteProperty: _bindgen_ty_2 = 101; -pub const JS_ATOM_defineProperty: _bindgen_ty_2 = 102; -pub const JS_ATOM_getOwnPropertyDescriptor: _bindgen_ty_2 = 103; -pub const JS_ATOM_ownKeys: _bindgen_ty_2 = 104; -pub const JS_ATOM_add: _bindgen_ty_2 = 105; -pub const JS_ATOM_done: _bindgen_ty_2 = 106; -pub const JS_ATOM_next: _bindgen_ty_2 = 107; -pub const JS_ATOM_values: _bindgen_ty_2 = 108; -pub const JS_ATOM_source: _bindgen_ty_2 = 109; -pub const JS_ATOM_flags: _bindgen_ty_2 = 110; -pub const JS_ATOM_global: _bindgen_ty_2 = 111; -pub const JS_ATOM_unicode: _bindgen_ty_2 = 112; -pub const JS_ATOM_raw: _bindgen_ty_2 = 113; -pub const JS_ATOM_new_target: _bindgen_ty_2 = 114; -pub const JS_ATOM_this_active_func: _bindgen_ty_2 = 115; -pub const JS_ATOM_home_object: _bindgen_ty_2 = 116; -pub const JS_ATOM_computed_field: _bindgen_ty_2 = 117; -pub const JS_ATOM_static_computed_field: _bindgen_ty_2 = 118; -pub const JS_ATOM_class_fields_init: _bindgen_ty_2 = 119; -pub const JS_ATOM_brand: _bindgen_ty_2 = 120; -pub const JS_ATOM_hash_constructor: _bindgen_ty_2 = 121; -pub const JS_ATOM_as: _bindgen_ty_2 = 122; -pub const JS_ATOM_from: _bindgen_ty_2 = 123; -pub const JS_ATOM_meta: _bindgen_ty_2 = 124; -pub const JS_ATOM__default_: _bindgen_ty_2 = 125; -pub const JS_ATOM__star_: _bindgen_ty_2 = 126; -pub const JS_ATOM_Module: _bindgen_ty_2 = 127; -pub const JS_ATOM_then: _bindgen_ty_2 = 128; -pub const JS_ATOM_resolve: _bindgen_ty_2 = 129; -pub const JS_ATOM_reject: _bindgen_ty_2 = 130; -pub const JS_ATOM_promise: _bindgen_ty_2 = 131; -pub const JS_ATOM_proxy: _bindgen_ty_2 = 132; -pub const JS_ATOM_revoke: _bindgen_ty_2 = 133; -pub const JS_ATOM_async: _bindgen_ty_2 = 134; -pub const JS_ATOM_exec: _bindgen_ty_2 = 135; -pub const JS_ATOM_groups: _bindgen_ty_2 = 136; -pub const JS_ATOM_status: _bindgen_ty_2 = 137; -pub const JS_ATOM_reason: _bindgen_ty_2 = 138; -pub const JS_ATOM_globalThis: _bindgen_ty_2 = 139; -pub const JS_ATOM_bigint: _bindgen_ty_2 = 140; -pub const JS_ATOM_bigfloat: _bindgen_ty_2 = 141; -pub const JS_ATOM_bigdecimal: _bindgen_ty_2 = 142; -pub const JS_ATOM_roundingMode: _bindgen_ty_2 = 143; -pub const JS_ATOM_maximumSignificantDigits: _bindgen_ty_2 = 144; -pub const JS_ATOM_maximumFractionDigits: _bindgen_ty_2 = 145; -pub const JS_ATOM_not_equal: _bindgen_ty_2 = 146; -pub const JS_ATOM_timed_out: _bindgen_ty_2 = 147; -pub const JS_ATOM_ok: _bindgen_ty_2 = 148; -pub const JS_ATOM_toJSON: _bindgen_ty_2 = 149; -pub const JS_ATOM_Object: _bindgen_ty_2 = 150; -pub const JS_ATOM_Array: _bindgen_ty_2 = 151; -pub const JS_ATOM_Error: _bindgen_ty_2 = 152; -pub const JS_ATOM_Number: _bindgen_ty_2 = 153; -pub const JS_ATOM_String: _bindgen_ty_2 = 154; -pub const JS_ATOM_Boolean: _bindgen_ty_2 = 155; -pub const JS_ATOM_Symbol: _bindgen_ty_2 = 156; -pub const JS_ATOM_Arguments: _bindgen_ty_2 = 157; -pub const JS_ATOM_Math: _bindgen_ty_2 = 158; -pub const JS_ATOM_JSON: _bindgen_ty_2 = 159; -pub const JS_ATOM_Date: _bindgen_ty_2 = 160; -pub const JS_ATOM_Function: _bindgen_ty_2 = 161; -pub const JS_ATOM_GeneratorFunction: _bindgen_ty_2 = 162; -pub const JS_ATOM_ForInIterator: _bindgen_ty_2 = 163; -pub const JS_ATOM_RegExp: _bindgen_ty_2 = 164; -pub const JS_ATOM_ArrayBuffer: _bindgen_ty_2 = 165; -pub const JS_ATOM_SharedArrayBuffer: _bindgen_ty_2 = 166; -pub const JS_ATOM_Uint8ClampedArray: _bindgen_ty_2 = 167; -pub const JS_ATOM_Int8Array: _bindgen_ty_2 = 168; -pub const JS_ATOM_Uint8Array: _bindgen_ty_2 = 169; -pub const JS_ATOM_Int16Array: _bindgen_ty_2 = 170; -pub const JS_ATOM_Uint16Array: _bindgen_ty_2 = 171; -pub const JS_ATOM_Int32Array: _bindgen_ty_2 = 172; -pub const JS_ATOM_Uint32Array: _bindgen_ty_2 = 173; -pub const JS_ATOM_BigInt64Array: _bindgen_ty_2 = 174; -pub const JS_ATOM_BigUint64Array: _bindgen_ty_2 = 175; -pub const JS_ATOM_Float32Array: _bindgen_ty_2 = 176; -pub const JS_ATOM_Float64Array: _bindgen_ty_2 = 177; -pub const JS_ATOM_DataView: _bindgen_ty_2 = 178; -pub const JS_ATOM_BigInt: _bindgen_ty_2 = 179; -pub const JS_ATOM_BigFloat: _bindgen_ty_2 = 180; -pub const JS_ATOM_BigFloatEnv: _bindgen_ty_2 = 181; -pub const JS_ATOM_BigDecimal: _bindgen_ty_2 = 182; -pub const JS_ATOM_OperatorSet: _bindgen_ty_2 = 183; -pub const JS_ATOM_Operators: _bindgen_ty_2 = 184; -pub const JS_ATOM_Map: _bindgen_ty_2 = 185; -pub const JS_ATOM_Set: _bindgen_ty_2 = 186; -pub const JS_ATOM_WeakMap: _bindgen_ty_2 = 187; -pub const JS_ATOM_WeakSet: _bindgen_ty_2 = 188; -pub const JS_ATOM_Map_Iterator: _bindgen_ty_2 = 189; -pub const JS_ATOM_Set_Iterator: _bindgen_ty_2 = 190; -pub const JS_ATOM_Array_Iterator: _bindgen_ty_2 = 191; -pub const JS_ATOM_String_Iterator: _bindgen_ty_2 = 192; -pub const JS_ATOM_RegExp_String_Iterator: _bindgen_ty_2 = 193; -pub const JS_ATOM_Generator: _bindgen_ty_2 = 194; -pub const JS_ATOM_Proxy: _bindgen_ty_2 = 195; -pub const JS_ATOM_Promise: _bindgen_ty_2 = 196; -pub const JS_ATOM_PromiseResolveFunction: _bindgen_ty_2 = 197; -pub const JS_ATOM_PromiseRejectFunction: _bindgen_ty_2 = 198; -pub const JS_ATOM_AsyncFunction: _bindgen_ty_2 = 199; -pub const JS_ATOM_AsyncFunctionResolve: _bindgen_ty_2 = 200; -pub const JS_ATOM_AsyncFunctionReject: _bindgen_ty_2 = 201; -pub const JS_ATOM_AsyncGeneratorFunction: _bindgen_ty_2 = 202; -pub const JS_ATOM_AsyncGenerator: _bindgen_ty_2 = 203; -pub const JS_ATOM_EvalError: _bindgen_ty_2 = 204; -pub const JS_ATOM_RangeError: _bindgen_ty_2 = 205; -pub const JS_ATOM_ReferenceError: _bindgen_ty_2 = 206; -pub const JS_ATOM_SyntaxError: _bindgen_ty_2 = 207; -pub const JS_ATOM_TypeError: _bindgen_ty_2 = 208; -pub const JS_ATOM_URIError: _bindgen_ty_2 = 209; -pub const JS_ATOM_InternalError: _bindgen_ty_2 = 210; -pub const JS_ATOM_Private_brand: _bindgen_ty_2 = 211; -pub const JS_ATOM_Symbol_toPrimitive: _bindgen_ty_2 = 212; -pub const JS_ATOM_Symbol_iterator: _bindgen_ty_2 = 213; -pub const JS_ATOM_Symbol_match: _bindgen_ty_2 = 214; -pub const JS_ATOM_Symbol_matchAll: _bindgen_ty_2 = 215; -pub const JS_ATOM_Symbol_replace: _bindgen_ty_2 = 216; -pub const JS_ATOM_Symbol_search: _bindgen_ty_2 = 217; -pub const JS_ATOM_Symbol_split: _bindgen_ty_2 = 218; -pub const JS_ATOM_Symbol_toStringTag: _bindgen_ty_2 = 219; -pub const JS_ATOM_Symbol_isConcatSpreadable: _bindgen_ty_2 = 220; -pub const JS_ATOM_Symbol_hasInstance: _bindgen_ty_2 = 221; -pub const JS_ATOM_Symbol_species: _bindgen_ty_2 = 222; -pub const JS_ATOM_Symbol_unscopables: _bindgen_ty_2 = 223; -pub const JS_ATOM_Symbol_asyncIterator: _bindgen_ty_2 = 224; -pub const JS_ATOM_Symbol_operatorSet: _bindgen_ty_2 = 225; -pub const JS_ATOM_END: _bindgen_ty_2 = 226; +pub const JS_ATOM_cause: _bindgen_ty_2 = 53; +pub const JS_ATOM_errors: _bindgen_ty_2 = 54; +pub const JS_ATOM_stack: _bindgen_ty_2 = 55; +pub const JS_ATOM_name: _bindgen_ty_2 = 56; +pub const JS_ATOM_toString: _bindgen_ty_2 = 57; +pub const JS_ATOM_toLocaleString: _bindgen_ty_2 = 58; +pub const JS_ATOM_valueOf: _bindgen_ty_2 = 59; +pub const JS_ATOM_eval: _bindgen_ty_2 = 60; +pub const JS_ATOM_prototype: _bindgen_ty_2 = 61; +pub const JS_ATOM_constructor: _bindgen_ty_2 = 62; +pub const JS_ATOM_configurable: _bindgen_ty_2 = 63; +pub const JS_ATOM_writable: _bindgen_ty_2 = 64; +pub const JS_ATOM_enumerable: _bindgen_ty_2 = 65; +pub const JS_ATOM_value: _bindgen_ty_2 = 66; +pub const JS_ATOM_get: _bindgen_ty_2 = 67; +pub const JS_ATOM_set: _bindgen_ty_2 = 68; +pub const JS_ATOM_of: _bindgen_ty_2 = 69; +pub const JS_ATOM___proto__: _bindgen_ty_2 = 70; +pub const JS_ATOM_undefined: _bindgen_ty_2 = 71; +pub const JS_ATOM_number: _bindgen_ty_2 = 72; +pub const JS_ATOM_boolean: _bindgen_ty_2 = 73; +pub const JS_ATOM_string: _bindgen_ty_2 = 74; +pub const JS_ATOM_object: _bindgen_ty_2 = 75; +pub const JS_ATOM_symbol: _bindgen_ty_2 = 76; +pub const JS_ATOM_integer: _bindgen_ty_2 = 77; +pub const JS_ATOM_unknown: _bindgen_ty_2 = 78; +pub const JS_ATOM_arguments: _bindgen_ty_2 = 79; +pub const JS_ATOM_callee: _bindgen_ty_2 = 80; +pub const JS_ATOM_caller: _bindgen_ty_2 = 81; +pub const JS_ATOM__eval_: _bindgen_ty_2 = 82; +pub const JS_ATOM__ret_: _bindgen_ty_2 = 83; +pub const JS_ATOM__var_: _bindgen_ty_2 = 84; +pub const JS_ATOM__arg_var_: _bindgen_ty_2 = 85; +pub const JS_ATOM__with_: _bindgen_ty_2 = 86; +pub const JS_ATOM_lastIndex: _bindgen_ty_2 = 87; +pub const JS_ATOM_target: _bindgen_ty_2 = 88; +pub const JS_ATOM_index: _bindgen_ty_2 = 89; +pub const JS_ATOM_input: _bindgen_ty_2 = 90; +pub const JS_ATOM_defineProperties: _bindgen_ty_2 = 91; +pub const JS_ATOM_apply: _bindgen_ty_2 = 92; +pub const JS_ATOM_join: _bindgen_ty_2 = 93; +pub const JS_ATOM_concat: _bindgen_ty_2 = 94; +pub const JS_ATOM_split: _bindgen_ty_2 = 95; +pub const JS_ATOM_construct: _bindgen_ty_2 = 96; +pub const JS_ATOM_getPrototypeOf: _bindgen_ty_2 = 97; +pub const JS_ATOM_setPrototypeOf: _bindgen_ty_2 = 98; +pub const JS_ATOM_isExtensible: _bindgen_ty_2 = 99; +pub const JS_ATOM_preventExtensions: _bindgen_ty_2 = 100; +pub const JS_ATOM_has: _bindgen_ty_2 = 101; +pub const JS_ATOM_deleteProperty: _bindgen_ty_2 = 102; +pub const JS_ATOM_defineProperty: _bindgen_ty_2 = 103; +pub const JS_ATOM_getOwnPropertyDescriptor: _bindgen_ty_2 = 104; +pub const JS_ATOM_ownKeys: _bindgen_ty_2 = 105; +pub const JS_ATOM_add: _bindgen_ty_2 = 106; +pub const JS_ATOM_done: _bindgen_ty_2 = 107; +pub const JS_ATOM_next: _bindgen_ty_2 = 108; +pub const JS_ATOM_values: _bindgen_ty_2 = 109; +pub const JS_ATOM_source: _bindgen_ty_2 = 110; +pub const JS_ATOM_flags: _bindgen_ty_2 = 111; +pub const JS_ATOM_global: _bindgen_ty_2 = 112; +pub const JS_ATOM_unicode: _bindgen_ty_2 = 113; +pub const JS_ATOM_raw: _bindgen_ty_2 = 114; +pub const JS_ATOM_new_target: _bindgen_ty_2 = 115; +pub const JS_ATOM_this_active_func: _bindgen_ty_2 = 116; +pub const JS_ATOM_home_object: _bindgen_ty_2 = 117; +pub const JS_ATOM_computed_field: _bindgen_ty_2 = 118; +pub const JS_ATOM_static_computed_field: _bindgen_ty_2 = 119; +pub const JS_ATOM_class_fields_init: _bindgen_ty_2 = 120; +pub const JS_ATOM_brand: _bindgen_ty_2 = 121; +pub const JS_ATOM_hash_constructor: _bindgen_ty_2 = 122; +pub const JS_ATOM_as: _bindgen_ty_2 = 123; +pub const JS_ATOM_from: _bindgen_ty_2 = 124; +pub const JS_ATOM_meta: _bindgen_ty_2 = 125; +pub const JS_ATOM__default_: _bindgen_ty_2 = 126; +pub const JS_ATOM__star_: _bindgen_ty_2 = 127; +pub const JS_ATOM_Module: _bindgen_ty_2 = 128; +pub const JS_ATOM_then: _bindgen_ty_2 = 129; +pub const JS_ATOM_resolve: _bindgen_ty_2 = 130; +pub const JS_ATOM_reject: _bindgen_ty_2 = 131; +pub const JS_ATOM_promise: _bindgen_ty_2 = 132; +pub const JS_ATOM_proxy: _bindgen_ty_2 = 133; +pub const JS_ATOM_revoke: _bindgen_ty_2 = 134; +pub const JS_ATOM_async: _bindgen_ty_2 = 135; +pub const JS_ATOM_exec: _bindgen_ty_2 = 136; +pub const JS_ATOM_groups: _bindgen_ty_2 = 137; +pub const JS_ATOM_indices: _bindgen_ty_2 = 138; +pub const JS_ATOM_status: _bindgen_ty_2 = 139; +pub const JS_ATOM_reason: _bindgen_ty_2 = 140; +pub const JS_ATOM_globalThis: _bindgen_ty_2 = 141; +pub const JS_ATOM_bigint: _bindgen_ty_2 = 142; +pub const JS_ATOM_bigfloat: _bindgen_ty_2 = 143; +pub const JS_ATOM_bigdecimal: _bindgen_ty_2 = 144; +pub const JS_ATOM_roundingMode: _bindgen_ty_2 = 145; +pub const JS_ATOM_maximumSignificantDigits: _bindgen_ty_2 = 146; +pub const JS_ATOM_maximumFractionDigits: _bindgen_ty_2 = 147; +pub const JS_ATOM_not_equal: _bindgen_ty_2 = 148; +pub const JS_ATOM_timed_out: _bindgen_ty_2 = 149; +pub const JS_ATOM_ok: _bindgen_ty_2 = 150; +pub const JS_ATOM_toJSON: _bindgen_ty_2 = 151; +pub const JS_ATOM_Object: _bindgen_ty_2 = 152; +pub const JS_ATOM_Array: _bindgen_ty_2 = 153; +pub const JS_ATOM_Error: _bindgen_ty_2 = 154; +pub const JS_ATOM_Number: _bindgen_ty_2 = 155; +pub const JS_ATOM_String: _bindgen_ty_2 = 156; +pub const JS_ATOM_Boolean: _bindgen_ty_2 = 157; +pub const JS_ATOM_Symbol: _bindgen_ty_2 = 158; +pub const JS_ATOM_Arguments: _bindgen_ty_2 = 159; +pub const JS_ATOM_Math: _bindgen_ty_2 = 160; +pub const JS_ATOM_JSON: _bindgen_ty_2 = 161; +pub const JS_ATOM_Date: _bindgen_ty_2 = 162; +pub const JS_ATOM_Function: _bindgen_ty_2 = 163; +pub const JS_ATOM_GeneratorFunction: _bindgen_ty_2 = 164; +pub const JS_ATOM_ForInIterator: _bindgen_ty_2 = 165; +pub const JS_ATOM_RegExp: _bindgen_ty_2 = 166; +pub const JS_ATOM_ArrayBuffer: _bindgen_ty_2 = 167; +pub const JS_ATOM_SharedArrayBuffer: _bindgen_ty_2 = 168; +pub const JS_ATOM_Uint8ClampedArray: _bindgen_ty_2 = 169; +pub const JS_ATOM_Int8Array: _bindgen_ty_2 = 170; +pub const JS_ATOM_Uint8Array: _bindgen_ty_2 = 171; +pub const JS_ATOM_Int16Array: _bindgen_ty_2 = 172; +pub const JS_ATOM_Uint16Array: _bindgen_ty_2 = 173; +pub const JS_ATOM_Int32Array: _bindgen_ty_2 = 174; +pub const JS_ATOM_Uint32Array: _bindgen_ty_2 = 175; +pub const JS_ATOM_BigInt64Array: _bindgen_ty_2 = 176; +pub const JS_ATOM_BigUint64Array: _bindgen_ty_2 = 177; +pub const JS_ATOM_Float32Array: _bindgen_ty_2 = 178; +pub const JS_ATOM_Float64Array: _bindgen_ty_2 = 179; +pub const JS_ATOM_DataView: _bindgen_ty_2 = 180; +pub const JS_ATOM_BigInt: _bindgen_ty_2 = 181; +pub const JS_ATOM_BigFloat: _bindgen_ty_2 = 182; +pub const JS_ATOM_BigFloatEnv: _bindgen_ty_2 = 183; +pub const JS_ATOM_BigDecimal: _bindgen_ty_2 = 184; +pub const JS_ATOM_OperatorSet: _bindgen_ty_2 = 185; +pub const JS_ATOM_Operators: _bindgen_ty_2 = 186; +pub const JS_ATOM_Map: _bindgen_ty_2 = 187; +pub const JS_ATOM_Set: _bindgen_ty_2 = 188; +pub const JS_ATOM_WeakMap: _bindgen_ty_2 = 189; +pub const JS_ATOM_WeakSet: _bindgen_ty_2 = 190; +pub const JS_ATOM_Map_Iterator: _bindgen_ty_2 = 191; +pub const JS_ATOM_Set_Iterator: _bindgen_ty_2 = 192; +pub const JS_ATOM_Array_Iterator: _bindgen_ty_2 = 193; +pub const JS_ATOM_String_Iterator: _bindgen_ty_2 = 194; +pub const JS_ATOM_RegExp_String_Iterator: _bindgen_ty_2 = 195; +pub const JS_ATOM_Generator: _bindgen_ty_2 = 196; +pub const JS_ATOM_Proxy: _bindgen_ty_2 = 197; +pub const JS_ATOM_Promise: _bindgen_ty_2 = 198; +pub const JS_ATOM_PromiseResolveFunction: _bindgen_ty_2 = 199; +pub const JS_ATOM_PromiseRejectFunction: _bindgen_ty_2 = 200; +pub const JS_ATOM_AsyncFunction: _bindgen_ty_2 = 201; +pub const JS_ATOM_AsyncFunctionResolve: _bindgen_ty_2 = 202; +pub const JS_ATOM_AsyncFunctionReject: _bindgen_ty_2 = 203; +pub const JS_ATOM_AsyncGeneratorFunction: _bindgen_ty_2 = 204; +pub const JS_ATOM_AsyncGenerator: _bindgen_ty_2 = 205; +pub const JS_ATOM_EvalError: _bindgen_ty_2 = 206; +pub const JS_ATOM_RangeError: _bindgen_ty_2 = 207; +pub const JS_ATOM_ReferenceError: _bindgen_ty_2 = 208; +pub const JS_ATOM_SyntaxError: _bindgen_ty_2 = 209; +pub const JS_ATOM_TypeError: _bindgen_ty_2 = 210; +pub const JS_ATOM_URIError: _bindgen_ty_2 = 211; +pub const JS_ATOM_InternalError: _bindgen_ty_2 = 212; +pub const JS_ATOM_Private_brand: _bindgen_ty_2 = 213; +pub const JS_ATOM_Symbol_toPrimitive: _bindgen_ty_2 = 214; +pub const JS_ATOM_Symbol_iterator: _bindgen_ty_2 = 215; +pub const JS_ATOM_Symbol_match: _bindgen_ty_2 = 216; +pub const JS_ATOM_Symbol_matchAll: _bindgen_ty_2 = 217; +pub const JS_ATOM_Symbol_replace: _bindgen_ty_2 = 218; +pub const JS_ATOM_Symbol_search: _bindgen_ty_2 = 219; +pub const JS_ATOM_Symbol_split: _bindgen_ty_2 = 220; +pub const JS_ATOM_Symbol_toStringTag: _bindgen_ty_2 = 221; +pub const JS_ATOM_Symbol_isConcatSpreadable: _bindgen_ty_2 = 222; +pub const JS_ATOM_Symbol_hasInstance: _bindgen_ty_2 = 223; +pub const JS_ATOM_Symbol_species: _bindgen_ty_2 = 224; +pub const JS_ATOM_Symbol_unscopables: _bindgen_ty_2 = 225; +pub const JS_ATOM_Symbol_asyncIterator: _bindgen_ty_2 = 226; +pub const JS_ATOM_Symbol_operatorSet: _bindgen_ty_2 = 227; +pub const JS_ATOM_END: _bindgen_ty_2 = 228; pub type _bindgen_ty_2 = ::std::os::raw::c_uint; diff --git a/sys/src/inlines/common.rs b/sys/src/inlines/common.rs index b9416ee43..4be3dbbf7 100644 --- a/sys/src/inlines/common.rs +++ b/sys/src/inlines/common.rs @@ -171,7 +171,7 @@ pub unsafe fn JS_SetProperty( prop: JSAtom, val: JSValue, ) -> i32 { - JS_SetPropertyInternal(ctx, this_obj, prop, val, JS_PROP_THROW as i32) + JS_SetPropertyInternal(ctx, this_obj, prop, val, this_obj, JS_PROP_THROW as i32) } #[inline] diff --git a/tests/macros/pass_module.rs b/tests/macros/pass_module.rs index 3b5fd1341..e4bb1d3f0 100644 --- a/tests/macros/pass_module.rs +++ b/tests/macros/pass_module.rs @@ -60,7 +60,7 @@ mod test_mod { /// If our module doesn't quite fit with how this macro exports you can manually export from /// the declare and evaluate functions. #[qjs(declare)] - pub fn declare(declare: &mut rquickjs::module::Declarations) -> rquickjs::Result<()> { + pub fn declare(declare: &rquickjs::module::Declarations) -> rquickjs::Result<()> { declare.declare("aManuallyExportedValue")?; Ok(()) } @@ -68,7 +68,7 @@ mod test_mod { #[qjs(evaluate)] pub fn evaluate<'js>( _ctx: &Ctx<'js>, - exports: &mut rquickjs::module::Exports<'js>, + exports: &rquickjs::module::Exports<'js>, ) -> rquickjs::Result<()> { exports.export("aManuallyExportedValue", "Some Value")?; Ok(())