refactor: avoid parsing logic on locations (#13200)
This commit is contained in:
parent
fb908fd87e
commit
10f4d08efb
@ -252,16 +252,11 @@ export default (superClass: Class<Parser>): Class<Parser> =>
|
|||||||
|
|
||||||
flowParsePredicate(): N.FlowType {
|
flowParsePredicate(): N.FlowType {
|
||||||
const node = this.startNode();
|
const node = this.startNode();
|
||||||
const moduloLoc = this.state.startLoc;
|
|
||||||
const moduloPos = this.state.start;
|
const moduloPos = this.state.start;
|
||||||
this.expect(tt.modulo);
|
this.next(); // eat `%`
|
||||||
const checksLoc = this.state.startLoc;
|
|
||||||
this.expectContextual("checks");
|
this.expectContextual("checks");
|
||||||
// Force '%' and 'checks' to be adjacent
|
// Force '%' and 'checks' to be adjacent
|
||||||
if (
|
if (this.state.lastTokStart > moduloPos + 1) {
|
||||||
moduloLoc.line !== checksLoc.line ||
|
|
||||||
moduloLoc.column !== checksLoc.column - 1
|
|
||||||
) {
|
|
||||||
this.raise(moduloPos, FlowErrors.UnexpectedSpaceBetweenModuloChecks);
|
this.raise(moduloPos, FlowErrors.UnexpectedSpaceBetweenModuloChecks);
|
||||||
}
|
}
|
||||||
if (this.eat(tt.parenL)) {
|
if (this.eat(tt.parenL)) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user