mirror of
https://github.com/morluto/rea.git
synced 2026-10-31 20:06:14 +00:00
Compare managed member signatures using bounded, framed nominal type identities rather than build-local metadata row numbers. Preserve unresolved and historical evidence semantics, and share TypeRef, nesting and member-list facts at their producing boundaries. Validation: current-head CI and Greptile pass; all 435 related managed tests pass. Genuine Microsoft .NET DLL CLI comparison and bounded SDK MCP paging pass without modifying targets. A local CLI filter deadline also fails on clean main; no unrelated timeout or product change is included. Co-authored-by: JayOfTheKeyboard <140487034+JayOfTheKeyboard@users.noreply.github.com> Co-authored-by: N0zoM1z0 <161784452+N0zoM1z0@users.noreply.github.com> Co-authored-by: Kaoru0822 <208281322+kaoru0822-kitauji@users.noreply.github.com>
46 lines
1.8 KiB
TypeScript
46 lines
1.8 KiB
TypeScript
import { managedDecodeBudget } from "./ManagedDecodeBudget.js";
|
|
import { metadataRowCursor, metadataToken } from "./ManagedMetadataHeaps.js";
|
|
import type { ManagedMetadataLayout } from "./ManagedMetadataLayout.js";
|
|
import { managedFailure, readManagedValue } from "./ManagedReaderFailure.js";
|
|
import type { ManagedParseIssue } from "../domain/managed/managedArtifact.js";
|
|
|
|
/** Parsed NestedClass facts shared by declaring types and signature operands. */
|
|
export interface ManagedTypeNesting {
|
|
readonly enclosing: ReadonlyMap<number, number>;
|
|
readonly complete: boolean;
|
|
}
|
|
|
|
export const readManagedTypeNesting = (
|
|
bytes: Buffer,
|
|
layout: ManagedMetadataLayout,
|
|
issues: ManagedParseIssue[],
|
|
): ManagedTypeNesting => {
|
|
const initialIssues = issues.length;
|
|
const typeCount = layout.table(2)?.rowCount ?? 0;
|
|
const enclosing = new Map<number, number>();
|
|
for (let row = 1; row <= (layout.table(41)?.rowCount ?? 0); row += 1) {
|
|
readManagedValue(() => {
|
|
const cursor = metadataRowCursor(bytes, layout, 41, row);
|
|
const nested = cursor.readIndex(layout.tableIndexSize(2));
|
|
const outer = cursor.readIndex(layout.tableIndexSize(2));
|
|
if (
|
|
nested < 1 ||
|
|
outer < 1 ||
|
|
nested > typeCount ||
|
|
outer > typeCount ||
|
|
nested === outer ||
|
|
enclosing.has(nested)
|
|
)
|
|
throw managedFailure(
|
|
"invalid-row",
|
|
`metadata.NestedClass:${metadataToken(41, row)}`,
|
|
`NestedClass requires a unique nested type and distinct existing enclosing type; observed ${nested} -> ${outer}`,
|
|
cursor.start,
|
|
);
|
|
managedDecodeBudget(layout).reserve(128, cursor.start);
|
|
enclosing.set(nested, outer);
|
|
}, issues);
|
|
}
|
|
return { enclosing, complete: issues.length === initialIssues };
|
|
};
|