X-Git-Url: https://git.josue.xyz/?p=dotfiles%2F.git;a=blobdiff_plain;f=.config%2Fcoc%2Fextensions%2Fnode_modules%2Fcoc-prettier%2Fnode_modules%2Fcore-js%2Fmodules%2Fes.promise.js;h=10a48e66abf56c02de0abdb960b44a614e484d6e;hp=b79d2bc2592ff23101107995926a11675315178f;hb=4d07c77cf4d78cab8639e13ddc3c22495e585b0b;hpb=b3950616b54221c40a7dab9099bda675007e5b6e diff --git a/.config/coc/extensions/node_modules/coc-prettier/node_modules/core-js/modules/es.promise.js b/.config/coc/extensions/node_modules/coc-prettier/node_modules/core-js/modules/es.promise.js index b79d2bc2..10a48e66 100644 --- a/.config/coc/extensions/node_modules/coc-prettier/node_modules/core-js/modules/es.promise.js +++ b/.config/coc/extensions/node_modules/coc-prettier/node_modules/core-js/modules/es.promise.js @@ -11,7 +11,6 @@ var setSpecies = require('../internals/set-species'); var isObject = require('../internals/is-object'); var aFunction = require('../internals/a-function'); var anInstance = require('../internals/an-instance'); -var classof = require('../internals/classof-raw'); var inspectSource = require('../internals/inspect-source'); var iterate = require('../internals/iterate'); var checkCorrectnessOfIteration = require('../internals/check-correctness-of-iteration'); @@ -25,6 +24,7 @@ var perform = require('../internals/perform'); var InternalStateModule = require('../internals/internal-state'); var isForced = require('../internals/is-forced'); var wellKnownSymbol = require('../internals/well-known-symbol'); +var IS_NODE = require('../internals/engine-is-node'); var V8_VERSION = require('../internals/engine-v8-version'); var SPECIES = wellKnownSymbol('species'); @@ -39,8 +39,8 @@ var process = global.process; var $fetch = getBuiltIn('fetch'); var newPromiseCapability = newPromiseCapabilityModule.f; var newGenericPromiseCapability = newPromiseCapability; -var IS_NODE = classof(process) == 'process'; var DISPATCH_EVENT = !!(document && document.createEvent && global.dispatchEvent); +var NATIVE_REJECTION_EVENT = typeof PromiseRejectionEvent == 'function'; var UNHANDLED_REJECTION = 'unhandledrejection'; var REJECTION_HANDLED = 'rejectionhandled'; var PENDING = 0; @@ -58,7 +58,7 @@ var FORCED = isForced(PROMISE, function () { // We can't detect it synchronously, so just check versions if (V8_VERSION === 66) return true; // Unhandled rejections tracking support, NodeJS Promise without it fails @@species test - if (!IS_NODE && typeof PromiseRejectionEvent != 'function') return true; + if (!IS_NODE && !NATIVE_REJECTION_EVENT) return true; } // We need Promise#finally in the pure version for preventing prototype pollution if (IS_PURE && !PromiseConstructor.prototype['finally']) return true; @@ -86,7 +86,7 @@ var isThenable = function (it) { return isObject(it) && typeof (then = it.then) == 'function' ? then : false; }; -var notify = function (promise, state, isReject) { +var notify = function (state, isReject) { if (state.notified) return; state.notified = true; var chain = state.reactions; @@ -105,7 +105,7 @@ var notify = function (promise, state, isReject) { try { if (handler) { if (!ok) { - if (state.rejection === UNHANDLED) onHandleUnhandled(promise, state); + if (state.rejection === UNHANDLED) onHandleUnhandled(state); state.rejection = HANDLED; } if (handler === true) result = value; @@ -130,7 +130,7 @@ var notify = function (promise, state, isReject) { } state.reactions = []; state.notified = false; - if (isReject && !state.rejection) onUnhandled(promise, state); + if (isReject && !state.rejection) onUnhandled(state); }); }; @@ -143,12 +143,13 @@ var dispatchEvent = function (name, promise, reason) { event.initEvent(name, false, true); global.dispatchEvent(event); } else event = { promise: promise, reason: reason }; - if (handler = global['on' + name]) handler(event); + if (!NATIVE_REJECTION_EVENT && (handler = global['on' + name])) handler(event); else if (name === UNHANDLED_REJECTION) hostReportErrors('Unhandled promise rejection', reason); }; -var onUnhandled = function (promise, state) { +var onUnhandled = function (state) { task.call(global, function () { + var promise = state.facade; var value = state.value; var IS_UNHANDLED = isUnhandled(state); var result; @@ -169,55 +170,56 @@ var isUnhandled = function (state) { return state.rejection !== HANDLED && !state.parent; }; -var onHandleUnhandled = function (promise, state) { +var onHandleUnhandled = function (state) { task.call(global, function () { + var promise = state.facade; if (IS_NODE) { process.emit('rejectionHandled', promise); } else dispatchEvent(REJECTION_HANDLED, promise, state.value); }); }; -var bind = function (fn, promise, state, unwrap) { +var bind = function (fn, state, unwrap) { return function (value) { - fn(promise, state, value, unwrap); + fn(state, value, unwrap); }; }; -var internalReject = function (promise, state, value, unwrap) { +var internalReject = function (state, value, unwrap) { if (state.done) return; state.done = true; if (unwrap) state = unwrap; state.value = value; state.state = REJECTED; - notify(promise, state, true); + notify(state, true); }; -var internalResolve = function (promise, state, value, unwrap) { +var internalResolve = function (state, value, unwrap) { if (state.done) return; state.done = true; if (unwrap) state = unwrap; try { - if (promise === value) throw TypeError("Promise can't be resolved itself"); + if (state.facade === value) throw TypeError("Promise can't be resolved itself"); var then = isThenable(value); if (then) { microtask(function () { var wrapper = { done: false }; try { then.call(value, - bind(internalResolve, promise, wrapper, state), - bind(internalReject, promise, wrapper, state) + bind(internalResolve, wrapper, state), + bind(internalReject, wrapper, state) ); } catch (error) { - internalReject(promise, wrapper, error, state); + internalReject(wrapper, error, state); } }); } else { state.value = value; state.state = FULFILLED; - notify(promise, state, false); + notify(state, false); } } catch (error) { - internalReject(promise, { done: false }, error, state); + internalReject({ done: false }, error, state); } }; @@ -230,9 +232,9 @@ if (FORCED) { Internal.call(this); var state = getInternalState(this); try { - executor(bind(internalResolve, this, state), bind(internalReject, this, state)); + executor(bind(internalResolve, state), bind(internalReject, state)); } catch (error) { - internalReject(this, state, error); + internalReject(state, error); } }; // eslint-disable-next-line no-unused-vars @@ -259,7 +261,7 @@ if (FORCED) { reaction.domain = IS_NODE ? process.domain : undefined; state.parent = true; state.reactions.push(reaction); - if (state.state != PENDING) notify(this, state, false); + if (state.state != PENDING) notify(state, false); return reaction.promise; }, // `Promise.prototype.catch` method @@ -272,8 +274,8 @@ if (FORCED) { var promise = new Internal(); var state = getInternalState(promise); this.promise = promise; - this.resolve = bind(internalResolve, promise, state); - this.reject = bind(internalReject, promise, state); + this.resolve = bind(internalResolve, state); + this.reject = bind(internalReject, state); }; newPromiseCapabilityModule.f = newPromiseCapability = function (C) { return C === PromiseConstructor || C === PromiseWrapper