fix flow function param type parsing - allow optional notation as well as type declaration - fixes 6to5/6to5#524

This commit is contained in:
Sebastian McKenzie 2015-01-18 18:33:42 +11:00
parent 2debaf0f5e
commit 5f9f588386

View File

@ -3043,6 +3043,7 @@
defaults.push(null);
}
}
if (!eat(_comma)) {
expect(_parenR);
break;
@ -3058,10 +3059,11 @@
}
function parseFunctionParam(param) {
if (eat(_question)) {
param.optional = true;
}
if (tokType === _colon) {
param.typeAnnotation = parseTypeAnnotation();
} else if (eat(_question)) {
param.optional = true;
}
finishNode(param, param.type);
}