perf: Move input to state and precalculate length

This also fixes a bug with async functions
This commit is contained in:
Daniel Tschinder
2019-01-15 12:45:36 -08:00
parent ae154c86ed
commit 2dc1c91955
12 changed files with 160 additions and 126 deletions

View File

@@ -21,7 +21,7 @@ export default class LocationParser extends CommentsParser {
code?: string,
} = {},
): empty {
const loc = getLineInfo(this.input, pos);
const loc = getLineInfo(this.state.input, pos);
message += ` (${loc.line}:${loc.column})`;
// $FlowIgnore
const err: SyntaxError & { pos: number, loc: Position } = new SyntaxError(