Skip to content

Commit 3d60e55

Browse files
authored
SwiftSyntax: add an API to check whether a syntax node has underlying source. (swiftlang#15389)
1 parent 9c27f97 commit 3d60e55

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Syntax.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,12 @@ extension Syntax {
152152
return raw.trailingTrivia
153153
}
154154

155+
/// When isImplicit is true, the syntax node doesn't include any
156+
/// underlying tokens, e.g. an empty CodeBlockItemList.
157+
public var isImplicit: Bool {
158+
return leadingTrivia == nil
159+
}
160+
155161
/// The textual byte length of this node exluding leading and trailing trivia.
156162
public var byteSizeAfterTrimmingTrivia: Int {
157163
return data.byteSize - (leadingTrivia?.byteSize ?? 0) -

0 commit comments

Comments
 (0)