File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed
SourceKitLSPDevUtils/Sources/ConfigSchemaGen Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -15,6 +15,9 @@ import SwiftSyntax
15
15
/// Resolves type declarations from Swift syntax nodes
16
16
class TypeDeclResolver {
17
17
typealias TypeDecl = NamedDeclSyntax & DeclGroupSyntax & DeclSyntaxProtocol
18
+ /// A representation of a qualified name of a type declaration
19
+ ///
20
+ /// `Outer.Inner` type declaration is represented as ["Outer", "Inner"]
18
21
typealias QualifiedName = [ String ]
19
22
private var typeDeclByQualifiedName : [ QualifiedName : TypeDecl ] = [ : ]
20
23
@@ -69,15 +72,15 @@ class TypeDeclResolver {
69
72
70
73
/// Builds the type name scope for a given type usage
71
74
private func buildScope( type: IdentifierTypeSyntax ) -> QualifiedName {
72
- var contextScope : [ String ] = [ ]
75
+ var innerToOuter : [ String ] = [ ]
73
76
var context : SyntaxProtocol = type
74
77
while let parent = context. parent {
75
78
if let parent = parent. asProtocol ( NamedDeclSyntax . self) , parent. isProtocol ( DeclGroupSyntax . self) {
76
- contextScope . append ( parent. name. text)
79
+ innerToOuter . append ( parent. name. text)
77
80
}
78
81
context = parent
79
82
}
80
- return contextScope
83
+ return innerToOuter . reversed ( )
81
84
}
82
85
83
86
/// Looks up a qualified name of a type declaration by its unqualified type usage
You can’t perform that action at this time.
0 commit comments