codegen: use FromJSValConvertible trait for Promise (#36966)

Before it was only used when converting to a `Record`, using it all the
times allow us to remove two methods.
Plus added a helper method in CodegenRust.py to avoid repeated code.

Testing: a successful build and existing tests should cover the changes.
Fixes: #36410

---------

Signed-off-by: Gae24 <96017547+Gae24@users.noreply.github.com>
This commit is contained in:
Gae24 2025-05-12 13:05:46 +02:00 committed by GitHub
parent d780fb7695
commit c37d5572fd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 27 additions and 118 deletions

View file

@ -11,12 +11,12 @@ pub(crate) mod base {
};
pub(crate) use js::error::throw_type_error;
pub(crate) use js::jsapi::{
CurrentGlobalOrNull, HandleValue as RawHandleValue, HandleValueArray, Heap, IsCallable,
JS_NewObject, JSContext, JSObject,
HandleValue as RawHandleValue, HandleValueArray, Heap, IsCallable, JS_NewObject, JSContext,
JSObject,
};
pub(crate) use js::jsval::{JSVal, NullValue, ObjectOrNullValue, ObjectValue, UndefinedValue};
pub(crate) use js::panic::maybe_resume_unwind;
pub(crate) use js::rust::wrappers::{Call, JS_WrapValue};
pub(crate) use js::rust::wrappers::Call;
pub(crate) use js::rust::{HandleObject, HandleValue, MutableHandleObject, MutableHandleValue};
pub(crate) use crate::callback::{