Fix some flow unused warnings (#543)

This commit is contained in:
Brian Ng 2017-05-26 22:44:36 -05:00 committed by Henry Zhu
parent 81ce415359
commit aad95c63ec
2 changed files with 14 additions and 6 deletions

View File

@ -151,7 +151,7 @@ export default class ExpressionParser extends LValParser {
// Parse a ternary conditional (`?:`) operator.
parseMaybeConditional(noIn: ?boolean, refShorthandDefaultPos: Pos, refNeedsArrowPos: ?Pos): N.Expression {
parseMaybeConditional(noIn: ?boolean, refShorthandDefaultPos: Pos, refNeedsArrowPos?: ?Pos): N.Expression {
const startPos = this.state.start;
const startLoc = this.state.startLoc;
const expr = this.parseExprOps(noIn, refShorthandDefaultPos);
@ -160,7 +160,15 @@ export default class ExpressionParser extends LValParser {
return this.parseConditional(expr, noIn, startPos, startLoc, refNeedsArrowPos);
}
parseConditional(expr: N.Expression, noIn: ?boolean, startPos: number, startLoc: Position): N.Expression {
parseConditional(
expr: N.Expression,
noIn: ?boolean,
startPos: number,
startLoc: Position,
// FIXME: Disabling this for now since can't seem to get it to play nicely
// eslint-disable-next-line no-unused-vars
refNeedsArrowPos?: ?Pos
): N.Expression {
if (this.eat(tt.question)) {
const node = this.startNodeAt(startPos, startLoc);
node.test = expr;
@ -470,7 +478,7 @@ export default class ExpressionParser extends LValParser {
const oldLabels = this.state.labels;
this.state.labels = [];
this.state.inFunction = false;
node.body = this.parseBlock(false, true);
node.body = this.parseBlock(false);
this.state.inFunction = oldInFunction;
this.state.labels = oldLabels;
return this.finishNode(node, "DoExpression");

View File

@ -1072,7 +1072,7 @@ export default (superClass: Class<Parser>): Class<Parser> => class extends super
return super.isExportDefaultSpecifier();
}
parseConditional(expr: N.Expression, noIn: ?boolean, startPos: number, startLoc: Position, refNeedsArrowPos?: Pos): N.Expression {
parseConditional(expr: N.Expression, noIn: ?boolean, startPos: number, startLoc: Position, refNeedsArrowPos?: ?Pos): N.Expression {
// only do the expensive clone if there is a question mark
// and if we come from inside parens
if (refNeedsArrowPos && this.match(tt.question)) {
@ -1260,8 +1260,8 @@ export default (superClass: Class<Parser>): Class<Parser> => class extends super
}
// parse a the super class type parameters and implements
parseClassSuper(node: N.Class, isStatement?: boolean): void {
super.parseClassSuper(node, isStatement);
parseClassSuper(node: N.Class): void {
super.parseClassSuper(node);
if (node.superClass && this.isRelational("<")) {
node.superTypeParameters = this.flowParseTypeParameterInstantiation();
}