move util.errorWithNode to File
This commit is contained in:
@@ -55,7 +55,7 @@ var buildClass = function (node, file) {
|
||||
container.callee.params.push(superClassCallee);
|
||||
}
|
||||
|
||||
buildClassBody(construct, body, className, superName, node);
|
||||
buildClassBody(file, construct, body, className, superName, node);
|
||||
|
||||
if (body.length === 1) {
|
||||
// only a constructor so no need for a closure container
|
||||
@@ -66,7 +66,7 @@ var buildClass = function (node, file) {
|
||||
}
|
||||
};
|
||||
|
||||
var buildClassBody = function (construct, body, className, superName, node) {
|
||||
var buildClassBody = function (file, construct, body, className, superName, node) {
|
||||
var instanceMutatorMap = {};
|
||||
var staticMutatorMap = {};
|
||||
var hasConstructor = false;
|
||||
@@ -84,7 +84,7 @@ var buildClassBody = function (construct, body, className, superName, node) {
|
||||
hasConstructor = true;
|
||||
addConstructor(construct, method);
|
||||
} else {
|
||||
throw util.errorWithNode(node, "unknown kind for constructor method");
|
||||
throw file.errorWithNode(node, "unknown kind for constructor method");
|
||||
}
|
||||
} else {
|
||||
var mutatorMap = instanceMutatorMap;
|
||||
|
||||
@@ -6,12 +6,12 @@ exports.Program =
|
||||
exports.BlockStatement =
|
||||
exports.ForInStatement =
|
||||
exports.ForOfStatement =
|
||||
exports.ForStatement = function (node) {
|
||||
exports.ForStatement = function (node, parent, file) {
|
||||
var constants = [];
|
||||
|
||||
var check = function (node, name) {
|
||||
if (constants.indexOf(name) >= 0) {
|
||||
throw util.errorWithNode(node, name + " is read-only");
|
||||
throw file.errorWithNode(node, name + " is read-only");
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -154,7 +154,7 @@ exports.VariableDeclaration = function (node, parent, file) {
|
||||
declar = declar || b.variableDeclaration(node.kind, []);
|
||||
|
||||
if (node.type !== "VariableDeclaration" && declar.kind !== node.kind) {
|
||||
throw util.errorWithNode(node, "Cannot use this node within the current parent");
|
||||
throw file.errorWithNode(node, "Cannot use this node within the current parent");
|
||||
}
|
||||
|
||||
declar.declarations = declar.declarations.concat(node.declarations);
|
||||
|
||||
Reference in New Issue
Block a user