Merge branch 'master' into code-generator

Conflicts:
	lib/6to5/transformers/classes.js
	test/fixtures/transformation/source-maps/class/expected.js
	test/fixtures/transformation/source-maps/class/source-mappings.json
This commit is contained in:
Sebastian McKenzie
2014-11-03 13:38:44 +11:00
14 changed files with 110 additions and 39 deletions

View File

@@ -107,16 +107,28 @@ var buildClassBody = function (file, construct, body, className, superName, node
}, true));
}
var instanceProps;
var staticProps;
if (!_.isEmpty(instanceMutatorMap)) {
var protoId = util.template("prototype-identifier", {
CLASS_NAME: className
});
body.push(util.buildDefineProperties(instanceMutatorMap, protoId));
instanceProps = util.buildDefineProperties(instanceMutatorMap, protoId);
}
if (!_.isEmpty(staticMutatorMap)) {
body.push(util.buildDefineProperties(staticMutatorMap, className));
staticProps = util.buildDefineProperties(staticMutatorMap, className);
}
if (instanceProps || staticProps) {
instanceProps = instanceProps || b.literal(null);
staticProps = staticProps || b.literal(null);
body.push(b.expressionStatement(
b.callExpression(file.addDeclaration("class-props"), [className, staticProps, instanceProps])
));
}
};