fix(apple): derive dispatch coverage from located decode facts

This commit is contained in:
morluto
2026-10-09 00:49:30 +08:00
parent 15f92f2988
commit 488f448ae2
12 changed files with 601 additions and 116 deletions
+13 -3
View File
@@ -2,6 +2,7 @@ import type { ObjcSwiftMetadata } from "../domain/native/objcSwiftMetadata.js";
import type { Section } from "./AppleMachoSelection.js";
import type { ObjcDispatchReaders } from "./AppleObjcDispatchFacets.js";
import { readObjcPropertiesOf } from "./AppleObjcProperties.js";
import { issue, type DecodeIssue } from "./AppleDispatchDecodeFacts.js";
const CLASS_SYMBOL = /^_OBJC_(?:META)?CLASS_\$_(.+)$/u;
@@ -23,6 +24,7 @@ export const decodeObjcCategories = (input: {
readonly read: ObjcDispatchReaders;
readonly result: ObjcSwiftMetadata;
readonly failures: string[];
readonly issues: DecodeIssue[];
readonly admit: () => boolean;
/** Decode a method list into implementations attributed to the category. */
readonly methods: (
@@ -79,7 +81,8 @@ export const decodeObjcCategories = (input: {
properties: readObjcPropertiesOf(read, read.pointer(category + 40n), {
owner: `category ${name}`,
admit: input.admit,
failures,
issues: input.issues,
location: `0x${read.pointer(category + 40n).toString(16)}`,
}),
location: read.location(category),
decode:
@@ -89,8 +92,15 @@ export const decodeObjcCategories = (input: {
evidence: read.evidence(category, "Objective-C category_t record"),
});
} catch (cause: unknown) {
failures.push(
`Category at ${`0x${field.toString(16)}`}: ${cause instanceof Error ? cause.message : String(cause)}`,
const message = cause instanceof Error ? cause.message : String(cause);
failures.push(`Category at 0x${field.toString(16)}: ${message}`);
input.issues.push(
issue(
"objc_properties_categories",
"category_decode_failed",
message,
`0x${field.toString(16)}`,
),
);
}
}