diff --git a/Sources/SwiftSyntax/SyntaxBuilders.swift.gyb b/Sources/SwiftSyntax/SyntaxBuilders.swift.gyb index 6c2684cffb5..bfde3132273 100644 --- a/Sources/SwiftSyntax/SyntaxBuilders.swift.gyb +++ b/Sources/SwiftSyntax/SyntaxBuilders.swift.gyb @@ -39,8 +39,9 @@ public struct ${Builder} { % if child_node and child_node.is_syntax_collection(): % child_elt = child_node.collection_element_name % child_elt_type = child_node.collection_element_type +% child_elt_name = child.name + 'Member' - public mutating func add${child_elt}(_ elt: ${child_elt_type}) { + public mutating func add${child_elt_name}(_ elt: ${child_elt_type}) { let idx = ${node.name}.Cursor.${child.swift_name}.rawValue if let list = layout[idx] { layout[idx] = list.appending(elt.raw) diff --git a/Sources/SwiftSyntax/SyntaxNodes.swift.gyb b/Sources/SwiftSyntax/SyntaxNodes.swift.gyb index 6104cae6112..51082b18c91 100644 --- a/Sources/SwiftSyntax/SyntaxNodes.swift.gyb +++ b/Sources/SwiftSyntax/SyntaxNodes.swift.gyb @@ -129,6 +129,7 @@ public struct ${node.name}: ${base_type}, _SyntaxBase, Hashable { % if child_node and child_node.is_syntax_collection(): % child_elt = child_node.collection_element_name % child_elt_type = child_node.collection_element_type +% child_elt_name = child.name + 'Member' /// Adds the provided `${child_elt}` to the node's `${child.swift_name}` /// collection. @@ -136,7 +137,7 @@ public struct ${node.name}: ${base_type}, _SyntaxBase, Hashable { /// `${child.swift_name}` collection. /// - returns: A copy of the receiver with the provided `${child_elt}` /// appended to its `${child.swift_name}` collection. - public func add${child_elt}(_ element: ${child_elt_type}) -> ${node.name} { + public func add${child_elt_name}(_ element: ${child_elt_type}) -> ${node.name} { var collection: RawSyntax if let col = raw[Cursor.${child.swift_name}] { collection = col.appending(element.raw) diff --git a/Tests/SwiftSyntaxTest/ModifierTests.swift b/Tests/SwiftSyntaxTest/ModifierTests.swift index 5129834e028..064b63da716 100644 --- a/Tests/SwiftSyntaxTest/ModifierTests.swift +++ b/Tests/SwiftSyntaxTest/ModifierTests.swift @@ -11,7 +11,7 @@ fileprivate func cannedVarDecl() -> VariableDeclSyntax { initializer: nil, accessor: nil, trailingComma: nil) return VariableDeclSyntax { $0.useLetOrVarKeyword(SyntaxFactory.makeLetKeyword()) - $0.addPatternBinding(Pattern) + $0.addBindingsMember(Pattern) } } diff --git a/Tests/SwiftSyntaxTest/SyntaxFactory.swift b/Tests/SwiftSyntaxTest/SyntaxFactory.swift index 8a476eb7c35..cbe9ef0905d 100644 --- a/Tests/SwiftSyntaxTest/SyntaxFactory.swift +++ b/Tests/SwiftSyntaxTest/SyntaxFactory.swift @@ -102,7 +102,7 @@ public class SyntaxFactoryAPITestCase: XCTestCase { let call = FunctionCallExprSyntax { $0.useCalledExpression(printID) $0.useLeftParen(SyntaxFactory.makeLeftParenToken()) - $0.addFunctionCallArgument(arg) + $0.addArgumentListMember(arg) $0.useRightParen(SyntaxFactory.makeRightParenToken()) } XCTAssertEqual("\(call)", "print(\"Hello, world!\")") @@ -133,7 +133,7 @@ public class SyntaxFactoryAPITestCase: XCTestCase { let call1 = FunctionCallExprSyntax { $0.useCalledExpression(printID) $0.useLeftParen(SyntaxFactory.makeLeftParenToken()) - $0.addFunctionCallArgument(arg) + $0.addArgumentListMember(arg) $0.useRightParen(SyntaxFactory.makeRightParenToken()) } XCTAssertNotNil(call1.leftParen) @@ -145,7 +145,7 @@ public class SyntaxFactoryAPITestCase: XCTestCase { let call3 = FunctionCallExprSyntax { $0.useCalledExpression(printID) - $0.addFunctionCallArgument(arg) + $0.addArgumentListMember(arg) } XCTAssertNil(call3.leftParen) XCTAssertNil(call3.rightParen)