Skip to content

[ASTGen] NFC: Fixup formatting #69336

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 23, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 11 additions & 8 deletions lib/ASTGen/Sources/LLVMJSON/LLVMJSON.swift
Original file line number Diff line number Diff line change
Expand Up @@ -389,9 +389,10 @@ extension LLVMJSONDecoding.KeyedContainer: KeyedDecodingContainerProtocol {
return try decode(type, forKey: key)
}

func nestedContainer<NestedKey>(keyedBy type: NestedKey.Type, forKey key: Key) throws -> KeyedDecodingContainer<
NestedKey
> where NestedKey: CodingKey {
func nestedContainer<NestedKey: CodingKey>(
keyedBy type: NestedKey.Type,
forKey key: Key
) throws -> KeyedDecodingContainer<NestedKey> {
var objectPtr: UnsafeMutableRawPointer? = nil
if JSON_value_getAsObject(try _getValueOrThrow(forKey: key), &objectPtr) {
throw _typeMismatchError(KeyedDecodingContainer<NestedKey>.self, forKey: key)
Expand Down Expand Up @@ -533,8 +534,9 @@ extension LLVMJSONDecoding.UnkeyedContainer: UnkeyedDecodingContainer {
)
}

mutating func nestedContainer<NestedKey>(keyedBy type: NestedKey.Type) throws -> KeyedDecodingContainer<NestedKey>
where NestedKey: CodingKey {
mutating func nestedContainer<NestedKey: CodingKey>(
keyedBy type: NestedKey.Type
) throws -> KeyedDecodingContainer<NestedKey> {
var objectPtr: UnsafeMutableRawPointer? = nil
let newPath = codingPath + [IndexKey(intValue: currentIndex)]
if JSON_value_getAsObject(try _getValueOrThrow(), &objectPtr) {
Expand Down Expand Up @@ -672,9 +674,10 @@ extension LLVMJSONEncoding.KeyedContainer: KeyedEncodingContainerProtocol {
try value.encode(to: encoder)
}

mutating func nestedContainer<NestedKey>(keyedBy keyType: NestedKey.Type, forKey key: Key) -> KeyedEncodingContainer<
NestedKey
> where NestedKey: CodingKey {
mutating func nestedContainer<NestedKey: CodingKey>(
keyedBy keyType: NestedKey.Type,
forKey key: Key
) -> KeyedEncodingContainer<NestedKey> {
let nestedObjectPtr = JSON_object_setNewObject(objectPtr, key.stringValue)
return KeyedEncodingContainer(KeyedContainer(objectPtr: nestedObjectPtr, codingPath: codingPath + [key]))
}
Expand Down