mildew.types.bindings

This module implements the __proto__ field given to each special object such as ScriptObject, ScriptFunction, ScriptArray, and ScriptString, as well as the static methods for Object, Array, Function, and String

────────────────────────────────────────────────────────────────────────────────

Copyright (C) 2021 pillager86.rf.gd

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.

Members

Functions

getArrayPrototype
ScriptObject getArrayPrototype()

Gets the prototype of all arrays

getFunctionPrototype
ScriptObject getFunctionPrototype()

Gets the prototype of all functions

getLocalThis
ScriptAny getLocalThis(Environment env, ScriptAny func)

Determine the local this

getObjectPrototype
ScriptObject getObjectPrototype()

Gets the prototype of Object

getStringPrototype
ScriptObject getStringPrototype()

Gets the prototype of all strings

initializeTypesLibrary
void initializeTypesLibrary(Interpreter interpreter)

Initializes the bindings of builtin types such as Object, Function, String, and Array. This function is not required because these objects already have their __proto__ set correctly when constructed. Documentation for all these classes' methods can be found at https://pillager86.github.io/dmildew/

isIterable
bool isIterable(ScriptAny object)

Returns true if object is an iterable for Array.from

native_Array_s_from
ScriptAny native_Array_s_from(Environment env, ScriptAny* thisObj, ScriptAny[] args, NativeFunctionError nfe)

Creates an Array from any iterable

native_Function_call
ScriptAny native_Function_call(Environment env, ScriptAny* thisIsFn, ScriptAny[] args, NativeFunctionError nfe)

This function provides a way for Mildew functions to be called with arbitrary "this" objects. This function is public so that there is a common interface for calling ScriptFunctions without worrying about the underlying details.

Meta