diff options
author | Philip Chimento <philip.chimento@gmail.com> | 2017-03-22 15:37:09 +0000 |
---|---|---|
committer | Philip Chimento <philip.chimento@gmail.com> | 2017-05-05 23:26:30 -0700 |
commit | ac2f29b1e6ed3846173634986075166b1022ae11 (patch) | |
tree | e393fc73d3edc519c1db8545aca56f8763607a27 | |
parent | 24b745d9f156c49a75a09b840ba03ecdba016310 (diff) | |
download | gjs-ac2f29b1e6ed3846173634986075166b1022ae11.tar.gz |
coverage: Misc Javascript-side API changes
Debugger.Script.getOffsetLine() which we previously used in code coverage
is gone now, replaced by Debugger.Script.getOffsetLocation() which gives
more information. We don't currently take advantage of the extra
information.
ArrowExpression was renamed to ArrowFunctionExpression.
-rw-r--r-- | modules/coverage.js | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/modules/coverage.js b/modules/coverage.js index d01b3787..0ed3407c 100644 --- a/modules/coverage.js +++ b/modules/coverage.js @@ -92,7 +92,7 @@ function getSubNodesForNode(node) { subNodes.push(elem); }); break; - case 'ArrowExpression': + case 'ArrowFunctionExpression': Array.prototype.push.apply(subNodes, node.defaults); subNodes.push(node.body); break; @@ -219,7 +219,7 @@ function functionsForNode(node) { switch (node.type) { case 'FunctionDeclaration': case 'FunctionExpression': - case 'ArrowExpression': + case 'ArrowFunctionExpression': functionNames.push({ key: _getFunctionKeyFromReflectedFunction(node), line: node.loc.start.line, n_params: node.params.length }); @@ -921,19 +921,17 @@ function CoverageStatistics(prefixes, cache, shouldWarn) { /* Log function calls */ if (frame.callee !== null && frame.callee.callable) { let name = frame.callee.name ? frame.callee.name : "(anonymous)"; - let line = frame.script.getOffsetLine(frame.offset); + let {lineNumber} = frame.script.getOffsetLocation(frame.offset); let nArgs = frame.callee.parameterNames.length; try { _incrementFunctionCounters(statistics.functionCounters, statistics.linesWithKnownFunctions, - name, - line, - nArgs); + name, lineNumber, nArgs); } catch (e) { /* Something bad happened. Log the exception and delete * statistics for this file */ - _logExceptionAndReset(e, name, line); + _logExceptionAndReset(e, name, lineNumber); return undefined; } } @@ -945,17 +943,17 @@ function CoverageStatistics(prefixes, cache, shouldWarn) { frame.onStep = function() { /* Line counts */ let offset = this.offset; - let offsetLine = this.script.getOffsetLine(offset); + let {lineNumber} = this.script.getOffsetLocation(offset); try { _incrementExpressionCounters(statistics.expressionCounters, frame.script.url, - offsetLine, shouldWarn); - this._branchTracker.incrementBranchCounters(offsetLine); + lineNumber, shouldWarn); + this._branchTracker.incrementBranchCounters(lineNumber); } catch (e) { /* Something bad happened. Log the exception and delete * statistics for this file */ - _logExceptionAndReset(e, frame.callee, offsetLine); + _logExceptionAndReset(e, frame.callee, lineNumber); } }; |