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.
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.
Same as definePrototypeMethod, but the engine can recognise the result by its tag.
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.
The instanceof operator for function objects: true when this function's prototype property is somewhere in instance's prototype chain.
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.
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.