Code coverage report for debug\context.js

Statements: 100% (26 / 26)      Branches: 100% (12 / 12)      Functions: 100% (6 / 6)      Lines: 100% (23 / 23)      Ignored: none     

All files » debug\ » context.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41  8 8 8 53   8 31869 23494 23252       8 31868 23493 23251       8 79     8 20794 20794 7749   13045     8 8 8   8        
(function () { "use strict";
module.exports = function(Promise, CapturedTrace, isDebugging) {
var contextStack = [];
function Context() {
    this._trace = new CapturedTrace(peekContext());
}
Context.prototype._pushContext = function () {
    if (!isDebugging()) return;
    if (this._trace !== undefined) {
        contextStack.push(this._trace);
    }
};
 
Context.prototype._popContext = function () {
    if (!isDebugging()) return;
    if (this._trace !== undefined) {
        contextStack.pop();
    }
};
 
function createContext() {
    if (isDebugging()) return new Context();
}
 
function peekContext() {
    var lastIndex = contextStack.length - 1;
    if (lastIndex >= 0) {
        return contextStack[lastIndex];
    }
    return undefined;
}
 
Promise.prototype._peekContext = peekContext;
Promise.prototype._pushContext = Context.prototype._pushContext;
Promise.prototype._popContext = Context.prototype._popContext;
 
return createContext;
};
 
}());