(x, then, context)
| 8835 | } |
| 8836 | |
| 8837 | function doThenable(x, then, context) { |
| 8838 | var promise = new Promise(INTERNAL); |
| 8839 | var ret = promise; |
| 8840 | if (context) context._pushContext(); |
| 8841 | promise._captureStackTrace(); |
| 8842 | if (context) context._popContext(); |
| 8843 | var synchronous = true; |
| 8844 | var result = util.tryCatch(then).call(x, resolve, reject); |
| 8845 | synchronous = false; |
| 8846 | |
| 8847 | if (promise && result === errorObj) { |
| 8848 | promise._rejectCallback(result.e, true, true); |
| 8849 | promise = null; |
| 8850 | } |
| 8851 | |
| 8852 | function resolve(value) { |
| 8853 | if (!promise) return; |
| 8854 | promise._resolveCallback(value); |
| 8855 | promise = null; |
| 8856 | } |
| 8857 | |
| 8858 | function reject(reason) { |
| 8859 | if (!promise) return; |
| 8860 | promise._rejectCallback(reason, synchronous, true); |
| 8861 | promise = null; |
| 8862 | } |
| 8863 | return ret; |
| 8864 | } |
| 8865 | |
| 8866 | return tryConvertToPromise; |
| 8867 | }; |
no outgoing calls
no test coverage detected