Search in sources :

Example 1 with NewSymbol

use of org.sonar.api.batch.sensor.symbol.NewSymbol in project sonar-java by SonarSource.

the class SonarSymbolTableVisitor method createSymbol.

private void createSymbol(IdentifierTree declaration, List<IdentifierTree> usages) {
    SyntaxToken syntaxToken = declaration.identifierToken();
    NewSymbol newSymbol = newSymbolTable.newSymbol(syntaxToken.line(), syntaxToken.column(), syntaxToken.line(), syntaxToken.text().length() + syntaxToken.column());
    for (IdentifierTree usage : usages) {
        syntaxToken = usage.identifierToken();
        newSymbol.newReference(syntaxToken.line(), syntaxToken.column(), syntaxToken.line(), syntaxToken.text().length() + syntaxToken.column());
    }
}
Also used : SyntaxToken(org.sonar.plugins.java.api.tree.SyntaxToken) IdentifierTree(org.sonar.plugins.java.api.tree.IdentifierTree) NewSymbol(org.sonar.api.batch.sensor.symbol.NewSymbol)

Aggregations

NewSymbol (org.sonar.api.batch.sensor.symbol.NewSymbol)1 IdentifierTree (org.sonar.plugins.java.api.tree.IdentifierTree)1 SyntaxToken (org.sonar.plugins.java.api.tree.SyntaxToken)1