Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1151 from zloirock/explicit-resource-management
- Loading branch information
Showing
50 changed files
with
1,538 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
require('../../modules/es.error.cause'); | ||
require('../../modules/es.object.to-string'); | ||
require('../../modules/esnext.suppressed-error.constructor'); | ||
require('../../modules/esnext.disposable-stack.constructor'); | ||
var path = require('../../internals/path'); | ||
|
||
module.exports = path.DisposableStack; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
require('../../modules/es.error.cause'); | ||
require('../../modules/es.object.to-string'); | ||
require('../../modules/esnext.suppressed-error.constructor'); | ||
require('../../modules/esnext.disposable-stack.constructor'); | ||
var path = require('../../internals/path'); | ||
|
||
module.exports = path.DisposableStack; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
require('../../modules/esnext.iterator.dispose'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
require('../modules/es.error.cause'); | ||
require('../modules/esnext.suppressed-error.constructor'); | ||
var path = require('../internals/path'); | ||
|
||
module.exports = path.SuppressedError; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
require('../../modules/esnext.symbol.dispose'); | ||
var WrappedWellKnownSymbolModule = require('../../internals/well-known-symbol-wrapped'); | ||
|
||
module.exports = WrappedWellKnownSymbolModule.f('dispose'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
var parent = require('../../stable/symbol'); | ||
|
||
require('../../modules/esnext.symbol.dispose'); | ||
|
||
module.exports = parent; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
require('../../modules/es.error.cause'); | ||
require('../../modules/es.object.to-string'); | ||
require('../../modules/es.promise'); | ||
require('../../modules/esnext.suppressed-error.constructor'); | ||
require('../../modules/esnext.async-disposable-stack.constructor'); | ||
var path = require('../../internals/path'); | ||
|
||
module.exports = path.AsyncDisposableStack; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
require('../../modules/es.error.cause'); | ||
require('../../modules/es.object.to-string'); | ||
require('../../modules/es.promise'); | ||
require('../../modules/esnext.suppressed-error.constructor'); | ||
require('../../modules/esnext.async-disposable-stack.constructor'); | ||
var path = require('../../internals/path'); | ||
|
||
module.exports = path.AsyncDisposableStack; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
require('../../modules/es.object.to-string'); | ||
require('../../modules/es.promise'); | ||
require('../../modules/esnext.async-iterator.async-dispose'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
var parent = require('../../actual/disposable-stack/constructor'); | ||
|
||
module.exports = parent; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
var parent = require('../../actual/disposable-stack'); | ||
|
||
module.exports = parent; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
var parent = require('../../actual/iterator/dispose'); | ||
|
||
module.exports = parent; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
var parent = require('../actual/suppressed-error'); | ||
|
||
module.exports = parent; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
require('../../modules/esnext.symbol.dispose'); | ||
var WrappedWellKnownSymbolModule = require('../../internals/well-known-symbol-wrapped'); | ||
var parent = require('../../actual/symbol/dispose'); | ||
|
||
module.exports = WrappedWellKnownSymbolModule.f('dispose'); | ||
module.exports = parent; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
var uncurryThis = require('../internals/function-uncurry-this'); | ||
var bind = require('../internals/function-bind-context'); | ||
var anObject = require('../internals/an-object'); | ||
var isNullOrUndefined = require('../internals/is-null-or-undefined'); | ||
var getMethod = require('../internals/get-method'); | ||
var wellKnownSymbol = require('../internals/well-known-symbol'); | ||
|
||
var ASYNC_DISPOSE = wellKnownSymbol('asyncDispose'); | ||
var DISPOSE = wellKnownSymbol('dispose'); | ||
|
||
var push = uncurryThis([].push); | ||
|
||
var getDisposeMethod = function (V, hint) { | ||
if (hint == 'async-dispose') { | ||
return getMethod(V, ASYNC_DISPOSE) || getMethod(V, DISPOSE); | ||
} return getMethod(V, DISPOSE); | ||
}; | ||
|
||
var createDisposableResource = function (V, hint, method) { | ||
return bind(method || getDisposeMethod(V, hint), V); | ||
}; | ||
|
||
var addDisposableResource = function (disposable, V, hint, method) { | ||
var resource; | ||
if (!method) { | ||
if (isNullOrUndefined(V)) return; | ||
resource = createDisposableResource(V, hint); | ||
} else if (isNullOrUndefined(V)) { | ||
resource = createDisposableResource(undefined, hint, method); | ||
} else { | ||
resource = createDisposableResource(anObject(V), hint, method); | ||
} | ||
|
||
push(disposable.stack, resource); | ||
}; | ||
|
||
module.exports = { | ||
getDisposeMethod: getDisposeMethod, | ||
addDisposableResource: addDisposableResource | ||
}; |
Oops, something went wrong.