repl: deprecate REPLServer.rli

This is only a reference to the instance and should not be used.

PR-URL: https://github.com/nodejs/node/pull/26260
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
Ruben Bridgewater 2019-01-21 01:08:22 +01:00
parent 8bb30926fd
commit 584305841d
No known key found for this signature in database
GPG Key ID: F07496B3EB3C1762
3 changed files with 28 additions and 3 deletions

View File

@ -2321,7 +2321,6 @@ Type: Runtime
Please use `Server.prototype.setSecureContext()` instead. Please use `Server.prototype.setSecureContext()` instead.
<a id="DEP0123"></a> <a id="DEP0123"></a>
### DEP0123: setting the TLS ServerName to an IP address ### DEP0123: setting the TLS ServerName to an IP address
<!-- YAML <!-- YAML
@ -2336,6 +2335,19 @@ Type: Runtime
Setting the TLS ServerName to an IP address is not permitted by Setting the TLS ServerName to an IP address is not permitted by
[RFC 6066][]. This will be ignored in a future version. [RFC 6066][]. This will be ignored in a future version.
<a id="DEP0XXX"></a>
### DEP0XXX: using REPLServer.rli
<!-- YAML
changes:
- version: REPLACEME
pr-url: https://github.com/nodejs/node/pull/26260
description: Runtime deprecation.
-->
Type: Runtime
This property is a reference to the instance itself.
[`--pending-deprecation`]: cli.html#cli_pending_deprecation [`--pending-deprecation`]: cli.html#cli_pending_deprecation
[`Buffer.allocUnsafeSlow(size)`]: buffer.html#buffer_class_method_buffer_allocunsafeslow_size [`Buffer.allocUnsafeSlow(size)`]: buffer.html#buffer_class_method_buffer_allocunsafeslow_size
[`Buffer.from(array)`]: buffer.html#buffer_class_method_buffer_from_array [`Buffer.from(array)`]: buffer.html#buffer_class_method_buffer_from_array

View File

@ -176,8 +176,15 @@ function REPLServer(prompt,
// Context id for use with the inspector protocol. // Context id for use with the inspector protocol.
self[kContextId] = undefined; self[kContextId] = undefined;
// Just for backwards compat, see github.com/joyent/node/pull/7127 let rli = self;
self.rli = this; Object.defineProperty(self, 'rli', {
get: util.deprecate(() => rli,
'REPLServer.rli is deprecated', 'DEP0XXX'),
set: util.deprecate((val) => rli = val,
'REPLServer.rli is deprecated', 'DEP0XXX'),
enumerable: true,
configurable: true
});
const savedRegExMatches = ['', '', '', '', '', '', '', '', '', '']; const savedRegExMatches = ['', '', '', '', '', '', '', '', '', ''];
const sep = '\u0000\u0000\u0000'; const sep = '\u0000\u0000\u0000';

View File

@ -25,6 +25,12 @@ const ArrayStream = require('../common/arraystream');
const assert = require('assert'); const assert = require('assert');
const repl = require('repl'); const repl = require('repl');
common.expectWarning({
DeprecationWarning: {
DEP0XXX: 'REPLServer.rli is deprecated'
}
});
// Create a dummy stream that does nothing // Create a dummy stream that does nothing
const stream = new ArrayStream(); const stream = new ArrayStream();