Skip to content

Commit 07a432d

Browse files
committed
[ASTGen] Soft deprecate generate(choices:)
1 parent 5fdeabd commit 07a432d

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

lib/ASTGen/Sources/ASTGen/ASTGen.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ extension ASTGenVisitor {
188188
}
189189

190190
extension ASTGenVisitor {
191-
/// Generate AST from a Syntax node. The node must be a decl, stmt, expr, or
191+
/// Generate ASTNode from a Syntax node. The node must be a decl, stmt, expr, or
192192
/// type.
193193
func generate(_ node: Syntax) -> ASTNode {
194194
if let decl = node.as(DeclSyntax.self) {
@@ -222,6 +222,8 @@ extension ASTGenVisitor {
222222
// Misc visits.
223223
// TODO: Some of these are called within a single file/method; we may want to move them to the respective files.
224224
extension ASTGenVisitor {
225+
226+
/// Do NOT introduce another usage of this. Not all choices can produce 'ASTNode'.
225227
func generate(choices node: some SyntaxChildChoices) -> ASTNode {
226228
return self.generate(Syntax(node))
227229
}
@@ -273,6 +275,7 @@ extension ASTGenVisitor {
273275
return self.generate(expr: node)
274276
}
275277

278+
/// DO NOT introduce another usage of this. Not all choices can produce 'ASTNode'.
276279
@inline(__always)
277280
func generate(optional node: (some SyntaxChildChoices)?) -> ASTNode? {
278281
guard let node else {

lib/ASTGen/Sources/ASTGen/Stmts.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,10 @@ extension ASTGenVisitor {
6464
}
6565

6666
func makeIfStmt(_ node: IfExprSyntax) -> BridgedIfStmt {
67+
// FIXME: handle multiple coniditons.
68+
// FIXME: handle non-expression conditions.
6769
let conditions = node.conditions.map(self.generate)
68-
assert(conditions.count == 1) // TODO: handle multiple conditions.
70+
assert(conditions.count == 1)
6971

7072
return .createParsed(
7173
self.ctx,

0 commit comments

Comments
 (0)