Skip to content

Commit

Permalink
final codacity for day
Browse files Browse the repository at this point in the history
  • Loading branch information
greenemcg committed Mar 25, 2021
1 parent 74a18b0 commit a0732a4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 14 deletions.
6 changes: 2 additions & 4 deletions src/antlr/AntlrUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,9 @@ export class AntlrUtils {

const foundChild = AntlrUtils.findChild(children, lexerType, occurrence);

if (!foundChild) {
return undefined;
if (foundChild) {
return AntlrUtils.findText(foundChild as ParserRuleContext);
}

return AntlrUtils.findText(foundChild as ParserRuleContext)
}
}

Expand Down
18 changes: 8 additions & 10 deletions src/antlr/CqlAntlrListener.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,19 +39,17 @@ abstract class CreatorBase<T extends CqlText> {
}

buildLineInfo(token: Token | undefined): LineInfo | undefined {
if (!token) {
return undefined;
}
if (token) {
const lineInfo = {} as LineInfo;
lineInfo.line = token.line;
lineInfo.position = token.charPositionInLine;

const lineInfo = {} as LineInfo;
lineInfo.line = token.line;
lineInfo.position = token.charPositionInLine;
if (token.charPositionInLine !== 0) {
lineInfo.position += token.stopIndex - token.startIndex;
}

if (token.charPositionInLine !== 0) {
lineInfo.position += token.stopIndex - token.startIndex;
return lineInfo;
}

return lineInfo;
}

protected findChildText(cqlLexerId: number, occurrence: number = 1): string | undefined {
Expand Down

0 comments on commit a0732a4

Please sign in to comment.