@@ -387,7 +387,10 @@ pub type ConstructorFn = for<'gc> fn(
387387#[ allow( unpredictable_function_pointer_comparisons) ]
388388#[ derive( Debug , Clone , Copy , PartialEq , Eq ) ]
389389pub enum Behaviour {
390+ /// Regular JavaScript function not callable with the `new` keyword.
390391 Regular ( RegularFn ) ,
392+ /// JavaScript function callable with the `new` keyword, and possibly
393+ /// without it.
391394 Constructor ( ConstructorFn ) ,
392395}
393396
@@ -446,27 +449,37 @@ pub(crate) trait BuiltinIntrinsic: Builtin {
446449}
447450/// Helper trait for defining builtin getter function properties.
448451pub trait BuiltinGetter : Builtin {
452+ /// Accessor property's getter function's `name` property value.
449453 const GETTER_NAME : String < ' static > = Self :: NAME ;
454+ /// Accessor property's getter function's call behaviour.
450455 const GETTER_BEHAVIOUR : Behaviour = Self :: BEHAVIOUR ;
451456}
452457/// Helper trait for defining builtin setter function properties.
453458pub trait BuiltinSetter : Builtin {
459+ /// Accessor property's setter function's `name` property value.
454460 const SETTER_NAME : String < ' static > = Self :: NAME ;
461+ /// Accessor property's setter function's call behaviour.
455462 const SETTER_BEHAVIOUR : Behaviour = Self :: BEHAVIOUR ;
456463}
457464
458465/// Builtin function creation arguments.
459466#[ derive( Debug , Default ) ]
460467pub struct BuiltinFunctionArgs < ' a > {
468+ /// The builtin function's `length` property initial value.
461469 pub length : u32 ,
470+ /// The builtin function's `name` property initial value.
462471 pub name : & ' static str ,
472+ /// The builtin function's Realm. Defaults to the current Realm.
463473 pub realm : Option < Realm < ' a > > ,
474+ /// The builtin function's prototype. Defaults to the current Realm's
475+ /// `Function.prototype`
464476 pub prototype : Option < Object < ' a > > ,
477+ /// An optional prefix for the builtin function's name.
465478 pub prefix : Option < & ' static str > ,
466479}
467480
468481impl < ' a > BuiltinFunctionArgs < ' a > {
469- // Create new builtin function creation arguments with length and name.
482+ /// Create new builtin function creation arguments with length and name.
470483 pub fn new ( length : u32 , name : & ' static str ) -> Self {
471484 Self {
472485 length,
@@ -475,7 +488,7 @@ impl<'a> BuiltinFunctionArgs<'a> {
475488 }
476489 }
477490
478- // Create new builtin function creation arguments with length, name, and a realm.
491+ /// Create new builtin function creation arguments with length, name, and a realm.
479492 pub fn new_with_realm ( length : u32 , name : & ' static str , realm : Realm < ' a > ) -> Self {
480493 Self {
481494 length,
0 commit comments