From e16cde07f98a8459398b29d4bd29f3f371f788d6 Mon Sep 17 00:00:00 2001 From: Evan Wallace Date: Fri, 1 Apr 2022 23:36:08 -0400 Subject: [PATCH] async method + super + object + loop test coverage --- scripts/end-to-end-tests.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/scripts/end-to-end-tests.js b/scripts/end-to-end-tests.js index 226d35cad5c..4310b4f31ac 100644 --- a/scripts/end-to-end-tests.js +++ b/scripts/end-to-end-tests.js @@ -4770,8 +4770,16 @@ Derived = class extends Base { static x = async () => class { [super.foo()] = 123 } }; if (new (await Derived.x())().bar === 123) log.push(19); + // Check that an captured temporary for object methods has the correct scope + o = []; + for (let i = 0; i < 3; i++) o.push({ + __proto__: { foo() { return i } }, + async bar() { return super.foo() }, + }) + for (const x of o) log.push(20 + await x.bar()); + const observed = log.join(','); - const expected = '1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19'; + const expected = '1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22'; if (observed !== expected) throw 'fail: ' + observed + ' != ' + expected; } `,