istanbul-lib-instrument
Advanced tools
Comparing version 1.1.1 to 1.1.2
@@ -5,2 +5,12 @@ # Change Log | ||
<a name="1.1.2"></a> | ||
## [1.1.2](https://github.com/istanbuljs/istanbul-lib-instrument/compare/v1.1.1...v1.1.2) (2016-09-08) | ||
### Performance Improvements | ||
* use zero-based numeric indices for much faster instrumented code ([#22](https://github.com/istanbuljs/istanbul-lib-instrument/issues/22)) ([5b401f5](https://github.com/istanbuljs/istanbul-lib-instrument/commit/5b401f5)) | ||
<a name="1.1.1"></a> | ||
@@ -7,0 +17,0 @@ ## [1.1.1](https://github.com/istanbuljs/istanbul-lib-instrument/compare/v1.1.0...v1.1.1) (2016-08-30) |
@@ -47,3 +47,3 @@ 'use strict'; | ||
var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(SourceCoverage).call(this, pathOrObj)); | ||
var _this = _possibleConstructorReturn(this, (SourceCoverage.__proto__ || Object.getPrototypeOf(SourceCoverage)).call(this, pathOrObj)); | ||
@@ -63,6 +63,6 @@ _this.meta = { | ||
value: function newStatement(loc) { | ||
this.meta.last.s += 1; | ||
var s = this.meta.last.s; | ||
this.data.statementMap[s] = cloneLocation(loc); | ||
this.data.s[s] = 0; | ||
this.meta.last.s += 1; | ||
return s; | ||
@@ -73,3 +73,2 @@ } | ||
value: function newFunction(name, decl, loc) { | ||
this.meta.last.f += 1; | ||
var f = this.meta.last.f; | ||
@@ -83,2 +82,3 @@ name = name || '(anonymous_' + f + ')'; | ||
this.data.f[f] = 0; | ||
this.meta.last.f += 1; | ||
return f; | ||
@@ -89,3 +89,2 @@ } | ||
value: function newBranch(type, loc) { | ||
this.meta.last.b += 1; | ||
var b = this.meta.last.b; | ||
@@ -98,2 +97,3 @@ this.data.b[b] = []; | ||
}; | ||
this.meta.last.b += 1; | ||
return b; | ||
@@ -100,0 +100,0 @@ } |
@@ -124,3 +124,3 @@ 'use strict'; | ||
// else check custom node attribute set by a prior visitor | ||
if (this.getAttr(path.node, 'skip-all')) { | ||
if (this.getAttr(path.node, 'skip-all') !== null) { | ||
this.nextIgnore = n; | ||
@@ -178,3 +178,3 @@ } | ||
}; | ||
return T.unaryExpression('++', wrap(T.memberExpression(T.memberExpression(T.identifier(this.varName), T.identifier(type)), T.stringLiteral(String(id)), true))); | ||
return T.unaryExpression('++', wrap(T.memberExpression(T.memberExpression(T.identifier(this.varName), T.identifier(type)), T.numericLiteral(id), true))); | ||
} | ||
@@ -402,3 +402,3 @@ }, { | ||
/* istanbul ignore if: paranoid check */ | ||
if (!b) { | ||
if (b === null) { | ||
throw new Error('Unable to get switch branch name'); | ||
@@ -476,3 +476,3 @@ } | ||
// the template to insert at the top of the program. | ||
var coverageTemplate = (0, _babelTemplate2.default)('\n var COVERAGE_VAR = (function () {\n var path = PATH, \n hash = HASH,\n global = (new Function(\'return this\'))(),\n gcv = GLOBAL_COVERAGE_VAR,\n coverageData = INITIAL,\n coverage = global[gcv] || (global[gcv] = {});\n if (coverage[path] && coverage[path].hash === hash) {\n return coverage[path];\n }\n coverageData.hash = hash;\n return coverage[path] = coverageData;\n })();\n'); | ||
var coverageTemplate = (0, _babelTemplate2.default)('\n var COVERAGE_VAR = (function () {\n var path = PATH,\n hash = HASH,\n global = (new Function(\'return this\'))(),\n gcv = GLOBAL_COVERAGE_VAR,\n coverageData = INITIAL,\n coverage = global[gcv] || (global[gcv] = {});\n if (coverage[path] && coverage[path].hash === hash) {\n return coverage[path];\n }\n coverageData.hash = hash;\n return coverage[path] = coverageData;\n })();\n'); | ||
/** | ||
@@ -479,0 +479,0 @@ * programVisitor is a `babel` adaptor for instrumentation. |
{ | ||
"name": "istanbul-lib-instrument", | ||
"version": "1.1.1", | ||
"version": "1.1.2", | ||
"description": "Core istanbul API for JS code coverage", | ||
@@ -5,0 +5,0 @@ "author": "Krishnan Anantheswaran <kananthmail-github@yahoo.com>", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
39852