ast-types
Advanced tools
Comparing version 0.3.1 to 0.3.2
@@ -68,2 +68,6 @@ var assert = require("assert"); | ||
NPp.getValueProperty = function(name) { | ||
return types.getFieldValue(this.value, name); | ||
}; | ||
NPp.needsParens = function() { | ||
@@ -70,0 +74,0 @@ if (!this.parent) |
@@ -0,1 +1,2 @@ | ||
var assert = require("assert"); | ||
var types = require("./types"); | ||
@@ -10,2 +11,3 @@ var Node = types.namedTypes.Node; | ||
path.each(traverse); | ||
} else if (Node.check(path.value)) { | ||
@@ -18,7 +20,17 @@ var node = path.value; | ||
// Child paths are cached, so path.parentPath.get(path.name) | ||
// should return the same Path object unless path.replace was | ||
// called during the callback. | ||
path = path.parentPath.get(path.name); | ||
// The node might have been replaced during the callback. | ||
node = path.value; | ||
if (!Node.check(node)) { | ||
return; | ||
} | ||
types.eachField(node, function(name, child) { | ||
// Need to create the child path manually because child | ||
// might not actually be identical to path.value[name], | ||
// if for instance a default field value was substituted. | ||
traverse(new NodePath(child, path, name)); | ||
var childPath = path.get(name); | ||
assert.strictEqual(childPath.value, child); | ||
traverse(childPath); | ||
}); | ||
@@ -25,0 +37,0 @@ } |
@@ -21,3 +21,3 @@ { | ||
], | ||
"version": "0.3.1", | ||
"version": "0.3.2", | ||
"homepage": "http://github.com/benjamn/ast-types", | ||
@@ -33,3 +33,3 @@ "repository": { | ||
"dependencies": { | ||
"ast-path": "~0.1.1" | ||
"ast-path": "~0.1.2" | ||
}, | ||
@@ -36,0 +36,0 @@ "devDependencies": {}, |
403390
11330
Updatedast-path@~0.1.2