don't allow visitor methods to return a new node to replace

This commit is contained in:
Sebastian McKenzie 2015-09-15 06:27:37 +01:00
parent 13773e3c02
commit 6898cf83d0

View File

@ -23,7 +23,7 @@ export function call(key) {
var replacement = fn.call(this, this, this.state);
if (replacement) {
this.replaceWith(replacement, true);
throw new Error("Unexpected return value from visitor method");
}
if (this.shouldStop || this.shouldSkip || this.removed) return;