- 05 Feb, 2020 1 commit
-
-
Sathya Gunasekaran authored
The source position is set to the function call (console.log) not the spread (..x), in the bytecode generator, as the spread operation is done as part of the CallWithSpread bytecode. The CallPrinter stops at the function call and doesn't look at the arguments as well (in CallPrinter::VisitCall) to see if the error is from an incorrect spread operation. With this patch, we pass some state to the CallPrinter in the CallWithSpread error case and check that in CallPrinter::VisitCall before returning. For the given source string: ``` x = undefined; console.log(1, ...x); ``` Previously, the error was - ``` test.js:2: TypeError: console.log is not iterable (cannot read property Symbol(Symbol.iterator)) console.log(1, ...x); ^ TypeError: console.log is not iterable (cannot read property Symbol(Symbol.iterator)) at test.js:2:9 ``` Now, the error is - ``` _test.js:2: TypeError: x is not iterable (cannot read property undefined) console.log(1, ...x); ^ TypeError: x is not iterable (cannot read property undefined) at _test.js:2:9 ``` Bug: v8:10038 Change-Id: I199de9997f1d949c6f9b7b4f41d51f422b8b5131 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2037431Reviewed-by: Jakob Kummerow <jkummerow@chromium.org> Reviewed-by: Leszek Swirski <leszeks@chromium.org> Commit-Queue: Sathya Gunasekaran <gsathya@chromium.org> Cr-Commit-Position: refs/heads/master@{#66131}
-