fix comments not being retained from MethodDefinition in classes

This commit is contained in:
Sebastian McKenzie
2014-11-16 11:30:05 +11:00
parent d09bafaf8c
commit 00483917f0
4 changed files with 40 additions and 16 deletions

View File

@@ -106,8 +106,13 @@ exports.buildDefineProperties = function (mutatorMap) {
if (key[0] === "_") return;
node = _.clone(node);
var inheritNode = node;
if (t.isMethodDefinition(node)) node = node.value;
mapNode.properties.push(t.property("init", t.identifier(key), node));
var prop = t.property("init", t.identifier(key), node);
t.inheritsComments(prop, inheritNode);
t.removeComments(inheritNode);
mapNode.properties.push(prop);
});
objExpr.properties.push(propNode);