Skip to content

Commit 3d9e7bb

Browse files
committed
repl: remove unused function convertToContext
PR-URL: #13434 Reviewed-By: Prince John Wesley <[email protected]> Reviewed-By: Tobias Nießen <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Sakthipriyan Vairamani <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent 5ca836c commit 3d9e7bb

File tree

3 files changed

+1
-50
lines changed

3 files changed

+1
-50
lines changed

doc/api/deprecations.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ The `os.getNetworkInterfaces()` method is deprecated. Please use the
237237
<a id="DEP0024"></a>
238238
### DEP0024: REPLServer.prototype.convertToContext()
239239

240-
Type: Runtime
240+
Type: End-of-Life
241241

242242
The `REPLServer.prototype.convertToContext()` API is deprecated and should
243243
not be used.

lib/repl.js

-31
Original file line numberDiff line numberDiff line change
@@ -1223,37 +1223,6 @@ function regexpEscape(s) {
12231223
return s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&');
12241224
}
12251225

1226-
1227-
/**
1228-
* Converts commands that use var and function <name>() to use the
1229-
* local exports.context when evaled. This provides a local context
1230-
* on the REPL.
1231-
*
1232-
* @param {String} cmd The cmd to convert.
1233-
* @return {String} The converted command.
1234-
*/
1235-
// TODO(princejwesley): Remove it prior to v8.0.0 release
1236-
// Reference: https://github.com/nodejs/node/pull/7829
1237-
REPLServer.prototype.convertToContext = util.deprecate(function(cmd) {
1238-
const scopeVar = /^\s*var\s*([\w$]+)(.*)$/m;
1239-
const scopeFunc = /^\s*function\s*([\w$]+)/;
1240-
var matches;
1241-
1242-
// Replaces: var foo = "bar"; with: self.context.foo = bar;
1243-
matches = scopeVar.exec(cmd);
1244-
if (matches && matches.length === 3) {
1245-
return 'self.context.' + matches[1] + matches[2];
1246-
}
1247-
1248-
// Replaces: function foo() {}; with: foo = function foo() {};
1249-
matches = scopeFunc.exec(this.bufferedCommand);
1250-
if (matches && matches.length === 2) {
1251-
return matches[1] + ' = ' + this.bufferedCommand;
1252-
}
1253-
1254-
return cmd;
1255-
}, 'replServer.convertToContext() is deprecated', 'DEP0024');
1256-
12571226
// If the error is that we've unexpectedly ended the input,
12581227
// then let the user try to recover by adding more input.
12591228
function isRecoverableError(e, code) {

test/parallel/test-repl-deprecated.js

-18
This file was deleted.

0 commit comments

Comments
 (0)