v8/test/mjsunit/regress/regress-v8-12595.js
jameslahm 60ac939f07 [bytecode-generator] dont get value when destructuring assignment with hole
according https://tc39.es/ecma262/#sec-runtime-semantics-iteratordestructuringassignmentevaluation,
when desturcturing assignment with elision, iteratorValue should not be called, thus
the returned object's "value" property should not be read during the assignment.

Bug: v8:12595
Change-Id: Id4b2c236c30486397683b4ccd4d156b718e12df3
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3459922
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Commit-Queue: Leszek Swirski <leszeks@chromium.org>
Cr-Commit-Position: refs/heads/main@{#79093}
2022-02-15 10:53:20 +00:00

19 lines
405 B
JavaScript

// Copyright 2021 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
const iterable = {
[Symbol.iterator]: () => ({
next: () => ({
done: false,
get value() {
assertUnreachable()
print('"value" getter is called');
return 42;
}
})
})
};
[,] = iterable;