fix(napi): freeze and seal should be methods of JsObject

This commit is contained in:
LongYinan 2021-11-21 23:11:14 +08:00
parent 4aa56a148c
commit e8cfa0b467
No known key found for this signature in database
GPG key ID: C3666B7FC82ADAD7

View file

@ -254,16 +254,6 @@ macro_rules! impl_js_value_methods {
})?;
Ok(result)
}
#[cfg(feature = "napi8")]
pub fn freeze(&mut self) -> Result<()> {
check_status!(unsafe { sys::napi_object_freeze(self.0.env, self.0.value) })
}
#[cfg(feature = "napi8")]
pub fn seal(&mut self) -> Result<()> {
check_status!(unsafe { sys::napi_object_seal(self.0.env, self.0.value) })
}
}
};
}
@ -572,6 +562,16 @@ macro_rules! impl_object_methods {
})?;
Ok(length)
}
#[cfg(feature = "napi8")]
pub fn freeze(&mut self) -> Result<()> {
check_status!(unsafe { sys::napi_object_freeze(self.0.env, self.0.value) })
}
#[cfg(feature = "napi8")]
pub fn seal(&mut self) -> Result<()> {
check_status!(unsafe { sys::napi_object_seal(self.0.env, self.0.value) })
}
}
};
}