Skip to content

Commit

Permalink
remove impl from ABI names
Browse files Browse the repository at this point in the history
  • Loading branch information
stevenbrix committed Oct 1, 2024
1 parent 1efc208 commit 388328e
Show file tree
Hide file tree
Showing 25 changed files with 2,213 additions and 2,213 deletions.
22 changes: 11 additions & 11 deletions swiftwinrt/code_writers.h
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ namespace swiftwinrt
written_params.append(w.write_temp("_ baseInterface: UnsealedWinRTClassWrapper<%.Composable>?, _ innerInterface: inout %.IInspectable?", classType, w.support));
}

w.write("% func %Impl(%) throws% {\n",
w.write("% func %(%) throws% {\n",
is_exclusive(type) ? "public" : "open",
func_name,
written_params,
Expand Down Expand Up @@ -1732,7 +1732,7 @@ vtable);

auto swift_name = get_swift_name(factory);
auto return_name = method.return_type.value().name;
auto func_call = w.write_temp("try! Self.%.%Impl(%)",
auto func_call = w.write_temp("try! Self.%.%(%)",
swift_name,
func_name,
bind<write_implementation_args>(method));
Expand Down Expand Up @@ -2022,7 +2022,7 @@ public init<Composable: ComposableImpl>(
w.write("super.init()\n");
w.write("MakeComposed(composing: Self.Composable.self, self) { baseInterface, innerInterface in \n");
}
w.write(" try! Self.%.%Impl(%)\n",
w.write(" try! Self.%.%(%)\n",
get_swift_name(factory_info),
func_name,
bind<write_implementation_args>(method));
Expand Down Expand Up @@ -2086,7 +2086,7 @@ public init<Composable: ComposableImpl>(
std::string_view func_name = get_abi_name(function);
auto impl = get_swift_name(iface);
auto try_flavor = is_noexcept ? "try!" : "try";
w.write("% %.%Impl(%)\n",
w.write("% %.%(%)\n",
try_flavor,
impl,
func_name,
Expand Down Expand Up @@ -2157,15 +2157,15 @@ public init<Composable: ComposableImpl>(
get_swift_name(prop),
bind<write_type>(*prop.getter->return_type->type, swift_write_type_params_for(*iface.type)));

w.write(" get { try! %.%Impl() }\n",
w.write(" get { try! %.%() }\n",
impl,
get_swift_name(prop.getter.value()));

// TODO: https://linear.app/the-browser-company/issue/WIN-82/support-setters-not-defined-in-same-api-contract-as-getters
// right now require that both getter and setter are defined in the same version
if (prop.setter)
{
w.write(" set { try! %.%Impl(newValue) }\n", impl, get_swift_name(prop.setter.value()));
w.write(" set { try! %.%(newValue) }\n", impl, get_swift_name(prop.setter.value()));

}
w.write("}\n\n");
Expand Down Expand Up @@ -2206,10 +2206,10 @@ public init<Composable: ComposableImpl>(
.init(
add: { [weak self] in
guard let this = self?.% else { return .init() }
return try! this.add_%Impl($0)
return try! this.add_%($0)
},
remove: { [weak self] in
try? self?.%.remove_%Impl($0)
try? self?.%.remove_%($0)
}
)
}()
Expand All @@ -2218,8 +2218,8 @@ public init<Composable: ComposableImpl>(

auto static_format = R"(%var % : Event<%> = {
.init(
add: { try! %.add_%Impl($0) },
remove: { try? %.remove_%Impl($0) }
add: { try! %.add_%($0) },
remove: { try? %.remove_%($0) }
)
}()
Expand Down Expand Up @@ -2262,7 +2262,7 @@ public init<Composable: ComposableImpl>(
{
w.write("return ");
}
w.write("try _%.%Impl(%)\n",
w.write("try _%.%(%)\n",
statics.swift_type_name(),
func_name,
bind<write_implementation_args>(method));
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -30,39 +30,39 @@ public enum __IMPL_Windows_Foundation {

/// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.iasyncaction.getresults)
fileprivate func getResults() throws {
try _default.GetResultsImpl()
try _default.GetResults()
}

/// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.iasyncaction.completed)
fileprivate var completed : AsyncActionCompletedHandler! {
get { try! _default.get_CompletedImpl() }
set { try! _default.put_CompletedImpl(newValue) }
get { try! _default.get_Completed() }
set { try! _default.put_Completed(newValue) }
}

private lazy var _IAsyncInfo: __ABI_Windows_Foundation.IAsyncInfo! = getInterfaceForCaching()
/// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.iasyncaction.cancel)
fileprivate func cancel() throws {
try _IAsyncInfo.CancelImpl()
try _IAsyncInfo.Cancel()
}

/// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.iasyncaction.close)
fileprivate func close() throws {
try _IAsyncInfo.CloseImpl()
try _IAsyncInfo.Close()
}

/// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.iasyncaction.errorcode)
fileprivate var errorCode : HRESULT {
get { try! _IAsyncInfo.get_ErrorCodeImpl() }
get { try! _IAsyncInfo.get_ErrorCode() }
}

/// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.iasyncaction.id)
fileprivate var id : UInt32 {
get { try! _IAsyncInfo.get_IdImpl() }
get { try! _IAsyncInfo.get_Id() }
}

/// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.iasyncaction.status)
fileprivate var status : AsyncStatus {
get { try! _IAsyncInfo.get_StatusImpl() }
get { try! _IAsyncInfo.get_Status() }
}

}
Expand Down Expand Up @@ -92,27 +92,27 @@ public enum __IMPL_Windows_Foundation {

/// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.iasyncinfo.cancel)
fileprivate func cancel() throws {
try _default.CancelImpl()
try _default.Cancel()
}

/// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.iasyncinfo.close)
fileprivate func close() throws {
try _default.CloseImpl()
try _default.Close()
}

/// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.iasyncinfo.errorcode)
fileprivate var errorCode : HRESULT {
get { try! _default.get_ErrorCodeImpl() }
get { try! _default.get_ErrorCode() }
}

/// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.iasyncinfo.id)
fileprivate var id : UInt32 {
get { try! _default.get_IdImpl() }
get { try! _default.get_Id() }
}

/// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.iasyncinfo.status)
fileprivate var status : AsyncStatus {
get { try! _default.get_StatusImpl() }
get { try! _default.get_Status() }
}

}
Expand Down Expand Up @@ -142,7 +142,7 @@ public enum __IMPL_Windows_Foundation {

/// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.iclosable.close)
fileprivate func close() throws {
try _default.CloseImpl()
try _default.Close()
}

}
Expand Down Expand Up @@ -172,13 +172,13 @@ public enum __IMPL_Windows_Foundation {

/// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.imemorybuffer.createreference)
fileprivate func createReference() throws -> AnyIMemoryBufferReference! {
try _default.CreateReferenceImpl()
try _default.CreateReference()
}

private lazy var _IClosable: __ABI_Windows_Foundation.IClosable! = getInterfaceForCaching()
/// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.imemorybuffer.close)
fileprivate func close() throws {
try _IClosable.CloseImpl()
try _IClosable.Close()
}

}
Expand Down Expand Up @@ -208,26 +208,26 @@ public enum __IMPL_Windows_Foundation {

/// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.imemorybufferreference.capacity)
fileprivate var capacity : UInt32 {
get { try! _default.get_CapacityImpl() }
get { try! _default.get_Capacity() }
}

/// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.imemorybufferreference.closed)
fileprivate lazy var closed : Event<TypedEventHandler<IMemoryBufferReference?, Any?>> = {
.init(
add: { [weak self] in
guard let this = self?._default else { return .init() }
return try! this.add_ClosedImpl($0)
return try! this.add_Closed($0)
},
remove: { [weak self] in
try? self?._default.remove_ClosedImpl($0)
try? self?._default.remove_Closed($0)
}
)
}()

private lazy var _IClosable: __ABI_Windows_Foundation.IClosable! = getInterfaceForCaching()
/// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.imemorybufferreference.close)
fileprivate func close() throws {
try _IClosable.CloseImpl()
try _IClosable.Close()
}

private lazy var _IMemoryBufferByteAccess: __ABI_.IMemoryBufferByteAccess! = getInterfaceForCaching()
Expand Down Expand Up @@ -357,7 +357,7 @@ public enum __IMPL_Windows_Foundation {

/// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.istringable.tostring)
fileprivate func toString() throws -> String {
try _default.ToStringImpl()
try _default.ToString()
}

}
Expand Down Expand Up @@ -387,12 +387,12 @@ public enum __IMPL_Windows_Foundation {

/// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.iwwwformurldecoderentry.name)
fileprivate var name : String {
get { try! _default.get_NameImpl() }
get { try! _default.get_Name() }
}

/// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.iwwwformurldecoderentry.value)
fileprivate var value : String {
get { try! _default.get_ValueImpl() }
get { try! _default.get_Value() }
}

}
Expand All @@ -406,7 +406,7 @@ public enum __IMPL_Windows_Foundation {
guard let abi = abi else { return nil }
let _default = SwiftABI(abi)
let handler: Handler = { (asyncInfo, asyncStatus) in
try _default.InvokeImpl(asyncInfo, asyncStatus)
try _default.Invoke(asyncInfo, asyncStatus)
}
return handler
}
Expand All @@ -420,7 +420,7 @@ public enum __IMPL_Windows_Foundation {
guard let abi = abi else { return nil }
let _default = SwiftABI(abi)
let handler: Handler = { () in
try _default.InvokeImpl()
try _default.Invoke()
}
return handler
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,15 +102,15 @@ public enum __ABI_Windows_Foundation_Collections {
public class IVectorChangedEventArgs: test_component.IInspectable {
override public class var IID: test_component.IID { IID___x_ABI_CWindows_CFoundation_CCollections_CIVectorChangedEventArgs }

open func get_CollectionChangeImpl() throws -> test_component.CollectionChange {
open func get_CollectionChange() throws -> test_component.CollectionChange {
var value: __x_ABI_CWindows_CFoundation_CCollections_CCollectionChange = .init(0)
_ = try perform(as: __x_ABI_CWindows_CFoundation_CCollections_CIVectorChangedEventArgs.self) { pThis in
try CHECKED(pThis.pointee.lpVtbl.pointee.get_CollectionChange(pThis, &value))
}
return value
}

open func get_IndexImpl() throws -> UInt32 {
open func get_Index() throws -> UInt32 {
var value: UINT32 = 0
_ = try perform(as: __x_ABI_CWindows_CFoundation_CCollections_CIVectorChangedEventArgs.self) { pThis in
try CHECKED(pThis.pointee.lpVtbl.pointee.get_Index(pThis, &value))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,54 +37,54 @@ public enum __IMPL_Windows_Foundation_Collections {
.init(
add: { [weak self] in
guard let this = self?._IObservableMap else { return .init() }
return try! this.add_MapChangedImpl($0)
return try! this.add_MapChanged($0)
},
remove: { [weak self] in
try? self?._IObservableMap.remove_MapChangedImpl($0)
try? self?._IObservableMap.remove_MapChanged($0)
}
)
}()

private lazy var _IMap: IMapString_Any! = getInterfaceForCaching()
/// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.collections.ipropertyset.lookup)
fileprivate func lookup(_ key: String) -> Any? {
try! _IMap.LookupImpl(key)
try! _IMap.Lookup(key)
}

/// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.collections.ipropertyset.haskey)
fileprivate func hasKey(_ key: String) -> Bool {
try! _IMap.HasKeyImpl(key)
try! _IMap.HasKey(key)
}

/// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.collections.ipropertyset.getview)
fileprivate func getView() -> AnyIMapView<String, Any?>? {
try! _IMap.GetViewImpl()
try! _IMap.GetView()
}

/// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.collections.ipropertyset.insert)
fileprivate func insert(_ key: String, _ value: Any?) -> Bool {
try! _IMap.InsertImpl(key, value)
try! _IMap.Insert(key, value)
}

/// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.collections.ipropertyset.remove)
fileprivate func remove(_ key: String) {
try! _IMap.RemoveImpl(key)
try! _IMap.Remove(key)
}

/// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.collections.ipropertyset.clear)
fileprivate func clear() {
try! _IMap.ClearImpl()
try! _IMap.Clear()
}

/// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.collections.ipropertyset.size)
fileprivate var size : UInt32 {
get { try! _IMap.get_SizeImpl() }
get { try! _IMap.get_Size() }
}

private lazy var _IIterable: IIterableIKeyValuePairString_Any! = getInterfaceForCaching()
/// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.collections.ipropertyset.first)
fileprivate func first() -> AnyIIterator<AnyIKeyValuePair<String, Any?>?>? {
try! _IIterable.FirstImpl()
try! _IIterable.First()
}

}
Expand Down Expand Up @@ -114,12 +114,12 @@ public enum __IMPL_Windows_Foundation_Collections {

/// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.collections.ivectorchangedeventargs.collectionchange)
fileprivate var collectionChange : CollectionChange {
get { try! _default.get_CollectionChangeImpl() }
get { try! _default.get_CollectionChange() }
}

/// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.collections.ivectorchangedeventargs.index)
fileprivate var index : UInt32 {
get { try! _default.get_IndexImpl() }
get { try! _default.get_Index() }
}

}
Expand Down
Loading

0 comments on commit 388328e

Please sign in to comment.