LambdaConstructor
A function that can be used as a constructor, with the construction handed off to a lambda. LambdaFunction adds the prototype methods the same way.
This is how the built-in classes are written. Upstream measured it at roughly 15% faster than IdScriptableObject and 25% faster than the reflection-based defineClass, and the resulting code reads much closer to the JavaScript it implements.
Constructors
Callable both with and without new, and either way it returns a wired-up new object.
flags says which of new and a direct call are allowed. Whichever is allowed behaves the same way; the other throws a TypeError.
Behaves differently with and without new: new returns a wired-up object, a direct call does whatever target says. Date is the standard example.
Properties
The scope this function was declared in.
What the name property answers. Empty for an anonymous function.
The object a method was defined on, which super resolves against. Null for a plain function.
A constructor that refuses new still has [Construct], the way Symbol and BigInt do.
[IsExtensible]. Legacy hosts remain extensible until they supply a different contract.
The prototype property: undefined when unset, null when explicitly set to null.
"function", or "undefined" when avoidObjectDetection says so.
Functions
True for an object that has to pretend it is undefined, which only NativeWith does.
Subclasses override this. The base does nothing.
Same as above for a built-in method, which does not get a prototype property.
defineKnownBuiltInPrototypeMethod for a method named by a symbol.
Same as definePrototypeMethod, but the engine can recognise the result by its tag.
[DefineOwnProperty], returning false when the host cannot make the requested definition. The legacy default supports its data-property attributes and refuses accessors or flags that put cannot represent. It does not add storage alongside the host's own properties.
Defines a property whose value comes from a lambda that needs nothing but itself.
Defines a method backed by a Kotlin lambda.
Defines a prototype property through a getter. The result looks exactly like a property defined with Object.defineProperty and an accessor descriptor.
The getter and setter pair version of definePrototypeProperty.
A value another part of the engine parked on this object under key.
Converts this object to a primitive, guided by hint.
[GetOwnProperty]. The legacy default describes a mutable, enumerable, configurable data property. Hosts with accessors or other attributes override this operation.
OrdinaryHasInstance for this function, which instanceof falls back to when there is no Symbol.hasInstance to ask: true when this function's prototype is somewhere in instance's prototype chain, and for a bound function whatever instanceof says of its target.
[OwnPropertyKeys], including non-enumerable names and symbols. Keys use the engine's String, Int-index or Symbol representation. The legacy default lists getIds.
[PreventExtensions]. A legacy host cannot enforce this through put, so it refuses.
Seals the object, so no property can be added, removed or changed.
Attaches data that lives outside the engine, or detaches it with null.
Makes value a non-enumerable, non-deletable, read-only prototype on this function.
[SetPrototypeOf] as the spec states it, answering whether the prototype was set: OrdinarySetPrototypeOf (ES 10.1.2.1), whose cycle check walks [Prototype] directly and stops at an object with its own [GetPrototypeOf], a proxy, without calling into it; and for %Object.prototype%, an immutable prototype exotic object, SetImmutablePrototype (ES 10.4.7). Upstream threw from inside the check, walked through a proxy's getPrototypeOf trap, and let Object.prototype take a new prototype.
Swaps the plain Object prototype for one of a particular kind. Only a few built-ins need this, Boolean among them, because their prototype has to carry an internal slot.
Sets the attributes of name, length and arity, which differ across the natives.