14
14
//===----------------------------------------------------------------------===//
15
15
16
16
import SwiftSyntax
17
- extension TokenSyntax : ExpressibleAsTokenList , ExpressibleAsNonEmptyTokenList , ExpressibleAsBinaryOperatorExpr , ExpressibleAsDeclModifier , ExpressibleAsIdentifierExpr {
17
+ extension TokenSyntax : ExpressibleAsTokenList , ExpressibleAsNonEmptyTokenList , ExpressibleAsBinaryOperatorExpr , ExpressibleAsDeclModifier , ExpressibleAsIdentifierExpr {
18
18
/// Conformance to ExpressibleAsTokenList
19
- public func createTokenList( ) -> TokenList {
19
+ public func createTokenList( ) -> TokenList {
20
20
return TokenList ( [ self ] )
21
21
}
22
22
/// Conformance to ExpressibleAsNonEmptyTokenList
23
- public func createNonEmptyTokenList( ) -> NonEmptyTokenList {
23
+ public func createNonEmptyTokenList( ) -> NonEmptyTokenList {
24
24
return NonEmptyTokenList ( [ self ] )
25
25
}
26
26
/// Conformance to ExpressibleAsBinaryOperatorExpr
27
- public func createBinaryOperatorExpr( ) -> BinaryOperatorExpr {
27
+ public func createBinaryOperatorExpr( ) -> BinaryOperatorExpr {
28
28
return BinaryOperatorExpr ( operatorToken: self )
29
29
}
30
30
/// Conformance to ExpressibleAsDeclModifier
31
- public func createDeclModifier( ) -> DeclModifier {
31
+ public func createDeclModifier( ) -> DeclModifier {
32
32
return DeclModifier ( name: self )
33
33
}
34
34
/// Conformance to ExpressibleAsIdentifierExpr
35
- public func createIdentifierExpr( ) -> IdentifierExpr {
35
+ public func createIdentifierExpr( ) -> IdentifierExpr {
36
36
return IdentifierExpr ( identifier: self )
37
37
}
38
38
}
39
39
40
40
/// `TokenSyntax` conforms to `SyntaxBuildable` and `ExprBuildable` via different paths, so we need to pick one default conversion path to create an `ExprSyntax` (and `Syntax`) from a `String`. We choose `IdentifierExpr`.
41
- extension TokenSyntax {
42
- public func createSyntaxBuildable( ) -> SyntaxBuildable {
41
+ extension TokenSyntax {
42
+ public func createSyntaxBuildable( ) -> SyntaxBuildable {
43
43
return createIdentifierExpr ( )
44
44
}
45
- public func createExprBuildable( ) -> ExprBuildable {
45
+ public func createExprBuildable( ) -> ExprBuildable {
46
46
return createIdentifierExpr ( )
47
47
}
48
48
}
0 commit comments