repl: deprecate REPLServer.parseREPLKeyword#14223
repl: deprecate REPLServer.parseREPLKeyword#14223lance wants to merge 5 commits intonodejs:masterfrom lance:7619-repl-keyword-deprecation
Conversation
refack
left a comment
There was a problem hiding this comment.
You should add a test that using this function raises the deprecation warning
Ref:
|
@refack test added |
doc/api/repl.md
Outdated
There was a problem hiding this comment.
Nit: (can be done while landing) XXXX should be REPLACEME
|
FWIW: https://ci.nodejs.org/job/node-test-commit/11116/ |
|
lint: |
lib/repl.js
Outdated
There was a problem hiding this comment.
Perhaps rather than passing repl in as an argument, restructure this to assume this === repl ... such that in the util.deprecate call above you can do:
util.deprecate(_parseREPLKeyword, '...', '...');There was a problem hiding this comment.
Wouldn't that just introduce another property on the class?
There was a problem hiding this comment.
@TimothyGu sure, but how is that any better than what is there now? Wouldn't that mean doing something like this?
REPLServer.prototype.parseREPLKeyword = util.deprecate(
function(keyword, rest) {
return _parseREPLKeyword.call(this, keyword, rest);
}, 'REPLServer.parseREPLKeyword() is deprecated', 'DEP0XX');I don't see how this improves the code. Is .call() inherently faster?
There was a problem hiding this comment.
No, in that case you can just
REPLServer.prototype.parseREPLKeyword =
util.deprecate(_parseREPLKeyword,
'REPLServer.parseREPLKeyword() is deprecated', 'DEP0XX');Or am I missing something?
There was a problem hiding this comment.
There should be only one call to common.expectWarning(). The deprecation warning is only going to be emitted once. What calling common.expectWarning() twice does is set up two identical listeners for the process.on('warning') event that is only emitted once.
There was a problem hiding this comment.
I have a local change with only a single call to common.expectWarning(). But what I find confusing is that the tests pass whether there is one or two calls to this. Does common.expectWarning() not fail if the warning isn't issued?
|
@jasnell made changes per your request. PTAL. |
|
Ping @jasnell - it needs a rebase on deprecations.md but otherwise, just following up here... |
There was a problem hiding this comment.
Why separate these out into separate functions like this?
There was a problem hiding this comment.
Only the assumption that there may be future deprecations tests, and the test() function would run them all. I have no particular affinity for this approach though.
jasnell
left a comment
There was a problem hiding this comment.
In general, this looks ok, but the test could use a bit of reworking. LGTM overall tho.
This method does not need to be visible to user code. It has been undocumented since it was introduced which was perhaps v0.8.9, as far as I can tell. This change is as recommended by @jasnell in #7619 (comment). This change is only for `parseREPLKeyword()`.
|
Landed in 766506a |
This method does not need to be visible to user code. It has been undocumented since it was introduced which was perhaps v0.8.9. The motivation for this change is that the method is simply an implementation detail of the REPLServer behavior, and does not need to be exposed to user code. This change adds documentation of the method with a deprecation warning, and a test that the method is actually documented. PR-RUL: #14223 Refs: #7619 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
|
Shouldn’t this have been |
|
(@nodejs/release: This is semver-major and has no valid PR-URL: metadata, any idea how to work around this showing up in |
I don't think there's a way at the moment, we have some of these for 6.x. Maybe teaching |
This method does not need to be visible to user code. It has been undocumented since it was introduced which was perhaps v0.8.9. The motivation for this change is that the method is simply an implementation detail of the REPLServer behavior, and does not need to be exposed to user code. This change adds documentation of the method with a deprecation warning, and a test that the method is actually documented. PR-RUL: #14223 Refs: #7619 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
This method does not need to be visible to user code. It has been
undocumented since it was introduced which was perhaps v0.8.9, as
far as I can tell.
The motivation for this change is that the method is simply an
implementation detail of the
REPLServerbehavior, and doesnot need to be exposed to user code.
This change adds documentation of the method with a deprecation
warning as recommended by @jasnell in
#7619 (comment).
Refs: #7619
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passesAffected core subsystem(s)
repl, doc