Skip to content

Commit

Permalink
Remove the PrimitiveProjection namespace enum in favor of -Projection…
Browse files Browse the repository at this point in the history
… suffixes (#253)
  • Loading branch information
tristanlabelle authored Sep 2, 2024
1 parent 8dc187c commit db7cd44
Show file tree
Hide file tree
Showing 12 changed files with 256 additions and 258 deletions.
4 changes: 2 additions & 2 deletions Generator/Sources/ProjectionModel/SupportModules.swift
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,11 @@ extension SupportModules.WinRT {
}

public static func primitiveProjection(of type: WinRTPrimitiveType) -> SwiftType {
.chain([ .init(moduleName), .init("PrimitiveProjection"), .init(type.name) ])
.chain([ .init(moduleName), .init(type.name + "Projection") ])
}

public static func ireferenceToOptionalProjection(of type: WinRTPrimitiveType) -> SwiftType {
.chain([ .init(moduleName), .init("PrimitiveProjection"), .init(type.name), .init("IReferenceToOptional") ])
.chain([ .init(moduleName), .init(type.name + "Projection"), .init("IReferenceToOptional") ])
}

public static func ireferenceToOptionalProjection(of projectionType: SwiftType) -> SwiftType {
Expand Down
4 changes: 2 additions & 2 deletions InteropTests/Tests/InspectableBoxingTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ extension IInspectableProtocol {
class InspectableBoxingTests: WinRTTestCase {
func testInertPrimitiveRoundTrip() throws {
let original = Int32(42)
XCTAssertEqual(try InspectableBoxing.boxInt32(original).unbox(PrimitiveProjection.Int32.self), original)
XCTAssertEqual(try InspectableBoxing.boxInt32(original).unbox(Int32Projection.self), original)
XCTAssertEqual(try InspectableBoxing.unboxInt32(createIReference(original)), original)
}

func testAllocatingPrimitiveRoundTrip() throws {
let original = "Hello"
XCTAssertEqual(try InspectableBoxing.boxString(original).unbox(PrimitiveProjection.String.self), original)
XCTAssertEqual(try InspectableBoxing.boxString(original).unbox(StringProjection.self), original)
XCTAssertEqual(try InspectableBoxing.unboxString(createIReference(original)), original)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ public struct SystemActivationFactoryResolver: ActivationFactoryResolver {

public static func resolve<ABIStruct>(runtimeClass: String, interfaceID: COMInterfaceID,
type: ABIStruct.Type = ABIStruct.self) throws -> COMReference<ABIStruct> {
var activatableId = try PrimitiveProjection.String.toABI(runtimeClass)
defer { PrimitiveProjection.String.release(&activatableId) }
var activatableId = try StringProjection.toABI(runtimeClass)
defer { StringProjection.release(&activatableId) }

var iid = GUIDProjection.toABI(interfaceID)
var rawPointer: UnsafeMutableRawPointer?
Expand Down Expand Up @@ -84,8 +84,8 @@ public final class DllActivationFactoryResolver: ActivationFactoryResolver {
}

public func resolve(runtimeClass: String) throws -> IActivationFactoryProjection.ABIReference {
var activatableId = try PrimitiveProjection.String.toABI(runtimeClass)
defer { PrimitiveProjection.String.release(&activatableId) }
var activatableId = try StringProjection.toABI(runtimeClass)
defer { StringProjection.release(&activatableId) }

var factoryPointer: UnsafeMutablePointer<SWRT_IActivationFactory>?
try WinRTError.throwIfFailed(function(activatableId, &factoryPointer))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public enum IInspectableVirtualTable {
className.pointee = nil
let object = COMEmbedding.getEmbedderObjectOrCrash(this) as! IInspectable
return HResult.catchValue {
className.pointee = try PrimitiveProjection.String.toABI(object.getRuntimeClassName())
className.pointee = try StringProjection.toABI(object.getRuntimeClassName())
}
}

Expand Down
196 changes: 0 additions & 196 deletions Support/Sources/WindowsRuntime/PrimitiveProjection.swift

This file was deleted.

Loading

0 comments on commit db7cd44

Please sign in to comment.