simplify isLookaheadRelational method (#11922)
* refactor: move isLookaheadRelational to flow plugins * refactor: simplify isLookaheadRelational to isLookaheadToken_lt
This commit is contained in:
@@ -6,7 +6,6 @@ import State from "../tokenizer/state";
|
||||
import type { Node } from "../types";
|
||||
import { lineBreak } from "../util/whitespace";
|
||||
import { isIdentifierChar } from "../util/identifier";
|
||||
import * as charCodes from "charcodes";
|
||||
import { Errors } from "./error";
|
||||
|
||||
type TryParse<Node, Error, Thrown, Aborted, FailState> = {
|
||||
@@ -35,18 +34,6 @@ export default class UtilParser extends Tokenizer {
|
||||
return this.match(tt.relational) && this.state.value === op;
|
||||
}
|
||||
|
||||
isLookaheadRelational(op: "<" | ">"): boolean {
|
||||
const next = this.nextTokenStart();
|
||||
if (this.input.charAt(next) === op) {
|
||||
if (next + 1 === this.input.length) {
|
||||
return true;
|
||||
}
|
||||
const afterNext = this.input.charCodeAt(next + 1);
|
||||
return afterNext !== op.charCodeAt(0) && afterNext !== charCodes.equalsTo;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// TODO
|
||||
|
||||
expectRelational(op: "<" | ">"): void {
|
||||
|
||||
Reference in New Issue
Block a user