Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 5bd6947

Browse filesBrowse files
targosMylesBorins
authored andcommitted
assert: fix line number calculation after V8 upgrade
Backport-PR-URL: #30109 PR-URL: #29694 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Jiawen Geng <technicalcute@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Ujjwal Sharma <usharma1998@gmail.com>
1 parent 6a17aec commit 5bd6947
Copy full SHA for 5bd6947

File tree

Expand file treeCollapse file tree

1 file changed

+4
-1
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+4
-1
lines changed
Open diff view settings
Collapse file

‎lib/assert.js‎

Copy file name to clipboardExpand all lines: lib/assert.js
+4-1Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ function getErrMessage(message, fn) {
268268
const call = err.stack[0];
269269

270270
const filename = call.getFileName();
271-
const line = call.getLineNumber() - 1;
271+
let line = call.getLineNumber() - 1;
272272
let column = call.getColumnNumber() - 1;
273273
let identifier;
274274
let code;
@@ -288,6 +288,9 @@ function getErrMessage(message, fn) {
288288
return message;
289289
}
290290
code = String(fn);
291+
// For functions created with the Function constructor, V8 does not count
292+
// the lines containing the function header.
293+
line += 2;
291294
identifier = `${code}${line}${column}`;
292295
}
293296

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.