merge validation transformers

This commit is contained in:
Sebastian McKenzie 2015-03-07 01:25:44 +11:00
parent 119314df74
commit 35c49dbef7
3 changed files with 10 additions and 18 deletions

View File

@ -1,9 +1,8 @@
export default {
strict: require("./other/strict"),
"validation.undeclaredVariableCheck": require("./validation/undeclared-variable-check"),
"validation.noForInOfAssignment": require("./validation/no-for-in-of-assignment"),
"validation.setters": require("./validation/setters"),
_validation: require("./internal/validation"),
"validation.react": require("./validation/react"),
// this goes at the start so we only transform the original user code

View File

@ -1,8 +1,6 @@
import * as messages from "../../../messages";
import t from "../../../types";
export { isFor as check } from "../../../types";
export function ForOfStatement(node, parent, scope, file) {
var left = node.left;
if (t.isVariableDeclaration(left)) {
@ -12,3 +10,11 @@ export function ForOfStatement(node, parent, scope, file) {
}
export { ForOfStatement as ForInStatement };
export function Property(node, parent, scope, file) {
if (node.kind === "set" && node.value.params.length !== 1) {
throw file.errorWithNode(node.value, messages.get("settersInvalidParamLength"));
}
}
export { Property as MethodDefinition };

View File

@ -1,13 +0,0 @@
import * as messages from "../../../messages";
export function check(node) {
return node.kind === "set";
}
export function Property(node, parent, scope, file) {
if (node.kind === "set" && node.value.params.length !== 1) {
throw file.errorWithNode(node.value, messages.get("settersInvalidParamLength"));
}
}
export { Property as MethodDefinition };