Skip to content

Commit 8490e3f

Browse files
committed
Change casting function to SyntaxEnum to as(SyntaxEnum.self)
SyntaxEnum was the only place that uses the asSyntaxEnum-style casting. Make the syntax more consistent with the other as(Something.self) casting functions.
1 parent bfa0ddc commit 8490e3f

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

Sources/SwiftSyntax/Misc.swift.gyb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public extension Syntax {
4343
/// Retrieve the concretely typed node that this Syntax node wraps.
4444
/// This property is exposed for testing purposes only.
4545
var _asConcreteType: Any {
46-
switch self.asSyntaxEnum {
46+
switch self.as(SyntaxEnum.self) {
4747
case .token(let node):
4848
return node
4949
case .unknown(let node):

Sources/SwiftSyntax/SyntaxEnum.swift.gyb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public enum SyntaxEnum {
3434

3535
public extension Syntax {
3636
/// Get an enum that can be used to exhaustively switch over all syntax nodes.
37-
var asSyntaxEnum: SyntaxEnum {
37+
func `as`(_: SyntaxEnum.Type) -> SyntaxEnum {
3838
switch raw.kind {
3939
case .token:
4040
return .token(TokenSyntax(self)!)

Sources/SwiftSyntax/gyb_generated/Misc.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1352,7 +1352,7 @@ public extension Syntax {
13521352
/// Retrieve the concretely typed node that this Syntax node wraps.
13531353
/// This property is exposed for testing purposes only.
13541354
var _asConcreteType: Any {
1355-
switch self.asSyntaxEnum {
1355+
switch self.as(SyntaxEnum.self) {
13561356
case .token(let node):
13571357
return node
13581358
case .unknown(let node):

Sources/SwiftSyntax/gyb_generated/SyntaxEnum.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ public enum SyntaxEnum {
246246

247247
public extension Syntax {
248248
/// Get an enum that can be used to exhaustively switch over all syntax nodes.
249-
var asSyntaxEnum: SyntaxEnum {
249+
func `as`(_: SyntaxEnum.Type) -> SyntaxEnum {
250250
switch raw.kind {
251251
case .token:
252252
return .token(TokenSyntax(self)!)

0 commit comments

Comments
 (0)