Comparing version 0.20.3 to 0.20.4
@@ -12,4 +12,3 @@ "use strict"; | ||
var util_1 = require("./util"); | ||
var private_1 = require("private"); | ||
var childNodesCacheKey = private_1.makeUniqueKey(); | ||
var childNodesCache = new WeakMap(); | ||
// TODO Move a non-caching implementation of this function into ast-types, | ||
@@ -19,3 +18,3 @@ // and implement a caching wrapper function here. | ||
if (!node) { | ||
return; | ||
return resultArray; | ||
} | ||
@@ -34,3 +33,6 @@ // The .loc checks below are sensitive to some of the problems that | ||
for (; i >= 0; --i) { | ||
if (util_1.comparePos(resultArray[i].loc.end, node.loc.start) <= 0) { | ||
var child = resultArray[i]; | ||
if (child && | ||
child.loc && | ||
util_1.comparePos(child.loc.end, node.loc.start) <= 0) { | ||
break; | ||
@@ -40,7 +42,10 @@ } | ||
resultArray.splice(i + 1, 0, node); | ||
return; | ||
return resultArray; | ||
} | ||
} | ||
else if (node[childNodesCacheKey]) { | ||
return node[childNodesCacheKey]; | ||
else { | ||
var childNodes = childNodesCache.get(node); | ||
if (childNodes) { | ||
return childNodes; | ||
} | ||
} | ||
@@ -55,9 +60,6 @@ var names; | ||
else { | ||
return; | ||
return resultArray; | ||
} | ||
if (!resultArray) { | ||
Object.defineProperty(node, childNodesCacheKey, { | ||
value: resultArray = [], | ||
enumerable: false, | ||
}); | ||
childNodesCache.set(node, (resultArray = [])); | ||
} | ||
@@ -75,4 +77,7 @@ for (var i = 0, nameCount = names.length; i < nameCount; ++i) { | ||
// Time to dust off the old binary search robes and wizard hat. | ||
var left = 0, right = childNodes.length, precedingNode, followingNode; | ||
while (left < right) { | ||
var left = 0; | ||
var right = childNodes && childNodes.length; | ||
var precedingNode; | ||
var followingNode; | ||
while (typeof right === "number" && left < right) { | ||
var middle = (left + right) >> 1; | ||
@@ -79,0 +84,0 @@ var child = childNodes[middle]; |
{ | ||
"author": "Ben Newman <bn@cs.stanford.edu>", | ||
"name": "recast", | ||
"version": "0.20.3", | ||
"version": "0.20.4", | ||
"description": "JavaScript syntax tree transformer, nondestructive pretty-printer, and automatic source map generator", | ||
@@ -45,5 +45,4 @@ "keywords": [ | ||
"dependencies": { | ||
"ast-types": "0.14.1", | ||
"ast-types": "0.14.2", | ||
"esprima": "~4.0.0", | ||
"private": "^0.1.8", | ||
"source-map": "~0.6.1", | ||
@@ -53,13 +52,13 @@ "tslib": "^2.0.1" | ||
"devDependencies": { | ||
"@babel/core": "7.11.4", | ||
"@babel/parser": "7.11.4", | ||
"@babel/preset-env": "7.11.0", | ||
"@babel/core": "7.11.6", | ||
"@babel/parser": "7.11.5", | ||
"@babel/preset-env": "7.11.5", | ||
"@types/esprima": "4.0.2", | ||
"@types/glob": "7.1.3", | ||
"@types/mocha": "8.0.3", | ||
"@types/node": "14.6.1", | ||
"@types/node": "14.10.0", | ||
"@typescript-eslint/parser": "^3.0.1", | ||
"eslint": "^7.1.0", | ||
"esprima-fb": "15001.1001.0-dev-harmony-fb", | ||
"flow-parser": "0.132.0", | ||
"flow-parser": "0.135.0", | ||
"glob": "7.1.6", | ||
@@ -66,0 +65,0 @@ "lint-staged": "^10.2.6", |
Sorry, the diff of this file is too big to display
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
234604
4
5621
+ Addedast-types@0.14.2(transitive)
- Removedprivate@^0.1.8
- Removedast-types@0.14.1(transitive)
- Removedprivate@0.1.8(transitive)
Updatedast-types@0.14.2