remove some unneeded functions
This commit is contained in:
@@ -83,12 +83,6 @@ function use_core(path) {
|
||||
|
||||
var blob = use_core('blob')
|
||||
|
||||
// Capture Object and Array methods before they're deleted
|
||||
Object.prototype.toString = function()
|
||||
{
|
||||
return json.encode(this)
|
||||
}
|
||||
|
||||
globalThis.actor = function()
|
||||
{
|
||||
|
||||
@@ -348,7 +342,7 @@ function guid(bits = 256)
|
||||
return text(guid,'h')
|
||||
}
|
||||
|
||||
var HEADER = key()
|
||||
var HEADER = {}
|
||||
|
||||
// takes a function input value that will eventually be called with the current time in number form.
|
||||
$_.clock = function(fn) {
|
||||
|
||||
213
source/quickjs.c
213
source/quickjs.c
@@ -28631,53 +28631,6 @@ static JSValue js_object_defineProperties(JSContext *ctx, JSValueConst this_val,
|
||||
return JS_DupValue(ctx, obj);
|
||||
}
|
||||
|
||||
/* magic = 1 if called as __defineSetter__ */
|
||||
static JSValue js_object___defineGetter__(JSContext *ctx, JSValueConst this_val,
|
||||
int argc, JSValueConst *argv, int magic)
|
||||
{
|
||||
JSValue obj;
|
||||
JSValueConst prop, value, get, set;
|
||||
int ret, flags;
|
||||
JSAtom atom;
|
||||
|
||||
prop = argv[0];
|
||||
value = argv[1];
|
||||
|
||||
obj = JS_ToObject(ctx, this_val);
|
||||
if (JS_IsException(obj))
|
||||
return JS_EXCEPTION;
|
||||
|
||||
if (check_function(ctx, value)) {
|
||||
JS_FreeValue(ctx, obj);
|
||||
return JS_EXCEPTION;
|
||||
}
|
||||
atom = JS_ValueToAtom(ctx, prop);
|
||||
if (unlikely(atom == JS_ATOM_NULL)) {
|
||||
JS_FreeValue(ctx, obj);
|
||||
return JS_EXCEPTION;
|
||||
}
|
||||
flags = JS_PROP_THROW |
|
||||
JS_PROP_HAS_ENUMERABLE | JS_PROP_ENUMERABLE |
|
||||
JS_PROP_HAS_CONFIGURABLE | JS_PROP_CONFIGURABLE;
|
||||
if (magic) {
|
||||
get = JS_NULL;
|
||||
set = value;
|
||||
flags |= JS_PROP_HAS_SET;
|
||||
} else {
|
||||
get = value;
|
||||
set = JS_NULL;
|
||||
flags |= JS_PROP_HAS_GET;
|
||||
}
|
||||
ret = JS_DefineProperty(ctx, obj, atom, JS_NULL, get, set, flags);
|
||||
JS_FreeValue(ctx, obj);
|
||||
JS_FreeAtom(ctx, atom);
|
||||
if (ret < 0) {
|
||||
return JS_EXCEPTION;
|
||||
} else {
|
||||
return JS_NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static JSValue js_object_getOwnPropertyDescriptor(JSContext *ctx, JSValueConst this_val,
|
||||
int argc, JSValueConst *argv, int magic)
|
||||
{
|
||||
@@ -28879,13 +28832,6 @@ static JSValue js_object_getOwnPropertyNames(JSContext *ctx, JSValueConst this_v
|
||||
JS_GPN_STRING_MASK, JS_ITERATOR_KIND_KEY);
|
||||
}
|
||||
|
||||
static JSValue js_object_getOwnPropertySymbols(JSContext *ctx, JSValueConst this_val,
|
||||
int argc, JSValueConst *argv)
|
||||
{
|
||||
return JS_GetOwnPropertyNames2(ctx, argv[0],
|
||||
JS_GPN_SYMBOL_MASK, JS_ITERATOR_KIND_KEY);
|
||||
}
|
||||
|
||||
static JSValue js_object_keys(JSContext *ctx, JSValueConst this_val,
|
||||
int argc, JSValueConst *argv, int kind)
|
||||
{
|
||||
@@ -28938,32 +28884,6 @@ static JSValue js_object_preventExtensions(JSContext *ctx, JSValueConst this_val
|
||||
}
|
||||
}
|
||||
|
||||
static JSValue js_object_hasOwnProperty(JSContext *ctx, JSValueConst this_val,
|
||||
int argc, JSValueConst *argv)
|
||||
{
|
||||
JSValue obj;
|
||||
JSAtom atom;
|
||||
JSObject *p;
|
||||
BOOL ret;
|
||||
|
||||
atom = JS_ValueToAtom(ctx, argv[0]); /* must be done first */
|
||||
if (unlikely(atom == JS_ATOM_NULL))
|
||||
return JS_EXCEPTION;
|
||||
obj = JS_ToObject(ctx, this_val);
|
||||
if (JS_IsException(obj)) {
|
||||
JS_FreeAtom(ctx, atom);
|
||||
return obj;
|
||||
}
|
||||
p = JS_VALUE_GET_OBJ(obj);
|
||||
ret = JS_GetOwnPropertyInternal(ctx, NULL, p, atom);
|
||||
JS_FreeAtom(ctx, atom);
|
||||
JS_FreeValue(ctx, obj);
|
||||
if (ret < 0)
|
||||
return JS_EXCEPTION;
|
||||
else
|
||||
return JS_NewBool(ctx, ret);
|
||||
}
|
||||
|
||||
static JSValue js_object_hasOwn(JSContext *ctx, JSValueConst this_val,
|
||||
int argc, JSValueConst *argv)
|
||||
{
|
||||
@@ -28990,12 +28910,6 @@ static JSValue js_object_hasOwn(JSContext *ctx, JSValueConst this_val,
|
||||
return JS_NewBool(ctx, ret);
|
||||
}
|
||||
|
||||
static JSValue js_object_valueOf(JSContext *ctx, JSValueConst this_val,
|
||||
int argc, JSValueConst *argv)
|
||||
{
|
||||
return JS_ToObject(ctx, this_val);
|
||||
}
|
||||
|
||||
static JSValue js_object_toString(JSContext *ctx, JSValueConst this_val,
|
||||
int argc, JSValueConst *argv)
|
||||
{
|
||||
@@ -29046,12 +28960,6 @@ static JSValue js_object_toString(JSContext *ctx, JSValueConst this_val,
|
||||
return JS_ConcatString3(ctx, "[object ", tag, "]");
|
||||
}
|
||||
|
||||
static JSValue js_object_toLocaleString(JSContext *ctx, JSValueConst this_val,
|
||||
int argc, JSValueConst *argv)
|
||||
{
|
||||
return JS_Invoke(ctx, this_val, JS_ATOM_toString, 0, NULL);
|
||||
}
|
||||
|
||||
static JSValue js_object_assign(JSContext *ctx, JSValueConst this_val,
|
||||
int argc, JSValueConst *argv)
|
||||
{
|
||||
@@ -29131,52 +29039,6 @@ static JSValue js_object_seal(JSContext *ctx, JSValueConst this_val,
|
||||
return JS_EXCEPTION;
|
||||
}
|
||||
|
||||
static JSValue js_object_isSealed(JSContext *ctx, JSValueConst this_val,
|
||||
int argc, JSValueConst *argv, int is_frozen)
|
||||
{
|
||||
JSValueConst obj = argv[0];
|
||||
JSObject *p;
|
||||
JSPropertyEnum *props;
|
||||
uint32_t len, i;
|
||||
int flags, res;
|
||||
|
||||
if (!JS_IsObject(obj))
|
||||
return JS_TRUE;
|
||||
|
||||
p = JS_VALUE_GET_OBJ(obj);
|
||||
flags = JS_GPN_STRING_MASK | JS_GPN_SYMBOL_MASK;
|
||||
if (JS_GetOwnPropertyNamesInternal(ctx, &props, &len, p, flags))
|
||||
return JS_EXCEPTION;
|
||||
|
||||
for(i = 0; i < len; i++) {
|
||||
JSPropertyDescriptor desc;
|
||||
JSAtom prop = props[i].atom;
|
||||
|
||||
res = JS_GetOwnPropertyInternal(ctx, &desc, p, prop);
|
||||
if (res < 0)
|
||||
goto exception;
|
||||
if (res) {
|
||||
js_free_desc(ctx, &desc);
|
||||
if ((desc.flags & JS_PROP_CONFIGURABLE)
|
||||
|| (is_frozen && (desc.flags & JS_PROP_WRITABLE))) {
|
||||
res = FALSE;
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
}
|
||||
res = JS_IsExtensible(ctx, obj);
|
||||
if (res < 0)
|
||||
return JS_EXCEPTION;
|
||||
res ^= 1;
|
||||
done:
|
||||
JS_FreePropertyEnum(ctx, props, len);
|
||||
return JS_NewBool(ctx, res);
|
||||
|
||||
exception:
|
||||
JS_FreePropertyEnum(ctx, props, len);
|
||||
return JS_EXCEPTION;
|
||||
}
|
||||
|
||||
static JSValue js_object_fromEntries(JSContext *ctx, JSValueConst this_val,
|
||||
int argc, JSValueConst *argv)
|
||||
{
|
||||
@@ -29298,51 +29160,6 @@ static JSValue JS_SpeciesConstructor(JSContext *ctx, JSValueConst obj,
|
||||
return species;
|
||||
}
|
||||
|
||||
static JSValue js_object___lookupGetter__(JSContext *ctx, JSValueConst this_val,
|
||||
int argc, JSValueConst *argv, int setter)
|
||||
{
|
||||
JSValue obj, res = JS_EXCEPTION;
|
||||
JSAtom prop = JS_ATOM_NULL;
|
||||
JSPropertyDescriptor desc;
|
||||
int has_prop;
|
||||
|
||||
obj = JS_ToObject(ctx, this_val);
|
||||
if (JS_IsException(obj))
|
||||
goto exception;
|
||||
prop = JS_ValueToAtom(ctx, argv[0]);
|
||||
if (unlikely(prop == JS_ATOM_NULL))
|
||||
goto exception;
|
||||
|
||||
for (;;) {
|
||||
has_prop = JS_GetOwnPropertyInternal(ctx, &desc, JS_VALUE_GET_OBJ(obj), prop);
|
||||
if (has_prop < 0)
|
||||
goto exception;
|
||||
if (has_prop) {
|
||||
if (desc.flags & JS_PROP_GETSET)
|
||||
res = JS_DupValue(ctx, setter ? desc.setter : desc.getter);
|
||||
else
|
||||
res = JS_NULL;
|
||||
js_free_desc(ctx, &desc);
|
||||
break;
|
||||
}
|
||||
obj = JS_GetPrototypeFree(ctx, obj);
|
||||
if (JS_IsException(obj))
|
||||
goto exception;
|
||||
if (JS_IsNull(obj)) {
|
||||
res = JS_NULL;
|
||||
break;
|
||||
}
|
||||
/* avoid infinite loop (possible with proxies) */
|
||||
if (js_poll_interrupts(ctx))
|
||||
goto exception;
|
||||
}
|
||||
|
||||
exception:
|
||||
JS_FreeAtom(ctx, prop);
|
||||
JS_FreeValue(ctx, obj);
|
||||
return res;
|
||||
}
|
||||
|
||||
static const JSCFunctionListEntry js_object_funcs[] = {
|
||||
JS_CFUNC_DEF("create", 2, js_object_create ),
|
||||
JS_CFUNC_MAGIC_DEF("getPrototypeOf", 1, js_object_getPrototypeOf, 0 ),
|
||||
@@ -29350,21 +29167,13 @@ static const JSCFunctionListEntry js_object_funcs[] = {
|
||||
JS_CFUNC_MAGIC_DEF("defineProperty", 3, js_object_defineProperty, 0 ),
|
||||
JS_CFUNC_DEF("defineProperties", 2, js_object_defineProperties ),
|
||||
JS_CFUNC_DEF("getOwnPropertyNames", 1, js_object_getOwnPropertyNames ),
|
||||
JS_CFUNC_DEF("getOwnPropertySymbols", 1, js_object_getOwnPropertySymbols ),
|
||||
JS_CFUNC_MAGIC_DEF("groupBy", 2, js_object_groupBy, 0 ),
|
||||
JS_CFUNC_MAGIC_DEF("keys", 1, js_object_keys, JS_ITERATOR_KIND_KEY ),
|
||||
JS_CFUNC_MAGIC_DEF("values", 1, js_object_keys, JS_ITERATOR_KIND_VALUE ),
|
||||
JS_CFUNC_MAGIC_DEF("entries", 1, js_object_keys, JS_ITERATOR_KIND_KEY_AND_VALUE ),
|
||||
JS_CFUNC_MAGIC_DEF("isExtensible", 1, js_object_isExtensible, 0 ),
|
||||
JS_CFUNC_MAGIC_DEF("preventExtensions", 1, js_object_preventExtensions, 0 ),
|
||||
JS_CFUNC_MAGIC_DEF("getOwnPropertyDescriptor", 2, js_object_getOwnPropertyDescriptor, 0 ),
|
||||
JS_CFUNC_DEF("getOwnPropertyDescriptors", 1, js_object_getOwnPropertyDescriptors ),
|
||||
JS_CFUNC_DEF("is", 2, js_object_is ),
|
||||
JS_CFUNC_DEF("assign", 2, js_object_assign ),
|
||||
JS_CFUNC_MAGIC_DEF("seal", 1, js_object_seal, 0 ),
|
||||
JS_CFUNC_MAGIC_DEF("freeze", 1, js_object_seal, 1 ),
|
||||
JS_CFUNC_MAGIC_DEF("isSealed", 1, js_object_isSealed, 0 ),
|
||||
JS_CFUNC_MAGIC_DEF("isFrozen", 1, js_object_isSealed, 1 ),
|
||||
JS_CFUNC_DEF("__getClass", 1, js_object___getClass ),
|
||||
JS_CFUNC_DEF("fromEntries", 1, js_object_fromEntries ),
|
||||
JS_CFUNC_DEF("hasOwn", 2, js_object_hasOwn ),
|
||||
@@ -29372,13 +29181,6 @@ static const JSCFunctionListEntry js_object_funcs[] = {
|
||||
|
||||
static const JSCFunctionListEntry js_object_proto_funcs[] = {
|
||||
JS_CFUNC_DEF("toString", 0, js_object_toString ),
|
||||
JS_CFUNC_DEF("toLocaleString", 0, js_object_toLocaleString ),
|
||||
JS_CFUNC_DEF("valueOf", 0, js_object_valueOf ),
|
||||
JS_CFUNC_DEF("hasOwnProperty", 1, js_object_hasOwnProperty ),
|
||||
JS_CFUNC_MAGIC_DEF("__defineGetter__", 2, js_object___defineGetter__, 0 ),
|
||||
JS_CFUNC_MAGIC_DEF("__defineSetter__", 2, js_object___defineGetter__, 1 ),
|
||||
JS_CFUNC_MAGIC_DEF("__lookupGetter__", 1, js_object___lookupGetter__, 0 ),
|
||||
JS_CFUNC_MAGIC_DEF("__lookupSetter__", 1, js_object___lookupGetter__, 1 ),
|
||||
};
|
||||
|
||||
/* Function class */
|
||||
@@ -39950,16 +39752,6 @@ static const JSCFunctionListEntry js_cell_stone_funcs[] = {
|
||||
JS_CFUNC_DEF("p", 1, js_cell_stone_p),
|
||||
};
|
||||
|
||||
/* ============================================================================
|
||||
* key() function - create a unique symbol
|
||||
* ============================================================================ */
|
||||
|
||||
static JSValue js_cell_key(JSContext *ctx, JSValueConst this_val,
|
||||
int argc, JSValueConst *argv)
|
||||
{
|
||||
return JS_NewSymbol(ctx, JS_ATOM_NULL, JS_ATOM_TYPE_SYMBOL);
|
||||
}
|
||||
|
||||
/* ============================================================================
|
||||
* reverse() function - reverse an array
|
||||
* ============================================================================ */
|
||||
@@ -40709,11 +40501,6 @@ void JS_AddIntrinsicBaseObjects(JSContext *ctx)
|
||||
JS_NewCFunction(ctx, js_cell_is_proto, "is_proto", 2),
|
||||
JS_PROP_WRITABLE | JS_PROP_CONFIGURABLE);
|
||||
|
||||
/* key() - create a unique symbol */
|
||||
JS_DefinePropertyValueStr(ctx, ctx->global_obj, "key",
|
||||
JS_NewCFunction(ctx, js_cell_key, "key", 0),
|
||||
JS_PROP_WRITABLE | JS_PROP_CONFIGURABLE);
|
||||
|
||||
/* reverse() - reverse an array */
|
||||
JS_DefinePropertyValueStr(ctx, ctx->global_obj, "reverse",
|
||||
JS_NewCFunction(ctx, js_cell_reverse, "reverse", 1),
|
||||
|
||||
Reference in New Issue
Block a user