From 284510f781be23200daedf43dd987afc1dd582b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sa=C3=BAl=20Ibarra=20Corretg=C3=A9?= Date: Thu, 14 Nov 2024 23:36:16 +0100 Subject: [PATCH] Make Iterator.from spec compliant Create a proper wrapper around the inner iterator and proxy the calls to next / return. --- gen/function_source.c | Bin 2749 -> 2749 bytes gen/hello.c | Bin 1416 -> 1416 bytes gen/hello_module.c | Bin 3818 -> 3818 bytes gen/repl.c | Bin 143185 -> 143185 bytes gen/test_fib.c | Bin 2697 -> 2697 bytes quickjs-atom.h | 1 + quickjs.c | 100 ++++++++++++++++++++++++++++++++++-------- test262_errors.txt | 10 ----- 8 files changed, 83 insertions(+), 28 deletions(-) diff --git a/gen/function_source.c b/gen/function_source.c index 0409ecc674a1e43252782f69b2d14f04677668be..3c55b87642a5145c80d983924c158d5aec55dada 100644 GIT binary patch delta 110 zcmdlhx>t0<9!BGhd(Sg6B^ylcV`^YDn#|8E%V;uLmst+T_F)c{G}BQqs4y@FlLlZi z1wA>Et2!g2(IhtU&8yfXK_+iL%Kn210M9WV A%>V!Z delta 110 zcmdlhx>t0<9!8^$d(Sg6C8bX8V`^YDn9R>C%V;!Nmst+T_F)c{G|^Eos4y@FlLlZi z1wN-ajFq}0iVOk$H?Gj>dVz$ngQVx+@0IiE?I!@xvG!Js15X!1rT NYoMad@0eyW0RRFM5sd%< diff --git a/gen/hello_module.c b/gen/hello_module.c index 55cefb401e8a4785240863c4ac6100c0d6598fad..70d43a40a8f1292a27e873c9d1972d092249b91b 100644 GIT binary patch delta 197 zcmaDQ`$~4gCPw3lo3Bh(U=p1?hf#2{JeS1eql__(Mw6A841i=XlMSQEF2rQ9o zGFgEu7id%;m)YdUTq0T^DH9`*>Qoc39*BNq5-gr-I+=;vjL~?qCAS<rB3c-RADrjtiUBc`6y!ykfp?A03?H%Y#5CuPhgS*%ZW`s z%CrEecyl`Q6K0SmU-kw@qs`~oC7DE$QgsvzDh!Olq#=k*1{=p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E(5_b9Gb#0uSkJw6d{pIG?Hnm3o=re7rO>bZ{1>fQ8rmE9 zH$wD#E1=(yj%A(!NcR5HI$(>jXBa)*ny22)E-?dO*Z-hG*I_tRXl-7BDKNk85LWheq;Ir)4DcT^*}n9u8yusH)808bcjt_I%sd?+;qmduS3xIqIEo*0RB|QjvmF#QeOPY|! z{1=`HAYYIHv<7RsdD0EHP5-Z=Ko?CliURnD()jjx5_MG;u=(jA){6E(aYlQvq7DK= z@3sdZgWDJpP|f4*jh2{XhD4N_h_j5CjRD=HQ%<6Z2v#VC61x>0fYi(mhP~ndB5oD| zBe#TBK}?#+P?>=>Uw6RC?J{sOlOQTrWgLK=Gb!XG45w0+i5W%~w+xjLzXf^#K}@F9 zObE7-$=StCklq2Az@;cd+kA^rYPM=-XBu(zBrml;2ee?*!t~GmnLrlGm12}-vtm05 zOT(yr7Pe_@u<7*?S$G_>g!i3sl75*#2Sa=Sv$Hahk+LNGP-Qi;0e&D%|0A`MiYP7+!A4ia a!Q|o93@7ARd7jf*uwE+N8QIbJ=KlcWiP!M} diff --git a/gen/test_fib.c b/gen/test_fib.c index c53b12d8c7fed5e0d013cacd822bc899859def55..53293833c6e47c3e57f788e878f677fdf1f9425a 100644 GIT binary patch delta 192 zcmeAa?G&A`j?sAI`nybg$p$(K1{DUzVA621E{pi&jm(WqCOVUSStKO55ONT8DIj&p z7L!w0JeW;&xF$bj6`dT%#y&ZMRb=vg78^#B$q!h?CL6J;P2R#PJ~^M&b@F{6eVSE- z(Gn=*!I(H%lTD5>39JgJk2x7^hRWm~HbI~qP%npx5y*u.iterator_wrap_data; + if (it) { + JS_FreeValueRT(rt, it->wrapped_iter); + JS_FreeValueRT(rt, it->wrapped_next); + js_free_rt(rt, it); + } +} + +static void js_iterator_wrap_mark(JSRuntime *rt, JSValue val, + JS_MarkFunc *mark_func) +{ + JSObject *p = JS_VALUE_GET_OBJ(val); + JSIteratorWrapData *it = p->u.iterator_wrap_data; + if (it) { + JS_MarkValue(rt, it->wrapped_iter, mark_func); + JS_MarkValue(rt, it->wrapped_next, mark_func); + } +} + +static JSValue js_iterator_wrap_next(JSContext *ctx, JSValue this_val, + int argc, JSValue *argv, + BOOL *pdone, int magic) +{ + JSIteratorWrapData *it; + JSValue method, ret; + it = JS_GetOpaque2(ctx, this_val, JS_CLASS_ITERATOR_WRAP); + if (!it) + return JS_EXCEPTION; + if (magic == GEN_MAGIC_NEXT) + return JS_IteratorNext(ctx, it->wrapped_iter, it->wrapped_next, argc, argv, pdone); + method = JS_GetProperty(ctx, it->wrapped_iter, JS_ATOM_return); + if (JS_IsException(method)) + return JS_EXCEPTION; + if (JS_IsNull(method) || JS_IsUndefined(method)) { + *pdone = TRUE; + return JS_UNDEFINED; + } + ret = JS_IteratorNext2(ctx, it->wrapped_iter, method, argc, argv, pdone); + JS_FreeValue(ctx, method); + return ret; +} + +static const JSCFunctionListEntry js_iterator_wrap_proto_funcs[] = { + JS_ITERATOR_NEXT_DEF("next", 0, js_iterator_wrap_next, GEN_MAGIC_NEXT ), + JS_ITERATOR_NEXT_DEF("return", 0, js_iterator_wrap_next, GEN_MAGIC_RETURN ), +}; + static JSValue js_iterator_constructor(JSContext *ctx, JSValue new_target, int argc, JSValue *argv) { @@ -40077,7 +40138,8 @@ static JSValue js_iterator_constructor(JSContext *ctx, JSValue new_target, static JSValue js_iterator_from(JSContext *ctx, JSValue this_val, int argc, JSValue *argv) { - JSValue obj, method, iter, temp; + JSValue obj, method, iter; + JSIteratorWrapData *it; int ret; obj = argv[0]; @@ -40101,22 +40163,15 @@ static JSValue js_iterator_from(JSContext *ctx, JSValue this_val, method = JS_GetProperty(ctx, obj, JS_ATOM_next); if (JS_IsException(method)) return JS_EXCEPTION; - // honestly kind of ghetto but avoids having to - // define a separate JS_CLASS_NON_GHETTO_ITERATOR - temp = method; - method = js_function_bind(ctx, method, 1, &obj); - JS_FreeValue(ctx, temp); - if (JS_IsException(method)) - return JS_EXCEPTION; - iter = JS_NewObjectProtoClass(ctx, ctx->class_proto[JS_CLASS_ITERATOR], JS_CLASS_ITERATOR); - if (JS_IsException(iter)) { - JS_FreeValue(ctx, method); - return JS_EXCEPTION; - } - if (JS_SetProperty(ctx, iter, JS_ATOM_next, method) < 0) { - JS_FreeValue(ctx, iter); - return JS_EXCEPTION; - } + iter = JS_NewObjectClass(ctx, JS_CLASS_ITERATOR_WRAP); + if (JS_IsException(iter)) + goto fail; + it = js_malloc(ctx, sizeof(*it)); + if (!it) + goto fail; + it->wrapped_iter = js_dup(obj); + it->wrapped_next = method; + JS_SetOpaqueInternal(iter, it); } else { iter = JS_GetIterator2(ctx, obj, method); JS_FreeValue(ctx, method); @@ -40124,6 +40179,10 @@ static JSValue js_iterator_from(JSContext *ctx, JSValue this_val, return JS_EXCEPTION; } return iter; +fail: + JS_FreeValue(ctx, method); + JS_FreeValue(ctx, iter); + return JS_EXCEPTION; } static JSValue js_create_iterator_helper(JSContext *ctx, JSValue iterator, @@ -51544,6 +51603,11 @@ void JS_AddIntrinsicBaseObjects(JSContext *ctx) js_iterator_helper_proto_funcs, countof(js_iterator_helper_proto_funcs)); + ctx->class_proto[JS_CLASS_ITERATOR_WRAP] = JS_NewObjectProto(ctx, ctx->class_proto[JS_CLASS_ITERATOR]); + JS_SetPropertyFunctionList(ctx, ctx->class_proto[JS_CLASS_ITERATOR_WRAP], + js_iterator_wrap_proto_funcs, + countof(js_iterator_wrap_proto_funcs)); + /* Array */ JS_SetPropertyFunctionList(ctx, ctx->class_proto[JS_CLASS_ARRAY], js_array_proto_funcs, diff --git a/test262_errors.txt b/test262_errors.txt index de4f7dc..7e5528f 100644 --- a/test262_errors.txt +++ b/test262_errors.txt @@ -42,16 +42,6 @@ test262/test/built-ins/Date/prototype/setUTCMonth/date-value-read-before-tonumbe test262/test/built-ins/Date/prototype/setUTCMonth/date-value-read-before-tonumber-when-date-is-invalid.js:26: strict mode: Test262Error: time updated in valueOf Expected SameValue(«NaN», «0») to be true test262/test/built-ins/Date/prototype/setUTCSeconds/date-value-read-before-tonumber-when-date-is-invalid.js:26: Test262Error: time updated in valueOf Expected SameValue(«NaN», «0») to be true test262/test/built-ins/Date/prototype/setUTCSeconds/date-value-read-before-tonumber-when-date-is-invalid.js:26: strict mode: Test262Error: time updated in valueOf Expected SameValue(«NaN», «0») to be true -test262/test/built-ins/Iterator/from/get-return-method-when-call-return.js:24: TypeError: not a function -test262/test/built-ins/Iterator/from/get-return-method-when-call-return.js:24: strict mode: TypeError: not a function -test262/test/built-ins/Iterator/from/result-proto.js:10: unexpected error: Test262Error: Expected SameValue(«[object Object]», «[object Iterator]») to be true -test262/test/built-ins/Iterator/from/result-proto.js:10: strict mode: unexpected error: Test262Error: Expected SameValue(«[object Object]», «[object Iterator]») to be true -test262/test/built-ins/Iterator/from/return-method-calls-base-return-method.js:29: TypeError: not a function -test262/test/built-ins/Iterator/from/return-method-calls-base-return-method.js:29: strict mode: TypeError: not a function -test262/test/built-ins/Iterator/from/return-method-returns-iterator-result.js:18: TypeError: not a function -test262/test/built-ins/Iterator/from/return-method-returns-iterator-result.js:18: strict mode: TypeError: not a function -test262/test/built-ins/Iterator/from/return-method-throws-for-invalid-this.js:16: TypeError: not a function -test262/test/built-ins/Iterator/from/return-method-throws-for-invalid-this.js:16: strict mode: TypeError: not a function test262/test/built-ins/Iterator/prototype/constructor/prop-desc.js:10: Test262Error: Expected SameValue(«"undefined"», «"function"») to be true test262/test/built-ins/Iterator/prototype/constructor/prop-desc.js:10: strict mode: Test262Error: Expected SameValue(«"undefined"», «"function"») to be true test262/test/built-ins/Iterator/prototype/constructor/weird-setter.js:23: TypeError: cannot read property 'call' of undefined