summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikolai Vavilov <vvnicholas@gmail.com>2017-06-03 14:11:13 +0300
committerNikolai Vavilov <vvnicholas@gmail.com>2017-06-05 13:30:05 +0300
commit3d9e7bb1d467765c0dc391798d8f954c98be095e (patch)
tree2728c4d1cf18b778aa9f6c41e68016975596d067
parent5ca836c192a046d94f28e6f7cb31a3749671624b (diff)
downloadandroid-node-v8-3d9e7bb1d467765c0dc391798d8f954c98be095e.tar.gz
android-node-v8-3d9e7bb1d467765c0dc391798d8f954c98be095e.tar.bz2
android-node-v8-3d9e7bb1d467765c0dc391798d8f954c98be095e.zip
repl: remove unused function convertToContext
PR-URL: https://github.com/nodejs/node/pull/13434 Reviewed-By: Prince John Wesley <princejohnwesley@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
-rw-r--r--doc/api/deprecations.md2
-rw-r--r--lib/repl.js31
-rw-r--r--test/parallel/test-repl-deprecated.js18
3 files changed, 1 insertions, 50 deletions
diff --git a/doc/api/deprecations.md b/doc/api/deprecations.md
index b66b9c5a5c..e41e942fc1 100644
--- a/doc/api/deprecations.md
+++ b/doc/api/deprecations.md
@@ -237,7 +237,7 @@ The `os.getNetworkInterfaces()` method is deprecated. Please use the
<a id="DEP0024"></a>
### DEP0024: REPLServer.prototype.convertToContext()
-Type: Runtime
+Type: End-of-Life
The `REPLServer.prototype.convertToContext()` API is deprecated and should
not be used.
diff --git a/lib/repl.js b/lib/repl.js
index 670dbfbc87..051261a679 100644
--- a/lib/repl.js
+++ b/lib/repl.js
@@ -1223,37 +1223,6 @@ function regexpEscape(s) {
return s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&');
}
-
-/**
- * Converts commands that use var and function <name>() to use the
- * local exports.context when evaled. This provides a local context
- * on the REPL.
- *
- * @param {String} cmd The cmd to convert.
- * @return {String} The converted command.
- */
-// TODO(princejwesley): Remove it prior to v8.0.0 release
-// Reference: https://github.com/nodejs/node/pull/7829
-REPLServer.prototype.convertToContext = util.deprecate(function(cmd) {
- const scopeVar = /^\s*var\s*([\w$]+)(.*)$/m;
- const scopeFunc = /^\s*function\s*([\w$]+)/;
- var matches;
-
- // Replaces: var foo = "bar"; with: self.context.foo = bar;
- matches = scopeVar.exec(cmd);
- if (matches && matches.length === 3) {
- return 'self.context.' + matches[1] + matches[2];
- }
-
- // Replaces: function foo() {}; with: foo = function foo() {};
- matches = scopeFunc.exec(this.bufferedCommand);
- if (matches && matches.length === 2) {
- return matches[1] + ' = ' + this.bufferedCommand;
- }
-
- return cmd;
-}, 'replServer.convertToContext() is deprecated', 'DEP0024');
-
// If the error is that we've unexpectedly ended the input,
// then let the user try to recover by adding more input.
function isRecoverableError(e, code) {
diff --git a/test/parallel/test-repl-deprecated.js b/test/parallel/test-repl-deprecated.js
deleted file mode 100644
index 551f2c3036..0000000000
--- a/test/parallel/test-repl-deprecated.js
+++ /dev/null
@@ -1,18 +0,0 @@
-'use strict';
-const common = require('../common');
-const assert = require('assert');
-const repl = require('repl');
-
-common.expectWarning('DeprecationWarning',
- 'replServer.convertToContext() is deprecated');
-
-// Create a dummy stream that does nothing
-const stream = new common.ArrayStream();
-
-const replServer = repl.start({
- input: stream,
- output: stream
-});
-
-const cmd = replServer.convertToContext('var name = "nodejs"');
-assert.strictEqual(cmd, 'self.context.name = "nodejs"');