From 36275438ade17be9aef2e66e7aa4eb21e86dd446 Mon Sep 17 00:00:00 2001 From: LongYinan Date: Tue, 23 Aug 2022 16:17:53 +0800 Subject: [PATCH] chore(napi): misc cleanup --- crates/macro/src/parser/mod.rs | 6 ++++++ crates/napi/src/bindgen_runtime/js_values/object.rs | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/crates/macro/src/parser/mod.rs b/crates/macro/src/parser/mod.rs index a38db36a..2c068d1b 100644 --- a/crates/macro/src/parser/mod.rs +++ b/crates/macro/src/parser/mod.rs @@ -724,6 +724,12 @@ impl ParseNapi for syn::ItemFn { "#[napi] can't be applied to a function with #[napi(ts_type)]" ); } + if opts.return_if_invalid().is_some() && opts.strict().is_some() { + bail_span!( + self, + "#[napi(return_if_invalid)] can't be used with #[napi(strict)]" + ); + } let napi = self.convert_to_ast(opts); self.to_tokens(tokens); diff --git a/crates/napi/src/bindgen_runtime/js_values/object.rs b/crates/napi/src/bindgen_runtime/js_values/object.rs index 04870e59..9396e6e7 100644 --- a/crates/napi/src/bindgen_runtime/js_values/object.rs +++ b/crates/napi/src/bindgen_runtime/js_values/object.rs @@ -30,7 +30,7 @@ impl Object { check_status!( sys::napi_get_named_property(self.0.env, self.0.value, c_field.as_ptr(), &mut ret), "Failed to get property with field `{}`", - c_field.to_string_lossy(), + field.as_ref(), )?; let ty = type_of!(self.0.env, ret)?;