File tree Expand file tree Collapse file tree 1 file changed +10
-5
lines changed
compiler/src/dotty/tools/dotc/printing Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -91,18 +91,23 @@ object SyntaxHighlighting {
91
91
name == nme.ERROR || name == nme.CONSTRUCTOR
92
92
}
93
93
94
+ def highlightAnnotations (tree : MemberDef ): Unit =
95
+ for (annotation <- tree.rawMods.annotations)
96
+ highlightPosition(annotation.pos, AnnotationColor )
97
+
94
98
def highlight (trees : List [Tree ])(implicit ctx : Context ): Unit =
95
99
trees.foreach(traverse)
96
100
97
101
def traverse (tree : Tree )(implicit ctx : Context ): Unit = {
98
102
tree match {
99
103
case tree : NameTree if ignored(tree) =>
100
104
()
101
- case tree : MemberDef /* ValOrDefDef | ModuleDef | TypeDef */ =>
102
- for (annotation <- tree.rawMods.annotations)
103
- highlightPosition(annotation.pos, AnnotationColor )
104
- val color = if (tree.isInstanceOf [ValOrDefDef ]) ValDefColor else TypeColor
105
- highlightPosition(tree.namePos, color)
105
+ case tree : ValOrDefDef =>
106
+ highlightAnnotations(tree)
107
+ highlightPosition(tree.namePos, ValDefColor )
108
+ case tree : MemberDef /* ModuleDef | TypeDef */ =>
109
+ highlightAnnotations(tree)
110
+ highlightPosition(tree.namePos, TypeColor )
106
111
case tree : Ident if tree.isType =>
107
112
highlightPosition(tree.pos, TypeColor )
108
113
case _ : TypTree =>
You can’t perform that action at this time.
0 commit comments