11package com.sourcegraph.semanticdb_kotlinc
22
33import org.scip_code.scip.Index
4+ import org.scip_code.scip.SymbolRole
45import java.nio.file.Path
56import java.nio.file.Paths
67import kotlin.contracts.ExperimentalContracts
@@ -42,12 +43,12 @@ class SemanticdbVisitor(
4243
4344 private fun Sequence<SymbolDescriptorPair>?.emitAll (
4445 element : KtSourceElement ,
45- role : ScipRole ,
46+ roles : Int ,
4647 context : CheckerContext ,
4748 enclosingSource : KtSourceElement ? = null,
4849 ): List <Symbol >? =
4950 this ?.onEach { (firBasedSymbol, symbol) ->
50- scipBuilder.emitScipData(firBasedSymbol, symbol, element, role , context, enclosingSource)
51+ scipBuilder.emitScipData(firBasedSymbol, symbol, element, roles , context, enclosingSource)
5152 }
5253 ?.map { it.symbol }
5354 ?.toList()
@@ -56,55 +57,55 @@ class SemanticdbVisitor(
5657 this .map { SymbolDescriptorPair (firBasedSymbol, it) }
5758
5859 fun visitPackage (pkg : FqName , element : KtSourceElement , context : CheckerContext ) {
59- cache[pkg].with (null ).emitAll(element, ScipRole . REFERENCE , context)
60+ cache[pkg].with (null ).emitAll(element, 0 , context)
6061 }
6162
6263 fun visitClassReference (firClassSymbol : FirClassLikeSymbol <* >, element : KtSourceElement , context : CheckerContext ) {
63- cache[firClassSymbol].with (firClassSymbol).emitAll(element, ScipRole . REFERENCE , context)
64+ cache[firClassSymbol].with (firClassSymbol).emitAll(element, 0 , context)
6465 }
6566
6667 fun visitCallableReference (firClassSymbol : FirCallableSymbol <* >, element : KtSourceElement , context : CheckerContext ) {
67- cache[firClassSymbol].with (firClassSymbol).emitAll(element, ScipRole . REFERENCE , context)
68+ cache[firClassSymbol].with (firClassSymbol).emitAll(element, 0 , context)
6869 }
6970
7071 fun visitClassOrObject (firClass : FirClassLikeDeclaration , element : KtSourceElement , context : CheckerContext , enclosingSource : KtSourceElement ? = null) {
71- cache[firClass.symbol].with (firClass.symbol).emitAll(element, ScipRole . DEFINITION , context, enclosingSource)
72+ cache[firClass.symbol].with (firClass.symbol).emitAll(element, SymbolRole . Definition_VALUE , context, enclosingSource)
7273 }
7374
7475 fun visitPrimaryConstructor (firConstructor : FirConstructor , source : KtSourceElement , context : CheckerContext , enclosingSource : KtSourceElement ? = null) {
75- cache[firConstructor.symbol].with (firConstructor.symbol).emitAll(source, ScipRole . DEFINITION , context, enclosingSource)
76+ cache[firConstructor.symbol].with (firConstructor.symbol).emitAll(source, SymbolRole . Definition_VALUE , context, enclosingSource)
7677 }
7778
7879 fun visitSecondaryConstructor (firConstructor : FirConstructor , source : KtSourceElement , context : CheckerContext , enclosingSource : KtSourceElement ? = null) {
79- cache[firConstructor.symbol].with (firConstructor.symbol).emitAll(source, ScipRole . DEFINITION , context, enclosingSource)
80+ cache[firConstructor.symbol].with (firConstructor.symbol).emitAll(source, SymbolRole . Definition_VALUE , context, enclosingSource)
8081 }
8182
8283 fun visitNamedFunction (firFunction : FirFunction , source : KtSourceElement , context : CheckerContext , enclosingSource : KtSourceElement ? = null) {
83- cache[firFunction.symbol].with (firFunction.symbol).emitAll(source, ScipRole . DEFINITION , context, enclosingSource)
84+ cache[firFunction.symbol].with (firFunction.symbol).emitAll(source, SymbolRole . Definition_VALUE , context, enclosingSource)
8485 }
8586
8687 fun visitProperty (firProperty : FirProperty , source : KtSourceElement , context : CheckerContext , enclosingSource : KtSourceElement ? = null) {
87- cache[firProperty.symbol].with (firProperty.symbol).emitAll(source, ScipRole . DEFINITION , context, enclosingSource)
88+ cache[firProperty.symbol].with (firProperty.symbol).emitAll(source, SymbolRole . Definition_VALUE , context, enclosingSource)
8889 }
8990
9091 fun visitParameter (firParameter : FirValueParameter , source : KtSourceElement , context : CheckerContext , enclosingSource : KtSourceElement ? = null) {
91- cache[firParameter.symbol].with (firParameter.symbol).emitAll(source, ScipRole . DEFINITION , context, enclosingSource)
92+ cache[firParameter.symbol].with (firParameter.symbol).emitAll(source, SymbolRole . Definition_VALUE , context, enclosingSource)
9293 }
9394
9495 fun visitTypeParameter (firTypeParameter : FirTypeParameter , source : KtSourceElement , context : CheckerContext , enclosingSource : KtSourceElement ? = null) {
9596 cache[firTypeParameter.symbol]
9697 .with (firTypeParameter.symbol)
97- .emitAll(source, ScipRole . DEFINITION , context, enclosingSource)
98+ .emitAll(source, SymbolRole . Definition_VALUE , context, enclosingSource)
9899 }
99100
100101 fun visitTypeAlias (firTypeAlias : FirTypeAlias , source : KtSourceElement , context : CheckerContext , enclosingSource : KtSourceElement ? = null) {
101- cache[firTypeAlias.symbol].with (firTypeAlias.symbol).emitAll(source, ScipRole . DEFINITION , context, enclosingSource)
102+ cache[firTypeAlias.symbol].with (firTypeAlias.symbol).emitAll(source, SymbolRole . Definition_VALUE , context, enclosingSource)
102103 }
103104
104105 fun visitPropertyAccessor (firPropertyAccessor : FirPropertyAccessor , source : KtSourceElement , context : CheckerContext , enclosingSource : KtSourceElement ? = null) {
105106 cache[firPropertyAccessor.symbol]
106107 .with (firPropertyAccessor.symbol)
107- .emitAll(source, ScipRole . DEFINITION , context, enclosingSource)
108+ .emitAll(source, SymbolRole . Definition_VALUE , context, enclosingSource)
108109 }
109110
110111 fun visitSimpleNameExpression (
@@ -113,7 +114,7 @@ class SemanticdbVisitor(
113114 ) {
114115 cache[firResolvedNamedReference.resolvedSymbol]
115116 .with (firResolvedNamedReference.resolvedSymbol)
116- .emitAll(source, ScipRole . REFERENCE , context)
117+ .emitAll(source, 0 , context)
117118 }
118119}
119120
0 commit comments