File tree Expand file tree Collapse file tree 8 files changed +587
-585
lines changed Expand file tree Collapse file tree 8 files changed +587
-585
lines changed Original file line number Diff line number Diff line change @@ -67,7 +67,7 @@ extension SyntaxProtocol {
67
67
if !allowBlockNames && ( syntax. is ( CodeBlockSyntax . self) || syntax. is ( MemberDeclBlockSyntax . self) ) {
68
68
return nil
69
69
}
70
- return syntax. as ( SyntaxEnum . self ) . nameForDiagnostics
70
+ return syntax. kind . nameForDiagnostics
71
71
}
72
72
73
73
/// A short description of this node that can be displayed inline in a single line.
Original file line number Diff line number Diff line change @@ -42,6 +42,23 @@ extension SyntaxKind {
42
42
case . unknown: return UnknownSyntax . self
43
43
% for node in NON_BASE_SYNTAX_NODES:
44
44
case . ${ node. swift_syntax_kind} : return ${ node. name} . self
45
+ % end
46
+ }
47
+ }
48
+
49
+ public var nameForDiagnostics : String ? {
50
+ switch self {
51
+ case . unknown:
52
+ return nil
53
+ case . token:
54
+ return " token "
55
+ % for node in NON_BASE_SYNTAX_NODES:
56
+ case . ${ node. swift_syntax_kind} :
57
+ % if node. name_for_diagnostics:
58
+ return " ${node.name_for_diagnostics} "
59
+ % else :
60
+ return nil
61
+ % end
45
62
% end
46
63
}
47
64
}
Original file line number Diff line number Diff line change @@ -225,6 +225,10 @@ extension SyntaxProtocol {
225
225
return _syntaxNode. data. raw
226
226
}
227
227
228
+ public var kind : SyntaxKind {
229
+ return raw. kind
230
+ }
231
+
228
232
public var syntaxNodeType : SyntaxProtocol . Type {
229
233
return self . raw. kind. syntaxNodeType
230
234
}
Original file line number Diff line number Diff line change @@ -30,23 +30,6 @@ public enum SyntaxEnum {
30
30
case ${ node. swift_syntax_kind} ( ${ node. name} )
31
31
% end
32
32
% end
33
-
34
- public var nameForDiagnostics : String ? {
35
- switch self {
36
- case . unknown:
37
- return nil
38
- case . token:
39
- return " token "
40
- % for node in NON_BASE_SYNTAX_NODES:
41
- case . ${ node. swift_syntax_kind} :
42
- % if node. name_for_diagnostics:
43
- return " ${node.name_for_diagnostics} "
44
- % else :
45
- return nil
46
- % end
47
- % end
48
- }
49
- }
50
33
}
51
34
52
35
public extension Syntax {
Original file line number Diff line number Diff line change 19
19
//===----------------------------------------------------------------------===//
20
20
21
21
/// Enumerates the known kinds of Syntax represented in the Syntax tree.
22
- @_spi ( RawSyntax)
23
22
public enum SyntaxKind {
24
23
case token
25
24
case unknown
You can’t perform that action at this time.
0 commit comments