Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ast-types

Package Overview
Dependencies
Maintainers
1
Versions
172
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ast-types - npm Package Compare versions

Comparing version 0.4.8 to 0.4.9

28

lib/path.js

@@ -34,3 +34,3 @@ var assert = require("assert");

// child Path object, for both performance and consistency reasons.
this.__childCache = Object.create(null);
this.__childCache = null;
}

@@ -40,4 +40,10 @@

function getChildCache(path) {
// Lazily create the child cache. This also cheapens cache
// invalidation, since you can just reset path.__childCache to null.
return path.__childCache || (path.__childCache = Object.create(null));
}
function getChildPath(path, name) {
var cache = path.__childCache;
var cache = getChildCache(path);
var actualChildValue = path.getValueProperty(name);

@@ -148,3 +154,3 @@ var childPath = cache[name];

var moves = Object.create(null);
var cache = path.__childCache;
var cache = getChildCache(path);

@@ -190,3 +196,3 @@ for (var i = start; i < end; ++i) {

isArray.assert(this.value);
delete this.__childCache.length
delete getChildCache(this).length
return this.value.push.apply(this.value, arguments);

@@ -197,3 +203,3 @@ };

isArray.assert(this.value);
var cache = this.__childCache;
var cache = getChildCache(this);
delete cache[this.value.length - 1];

@@ -252,3 +258,3 @@ delete cache.length;

var parentValue = pp.value;
var parentCache = pp.__childCache;
var parentCache = getChildCache(pp);

@@ -282,3 +288,3 @@ // Make sure parentCache[path.name] is populated.

var parentValue = this.parentPath.value;
var parentCache = this.parentPath.__childCache;
var parentCache = getChildCache(this.parentPath);
var count = arguments.length;

@@ -310,3 +316,3 @@

delete parentCache[this.name];
this.__childCache = {};
this.__childCache = null;

@@ -318,3 +324,3 @@ } else {

this.value = replacement;
this.__childCache = {};
this.__childCache = null;
}

@@ -331,3 +337,3 @@

if (this.value !== replacement) {
this.__childCache = {};
this.__childCache = null;
}

@@ -340,3 +346,3 @@ this.value = parentValue[this.name] = replacement;

delete this.value;
this.__childCache = {};
this.__childCache = null;

@@ -343,0 +349,0 @@ // Leave this path cached as parentCache[this.name], even though

@@ -8,2 +8,3 @@ var assert = require("assert");

var hasOwn = Object.prototype.hasOwnProperty;
var b = types.builders;

@@ -86,2 +87,20 @@ function Scope(path, parentScope) {

Sp.injectTemporary = function(identifier, init) {
identifier || (identifier = this.declareTemporary());
var bodyPath = this.path.get("body");
if (namedTypes.BlockStatement.check(bodyPath.value)) {
bodyPath = bodyPath.get("body");
}
bodyPath.unshift(
b.variableDeclaration(
"var",
[b.variableDeclarator(identifier, init || null)]
)
);
return identifier;
};
Sp.scan = function(force) {

@@ -88,0 +107,0 @@ if (force || !this.didScan) {

@@ -21,3 +21,3 @@ {

],
"version": "0.4.8",
"version": "0.4.9",
"homepage": "http://github.com/benjamn/ast-types",

@@ -24,0 +24,0 @@ "repository": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc