| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent d36b60e commit 58e645d
6 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -3019,14 +3019,17 @@ it was an aborted or graceful destroy. | |||
| 3019 | 3019 | ||
| 3020 | 3020 | <!-- YAML | |
| 3021 | 3021 | changes: | |
| 3022 | + - version: REPLACEME | ||
| 3023 | + pr-url: https://github.com/nodejs/node/pull/40773 | ||
| 3024 | + description: End-of-life. | ||
| 3022 | 3025 | - version: | |
| 3023 | 3026 | - v17.2.0 | |
| 3024 | 3027 | - v16.14.0 | |
| 3025 | 3028 | pr-url: https://github.com/nodejs/node/pull/40860 | |
| 3026 | 3029 | description: Documentation-only deprecation. | |
| 3027 | 3030 | --> | |
| 3028 | 3031 | ||
| 3029 | - Type: Documentation-only | ||
| 3032 | + Type: End-of-Life | ||
| 3030 | 3033 | ||
| 3031 | 3034 | An undocumented feature of Node.js streams was to support thenables in | |
| 3032 | 3035 | implementation methods. This is now deprecated, use callbacks instead and avoid | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -106,20 +106,7 @@ function _destroy(self, err, cb) { | |||
| 106 | 106 | } | |
| 107 | 107 | } | |
| 108 | 108 | try { | |
| 109 | - const result = self._destroy(err || null, onDestroy); | ||
| 110 | - if (result != null) { | ||
| 111 | - const then = result.then; | ||
| 112 | - if (typeof then === 'function') { | ||
| 113 | - then.call( | ||
| 114 | - result, | ||
| 115 | - function() { | ||
| 116 | - process.nextTick(onDestroy, null); | ||
| 117 | - }, | ||
| 118 | - function(err) { | ||
| 119 | - process.nextTick(onDestroy, err); | ||
| 120 | - }); | ||
| 121 | - } | ||
| 122 | - } | ||
| 109 | + self._destroy(err || null, onDestroy); | ||
| 123 | 110 | } catch (err) { | |
| 124 | 111 | onDestroy(err); | |
| 125 | 112 | } | |
@@ -285,24 +272,7 @@ function constructNT(stream) { | |||
| 285 | 272 | } | |
| 286 | 273 | ||
| 287 | 274 | try { | |
| 288 | - const result = stream._construct(onConstruct); | ||
| 289 | - if (result != null) { | ||
| 290 | - const then = result.then; | ||
| 291 | - if (typeof then === 'function') { | ||
| 292 | - then.call( | ||
| 293 | - result, | ||
| 294 | - function() { | ||
| 295 | - if (!called) { | ||
| 296 | - process.nextTick(onConstruct, null); | ||
| 297 | - } | ||
| 298 | - }, | ||
| 299 | - function(err) { | ||
| 300 | - if (!called) { | ||
| 301 | - process.nextTick(onConstruct, err); | ||
| 302 | - } | ||
| 303 | - }); | ||
| 304 | - } | ||
| 305 | - } | ||
| 275 | + stream._construct(onConstruct); | ||
| 306 | 276 | } catch (err) { | |
| 307 | 277 | onConstruct(err); | |
| 308 | 278 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -493,18 +493,7 @@ Readable.prototype.read = function(n) { | |||
| 493 | 493 | ||
| 494 | 494 | // Call internal read method | |
| 495 | 495 | try { | |
| 496 | - const result = this._read(state.highWaterMark); | ||
| 497 | - if (result != null) { | ||
| 498 | - const then = result.then; | ||
| 499 | - if (typeof then === 'function') { | ||
| 500 | - then.call( | ||
| 501 | - result, | ||
| 502 | - nop, | ||
| 503 | - function(err) { | ||
| 504 | - errorOrDestroy(this, err); | ||
| 505 | - }); | ||
| 506 | - } | ||
| 507 | - } | ||
| 496 | + this._read(state.highWaterMark); | ||
| 508 | 497 | } catch (err) { | |
| 509 | 498 | errorOrDestroy(this, err); | |
| 510 | 499 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -107,10 +107,8 @@ function Transform(options) { | |||
| 107 | 107 | } | |
| 108 | 108 | ||
| 109 | 109 | function final(cb) { | |
| 110 | - let called = false; | ||
| 111 | 110 | if (typeof this._flush === 'function' && !this.destroyed) { | |
| 112 | - const result = this._flush((er, data) => { | ||
| 113 | - called = true; | ||
| 111 | + this._flush((er, data) => { | ||
| 114 | 112 | if (er) { | |
| 115 | 113 | if (cb) { | |
| 116 | 114 | cb(er); | |
@@ -128,33 +126,6 @@ function final(cb) { | |||
| 128 | 126 | cb(); | |
| 129 | 127 | } | |
| 130 | 128 | }); | |
| 131 | - if (result !== undefined && result !== null) { | ||
| 132 | - try { | ||
| 133 | - const then = result.then; | ||
| 134 | - if (typeof then === 'function') { | ||
| 135 | - then.call( | ||
| 136 | - result, | ||
| 137 | - (data) => { | ||
| 138 | - if (called) | ||
| 139 | - return; | ||
| 140 | - if (data != null) | ||
| 141 | - this.push(data); | ||
| 142 | - this.push(null); | ||
| 143 | - if (cb) | ||
| 144 | - process.nextTick(cb); | ||
| 145 | - }, | ||
| 146 | - (err) => { | ||
| 147 | - if (cb) { | ||
| 148 | - process.nextTick(cb, err); | ||
| 149 | - } else { | ||
| 150 | - process.nextTick(() => this.destroy(err)); | ||
| 151 | - } | ||
| 152 | - }); | ||
| 153 | - } | ||
| 154 | - } catch (err) { | ||
| 155 | - process.nextTick(() => this.destroy(err)); | ||
| 156 | - } | ||
| 157 | - } | ||
| 158 | 129 | } else { | |
| 159 | 130 | this.push(null); | |
| 160 | 131 | if (cb) { | |
@@ -180,9 +151,7 @@ Transform.prototype._write = function(chunk, encoding, callback) { | |||
| 180 | 151 | const wState = this._writableState; | |
| 181 | 152 | const length = rState.length; | |
| 182 | 153 | ||
| 183 | - let called = false; | ||
| 184 | - const result = this._transform(chunk, encoding, (err, val) => { | ||
| 185 | - called = true; | ||
| 154 | + this._transform(chunk, encoding, (err, val) => { | ||
| 186 | 155 | if (err) { | |
| 187 | 156 | callback(err); | |
| 188 | 157 | return; | |
@@ -204,38 +173,6 @@ Transform.prototype._write = function(chunk, encoding, callback) { | |||
| 204 | 173 | this[kCallback] = callback; | |
| 205 | 174 | } | |
| 206 | 175 | }); | |
| 207 | - if (result !== undefined && result != null) { | ||
| 208 | - try { | ||
| 209 | - const then = result.then; | ||
| 210 | - if (typeof then === 'function') { | ||
| 211 | - then.call( | ||
| 212 | - result, | ||
| 213 | - (val) => { | ||
| 214 | - if (called) | ||
| 215 | - return; | ||
| 216 | - | ||
| 217 | - if (val != null) { | ||
| 218 | - this.push(val); | ||
| 219 | - } | ||
| 220 | - | ||
| 221 | - if ( | ||
| 222 | - wState.ended || | ||
| 223 | - length === rState.length || | ||
| 224 | - rState.length < rState.highWaterMark || | ||
| 225 | - rState.length === 0) { | ||
| 226 | - process.nextTick(callback); | ||
| 227 | - } else { | ||
| 228 | - this[kCallback] = callback; | ||
| 229 | - } | ||
| 230 | - }, | ||
| 231 | - (err) => { | ||
| 232 | - process.nextTick(callback, err); | ||
| 233 | - }); | ||
| 234 | - } | ||
| 235 | - } catch (err) { | ||
| 236 | - process.nextTick(callback, err); | ||
| 237 | - } | ||
| 238 | - } | ||
| 239 | 176 | }; | |
| 240 | 177 | ||
| 241 | 178 | Transform.prototype._read = function() { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -693,24 +693,7 @@ function callFinal(stream, state) { | |||
| 693 | 693 | state.pendingcb++; | |
| 694 | 694 | ||
| 695 | 695 | try { | |
| 696 | - const result = stream._final(onFinish); | ||
| 697 | - if (result != null) { | ||
| 698 | - const then = result.then; | ||
| 699 | - if (typeof then === 'function') { | ||
| 700 | - then.call( | ||
| 701 | - result, | ||
| 702 | - function() { | ||
| 703 | - if (!called) { | ||
| 704 | - process.nextTick(onFinish, null); | ||
| 705 | - } | ||
| 706 | - }, | ||
| 707 | - function(err) { | ||
| 708 | - if (!called) { | ||
| 709 | - process.nextTick(onFinish, err); | ||
| 710 | - } | ||
| 711 | - }); | ||
| 712 | - } | ||
| 713 | - } | ||
| 696 | + stream._final(onFinish); | ||
| 714 | 697 | } catch (err) { | |
| 715 | 698 | onFinish(err); | |
| 716 | 699 | } | |
| Back | FazBrowse Home | New Git URL |
0 commit comments