We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 511d9e8 commit f477dd0Copy full SHA for f477dd0
Sources/TestingMacros/Support/Additions/IntegerLiteralExprSyntaxAdditions.swift
@@ -0,0 +1,18 @@
1
+//
2
+// This source file is part of the Swift.org open source project
3
4
+// Copyright (c) 2024 Apple Inc. and the Swift project authors
5
+// Licensed under Apache License v2.0 with Runtime Library Exception
6
7
+// See https://swift.org/LICENSE.txt for license information
8
+// See https://swift.org/CONTRIBUTORS.txt for Swift project authors
9
10
+
11
+import SwiftSyntax
12
13
+extension IntegerLiteralExprSyntax {
14
+ init(_ value: some BinaryInteger, radix: IntegerLiteralExprSyntax.Radix = .decimal) {
15
+ let stringValue = "\(radix.literalPrefix)\(String(value, radix: radix.size))"
16
+ self.init(literal: .integerLiteral(stringValue))
17
+ }
18
+}
0 commit comments