fix flow function param type parsing - allow optional notation as well as type declaration - fixes 6to5/6to5#524
This commit is contained in:
parent
2debaf0f5e
commit
5f9f588386
6
acorn.js
6
acorn.js
@ -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);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user