Skip to content

Commit 55852fe

Browse files
targosgibfahn
authored andcommitted
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 <adamk@chromium.org> Commit-Queue: Sathya Gunasekaran <gsathya@chromium.org> Cr-Commit-Position: refs/heads/master@{nodejs#49042} PR-URL: nodejs#18060 Backport-PR-URL: nodejs#16413 Fixes: nodejs#15386 Refs: v8/v8@c3458a8 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
1 parent de532dd commit 55852fe

6 files changed

+37
-1
lines changed

deps/v8/include/v8-version.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#define V8_MAJOR_VERSION 6
1212
#define V8_MINOR_VERSION 2
1313
#define V8_BUILD_NUMBER 414
14-
#define V8_PATCH_LEVEL 48
14+
#define V8_PATCH_LEVEL 49
1515

1616
// Use 1 for candidates and 0 otherwise.
1717
// (Boolean macro values are not supported by all preprocessors.)

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)