File tree Expand file tree Collapse file tree 5 files changed +4
-17
lines changed Expand file tree Collapse file tree 5 files changed +4
-17
lines changed Original file line number Diff line number Diff line change @@ -347,7 +347,7 @@ extension ParseDiagnosticsGenerator {
347
347
missingNodes += [ sibling]
348
348
} else if sibling. isMissingAllTokens && sibling. hasTokens {
349
349
missingNodes += [ sibling]
350
- } else if sibling. isCollection && sibling. children ( viewMode: . sourceAccurate) . count == 0 {
350
+ } else if sibling. kind . isSyntaxCollection && sibling. children ( viewMode: . sourceAccurate) . count == 0 {
351
351
// Skip over any syntax collections without any elements while looking ahead for further missing nodes.
352
352
} else {
353
353
// Otherwise we have found a present node, so stop looking ahead.
Original file line number Diff line number Diff line change @@ -243,19 +243,6 @@ public extension SyntaxProtocol {
243
243
return SyntaxChildrenIndex ( self . data. absoluteInfo)
244
244
}
245
245
246
- /// Whether or not this node is a token one.
247
- var isToken : Bool {
248
- return raw. isToken
249
- }
250
-
251
- /// Whether or not this node represents an SyntaxCollection.
252
- var isCollection : Bool {
253
- // We need to provide a custom implementation for is(SyntaxCollection.self)
254
- // since SyntaxCollection has generic or self requirements and can thus
255
- // not be used as a method argument.
256
- return raw. kind. isSyntaxCollection
257
- }
258
-
259
246
/// Whether the tree contained by this layout has any
260
247
/// - missing nodes or
261
248
/// - unexpected nodes or
Original file line number Diff line number Diff line change @@ -118,7 +118,7 @@ public extension SyntaxProtocol {
118
118
return . nodeType
119
119
}
120
120
121
- if isToken {
121
+ if self . is ( TokenSyntax . self ) {
122
122
if let token = Syntax ( self ) . as ( TokenSyntax . self) , let baselineToken = Syntax ( baseline) . as ( TokenSyntax . self) {
123
123
if token. presence != baselineToken. presence {
124
124
return . presence
Original file line number Diff line number Diff line change @@ -114,7 +114,7 @@ extension SyntaxProtocol {
114
114
115
115
private func debugInitCallExpr( includeTrivia: Bool ) -> ExprSyntax {
116
116
let mirror = Mirror ( reflecting: self )
117
- if self . isCollection {
117
+ if self . kind . isSyntaxCollection {
118
118
let typeName = String ( describing: type ( of: self ) )
119
119
return ExprSyntax (
120
120
FunctionCallExprSyntax ( callee: IdentifierExprSyntax ( identifier: . identifier( typeName) ) ) {
Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ public class SyntaxCollectionsTests: XCTestCase {
29
29
] )
30
30
31
31
let newArrayElementList = arrayElementList. appending ( integerLiteralElement ( 1 ) )
32
- XCTAssert ( newArrayElementList. isCollection )
32
+ XCTAssert ( newArrayElementList. kind . isSyntaxCollection )
33
33
XCTAssertEqual ( newArrayElementList. count, 2 )
34
34
XCTAssertNotNil ( newArrayElementList. child ( at: 1 ) )
35
35
XCTAssert ( !newArrayElementList. child ( at: 1 ) !. isCollection)
You can’t perform that action at this time.
0 commit comments