mirror of
https://github.com/morluto/rea.git
synced 2026-11-06 14:56:32 +00:00
Share Field scalar facts and use one coded-index tag registry for widths and decoding. Preserve reserved constructor tags, generic-instantiation restrictions, heap failure order and selected-field signature admission. Derive native import member kind from the validated MemberForwarded coordinate independently of name lookup, retaining known field or method identity when its display name is unreadable. Validation: 368 focused source, CLI and MCP tests passed; five lost-kind regressions reproduced on the previous commit. Heap-width, coded-width, reserved-tag and selection boundaries are covered. Typecheck and lint passed.
34 lines
1.0 KiB
TypeScript
34 lines
1.0 KiB
TypeScript
import {
|
|
MANAGED_CODED_INDEXES,
|
|
type ManagedMetadataLayout,
|
|
} from "./ManagedMetadataLayout.js";
|
|
import {
|
|
decodeMetadataCodedIndex,
|
|
metadataRowCursor,
|
|
metadataToken,
|
|
} from "./ManagedMetadataHeaps.js";
|
|
|
|
/** Scalar MemberRef facts; consumers own heap admission and parent diagnostics. */
|
|
export const readMemberReferenceRowFacts = (
|
|
bytes: Buffer,
|
|
layout: ManagedMetadataLayout,
|
|
row: number,
|
|
) => {
|
|
// Layout admission bounds the complete row independently of its heap values.
|
|
const cursor = metadataRowCursor(bytes, layout, 10, row);
|
|
const parentRaw = cursor.readIndex(layout.codedIndexSize("MemberRefParent"));
|
|
return {
|
|
token: metadataToken(10, row),
|
|
rowOffset: cursor.start,
|
|
parentRaw,
|
|
parent: decodeMetadataCodedIndex(
|
|
parentRaw,
|
|
MANAGED_CODED_INDEXES.MemberRefParent.bits,
|
|
MANAGED_CODED_INDEXES.MemberRefParent.tables,
|
|
layout.rowCounts,
|
|
),
|
|
nameIndex: cursor.readIndex(layout.stringIndexSize),
|
|
signatureIndex: cursor.readIndex(layout.blobIndexSize),
|
|
};
|
|
};
|