Skip to content

Commit 5981fb7

Browse files
targosMylesBorins
authored andcommitted
assert: fix line number calculation after V8 upgrade
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 1676502 commit 5981fb7

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

‎lib/assert.js‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ function getErrMessage(message, fn) {
269269
constcall=err.stack[0];
270270

271271
constfilename=call.getFileName();
272-
constline=call.getLineNumber()-1;
272+
letline=call.getLineNumber()-1;
273273
letcolumn=call.getColumnNumber()-1;
274274
letidentifier;
275275
letcode;
@@ -289,6 +289,9 @@ function getErrMessage(message, fn) {
289289
returnmessage;
290290
}
291291
code=String(fn);
292+
// For functions created with the Function constructor, V8 does not count
293+
// the lines containing the function header.
294+
line+=2;
292295
identifier=`${code}${line}${column}`;
293296
}
294297

0 commit comments

Comments
 (0)