chore: make cpu usage more smooth (#3842)

This commit is contained in:
Kevin Wan
2024-01-13 19:36:25 +08:00
committed by GitHub
parent 7ba8adfc74
commit 81d72b5010
5 changed files with 11 additions and 6 deletions

View File

@@ -25,7 +25,7 @@ func (b *filterBuilder) check(nodes ...*ast.TokenNode) {
func (b *filterBuilder) checkNodeWithPrefix(prefix string, nodes ...*ast.TokenNode) {
for _, node := range nodes {
joinText:=fmt.Sprintf("%s/%s",prefix,node.Token.Text)
joinText := fmt.Sprintf("%s/%s", prefix, node.Token.Text)
if _, ok := b.m[joinText]; ok {
b.errorManager.add(ast.DuplicateStmtError(node.Pos(), "duplicate "+b.checkExprName))
} else {

View File

@@ -385,7 +385,7 @@ func (p *Parser) parsePathExpr() *ast.PathExpr {
}
values = append(values, p.curTok)
if p.peekTokenIs(token.LPAREN, token.Returns, token.AT_DOC, token.AT_HANDLER, token.SEMICOLON, token.RBRACE){
if p.peekTokenIs(token.LPAREN, token.Returns, token.AT_DOC, token.AT_HANDLER, token.SEMICOLON, token.RBRACE) {
break
}
if p.notExpectPeekTokenGotComment(p.curTokenNode().PeekFirstLeadingComment(), token.COLON, token.IDENT, token.INT) {