| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 76abf0f commit 7a29f44
3 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -728,6 +728,15 @@ Type: Runtime | |||
| 728 | 728 | deprecated. Please use `fs.ftruncate()` or `fs.ftruncateSync()` to work with | |
| 729 | 729 | file descriptors. | |
| 730 | 730 | ||
| 731 | + <a id="DEP0082"></a> | ||
| 732 | + ### DEP0082: REPLServer.prototype.memory() | ||
| 733 | + | ||
| 734 | + Type: Runtime | ||
| 735 | + | ||
| 736 | + `REPLServer.prototype.memory()` is a function only necessary for the | ||
| 737 | + internal mechanics of the `REPLServer` itself, and is therefore not | ||
| 738 | + necessary in user space. | ||
| 739 | + | ||
| 731 | 740 | ||
| 732 | 741 | [`Buffer.allocUnsafeSlow(size)`]: buffer.html#buffer_class_method_buffer_allocunsafeslow_size | |
| 733 | 742 | [`Buffer.from(array)`]: buffer.html#buffer_class_method_buffer_from_array | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -460,7 +460,7 @@ function REPLServer(prompt, | |||
| 460 | 460 | self.line = prefix; | |
| 461 | 461 | self.cursor = prefix.length; | |
| 462 | 462 | } | |
| 463 | - self.memory(cmd); | ||
| 463 | + _memory.call(self, cmd); | ||
| 464 | 464 | return; | |
| 465 | 465 | } | |
| 466 | 466 | ||
@@ -493,7 +493,7 @@ function REPLServer(prompt, | |||
| 493 | 493 | ||
| 494 | 494 | function finish(e, ret) { | |
| 495 | 495 | debug('finish', e, ret); | |
| 496 | - self.memory(cmd); | ||
| 496 | + _memory.call(self, cmd); | ||
| 497 | 497 | ||
| 498 | 498 | if (e && !self[kBufferedCommandSymbol] && cmd.trim().startsWith('npm ')) { | |
| 499 | 499 | self.outputStream.write('npm should be run outside of the ' + | |
@@ -1113,9 +1113,13 @@ REPLServer.prototype.defineCommand = function(keyword, cmd) { | |||
| 1113 | 1113 | this.commands[keyword] = cmd; | |
| 1114 | 1114 | }; | |
| 1115 | 1115 | ||
| 1116 | - REPLServer.prototype.memory = function memory(cmd) { | ||
| 1117 | - var self = this; | ||
| 1116 | + REPLServer.prototype.memory = util.deprecate( | ||
| 1117 | + _memory, | ||
| 1118 | + 'REPLServer.memory() is deprecated', | ||
| 1119 | + 'DEP0082'); | ||
| 1118 | 1120 | ||
| 1121 | + function _memory(cmd) { | ||
| 1122 | + const self = this; | ||
| 1119 | 1123 | self.lines = self.lines || []; | |
| 1120 | 1124 | self.lines.level = self.lines.level || []; | |
| 1121 | 1125 | ||
@@ -1185,7 +1189,7 @@ REPLServer.prototype.memory = function memory(cmd) { | |||
| 1185 | 1189 | } else { | |
| 1186 | 1190 | self.lines.level = []; | |
| 1187 | 1191 | } | |
| 1188 | - }; | ||
| 1192 | + } | ||
| 1189 | 1193 | ||
| 1190 | 1194 | function addStandardGlobals(completionGroups, filter) { | |
| 1191 | 1195 | // Global object properties | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,15 @@ | |||
| 1 | + 'use strict'; | ||
| 2 | + const common = require('../common'); | ||
| 3 | + const assert = require('assert'); | ||
| 4 | + const repl = require('repl'); | ||
| 5 | + | ||
| 6 | + testMemory(); | ||
| 7 | + | ||
| 8 | + function testMemory() { | ||
| 9 | + const server = repl.start({ prompt: '> ' }); | ||
| 10 | + const warn = 'REPLServer.memory() is deprecated'; | ||
| 11 | + | ||
| 12 | + common.expectWarning('DeprecationWarning', warn); | ||
| 13 | + assert.strictEqual(server.memory(), undefined); | ||
| 14 | + server.close(); | ||
| 15 | + } | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments