Skip to content

Commit

Permalink
feat: unlock some code
Browse files Browse the repository at this point in the history
  • Loading branch information
kkebo committed Apr 24, 2024
1 parent 4bfe662 commit c367c74
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 11 deletions.
12 changes: 8 additions & 4 deletions Sources/SwiftCompilerPlugin/CompilerPlugin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
// NOTE: This basic plugin mechanism is mostly copied from
// https://github.com/apple/swift-package-manager/blob/main/Sources/PackagePlugin/Plugin.swift

#if !os(WASI)

#if swift(>=6.0)
private import _SwiftSyntaxCShims
public import SwiftSyntaxMacros
Expand All @@ -24,6 +22,8 @@ private import Darwin
private import Glibc
#elseif canImport(ucrt)
private import ucrt
#elseif canImport(WASILibc)
private import WASILibc
#endif
#else
import _SwiftSyntaxCShims
Expand All @@ -35,6 +35,8 @@ import Darwin
import Glibc
#elseif canImport(ucrt)
import ucrt
#elseif canImport(WASILibc)
import WASILibc
#endif
#endif

Expand Down Expand Up @@ -133,6 +135,9 @@ extension CompilerPlugin {
/// Main entry point of the plugin — sets up a communication channel with
/// the plugin host and runs the main message loop.
public static func main() throws {
#if os(WASI)
internalError("CompilerPlugin.main() is not implemented in WASI.")
#else
let stdin = _ss_stdin()
let stdout = _ss_stdout()
let stderr = _ss_stderr()
Expand Down Expand Up @@ -187,6 +192,7 @@ extension CompilerPlugin {
// and exit with an error code.
internalError(String(describing: error))
}
#endif
}

// Private function to report internal errors and then exit.
Expand Down Expand Up @@ -283,5 +289,3 @@ private func describe(errno: CInt) -> String {
if let cStr = strerror(errno) { return String(cString: cStr) }
return String(describing: errno)
}

#endif
4 changes: 0 additions & 4 deletions Tests/SwiftCompilerPluginTest/CompilerPluginTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
//
//===----------------------------------------------------------------------===//

#if !os(WASI)

@_spi(Testing) import SwiftCompilerPlugin
import SwiftSyntax
import SwiftSyntaxMacros
Expand Down Expand Up @@ -70,5 +68,3 @@ class CompilerPluginTests: XCTestCase {

}
}

#endif
3 changes: 0 additions & 3 deletions Tests/SwiftParserTest/ParserTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ import Dispatch
import SwiftParser
import SwiftParserDiagnostics
import SwiftSyntax
#if os(WASI)
import WASILibc
#endif
import XCTest
import _SwiftSyntaxTestSupport

Expand Down

0 comments on commit c367c74

Please sign in to comment.