Commit f2c4c598 authored by jameslahm's avatar jameslahm Committed by V8 LUCI CQ

[error] Improve error message for array spread

... on non-iterable object. In CallPrinter::VisitAssignment,
when found_ is true, we could print node->target to show the
error node value, avoid printing twice for the assignment.

Bug: v8:10854
Change-Id: I5f295f46b5639b715f762935e675598d1d780f98
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3586763Reviewed-by: 's avatarToon Verwaest <verwaest@chromium.org>
Commit-Queue: 王澳 <wangao.james@bytedance.com>
Cr-Commit-Position: refs/heads/main@{#79997}
parent 02d8c126
...@@ -343,6 +343,10 @@ void CallPrinter::VisitAssignment(Assignment* node) { ...@@ -343,6 +343,10 @@ void CallPrinter::VisitAssignment(Assignment* node) {
} }
} }
if (!was_found) { if (!was_found) {
if (found_) {
Find(node->target(), true);
return;
}
Find(node->target()); Find(node->target());
if (node->target()->IsArrayLiteral()) { if (node->target()->IsArrayLiteral()) {
// Special case the visit for destructuring array assignment. // Special case the visit for destructuring array assignment.
......
// Copyright 2022 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.
[...(a={})]
*%(basename)s:5: TypeError: a is not iterable
[...(a={})]
^
TypeError: a is not iterable
at *%(basename)s:5:7
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment