about summary refs log tree commit diff stats
path: root/lib/quickjs/quickjs.c
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2023-12-08 10:47:56 +0100
committerbptato <nincsnevem662@gmail.com>2023-12-08 10:48:10 +0100
commitd6afbc0d3829d2860fc3c96e79686e7641761f16 (patch)
treee06b9db8df783a65940a24122398c35bf9f1df1c /lib/quickjs/quickjs.c
parent3efea1faab9651fc0c442b59a00142427c16fed5 (diff)
downloadchawan-d6afbc0d3829d2860fc3c96e79686e7641761f16.tar.gz
Revert "quickjs: add Array.prototype.at"
This reverts commit b7367506fa05e9396e69b1db7277e011722af6b0.

Importing upstream patch instead.
Diffstat (limited to 'lib/quickjs/quickjs.c')
-rw-r--r--lib/quickjs/quickjs.c30
1 files changed, 0 insertions, 30 deletions
diff --git a/lib/quickjs/quickjs.c b/lib/quickjs/quickjs.c
index 9c1d0c84..4e38053d 100644
--- a/lib/quickjs/quickjs.c
+++ b/lib/quickjs/quickjs.c
@@ -38253,35 +38253,6 @@ exception:
     return JS_EXCEPTION;
 }
 
-static JSValue js_array_at(JSContext *ctx, JSValueConst this_val, int argc,
-                           JSValueConst *argv)
-{
-    JSValue obj, val;
-    int64_t len, k;
-
-    obj = JS_ToObject(ctx, this_val);
-    if (JS_IsException(obj))
-        return JS_EXCEPTION;
-
-    if (js_get_length64(ctx, &len, obj))
-        goto exception;
-
-    if (JS_ToInt64Clamp(ctx, &k, argv[0], -1, len, len))
-        goto exception;
-
-    if (k >= len || k < 0) {
-        JS_FreeValue(ctx, obj);
-        return JS_UNDEFINED;
-    }
-
-    val = JS_GetPropertyInt64(ctx, obj, k);
-    JS_FreeValue(ctx, obj);
-    return val;
-exception:
-    JS_FreeValue(ctx, obj);
-    return JS_EXCEPTION;
-}
-
 #define special_every    0
 #define special_some     1
 #define special_forEach  2
@@ -39578,7 +39549,6 @@ static const JSCFunctionListEntry js_iterator_proto_funcs[] = {
 
 static const JSCFunctionListEntry js_array_proto_funcs[] = {
     JS_CFUNC_DEF("concat", 1, js_array_concat ),
-    JS_CFUNC_DEF("at", 1, js_array_at ),
     JS_CFUNC_MAGIC_DEF("every", 1, js_array_every, special_every ),
     JS_CFUNC_MAGIC_DEF("some", 1, js_array_every, special_some ),
     JS_CFUNC_MAGIC_DEF("forEach", 1, js_array_every, special_forEach ),