ast-types
Advanced tools
Comparing version 0.3.18 to 0.3.20
@@ -115,3 +115,3 @@ require("./core"); | ||
.field("id", def("Identifier")) | ||
.field("name", def("Identifier"), defaults["null"]); | ||
.field("name", or(def("Identifier"), null), defaults["null"]); | ||
@@ -136,3 +136,3 @@ def("ExportSpecifier") | ||
def("Declaration"), | ||
def("AssignmentExpression") // Implies default. | ||
def("Expression") // Implies default. | ||
)) | ||
@@ -142,4 +142,4 @@ .field("specifiers", [or( | ||
def("ExportBatchSpecifier") | ||
)]) | ||
.field("source", or(ModuleSpecifier, null)); | ||
)], defaults.emptyArray) | ||
.field("source", or(ModuleSpecifier, null), defaults["null"]); | ||
@@ -146,0 +146,0 @@ def("ImportDeclaration") |
var assert = require("assert"); | ||
var getChildCache = require("private").makeAccessor(); | ||
var Op = Object.prototype; | ||
@@ -21,17 +20,16 @@ var hasOwn = Op.hasOwnProperty; | ||
Object.defineProperties(this, { | ||
// The value encapsulated by this Path, generally equal to | ||
// parentPath.value[name] if we have a parentPath. | ||
value: { value: value }, | ||
// The value encapsulated by this Path, generally equal to | ||
// parentPath.value[name] if we have a parentPath. | ||
this.value = value; | ||
// The immediate parent Path of this Path. | ||
parentPath: { value: parentPath }, | ||
// The immediate parent Path of this Path. | ||
this.parentPath = parentPath; | ||
// The name of the property of parentPath.value through which this | ||
// Path's value was reached. | ||
name: { | ||
value: name, | ||
configurable: true | ||
} | ||
}); | ||
// The name of the property of parentPath.value through which this | ||
// Path's value was reached. | ||
this.name = name; | ||
// Calling path.get("child") multiple times always returns the same | ||
// child Path object, for both performance and consistency reasons. | ||
this.__childCache = {}; | ||
} | ||
@@ -42,3 +40,3 @@ | ||
function getChildPath(path, name) { | ||
var cache = getChildCache(path); | ||
var cache = path.__childCache; | ||
return hasOwn.call(cache, name) | ||
@@ -124,3 +122,3 @@ ? cache[name] | ||
var parentValue = this.parentPath.value; | ||
var parentCache = getChildCache(this.parentPath); | ||
var parentCache = this.parentPath.__childCache; | ||
var results = []; | ||
@@ -127,0 +125,0 @@ |
@@ -47,7 +47,2 @@ var assert = require("assert"); | ||
if (namedTypes.ModuleDeclaration) { | ||
// Include ModuleDeclaration only if it exists (ES6). | ||
scopeTypes.push(namedTypes.ModuleDeclaration); | ||
} | ||
var ScopeType = Type.or.apply(Type, scopeTypes); | ||
@@ -126,2 +121,6 @@ | ||
} else if (namedTypes.ModuleDeclaration && | ||
namedTypes.ModuleDeclaration.check(node)) { | ||
addPattern(path.get("id"), bindings); | ||
} else if (Node.check(node)) { | ||
@@ -128,0 +127,0 @@ types.eachField(node, function(name, child) { |
@@ -21,3 +21,3 @@ { | ||
], | ||
"version": "0.3.18", | ||
"version": "0.3.20", | ||
"homepage": "http://github.com/benjamn/ast-types", | ||
@@ -24,0 +24,0 @@ "repository": { |
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
424976
11863