Skip to content

Commit 3fddf8d

Browse files
jcmoscKyle-Ye
authored andcommitted
Add Swift name refinements for AGAttributeType and AGAttributeTypeFlags
1 parent 83f124b commit 3fddf8d

File tree

9 files changed

+10
-16
lines changed

9 files changed

+10
-16
lines changed

Sources/OpenGraph/Attribute/Attribute/AnyAttribute.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
public import OpenGraph_SPI
99

1010
extension AnyAttribute {
11-
public typealias Flags = OGAttributeTypeFlags
11+
public typealias Flags = AttributeType.Flags
1212

1313
public init<Value>(_ attribute: Attribute<Value>) {
1414
self = attribute.identifier

Sources/OpenGraph/Attribute/Attribute/Attribute.swift

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public struct Attribute<Value> {
3737
public init<Body: _AttributeBody>(
3838
body: UnsafePointer<Body>,
3939
value: UnsafePointer<Value>?,
40-
flags: OGAttributeTypeFlags = [],
40+
flags: AttributeType.Flags = [],
4141
update: AttributeUpdateBlock
4242
) {
4343
#if os(WASI)
@@ -228,12 +228,6 @@ extension Attribute {
228228
}
229229
}
230230

231-
// TODO:
232-
private struct AttributeType {
233-
var graphType: OGAttributeType
234-
var type: _AttributeBody.Type
235-
}
236-
237231
@_silgen_name("OGGraphCreateAttribute")
238232
@inline(__always)
239233
@inlinable

Sources/OpenGraph/Attribute/Attribute/External.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public struct External<Value> {
1515
extension External: _AttributeBody {
1616
public static var comparisonMode: ComparisonMode { .equatableAlways }
1717

18-
public static var flags: OGAttributeTypeFlags { [] }
18+
public static var flags: AttributeType.Flags { [] }
1919

2020
public static func _update(_: UnsafeMutableRawPointer, attribute _: AnyAttribute) {}
2121
}

Sources/OpenGraph/Attribute/Body/AttributeBody.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public protocol _AttributeBody {
1212
static var _hasDestroySelf: Bool { get }
1313
static func _updateDefault(_ pointer: UnsafeMutableRawPointer)
1414
static var comparisonMode: ComparisonMode { get }
15-
static var flags: OGAttributeTypeFlags { get }
15+
static var flags: AttributeType.Flags { get }
1616
}
1717

1818
// MARK: - Protocol Default implementation
@@ -22,7 +22,7 @@ extension _AttributeBody {
2222
public static var _hasDestroySelf: Bool { false }
2323
public static func _updateDefault(_ pointer: UnsafeMutableRawPointer) {}
2424
public static var comparisonMode: ComparisonMode { .equatableUnlessPOD }
25-
public static var flags: OGAttributeTypeFlags { .mainThread }
25+
public static var flags: AttributeType.Flags { .mainThread }
2626
}
2727

2828
extension _AttributeBody {

Sources/OpenGraph/Attribute/Rule/Focus.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public struct Focus<Root, Value>: Rule, CustomStringConvertible {
1717

1818
public var value: Value { root.value[keyPath: keyPath] }
1919

20-
public static var flags: OGAttributeTypeFlags { [] }
20+
public static var flags: AttributeType.Flags { [] }
2121

2222
public var description: String { "\(Metadata(Value.self).description)" }
2323
}

Sources/OpenGraph/Attribute/Rule/Map.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public struct Map<Source, Value>: Rule, CustomStringConvertible {
1919

2020
public var value: Value { body(arg.value) }
2121

22-
public static var flags: OGAttributeTypeFlags { [] }
22+
public static var flags: AttributeType.Flags { [] }
2323

2424
public var description: String { "λ \(Value.self)" }
2525
}

Sources/OpenGraph/Graph/Graph.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ extension Graph {
1212
ctx: GraphContext,
1313
body: _AttributeBody.Type,
1414
valueType: Metadata,
15-
flags: OGAttributeTypeFlags,
15+
flags: AttributeType.Flags,
1616
update: AttributeUpdateBlock
1717
) -> Int {
1818
// TODO: __AGGraphInternAttributeType

Sources/OpenGraph_SPI/include/OGAttributeType.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ typedef struct OGAttributeVTable {
2323
void (*_Nullable update_default)(const OGAttributeType *, void *);
2424
} OGAttributeVTable OG_SWIFT_NAME(_AttributeVTable);
2525

26-
typedef struct OGAttributeType {
26+
typedef struct OG_SWIFT_NAME(AttributeType) OGAttributeType {
2727
OGTypeID self_id;
2828
OGTypeID value_id;
2929
OGClosureStorage update;

Sources/OpenGraph_SPI/include/OGAttributeTypeFlags.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ typedef OG_OPTIONS(uint32_t, OGAttributeTypeFlags) {
1818
OGAttributeTypeFlagsMainThread = 1 << 3,
1919
OGAttributeTypeFlagsExternal = 1 << 4,
2020
OGAttributeTypeFlagsAsyncThread = 1 << 5,
21-
};
21+
} OG_SWIFT_NAME(AttributeType.Flags);
2222

2323
#endif /* OGAttributeTypeFlags_h */
2424

0 commit comments

Comments
 (0)