KnownBuiltInFunction

open class KnownBuiltInFunction(val tag: Any, scope: Scriptable, name: String, length: Int, prototype: Any?, target: SerializableCallable) : LambdaFunction

A LambdaFunction the engine recognises by its tag, so the interpreter and the runtime can treat it specially. Function.prototype.apply and call are the two that matter most.

Constructors

Link copied to clipboard
constructor(tag: Any, scope: Scriptable, name: String, length: Int, prototype: Any?, target: SerializableCallable)

Properties

Link copied to clipboard
open val allIds: Array<Any?>

Every property, enumerable or not.

Link copied to clipboard
open override val arity: Int

What the arity property answers.

Link copied to clipboard
open override val className: String

The class name, as Object.prototype.toString reports it.

Link copied to clipboard

The scope this function was declared in.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
override val functionName: String

What the name property answers. Empty for an anonymous function.

Link copied to clipboard

The object a method was defined on, which super resolves against. Null for a plain function.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
override val length: Int

What the length property answers: how many arguments the function declares.

Link copied to clipboard
open override var parentScope: Scriptable?
Link copied to clipboard
open override var prototype: Scriptable?
Link copied to clipboard

The prototype property: undefined when unset, null when explicitly set to null.

Link copied to clipboard
val tag: Any

What the engine identifies this function by.

Link copied to clipboard
open override val typeOf: String

"function", or "undefined" when avoidObjectDetection says so.

Functions

Link copied to clipboard
fun associateValue(key: Any, value: Any): Any

Parks value under key, or returns what is already there.

Link copied to clipboard

True for an object that has to pretend it is undefined, which only NativeWith does.

Link copied to clipboard
open override fun call(cx: Context, scope: Scriptable, thisObj: Scriptable?, args: Array<Any?>): Any?

Subclasses override this. The base does nothing.

Link copied to clipboard
open override fun construct(cx: Context, scope: Scriptable, args: Array<Any?>): Scriptable
Link copied to clipboard
open fun createObject(cx: Context, scope: Scriptable): Scriptable?

Builds the object that construct passes to call as this. Returning null says that call will make the object itself, and construct then fixes up its scope and prototype.

Link copied to clipboard
fun defineBuiltinProperty(scope: Scriptable, name: String, length: Int, target: SerializableCallable, attributes: Int = DONTENUM, propertyAttributes: Int = DONTENUM or READONLY)

Same as above for a built-in method, which does not get a prototype property.

Link copied to clipboard
open override fun defineConst(name: String, start: Scriptable)
Link copied to clipboard
Link copied to clipboard
fun defineProperty(key: Symbol, value: Any?, attributes: Int)
fun defineProperty(propertyName: String, value: Any?, attributes: Int)

fun defineProperty(name: String, getter: () -> Any??, setter: (Any?) -> Unit?, attributes: Int)

Defines a property whose value comes from a lambda that needs nothing but itself.

fun defineProperty(scope: Scriptable, name: String, length: Int, target: SerializableCallable, attributes: Int = DONTENUM, propertyAttributes: Int = DONTENUM or READONLY)

Defines a method backed by a Kotlin lambda.

Link copied to clipboard
open override fun delete(key: Symbol)
open override fun delete(index: Int)
open override fun delete(name: String)
Link copied to clipboard
operator fun get(key: Any?): Any?
open override fun get(key: Symbol, start: Scriptable): Any?

open override fun get(index: Int, start: Scriptable): Any?

Gets an indexed property, or NOT_FOUND when there is none.

open override fun get(name: String, start: Scriptable): Any?

Gets a named property, or NOT_FOUND when there is none.

Link copied to clipboard

A value another part of the engine parked on this object under key.

Link copied to clipboard
open fun getAttributes(sym: Symbol): Int
open fun getAttributes(index: Int): Int
open fun getAttributes(name: String): Int
Link copied to clipboard
open override fun getDefaultValue(hint: KClass<*>?): Any?

Converts this object to a primitive, guided by hint.

Link copied to clipboard
fun getGetterOrSetter(name: String?, index: Int, scope: Scriptable, isSetter: Boolean): Any?
Link copied to clipboard
open override fun getIds(): Array<Any?>

Every property name of this object alone, ignoring the prototype chain.

Link copied to clipboard
open override fun has(key: Symbol, start: Scriptable): Boolean
open override fun has(index: Int, start: Scriptable): Boolean
open override fun has(name: String, start: Scriptable): Boolean
Link copied to clipboard
open override fun hasInstance(instance: Scriptable): Boolean

The instanceof operator for function objects: true when this function's prototype property is somewhere in instance's prototype chain.

Link copied to clipboard
open override fun isConst(name: String): Boolean
Link copied to clipboard
open fun isEmpty(): Boolean
Link copied to clipboard
Link copied to clipboard
open override fun put(key: Symbol, start: Scriptable, value: Any?)
open override fun put(index: Int, start: Scriptable, value: Any?)
open override fun put(name: String, start: Scriptable, value: Any?)
Link copied to clipboard
open override fun putConst(name: String, start: Scriptable, value: Any?)
Link copied to clipboard

Seals the object, so no property can be added, removed or changed.

Link copied to clipboard
fun setAttributes(key: Symbol, attributes: Int)
fun setAttributes(index: Int, attributes: Int)
open fun setAttributes(name: String, attributes: Int)
Link copied to clipboard

Attaches data that lives outside the engine, or detaches it with null.

Link copied to clipboard
fun setGetterOrSetter(name: Any?, index: Int, getterOrSetter: Callable?, isSetter: Boolean)
Link copied to clipboard

Makes value a non-enumerable, non-deletable, read-only prototype on this function.

Link copied to clipboard
Link copied to clipboard

Sets the attributes of name, length and arity, which differ across the natives.

Link copied to clipboard
open fun size(): Int

Part of what java.util.Map needs. NativeObject finishes the job.