perf: Move input to state and precalculate length
This also fixes a bug with async functions
This commit is contained in:
@@ -24,6 +24,7 @@ type TopicContextState = {
|
||||
export default class State {
|
||||
strict: boolean;
|
||||
input: string;
|
||||
length: number;
|
||||
|
||||
curLine: number;
|
||||
|
||||
@@ -37,6 +38,7 @@ export default class State {
|
||||
options.strictMode === false ? false : options.sourceType === "module";
|
||||
|
||||
this.input = input;
|
||||
this.length = input.length;
|
||||
|
||||
this.curLine = options.startLine;
|
||||
this.startLoc = this.endLoc = this.curPosition();
|
||||
|
||||
Reference in New Issue
Block a user