File tree Expand file tree Collapse file tree 6 files changed +17
-4
lines changed
SwiftCompilerPluginMessageHandling Expand file tree Collapse file tree 6 files changed +17
-4
lines changed Original file line number Diff line number Diff line change 172172 - Pull request: https://github.com/apple/swift-syntax/pull/2531
173173 - Migration steps: Use ` if case .backslash = triviaPiece ` instead
174174
175+ - All symbols in ` SwiftCompilerPluginMessageHandling ` are now SPI
176+ - Description: This module is only intended to be used from some internal components. Any other modules should not use them directly.
177+ - Pull request: https://github.com/apple/swift-syntax/pull/2489
178+ - Migration steps: Stop using this module.
179+
175180## Template
176181
177182- * Affected API or two word description*
Original file line number Diff line number Diff line change 1515#if swift(>=6.0)
1616public import SwiftSyntaxMacros
1717private import Foundation
18- private import SwiftCompilerPluginMessageHandling
18+ @ _spi ( PluginMessage ) private import SwiftCompilerPluginMessageHandling
1919#else
2020import SwiftSyntaxMacros
2121import Foundation
22- import SwiftCompilerPluginMessageHandling
22+ @ _spi ( PluginMessage ) import SwiftCompilerPluginMessageHandling
2323#endif
2424
2525#if os(Windows)
Original file line number Diff line number Diff line change @@ -17,11 +17,13 @@ import SwiftSyntaxMacros
1717#endif
1818
1919/// Optional features.
20+ @_spi ( PluginMessage)
2021public enum PluginFeature : String {
2122 case loadPluginLibrary = " load-plugin-library "
2223}
2324
2425/// A type that provides the actual plugin functions.
26+ @_spi ( PluginMessage)
2527public protocol PluginProvider {
2628 /// Resolve macro type by the module name and the type name.
2729 func resolveMacro( moduleName: String , typeName: String ) throws -> Macro . Type
@@ -37,6 +39,7 @@ public protocol PluginProvider {
3739
3840/// Low level message connection to the plugin host.
3941/// This encapsulates the connection and the message serialization.
42+ @_spi ( PluginMessage)
4043public protocol MessageConnection {
4144 /// Send a message to the peer.
4245 func sendMessage< TX: Encodable > ( _ message: TX ) throws
@@ -66,6 +69,7 @@ struct HostCapability {
6669/// the response.
6770///
6871/// The low level connection and the provider is injected by the client.
72+ @_spi ( PluginMessage)
6973public class CompilerPluginMessageHandler < Connection: MessageConnection , Provider: PluginProvider > {
7074 /// Message channel for bidirectional communication with the plugin host.
7175 let connection : Connection
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ import SwiftBasicFormat
1414import SwiftDiagnostics
1515import SwiftOperators
1616import SwiftSyntax
17- @_spi ( ExperimentalLanguageFeature) import SwiftSyntaxMacroExpansion
17+ @_spi ( MacroExpansion ) @ _spi ( ExperimentalLanguageFeature) import SwiftSyntaxMacroExpansion
1818@_spi ( ExperimentalLanguageFeature) import SwiftSyntaxMacros
1919
2020extension CompilerPluginMessageHandler {
Original file line number Diff line number Diff line change 1111//===----------------------------------------------------------------------===//
1212
1313/// Old compiler might send '.declaration' as "freeStandingDeclaration".
14- @_spi ( PluginMessage) public extension PluginMessage . MacroRole {
14+ @_spi ( PluginMessage)
15+ public extension PluginMessage . MacroRole {
1516 init ( from decoder: Decoder ) throws {
1617 let stringValue = try decoder. singleValueContainer ( ) . decode ( String . self)
1718 if let role = Self ( rawValue: stringValue) {
Original file line number Diff line number Diff line change 1212
1313// NOTE: Types in this file should be self-contained and should not depend on any non-stdlib types.
1414
15+ @_spi ( PluginMessage)
1516public enum HostToPluginMessage : Codable {
1617 /// Send capability of the host, and get capability of the plugin.
1718 case getCapability(
@@ -49,6 +50,7 @@ public enum HostToPluginMessage: Codable {
4950 )
5051}
5152
53+ @_spi ( PluginMessage)
5254public enum PluginToHostMessage : Codable {
5355 case getCapabilityResult(
5456 capability: PluginMessage . PluginCapability
@@ -78,6 +80,7 @@ public enum PluginToHostMessage: Codable {
7880 )
7981}
8082
83+ @_spi ( PluginMessage)
8184public enum PluginMessage {
8285 public static var PROTOCOL_VERSION_NUMBER : Int { 7 } // Pass extension protocol list
8386
You can’t perform that action at this time.
0 commit comments