Skip to content

Commit 3c9e1f2

Browse files
committed
Use SwiftSyntaxBuilder to generate SwiftSyntaxBuilder Tokens
1 parent 6fa8f5e commit 3c9e1f2

File tree

9 files changed

+1077
-442
lines changed

9 files changed

+1077
-442
lines changed

Package.swift

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ let package = Package(
4040
products: [
4141
.library(name: "SwiftSyntax", type: .static, targets: ["SwiftSyntax"]),
4242
.library(name: "SwiftSyntaxParser", type: .static, targets: ["SwiftSyntaxParser"]),
43-
.library(name: "SwiftSyntaxBuilder", type: .static, targets: ["SwiftSyntaxBuilder"])
43+
.library(name: "SwiftSyntaxBuilder", type: .static, targets: ["SwiftSyntaxBuilder"]),
44+
.executable(name: "SwiftSyntaxBuilderGeneration", targets: ["SwiftSyntaxBuilderGeneration"])
4445
],
4546
targets: [
4647
.target(
@@ -81,7 +82,6 @@ let package = Package(
8182
"BuildableCollectionNodes.swift.gyb",
8283
"BuildableNodes.swift.gyb",
8384
"ResultBuilders.swift.gyb",
84-
"Tokens.swift.gyb",
8585
"TokenSyntax.swift.gyb",
8686
]
8787
),
@@ -97,6 +97,13 @@ let package = Package(
9797
name: "lit-test-helper",
9898
dependencies: ["SwiftSyntax", "SwiftSyntaxParser"]
9999
),
100+
.target(
101+
name: "SwiftSyntaxBuilderGeneration",
102+
dependencies: ["SwiftSyntaxBuilder"],
103+
exclude: [
104+
"Tokens.swift.gyb"
105+
]
106+
),
100107
.testTarget(
101108
name: "SwiftSyntaxTest",
102109
dependencies: ["SwiftSyntax"]
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
//===----------------------------------------------------------------------===//
2+
//
3+
// This source file is part of the Swift.org open source project
4+
//
5+
// Copyright (c) 2014 - 2022 Apple Inc. and the Swift project authors
6+
// Licensed under Apache License v2.0 with Runtime Library Exception
7+
//
8+
// See https://swift.org/LICENSE.txt for license information
9+
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
10+
//
11+
//===----------------------------------------------------------------------===//
12+
13+
import SwiftSyntax
14+
15+
extension MemberAccessExpr {
16+
/// Creates a `MemberAccessExpr` using the provided parameters.
17+
/// - Parameters:
18+
/// - base:
19+
/// - dot:
20+
/// - name:
21+
/// - declNameArguments:
22+
public init(
23+
base: ExpressibleAsExprBuildable? = nil,
24+
dot: TokenSyntax = .period,
25+
name: String,
26+
declNameArguments: ExpressibleAsDeclNameArguments? = nil
27+
) {
28+
self.init(base: base, dot: dot, name: SyntaxFactory.makeIdentifier(name), declNameArguments: declNameArguments)
29+
}
30+
}

Sources/SwiftSyntaxBuilder/Tokens.swift.gyb

Lines changed: 0 additions & 70 deletions
This file was deleted.

0 commit comments

Comments
 (0)