Skip to content

Commit b5b4251

Browse files
committed
fix sq
1 parent fafcdd1 commit b5b4251

File tree

1 file changed

+4
-7
lines changed
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/utils

1 file changed

+4
-7
lines changed

src/main/java/com/github/_1c_syntax/bsl/languageserver/utils/Trees.java

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ public static ParseTree getPreviousNode(ParseTree parent, ParseTree tnc, int rul
174174
/**
175175
* @param tokens - полный список токенов (см. {@link com.github._1c_syntax.bsl.languageserver.context.DocumentContext#getTokens()}
176176
* @param tokenIndex - индекс текущего токена в переданном списке токенов
177-
* @param tokenType - тип искомого токена (см. {@link com.github._1c_syntax.bsl.parser.BSLParser}
177+
* @param tokenType - тип искомого токена (см. {@link com.github._1c_syntax.bsl.parser.BSLParser}
178178
* @return предыдущий токен, если он был найден
179179
*/
180180
public Optional<Token> getPreviousTokenFromDefaultChannel(List<Token> tokens, int tokenIndex, int tokenType) {
@@ -183,11 +183,8 @@ public Optional<Token> getPreviousTokenFromDefaultChannel(List<Token> tokens, in
183183
return Optional.empty();
184184
}
185185
Token token = tokens.get(tokenIndex);
186-
if (token.getChannel() != Token.DEFAULT_CHANNEL) {
187-
tokenIndex = tokenIndex - 1;
188-
continue;
189-
}
190-
if(token.getType() != tokenType) {
186+
if (token.getChannel() != Token.DEFAULT_CHANNEL
187+
|| token.getType() != tokenType) {
191188
tokenIndex = tokenIndex - 1;
192189
continue;
193190
}
@@ -398,7 +395,7 @@ public static Optional<Token> getTrailingComment(List<Token> tokens, Token token
398395
*
399396
* @param tokens - список токенов из DocumentContext
400397
* @param token - токен, на строке которого требуется найти первый токен
401-
* @return - первый токен в строке
398+
* @return - первый токен в строке
402399
*/
403400
public Token getFirstTokenInLine(List<Token> tokens, Token token) {
404401
int index = token.getTokenIndex();

0 commit comments

Comments
 (0)