remove dead code

This commit is contained in:
Sebastian McKenzie
2014-09-29 18:29:16 +10:00
parent 0e19006641
commit be5ebe1758
3 changed files with 6 additions and 25 deletions

View File

@@ -37,25 +37,23 @@ var buildClassBody = function (body, className, superName, node) {
var mutatorMap = {};
var classBody = node.body.body;
_.each(classBody, function (bodyNode) {
if (bodyNode.type !== "MethodDefinition") return;
var methodName = bodyNode.key.name;
var method = bodyNode.value;
_.each(classBody, function (node) {
var methodName = node.key.name;
var method = node.value;
replaceInstanceSuperReferences(superName, method);
if (methodName === "constructor") {
if (bodyNode.kind === "") {
if (node.kind === "") {
addConstructor(body[0], method);
} else {
throw new Error("unknown kind for constructor method");
}
} else {
if (bodyNode.kind === "") {
if (node.kind === "") {
addInstanceMethod(body, className, methodName, method);
} else {
util.pushMutatorMap(mutatorMap, methodName, bodyNode.kind, bodyNode);
util.pushMutatorMap(mutatorMap, methodName, node.kind, node);
}
}
});

View File

@@ -75,8 +75,6 @@ exports.ExportDeclaration = function (node) {
KEY: declar.id,
VALUE: declar
}, true));
} else {
throw new Error("unsupported export declaration type " + declar.type);
}
}
}

View File

@@ -72,18 +72,3 @@ traverse.replace = function (node, callback) {
if (result != null) obj[key] = result;
});
};
traverse.replace.shallow = function (node, callback) {
traverse(node, function (node, parent, obj, key) {
var result = callback(node, parent);
if (result != null) obj[key] = result;
return false;
});
};
traverse.shallow = function (node, callback) {
traverse(node, function () {
callback.apply(this, arguments);
return false;
});
};