1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-22 15:24:46 -05:00

fix(ops): quoting serde_v8::Value (#19593)

The following code:

```rust
use deno_core::op;

#[op]
fn ops_serde_v8(value: serde_v8::Value) {
    //
}

fn main() {
    //
}
```

...with the following `Cargo.toml`:

```toml
[package]
name = "playground"
version = "0.1.0"
edition = "2021"

[dependencies]
deno_core = "0.191.0"
serde_v8 = "0.102.0"
```

...will not compile with the error:

```
error[E0433]: failed to resolve: use of undeclared crate or module `v8`
 --> src/main.rs:3:1
  |
3 | #[op]
  | ^^^^^ use of undeclared crate or module `v8`
  |
  = note: this error originates in the attribute macro `op` (in Nightly builds, run with -Z macro-backtrace for more info)
```

This PR is fixing the above issue by properly quoting
`deno_core::v8::Value` instead of `v8::Value`.
This commit is contained in:
Kangwook Lee (이강욱) 2023-06-26 06:41:48 +09:00 committed by GitHub
parent 8fe9b8a4cc
commit d8293cd8bc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View file

@ -145,7 +145,7 @@ impl Transform {
match &self.kind { match &self.kind {
// serde_v8::Value // serde_v8::Value
TransformKind::V8Value => { TransformKind::V8Value => {
*ty = parse_quote! { #core::v8::Local<v8::Value> }; *ty = parse_quote! { #core::v8::Local<#core::v8::Value> };
q!(Vars { var: &ident }, { q!(Vars { var: &ident }, {
let var = serde_v8::Value { v8_value: var }; let var = serde_v8::Value { v8_value: var };

View file

@ -88,7 +88,7 @@ impl op_is_proxy {
#[allow(clippy::too_many_arguments)] #[allow(clippy::too_many_arguments)]
fn op_is_proxy_fast_fn<'scope>( fn op_is_proxy_fast_fn<'scope>(
_: deno_core::v8::Local<deno_core::v8::Object>, _: deno_core::v8::Local<deno_core::v8::Object>,
value: deno_core::v8::Local<v8::Value>, value: deno_core::v8::Local<deno_core::v8::Value>,
) -> bool { ) -> bool {
use deno_core::v8; use deno_core::v8;
use deno_core::_ops; use deno_core::_ops;