mirror of
https://github.com/denoland/rusty_v8.git
synced 2025-01-13 17:40:23 -05:00
Update generated types/traits, and generate more types (#300)
This commit is contained in:
parent
d42099f9cc
commit
926f3a19da
9 changed files with 63 additions and 49 deletions
|
@ -469,6 +469,10 @@ bool v8__Value__IsSharedArrayBuffer(const v8::Value& self) {
|
|||
|
||||
bool v8__Value__IsProxy(const v8::Value& self) { return self.IsProxy(); }
|
||||
|
||||
bool v8__Value__IsWasmModuleObject(const v8::Value& self) {
|
||||
return self.IsWasmModuleObject();
|
||||
}
|
||||
|
||||
bool v8__Value__IsModuleNamespaceObject(const v8::Value& self) {
|
||||
return self.IsModuleNamespaceObject();
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// Copyright 2019-2020 the Deno authors. All rights reserved. MIT license.
|
||||
use crate::isolate::Isolate;
|
||||
use crate::support::Opaque;
|
||||
use crate::Context;
|
||||
use crate::Local;
|
||||
use crate::Object;
|
||||
use crate::ObjectTemplate;
|
||||
|
@ -19,11 +19,6 @@ extern "C" {
|
|||
fn v8__Context__Global(this: *mut Context) -> *mut Object;
|
||||
}
|
||||
|
||||
/// A sandboxed execution context with its own set of built-in objects and
|
||||
/// functions.
|
||||
#[repr(C)]
|
||||
pub struct Context(Opaque);
|
||||
|
||||
impl Context {
|
||||
/// Creates a new context.
|
||||
pub fn new<'sc>(scope: &mut impl ToLocal<'sc>) -> Local<'sc, Context> {
|
||||
|
|
46
src/data.rs
46
src/data.rs
|
@ -66,6 +66,11 @@ impl Display for TryFromTypeError {
|
|||
|
||||
impl Error for TryFromTypeError {}
|
||||
|
||||
/// A sandboxed execution context with its own set of built-in objects
|
||||
/// and functions.
|
||||
#[repr(C)]
|
||||
pub struct Context(Opaque);
|
||||
|
||||
/// The superclass of objects that can reside on V8's heap.
|
||||
#[repr(C)]
|
||||
pub struct Data(Opaque);
|
||||
|
@ -652,7 +657,6 @@ impl_try_from! { Value for Set if v => v.is_set() }
|
|||
impl_try_from! { Object for Set if v => v.is_set() }
|
||||
|
||||
/// An instance of the built-in SharedArrayBuffer constructor.
|
||||
/// This API is experimental and may change significantly.
|
||||
#[repr(C)]
|
||||
pub struct SharedArrayBuffer(Opaque);
|
||||
|
||||
|
@ -680,6 +684,8 @@ impl_try_from! { Object for SymbolObject if v => v.is_symbol_object() }
|
|||
pub struct WasmModuleObject(Opaque);
|
||||
|
||||
impl_deref! { Object for WasmModuleObject }
|
||||
impl_try_from! { Value for WasmModuleObject if v => v.is_wasm_module_object() }
|
||||
impl_try_from! { Object for WasmModuleObject if v => v.is_wasm_module_object() }
|
||||
|
||||
/// The superclass of primitive values. See ECMA-262 4.3.2.
|
||||
#[repr(C)]
|
||||
|
@ -783,3 +789,41 @@ impl_try_from! { Value for Uint32 if v => v.is_uint32() }
|
|||
impl_try_from! { Primitive for Uint32 if v => v.is_uint32() }
|
||||
impl_try_from! { Number for Uint32 if v => v.is_uint32() }
|
||||
impl_try_from! { Integer for Uint32 if v => v.is_uint32() }
|
||||
|
||||
/// An error message.
|
||||
#[repr(C)]
|
||||
pub struct Message(Opaque);
|
||||
|
||||
/// An array to hold Primitive values. This is used by the embedder to
|
||||
/// pass host defined options to the ScriptOptions during compilation.
|
||||
///
|
||||
/// This is passed back to the embedder as part of
|
||||
/// HostImportModuleDynamicallyCallback for module loading.
|
||||
#[repr(C)]
|
||||
pub struct PrimitiveArray(Opaque);
|
||||
|
||||
/// A compiled JavaScript script, tied to a Context which was active when the
|
||||
/// script was compiled.
|
||||
#[repr(C)]
|
||||
pub struct Script(Opaque);
|
||||
|
||||
/// A container type that holds relevant metadata for module loading.
|
||||
///
|
||||
/// This is passed back to the embedder as part of
|
||||
/// HostImportModuleDynamicallyCallback for module loading.
|
||||
#[repr(C)]
|
||||
pub struct ScriptOrModule(Opaque);
|
||||
|
||||
/// A single JavaScript stack frame.
|
||||
#[repr(C)]
|
||||
pub struct StackFrame(Opaque);
|
||||
|
||||
/// Representation of a JavaScript stack trace. The information collected is a
|
||||
/// snapshot of the execution stack and the information remains valid after
|
||||
/// execution continues.
|
||||
#[repr(C)]
|
||||
pub struct StackTrace(Opaque);
|
||||
|
||||
/// A compiled JavaScript script, not yet tied to a Context.
|
||||
#[repr(C)]
|
||||
pub struct UnboundScript(Opaque);
|
||||
|
|
|
@ -2,9 +2,11 @@
|
|||
|
||||
use crate::isolate::Isolate;
|
||||
use crate::support::int;
|
||||
use crate::support::Opaque;
|
||||
use crate::Context;
|
||||
use crate::Local;
|
||||
use crate::Message;
|
||||
use crate::StackFrame;
|
||||
use crate::StackTrace;
|
||||
use crate::String;
|
||||
use crate::ToLocal;
|
||||
use crate::Value;
|
||||
|
@ -64,12 +66,6 @@ extern "C" {
|
|||
fn v8__Exception__GetStackTrace(exception: Local<Value>) -> *mut StackTrace;
|
||||
}
|
||||
|
||||
/// Representation of a JavaScript stack trace. The information collected is a
|
||||
/// snapshot of the execution stack and the information remains valid after
|
||||
/// execution continues.
|
||||
#[repr(C)]
|
||||
pub struct StackTrace(Opaque);
|
||||
|
||||
impl StackTrace {
|
||||
/// Returns the number of StackFrames.
|
||||
pub fn get_frame_count(&self) -> usize {
|
||||
|
@ -89,10 +85,6 @@ impl StackTrace {
|
|||
}
|
||||
}
|
||||
|
||||
/// A single JavaScript stack frame.
|
||||
#[repr(C)]
|
||||
pub struct StackFrame(Opaque);
|
||||
|
||||
impl StackFrame {
|
||||
/// Returns the number, 1-based, of the line for the associate function call.
|
||||
/// This method will return Message::kNoLineNumberInfo if it is unable to
|
||||
|
@ -170,10 +162,6 @@ impl StackFrame {
|
|||
}
|
||||
}
|
||||
|
||||
/// An error message.
|
||||
#[repr(C)]
|
||||
pub struct Message(Opaque);
|
||||
|
||||
impl Message {
|
||||
pub fn get<'sc>(&self, scope: &mut impl ToLocal<'sc>) -> Local<'sc, String> {
|
||||
unsafe { scope.to_local(v8__Message__Get(self)) }.unwrap()
|
||||
|
|
|
@ -116,7 +116,6 @@ pub mod script_compiler;
|
|||
pub mod V8;
|
||||
|
||||
pub use array_buffer::*;
|
||||
pub use context::Context;
|
||||
pub use data::*;
|
||||
pub use exception::*;
|
||||
pub use external_references::ExternalReference;
|
||||
|
@ -142,7 +141,6 @@ pub use platform::Task;
|
|||
// TODO(ry) TaskBase and TaskImpl ideally shouldn't be part of the public API.
|
||||
pub use platform::TaskBase;
|
||||
pub use platform::TaskImpl;
|
||||
pub use primitive_array::PrimitiveArray;
|
||||
pub use primitives::*;
|
||||
pub use promise::{PromiseRejectEvent, PromiseRejectMessage, PromiseState};
|
||||
pub use property_attribute::*;
|
||||
|
@ -152,8 +150,7 @@ pub use scope::FunctionCallbackScope;
|
|||
pub use scope::PropertyCallbackScope;
|
||||
pub use scope::Scope;
|
||||
pub use scope_traits::*;
|
||||
pub use script::{Script, ScriptOrigin};
|
||||
pub use script_or_module::ScriptOrModule;
|
||||
pub use script::ScriptOrigin;
|
||||
pub use snapshot::FunctionCodeHandling;
|
||||
pub use snapshot::OwnedStartupData;
|
||||
pub use snapshot::SnapshotCreator;
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
// Copyright 2019-2020 the Deno authors. All rights reserved. MIT license.
|
||||
use crate::support::int;
|
||||
use crate::support::Opaque;
|
||||
use crate::Isolate;
|
||||
use crate::Local;
|
||||
use crate::Primitive;
|
||||
use crate::PrimitiveArray;
|
||||
use crate::ToLocal;
|
||||
|
||||
extern "C" {
|
||||
|
@ -28,14 +28,6 @@ extern "C" {
|
|||
) -> *mut Primitive;
|
||||
}
|
||||
|
||||
/// An array to hold Primitive values. This is used by the embedder to pass host
|
||||
/// defined options to the ScriptOptions during compilation.
|
||||
///
|
||||
/// This is passed back to the embedder as part of
|
||||
/// HostImportModuleDynamicallyCallback for module loading.
|
||||
#[repr(C)]
|
||||
pub struct PrimitiveArray(Opaque);
|
||||
|
||||
impl PrimitiveArray {
|
||||
pub fn new<'sc>(
|
||||
scope: &mut impl ToLocal<'sc>,
|
||||
|
|
|
@ -2,11 +2,11 @@ use std::marker::PhantomData;
|
|||
use std::mem::MaybeUninit;
|
||||
use std::ptr::null;
|
||||
|
||||
use crate::support::Opaque;
|
||||
use crate::Boolean;
|
||||
use crate::Context;
|
||||
use crate::Integer;
|
||||
use crate::Local;
|
||||
use crate::Script;
|
||||
use crate::String;
|
||||
use crate::ToLocal;
|
||||
use crate::Value;
|
||||
|
@ -37,11 +37,6 @@ extern "C" {
|
|||
);
|
||||
}
|
||||
|
||||
/// A compiled JavaScript script, tied to a Context which was active when the
|
||||
/// script was compiled.
|
||||
#[repr(C)]
|
||||
pub struct Script(Opaque);
|
||||
|
||||
impl Script {
|
||||
/// A shorthand for ScriptCompiler::Compile().
|
||||
pub fn compile<'sc>(
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// Copyright 2019-2020 the Deno authors. All rights reserved. MIT license.
|
||||
use crate::support::Opaque;
|
||||
use crate::Local;
|
||||
use crate::PrimitiveArray;
|
||||
use crate::ScriptOrModule;
|
||||
use crate::Value;
|
||||
|
||||
extern "C" {
|
||||
|
@ -12,13 +12,6 @@ extern "C" {
|
|||
) -> *mut PrimitiveArray;
|
||||
}
|
||||
|
||||
/// A container type that holds relevant metadata for module loading.
|
||||
///
|
||||
/// This is passed back to the embedder as part of
|
||||
/// HostImportModuleDynamicallyCallback for module loading.
|
||||
#[repr(C)]
|
||||
pub struct ScriptOrModule(Opaque);
|
||||
|
||||
impl ScriptOrModule {
|
||||
/// The name that was passed by the embedder as ResourceName to the
|
||||
/// ScriptOrigin. This can be either a v8::String or v8::Undefined.
|
||||
|
|
|
@ -65,6 +65,7 @@ extern "C" {
|
|||
fn v8__Value__IsDataView(this: &Value) -> bool;
|
||||
fn v8__Value__IsSharedArrayBuffer(this: &Value) -> bool;
|
||||
fn v8__Value__IsProxy(this: &Value) -> bool;
|
||||
fn v8__Value__IsWasmModuleObject(this: &Value) -> bool;
|
||||
fn v8__Value__IsModuleNamespaceObject(this: &Value) -> bool;
|
||||
fn v8__Value__StrictEquals(this: &Value, that: &Value) -> bool;
|
||||
fn v8__Value__SameValue(this: &Value, that: &Value) -> bool;
|
||||
|
@ -382,6 +383,11 @@ impl Value {
|
|||
unsafe { v8__Value__IsProxy(self) }
|
||||
}
|
||||
|
||||
/// Returns true if this value is a WasmModuleObject.
|
||||
pub fn is_wasm_module_object(&self) -> bool {
|
||||
unsafe { v8__Value__IsWasmModuleObject(self) }
|
||||
}
|
||||
|
||||
/// Returns true if the value is a Module Namespace Object.
|
||||
pub fn is_module_namespace_object(&self) -> bool {
|
||||
unsafe { v8__Value__IsModuleNamespaceObject(self) }
|
||||
|
|
Loading…
Reference in a new issue