@@ -3,7 +3,6 @@ package dotty.semanticdb
3
3
import scala .tasty .Reflection
4
4
import scala .tasty .file .TastyConsumer
5
5
6
- import scala .tasty .util .TreeTraverser
7
6
import dotty .tools .dotc .tastyreflect
8
7
import scala .collection .mutable .HashMap
9
8
import scala .meta .internal .{semanticdb => s }
@@ -13,36 +12,13 @@ import dotty.semanticdb.Scala._
13
12
class SemanticdbConsumer extends TastyConsumer {
14
13
var stack : List [String ] = Nil
15
14
16
- /*
17
- val symbolsDefs : HashMap[String, Int] = HashMap()
18
- val symbolsVals : HashMap[String, Int] = HashMap()
19
-
20
- def insertPathDefDef(path: String): String = {
21
- if (symbolsDefs.contains(path)) {
22
- symbolsDefs += (path -> (symbolsDefs(path) + 1))
23
- "+" + (symbolsDefs(path) - 1)
24
- } else {
25
- symbolsDefs += (path -> 1)
26
- ""
27
- }
28
- }
29
- def insertPathValDef(path: String): String = {
30
- if (symbolsVals.contains(path)) {
31
- symbolsVals += (path -> (symbolsVals(path) + 1))
32
- "+" + (symbolsVals(path) - 1)
33
- } else {
34
- symbolsVals += (path -> 1)
35
- ""
36
- }
37
- }*/
38
15
val semantic : s.TextDocument = s.TextDocument ()
39
16
var occurrences : Seq [s.SymbolOccurrence ] = Seq ()
40
17
41
18
def toSemanticdb (text : String ): s.TextDocument = {
42
19
s.TextDocument (text = text, occurrences = occurrences)
43
20
}
44
21
45
-
46
22
final def apply (reflect : Reflection )(root : reflect.Tree ): Unit = {
47
23
import reflect ._
48
24
@@ -67,12 +43,12 @@ class SemanticdbConsumer extends TastyConsumer {
67
43
}
68
44
69
45
object Traverser extends TreeTraverser {
70
- val symbolsCache : HashMap [tasty. Symbol , String ] = HashMap ()
46
+ val symbolsCache : HashMap [Symbol , String ] = HashMap ()
71
47
val symbolPathsDisimbiguator : HashMap [String , Int ] = HashMap ()
72
48
implicit class TreeExtender (tree : Tree ) {
73
49
def isUserCreated : Boolean = {
74
50
val children : List [Position ] =
75
- ChildTraverser .getChildren(tree)(tasty .rootContext)
51
+ ChildTraverser .getChildren(tree)(reflect .rootContext)
76
52
return ! ((tree.pos.exists && tree.pos.start == tree.pos.end && children == Nil ) || children
77
53
.exists(_ == tree.pos))
78
54
}
@@ -115,9 +91,6 @@ class SemanticdbConsumer extends TastyConsumer {
115
91
def isJavaClass : Boolean = false
116
92
}
117
93
118
- val symbolsCache : HashMap [tasty.Symbol , String ] = HashMap ()
119
- val symbolPathsDisimbiguator : HashMap [String , Int ] = HashMap ()
120
-
121
94
def disimbiguate (symbol_path : String ): String = {
122
95
if (symbolPathsDisimbiguator.contains(symbol_path)) {
123
96
symbolPathsDisimbiguator +=
@@ -238,7 +211,6 @@ class SemanticdbConsumer extends TastyConsumer {
238
211
239
212
override def traverseTree (tree : Tree )(implicit ctx : Context ): Unit = {
240
213
// println(tree.pos.startColumn, tree.symbol.name, tree.pos.endColumn)
241
- println(tree)
242
214
tree match {
243
215
case IsDefinition (body) => {
244
216
tree match {
0 commit comments