Skip to content

Commit 506d85b

Browse files
committed
deps: cherry-pick c3458a8 from upstream V8
Original commit message: [parser] Add new FunctionNameInferrer state before parsing param Create new state before parsing FormalParameter because we don't want to use any of the parameters as an inferred function name. Previously the stacktrace was: test.js:3: Error: boom throw new Error('boom'); ^ Error: boom at param (test.js:3:11) at test.js:4:5 at test.js:6:3 The stacktrace with this patch: test.js:3: Error: boom throw new Error('boom'); ^ Error: boom at test.js:3:11 at test.js:4:5 at test.js:6:3 Bug: v8:6822, v8:6513 Change-Id: Ifbadc660fc4e85248af405acd67c025f11662bd4 Reviewed-on: https://chromium-review.googlesource.com/742657 Reviewed-by: Adam Klein <[email protected]> Commit-Queue: Sathya Gunasekaran <[email protected]> Cr-Commit-Position: refs/heads/master@{#49042} PR-URL: #18060 Fixes: #15386 Refs: v8/v8@c3458a8 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
1 parent 39970e9 commit 506d85b

6 files changed

+37
-1
lines changed

common.gypi

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828
# Reset this number to 0 on major V8 upgrades.
2929
# Increment by one for each non-official patch applied to deps/v8.
30-
'v8_embedder_string': '-node.17',
30+
'v8_embedder_string': '-node.18',
3131

3232
# Enable disassembler for `--print-code` v8 options
3333
'v8_enable_disassembler': 1,

deps/v8/src/parsing/parser-base.h

+1
Original file line numberDiff line numberDiff line change
@@ -3634,6 +3634,7 @@ void ParserBase<Impl>::ParseFormalParameter(FormalParametersT* parameters,
36343634
// BindingElement[?Yield, ?GeneratorParameter]
36353635
bool is_rest = parameters->has_rest;
36363636

3637+
FuncNameInferrer::State fni_state(fni_);
36373638
ExpressionT pattern = ParsePrimaryExpression(CHECK_OK_CUSTOM(Void));
36383639
ValidateBindingPattern(CHECK_OK_CUSTOM(Void));
36393640

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// Copyright 2017 the V8 project authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
5+
(function (param = function() { throw new Error('boom') }) {
6+
(() => {
7+
param();
8+
})();
9+
10+
})();
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
*%(basename)s:5: Error: boom
2+
(function (param = function() { throw new Error('boom') }) {
3+
^
4+
Error: boom
5+
at param (*%(basename)s:5:39)
6+
at *%(basename)s:7:5
7+
at *%(basename)s:8:5
8+
at *%(basename)s:10:3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// Copyright 2017 the V8 project authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
5+
(function (param) {
6+
(() => {
7+
throw new Error('boom');
8+
})();
9+
10+
})();
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
*%(basename)s:7: Error: boom
2+
throw new Error('boom');
3+
^
4+
Error: boom
5+
at *%(basename)s:7:11
6+
at *%(basename)s:8:5
7+
at *%(basename)s:10:3

0 commit comments

Comments
 (0)