fix defaults on type annotated arrow function params - fixes #2493

This commit is contained in:
Sebastian McKenzie
2015-11-05 09:49:03 +00:00
parent 2b6f78df83
commit 779675610f
4 changed files with 462 additions and 10 deletions

View File

@@ -762,6 +762,16 @@ export default function (instance) {
return node.expression;
}
instance.extend("toAssignable", function (inner) {
return function (node) {
if (node.type === "TypeCastExpression") {
return typeCastToParameter(node);
} else {
return inner.apply(this, arguments);
}
};
});
// turn type casts that we found in function parameter head into type annotated params
instance.extend("toAssignableList", function (inner) {
return function (exprList, isBinding) {
@@ -807,6 +817,14 @@ export default function (instance) {
};
});
instance.extend("checkLVal", function (inner) {
return function (node) {
if (node.type !== "TypeCastExpression") {
return inner.apply(this, arguments);
}
};
});
// parse class property type annotations
instance.extend("parseClassProperty", function (inner) {
return function (node) {