Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

console: remove trace frame #27159

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/internal/console/constructor.js
Original file line number Diff line number Diff line change
Expand Up @@ -330,13 +330,13 @@ const consoleMethods = {
trace(kTraceInstant, kTraceConsoleCategory, `time::${label}`, 0);
},

trace(...args) {
trace: function trace(...args) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this strictly needed? I thought the shorthand notation had the same behavior.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the shorthand notation, the function would be called as obj.property. It is not possible to access the function itself by only using the property name. That is only possible inside the old function foo type.

It would also be possible if this would not be a property but a variable.

const err = {
name: 'Trace',
message: this[kFormatForStderr](args)
};
// eslint-disable-next-line no-restricted-syntax
Error.captureStackTrace(err, this.trace);
Error.captureStackTrace(err, trace);
this.error(err.stack);
},

Expand Down
1 change: 0 additions & 1 deletion test/message/console.out
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
Trace: foo
at Object.trace (*)
at Object.<anonymous> (*console.js:*:*)
at *
at *
Expand Down