Skip to content

Commit

Permalink
review
Browse files Browse the repository at this point in the history
  • Loading branch information
liuxingbaoyu committed Jan 9, 2024
1 parent 2ef66ce commit 16284ce
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/babel-parser/src/parser/index.ts
Expand Up @@ -44,6 +44,7 @@ export default class Parser extends StatementParser {
file.errors = null;
this.parseTopLevel(file, program);
file.errors = this.state.errors;
file.comments.length = this.state.commentsLen;
return file;
}
}
Expand Down
5 changes: 5 additions & 0 deletions packages/babel-parser/src/tokenizer/state.ts
Expand Up @@ -274,6 +274,11 @@ export default class State {
// Tokens length in token store
tokensLength: number = 0;

/**
* When we add a new property, we must manually update the `clone` method
* @see State#clone
*/

curPosition(): Position {
return new Position(this.curLine, this.pos - this.lineStart, this.pos);
}
Expand Down

0 comments on commit 16284ce

Please sign in to comment.