From e119681b1fc0e16c5873a92c2906ecaf43e8fa06 Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Sat, 30 May 2015 22:03:25 -0400 Subject: [PATCH] return paths accordingly in insertBefore and insertAfter methods --- src/babel/traversal/path/modification.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/babel/traversal/path/modification.js b/src/babel/traversal/path/modification.js index 466d15d73a..0f996a03f2 100644 --- a/src/babel/traversal/path/modification.js +++ b/src/babel/traversal/path/modification.js @@ -17,7 +17,7 @@ export function insertBefore(nodes) { } else if (this.isPreviousType("Statement") || !this.type) { this._maybePopFromStatements(nodes); if (Array.isArray(this.container)) { - this._containerInsertBefore(nodes); + return this._containerInsertBefore(nodes); } else if (this.isStatementOrBlock()) { if (this.node) nodes.push(this.node); this.node = this.container[this.key] = t.blockStatement(nodes); @@ -27,6 +27,7 @@ export function insertBefore(nodes) { } else { throw new Error("No clue what to do with this node type."); } + return [this]; } export function _containerInsert(from, nodes) { @@ -91,7 +92,7 @@ export function insertAfter(nodes) { } else if (this.isPreviousType("Statement") || !this.type) { this._maybePopFromStatements(nodes); if (Array.isArray(this.container)) { - this._containerInsertAfter(nodes); + return this._containerInsertAfter(nodes); } else if (this.isStatementOrBlock()) { if (this.node) nodes.unshift(this.node); this.node = this.container[this.key] = t.blockStatement(nodes); @@ -101,6 +102,7 @@ export function insertAfter(nodes) { } else { throw new Error("No clue what to do with this node type."); } + return [this]; } /**