From de42a6f796329e17dd8168b37e53da18ff7c7904 Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Sat, 28 Mar 2015 04:00:02 +1100 Subject: [PATCH] add existence check for child and parent when inheriting comments --- src/babel/types/index.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/babel/types/index.js b/src/babel/types/index.js index 30d510508b..78738609ac 100644 --- a/src/babel/types/index.js +++ b/src/babel/types/index.js @@ -267,9 +267,11 @@ export function removeComments(child: Object): Object { */ export function inheritsComments(child: Object, parent: Object): Object { - each(COMMENT_KEYS, function (key) { - child[key] = uniq(compact([].concat(child[key], parent[key]))); - }); + if (child && parent) { + each(COMMENT_KEYS, function (key) { + child[key] = uniq(compact([].concat(child[key], parent[key]))); + }); + } return child; }