Skip to content

Commit

Permalink
review
Browse files Browse the repository at this point in the history
  • Loading branch information
liuxingbaoyu committed Nov 25, 2023
1 parent eb0bb11 commit 21c6cd7
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 21c6cd7

Please sign in to comment.