@@ -3,7 +3,6 @@ package dotty.semanticdb
33import scala .tasty .Reflection
44import scala .tasty .file .TastyConsumer
55
6- import scala .tasty .util .TreeTraverser
76import dotty .tools .dotc .tastyreflect
87import scala .collection .mutable .HashMap
98import scala .meta .internal .{semanticdb => s }
@@ -13,36 +12,13 @@ import dotty.semanticdb.Scala._
1312class SemanticdbConsumer extends TastyConsumer {
1413 var stack : List [String ] = Nil
1514
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- }*/
3815 val semantic : s.TextDocument = s.TextDocument ()
3916 var occurrences : Seq [s.SymbolOccurrence ] = Seq ()
4017
4118 def toSemanticdb (text : String ): s.TextDocument = {
4219 s.TextDocument (text = text, occurrences = occurrences)
4320 }
4421
45-
4622 final def apply (reflect : Reflection )(root : reflect.Tree ): Unit = {
4723 import reflect ._
4824
@@ -67,12 +43,12 @@ class SemanticdbConsumer extends TastyConsumer {
6743 }
6844
6945 object Traverser extends TreeTraverser {
70- val symbolsCache : HashMap [tasty. Symbol , String ] = HashMap ()
46+ val symbolsCache : HashMap [Symbol , String ] = HashMap ()
7147 val symbolPathsDisimbiguator : HashMap [String , Int ] = HashMap ()
7248 implicit class TreeExtender (tree : Tree ) {
7349 def isUserCreated : Boolean = {
7450 val children : List [Position ] =
75- ChildTraverser .getChildren(tree)(tasty .rootContext)
51+ ChildTraverser .getChildren(tree)(reflect .rootContext)
7652 return ! ((tree.pos.exists && tree.pos.start == tree.pos.end && children == Nil ) || children
7753 .exists(_ == tree.pos))
7854 }
@@ -115,9 +91,6 @@ class SemanticdbConsumer extends TastyConsumer {
11591 def isJavaClass : Boolean = false
11692 }
11793
118- val symbolsCache : HashMap [tasty.Symbol , String ] = HashMap ()
119- val symbolPathsDisimbiguator : HashMap [String , Int ] = HashMap ()
120-
12194 def disimbiguate (symbol_path : String ): String = {
12295 if (symbolPathsDisimbiguator.contains(symbol_path)) {
12396 symbolPathsDisimbiguator +=
@@ -238,7 +211,6 @@ class SemanticdbConsumer extends TastyConsumer {
238211
239212 override def traverseTree (tree : Tree )(implicit ctx : Context ): Unit = {
240213 // println(tree.pos.startColumn, tree.symbol.name, tree.pos.endColumn)
241- println(tree)
242214 tree match {
243215 case IsDefinition (body) => {
244216 tree match {
0 commit comments