96bd5456f4ae2f0f69bb56214e3b6139d6d04fcc
[aai/esr-gui.git] /
1 "use strict";
2 module.exports = function() {
3 var makeSelfResolutionError = function () {
4     return new TypeError("circular promise resolution chain\u000a\u000a    See http://goo.gl/LhFpo0\u000a");
5 };
6 var reflect = function() {
7     return new Promise.PromiseInspection(this._target());
8 };
9 var apiRejection = function(msg) {
10     return Promise.reject(new TypeError(msg));
11 };
12
13 var util = require("./util.js");
14
15 var getDomain;
16 if (util.isNode) {
17     getDomain = function() {
18         var ret = process.domain;
19         if (ret === undefined) ret = null;
20         return ret;
21     };
22 } else {
23     getDomain = function() {
24         return null;
25     };
26 }
27 util.notEnumerableProp(Promise, "_getDomain", getDomain);
28
29 var UNDEFINED_BINDING = {};
30 var async = require("./async.js");
31 var errors = require("./errors.js");
32 var TypeError = Promise.TypeError = errors.TypeError;
33 Promise.RangeError = errors.RangeError;
34 Promise.CancellationError = errors.CancellationError;
35 Promise.TimeoutError = errors.TimeoutError;
36 Promise.OperationalError = errors.OperationalError;
37 Promise.RejectionError = errors.OperationalError;
38 Promise.AggregateError = errors.AggregateError;
39 var INTERNAL = function(){};
40 var APPLY = {};
41 var NEXT_FILTER = {e: null};
42 var tryConvertToPromise = require("./thenables.js")(Promise, INTERNAL);
43 var PromiseArray =
44     require("./promise_array.js")(Promise, INTERNAL,
45                                     tryConvertToPromise, apiRejection);
46 var CapturedTrace = require("./captured_trace.js")();
47 var isDebugging = require("./debuggability.js")(Promise, CapturedTrace);
48  /*jshint unused:false*/
49 var createContext =
50     require("./context.js")(Promise, CapturedTrace, isDebugging);
51 var CatchFilter = require("./catch_filter.js")(NEXT_FILTER);
52 var PromiseResolver = require("./promise_resolver.js");
53 var nodebackForPromise = PromiseResolver._nodebackForPromise;
54 var errorObj = util.errorObj;
55 var tryCatch = util.tryCatch;
56 function Promise(resolver) {
57     if (typeof resolver !== "function") {
58         throw new TypeError("the promise constructor requires a resolver function\u000a\u000a    See http://goo.gl/EC22Yn\u000a");
59     }
60     if (this.constructor !== Promise) {
61         throw new TypeError("the promise constructor cannot be invoked directly\u000a\u000a    See http://goo.gl/KsIlge\u000a");
62     }
63     this._bitField = 0;
64     this._fulfillmentHandler0 = undefined;
65     this._rejectionHandler0 = undefined;
66     this._progressHandler0 = undefined;
67     this._promise0 = undefined;
68     this._receiver0 = undefined;
69     this._settledValue = undefined;
70     if (resolver !== INTERNAL) this._resolveFromResolver(resolver);
71 }
72
73 Promise.prototype.toString = function () {
74     return "[object Promise]";
75 };
76
77 Promise.prototype.caught = Promise.prototype["catch"] = function (fn) {
78     var len = arguments.length;
79     if (len > 1) {
80         var catchInstances = new Array(len - 1),
81             j = 0, i;
82         for (i = 0; i < len - 1; ++i) {
83             var item = arguments[i];
84             if (typeof item === "function") {
85                 catchInstances[j++] = item;
86             } else {
87                 return Promise.reject(
88                     new TypeError("Catch filter must inherit from Error or be a simple predicate function\u000a\u000a    See http://goo.gl/o84o68\u000a"));
89             }
90         }
91         catchInstances.length = j;
92         fn = arguments[i];
93         var catchFilter = new CatchFilter(catchInstances, fn, this);
94         return this._then(undefined, catchFilter.doFilter, undefined,
95             catchFilter, undefined);
96     }
97     return this._then(undefined, fn, undefined, undefined, undefined);
98 };
99
100 Promise.prototype.reflect = function () {
101     return this._then(reflect, reflect, undefined, this, undefined);
102 };
103
104 Promise.prototype.then = function (didFulfill, didReject, didProgress) {
105     if (isDebugging() && arguments.length > 0 &&
106         typeof didFulfill !== "function" &&
107         typeof didReject !== "function") {
108         var msg = ".then() only accepts functions but was passed: " +
109                 util.classString(didFulfill);
110         if (arguments.length > 1) {
111             msg += ", " + util.classString(didReject);
112         }
113         this._warn(msg);
114     }
115     return this._then(didFulfill, didReject, didProgress,
116         undefined, undefined);
117 };
118
119 Promise.prototype.done = function (didFulfill, didReject, didProgress) {
120     var promise = this._then(didFulfill, didReject, didProgress,
121         undefined, undefined);
122     promise._setIsFinal();
123 };
124
125 Promise.prototype.spread = function (didFulfill, didReject) {
126     return this.all()._then(didFulfill, didReject, undefined, APPLY, undefined);
127 };
128
129 Promise.prototype.isCancellable = function () {
130     return !this.isResolved() &&
131         this._cancellable();
132 };
133
134 Promise.prototype.toJSON = function () {
135     var ret = {
136         isFulfilled: false,
137         isRejected: false,
138         fulfillmentValue: undefined,
139         rejectionReason: undefined
140     };
141     if (this.isFulfilled()) {
142         ret.fulfillmentValue = this.value();
143         ret.isFulfilled = true;
144     } else if (this.isRejected()) {
145         ret.rejectionReason = this.reason();
146         ret.isRejected = true;
147     }
148     return ret;
149 };
150
151 Promise.prototype.all = function () {
152     return new PromiseArray(this).promise();
153 };
154
155 Promise.prototype.error = function (fn) {
156     return this.caught(util.originatesFromRejection, fn);
157 };
158
159 Promise.is = function (val) {
160     return val instanceof Promise;
161 };
162
163 Promise.fromNode = function(fn) {
164     var ret = new Promise(INTERNAL);
165     var result = tryCatch(fn)(nodebackForPromise(ret));
166     if (result === errorObj) {
167         ret._rejectCallback(result.e, true, true);
168     }
169     return ret;
170 };
171
172 Promise.all = function (promises) {
173     return new PromiseArray(promises).promise();
174 };
175
176 Promise.defer = Promise.pending = function () {
177     var promise = new Promise(INTERNAL);
178     return new PromiseResolver(promise);
179 };
180
181 Promise.cast = function (obj) {
182     var ret = tryConvertToPromise(obj);
183     if (!(ret instanceof Promise)) {
184         var val = ret;
185         ret = new Promise(INTERNAL);
186         ret._fulfillUnchecked(val);
187     }
188     return ret;
189 };
190
191 Promise.resolve = Promise.fulfilled = Promise.cast;
192
193 Promise.reject = Promise.rejected = function (reason) {
194     var ret = new Promise(INTERNAL);
195     ret._captureStackTrace();
196     ret._rejectCallback(reason, true);
197     return ret;
198 };
199
200 Promise.setScheduler = function(fn) {
201     if (typeof fn !== "function") throw new TypeError("fn must be a function\u000a\u000a    See http://goo.gl/916lJJ\u000a");
202     var prev = async._schedule;
203     async._schedule = fn;
204     return prev;
205 };
206
207 Promise.prototype._then = function (
208     didFulfill,
209     didReject,
210     didProgress,
211     receiver,
212     internalData
213 ) {
214     var haveInternalData = internalData !== undefined;
215     var ret = haveInternalData ? internalData : new Promise(INTERNAL);
216
217     if (!haveInternalData) {
218         ret._propagateFrom(this, 4 | 1);
219         ret._captureStackTrace();
220     }
221
222     var target = this._target();
223     if (target !== this) {
224         if (receiver === undefined) receiver = this._boundTo;
225         if (!haveInternalData) ret._setIsMigrated();
226     }
227
228     var callbackIndex = target._addCallbacks(didFulfill,
229                                              didReject,
230                                              didProgress,
231                                              ret,
232                                              receiver,
233                                              getDomain());
234
235     if (target._isResolved() && !target._isSettlePromisesQueued()) {
236         async.invoke(
237             target._settlePromiseAtPostResolution, target, callbackIndex);
238     }
239
240     return ret;
241 };
242
243 Promise.prototype._settlePromiseAtPostResolution = function (index) {
244     if (this._isRejectionUnhandled()) this._unsetRejectionIsUnhandled();
245     this._settlePromiseAt(index);
246 };
247
248 Promise.prototype._length = function () {
249     return this._bitField & 131071;
250 };
251
252 Promise.prototype._isFollowingOrFulfilledOrRejected = function () {
253     return (this._bitField & 939524096) > 0;
254 };
255
256 Promise.prototype._isFollowing = function () {
257     return (this._bitField & 536870912) === 536870912;
258 };
259
260 Promise.prototype._setLength = function (len) {
261     this._bitField = (this._bitField & -131072) |
262         (len & 131071);
263 };
264
265 Promise.prototype._setFulfilled = function () {
266     this._bitField = this._bitField | 268435456;
267 };
268
269 Promise.prototype._setRejected = function () {
270     this._bitField = this._bitField | 134217728;
271 };
272
273 Promise.prototype._setFollowing = function () {
274     this._bitField = this._bitField | 536870912;
275 };
276
277 Promise.prototype._setIsFinal = function () {
278     this._bitField = this._bitField | 33554432;
279 };
280
281 Promise.prototype._isFinal = function () {
282     return (this._bitField & 33554432) > 0;
283 };
284
285 Promise.prototype._cancellable = function () {
286     return (this._bitField & 67108864) > 0;
287 };
288
289 Promise.prototype._setCancellable = function () {
290     this._bitField = this._bitField | 67108864;
291 };
292
293 Promise.prototype._unsetCancellable = function () {
294     this._bitField = this._bitField & (~67108864);
295 };
296
297 Promise.prototype._setIsMigrated = function () {
298     this._bitField = this._bitField | 4194304;
299 };
300
301 Promise.prototype._unsetIsMigrated = function () {
302     this._bitField = this._bitField & (~4194304);
303 };
304
305 Promise.prototype._isMigrated = function () {
306     return (this._bitField & 4194304) > 0;
307 };
308
309 Promise.prototype._receiverAt = function (index) {
310     var ret = index === 0
311         ? this._receiver0
312         : this[
313             index * 5 - 5 + 4];
314     if (ret === UNDEFINED_BINDING) {
315         return undefined;
316     } else if (ret === undefined && this._isBound()) {
317         return this._boundValue();
318     }
319     return ret;
320 };
321
322 Promise.prototype._promiseAt = function (index) {
323     return index === 0
324         ? this._promise0
325         : this[index * 5 - 5 + 3];
326 };
327
328 Promise.prototype._fulfillmentHandlerAt = function (index) {
329     return index === 0
330         ? this._fulfillmentHandler0
331         : this[index * 5 - 5 + 0];
332 };
333
334 Promise.prototype._rejectionHandlerAt = function (index) {
335     return index === 0
336         ? this._rejectionHandler0
337         : this[index * 5 - 5 + 1];
338 };
339
340 Promise.prototype._boundValue = function() {
341     var ret = this._boundTo;
342     if (ret !== undefined) {
343         if (ret instanceof Promise) {
344             if (ret.isFulfilled()) {
345                 return ret.value();
346             } else {
347                 return undefined;
348             }
349         }
350     }
351     return ret;
352 };
353
354 Promise.prototype._migrateCallbacks = function (follower, index) {
355     var fulfill = follower._fulfillmentHandlerAt(index);
356     var reject = follower._rejectionHandlerAt(index);
357     var progress = follower._progressHandlerAt(index);
358     var promise = follower._promiseAt(index);
359     var receiver = follower._receiverAt(index);
360     if (promise instanceof Promise) promise._setIsMigrated();
361     if (receiver === undefined) receiver = UNDEFINED_BINDING;
362     this._addCallbacks(fulfill, reject, progress, promise, receiver, null);
363 };
364
365 Promise.prototype._addCallbacks = function (
366     fulfill,
367     reject,
368     progress,
369     promise,
370     receiver,
371     domain
372 ) {
373     var index = this._length();
374
375     if (index >= 131071 - 5) {
376         index = 0;
377         this._setLength(0);
378     }
379
380     if (index === 0) {
381         this._promise0 = promise;
382         if (receiver !== undefined) this._receiver0 = receiver;
383         if (typeof fulfill === "function" && !this._isCarryingStackTrace()) {
384             this._fulfillmentHandler0 =
385                 domain === null ? fulfill : domain.bind(fulfill);
386         }
387         if (typeof reject === "function") {
388             this._rejectionHandler0 =
389                 domain === null ? reject : domain.bind(reject);
390         }
391         if (typeof progress === "function") {
392             this._progressHandler0 =
393                 domain === null ? progress : domain.bind(progress);
394         }
395     } else {
396         var base = index * 5 - 5;
397         this[base + 3] = promise;
398         this[base + 4] = receiver;
399         if (typeof fulfill === "function") {
400             this[base + 0] =
401                 domain === null ? fulfill : domain.bind(fulfill);
402         }
403         if (typeof reject === "function") {
404             this[base + 1] =
405                 domain === null ? reject : domain.bind(reject);
406         }
407         if (typeof progress === "function") {
408             this[base + 2] =
409                 domain === null ? progress : domain.bind(progress);
410         }
411     }
412     this._setLength(index + 1);
413     return index;
414 };
415
416 Promise.prototype._setProxyHandlers = function (receiver, promiseSlotValue) {
417     var index = this._length();
418
419     if (index >= 131071 - 5) {
420         index = 0;
421         this._setLength(0);
422     }
423     if (index === 0) {
424         this._promise0 = promiseSlotValue;
425         this._receiver0 = receiver;
426     } else {
427         var base = index * 5 - 5;
428         this[base + 3] = promiseSlotValue;
429         this[base + 4] = receiver;
430     }
431     this._setLength(index + 1);
432 };
433
434 Promise.prototype._proxyPromiseArray = function (promiseArray, index) {
435     this._setProxyHandlers(promiseArray, index);
436 };
437
438 Promise.prototype._resolveCallback = function(value, shouldBind) {
439     if (this._isFollowingOrFulfilledOrRejected()) return;
440     if (value === this)
441         return this._rejectCallback(makeSelfResolutionError(), false, true);
442     var maybePromise = tryConvertToPromise(value, this);
443     if (!(maybePromise instanceof Promise)) return this._fulfill(value);
444
445     var propagationFlags = 1 | (shouldBind ? 4 : 0);
446     this._propagateFrom(maybePromise, propagationFlags);
447     var promise = maybePromise._target();
448     if (promise._isPending()) {
449         var len = this._length();
450         for (var i = 0; i < len; ++i) {
451             promise._migrateCallbacks(this, i);
452         }
453         this._setFollowing();
454         this._setLength(0);
455         this._setFollowee(promise);
456     } else if (promise._isFulfilled()) {
457         this._fulfillUnchecked(promise._value());
458     } else {
459         this._rejectUnchecked(promise._reason(),
460             promise._getCarriedStackTrace());
461     }
462 };
463
464 Promise.prototype._rejectCallback =
465 function(reason, synchronous, shouldNotMarkOriginatingFromRejection) {
466     if (!shouldNotMarkOriginatingFromRejection) {
467         util.markAsOriginatingFromRejection(reason);
468     }
469     var trace = util.ensureErrorObject(reason);
470     var hasStack = trace === reason;
471     this._attachExtraTrace(trace, synchronous ? hasStack : false);
472     this._reject(reason, hasStack ? undefined : trace);
473 };
474
475 Promise.prototype._resolveFromResolver = function (resolver) {
476     var promise = this;
477     this._captureStackTrace();
478     this._pushContext();
479     var synchronous = true;
480     var r = tryCatch(resolver)(function(value) {
481         if (promise === null) return;
482         promise._resolveCallback(value);
483         promise = null;
484     }, function (reason) {
485         if (promise === null) return;
486         promise._rejectCallback(reason, synchronous);
487         promise = null;
488     });
489     synchronous = false;
490     this._popContext();
491
492     if (r !== undefined && r === errorObj && promise !== null) {
493         promise._rejectCallback(r.e, true, true);
494         promise = null;
495     }
496 };
497
498 Promise.prototype._settlePromiseFromHandler = function (
499     handler, receiver, value, promise
500 ) {
501     if (promise._isRejected()) return;
502     promise._pushContext();
503     var x;
504     if (receiver === APPLY && !this._isRejected()) {
505         x = tryCatch(handler).apply(this._boundValue(), value);
506     } else {
507         x = tryCatch(handler).call(receiver, value);
508     }
509     promise._popContext();
510
511     if (x === errorObj || x === promise || x === NEXT_FILTER) {
512         var err = x === promise ? makeSelfResolutionError() : x.e;
513         promise._rejectCallback(err, false, true);
514     } else {
515         promise._resolveCallback(x);
516     }
517 };
518
519 Promise.prototype._target = function() {
520     var ret = this;
521     while (ret._isFollowing()) ret = ret._followee();
522     return ret;
523 };
524
525 Promise.prototype._followee = function() {
526     return this._rejectionHandler0;
527 };
528
529 Promise.prototype._setFollowee = function(promise) {
530     this._rejectionHandler0 = promise;
531 };
532
533 Promise.prototype._cleanValues = function () {
534     if (this._cancellable()) {
535         this._cancellationParent = undefined;
536     }
537 };
538
539 Promise.prototype._propagateFrom = function (parent, flags) {
540     if ((flags & 1) > 0 && parent._cancellable()) {
541         this._setCancellable();
542         this._cancellationParent = parent;
543     }
544     if ((flags & 4) > 0 && parent._isBound()) {
545         this._setBoundTo(parent._boundTo);
546     }
547 };
548
549 Promise.prototype._fulfill = function (value) {
550     if (this._isFollowingOrFulfilledOrRejected()) return;
551     this._fulfillUnchecked(value);
552 };
553
554 Promise.prototype._reject = function (reason, carriedStackTrace) {
555     if (this._isFollowingOrFulfilledOrRejected()) return;
556     this._rejectUnchecked(reason, carriedStackTrace);
557 };
558
559 Promise.prototype._settlePromiseAt = function (index) {
560     var promise = this._promiseAt(index);
561     var isPromise = promise instanceof Promise;
562
563     if (isPromise && promise._isMigrated()) {
564         promise._unsetIsMigrated();
565         return async.invoke(this._settlePromiseAt, this, index);
566     }
567     var handler = this._isFulfilled()
568         ? this._fulfillmentHandlerAt(index)
569         : this._rejectionHandlerAt(index);
570
571     var carriedStackTrace =
572         this._isCarryingStackTrace() ? this._getCarriedStackTrace() : undefined;
573     var value = this._settledValue;
574     var receiver = this._receiverAt(index);
575     this._clearCallbackDataAtIndex(index);
576
577     if (typeof handler === "function") {
578         if (!isPromise) {
579             handler.call(receiver, value, promise);
580         } else {
581             this._settlePromiseFromHandler(handler, receiver, value, promise);
582         }
583     } else if (receiver instanceof PromiseArray) {
584         if (!receiver._isResolved()) {
585             if (this._isFulfilled()) {
586                 receiver._promiseFulfilled(value, promise);
587             }
588             else {
589                 receiver._promiseRejected(value, promise);
590             }
591         }
592     } else if (isPromise) {
593         if (this._isFulfilled()) {
594             promise._fulfill(value);
595         } else {
596             promise._reject(value, carriedStackTrace);
597         }
598     }
599
600     if (index >= 4 && (index & 31) === 4)
601         async.invokeLater(this._setLength, this, 0);
602 };
603
604 Promise.prototype._clearCallbackDataAtIndex = function(index) {
605     if (index === 0) {
606         if (!this._isCarryingStackTrace()) {
607             this._fulfillmentHandler0 = undefined;
608         }
609         this._rejectionHandler0 =
610         this._progressHandler0 =
611         this._receiver0 =
612         this._promise0 = undefined;
613     } else {
614         var base = index * 5 - 5;
615         this[base + 3] =
616         this[base + 4] =
617         this[base + 0] =
618         this[base + 1] =
619         this[base + 2] = undefined;
620     }
621 };
622
623 Promise.prototype._isSettlePromisesQueued = function () {
624     return (this._bitField &
625             -1073741824) === -1073741824;
626 };
627
628 Promise.prototype._setSettlePromisesQueued = function () {
629     this._bitField = this._bitField | -1073741824;
630 };
631
632 Promise.prototype._unsetSettlePromisesQueued = function () {
633     this._bitField = this._bitField & (~-1073741824);
634 };
635
636 Promise.prototype._queueSettlePromises = function() {
637     async.settlePromises(this);
638     this._setSettlePromisesQueued();
639 };
640
641 Promise.prototype._fulfillUnchecked = function (value) {
642     if (value === this) {
643         var err = makeSelfResolutionError();
644         this._attachExtraTrace(err);
645         return this._rejectUnchecked(err, undefined);
646     }
647     this._setFulfilled();
648     this._settledValue = value;
649     this._cleanValues();
650
651     if (this._length() > 0) {
652         this._queueSettlePromises();
653     }
654 };
655
656 Promise.prototype._rejectUncheckedCheckError = function (reason) {
657     var trace = util.ensureErrorObject(reason);
658     this._rejectUnchecked(reason, trace === reason ? undefined : trace);
659 };
660
661 Promise.prototype._rejectUnchecked = function (reason, trace) {
662     if (reason === this) {
663         var err = makeSelfResolutionError();
664         this._attachExtraTrace(err);
665         return this._rejectUnchecked(err);
666     }
667     this._setRejected();
668     this._settledValue = reason;
669     this._cleanValues();
670
671     if (this._isFinal()) {
672         async.throwLater(function(e) {
673             if ("stack" in e) {
674                 async.invokeFirst(
675                     CapturedTrace.unhandledRejection, undefined, e);
676             }
677             throw e;
678         }, trace === undefined ? reason : trace);
679         return;
680     }
681
682     if (trace !== undefined && trace !== reason) {
683         this._setCarriedStackTrace(trace);
684     }
685
686     if (this._length() > 0) {
687         this._queueSettlePromises();
688     } else {
689         this._ensurePossibleRejectionHandled();
690     }
691 };
692
693 Promise.prototype._settlePromises = function () {
694     this._unsetSettlePromisesQueued();
695     var len = this._length();
696     for (var i = 0; i < len; i++) {
697         this._settlePromiseAt(i);
698     }
699 };
700
701 util.notEnumerableProp(Promise,
702                        "_makeSelfResolutionError",
703                        makeSelfResolutionError);
704
705 require("./progress.js")(Promise, PromiseArray);
706 require("./method.js")(Promise, INTERNAL, tryConvertToPromise, apiRejection);
707 require("./bind.js")(Promise, INTERNAL, tryConvertToPromise);
708 require("./finally.js")(Promise, NEXT_FILTER, tryConvertToPromise);
709 require("./direct_resolve.js")(Promise);
710 require("./synchronous_inspection.js")(Promise);
711 require("./join.js")(Promise, PromiseArray, tryConvertToPromise, INTERNAL);
712 Promise.Promise = Promise;
713 require('./map.js')(Promise, PromiseArray, apiRejection, tryConvertToPromise, INTERNAL);
714 require('./cancel.js')(Promise);
715 require('./using.js')(Promise, apiRejection, tryConvertToPromise, createContext);
716 require('./generators.js')(Promise, apiRejection, INTERNAL, tryConvertToPromise);
717 require('./nodeify.js')(Promise);
718 require('./call_get.js')(Promise);
719 require('./props.js')(Promise, PromiseArray, tryConvertToPromise, apiRejection);
720 require('./race.js')(Promise, INTERNAL, tryConvertToPromise, apiRejection);
721 require('./reduce.js')(Promise, PromiseArray, apiRejection, tryConvertToPromise, INTERNAL);
722 require('./settle.js')(Promise, PromiseArray);
723 require('./some.js')(Promise, PromiseArray, apiRejection);
724 require('./promisify.js')(Promise, INTERNAL);
725 require('./any.js')(Promise);
726 require('./each.js')(Promise, INTERNAL);
727 require('./timers.js')(Promise, INTERNAL);
728 require('./filter.js')(Promise, INTERNAL);
729                                                          
730     util.toFastProperties(Promise);                                          
731     util.toFastProperties(Promise.prototype);                                
732     function fillTypes(value) {                                              
733         var p = new Promise(INTERNAL);                                       
734         p._fulfillmentHandler0 = value;                                      
735         p._rejectionHandler0 = value;                                        
736         p._progressHandler0 = value;                                         
737         p._promise0 = value;                                                 
738         p._receiver0 = value;                                                
739         p._settledValue = value;                                             
740     }                                                                        
741     // Complete slack tracking, opt out of field-type tracking and           
742     // stabilize map                                                         
743     fillTypes({a: 1});                                                       
744     fillTypes({b: 2});                                                       
745     fillTypes({c: 3});                                                       
746     fillTypes(1);                                                            
747     fillTypes(function(){});                                                 
748     fillTypes(undefined);                                                    
749     fillTypes(false);                                                        
750     fillTypes(new Promise(INTERNAL));                                        
751     CapturedTrace.setBounds(async.firstLineError, util.lastLineError);       
752     return Promise;                                                          
753
754 };