mirror of
https://github.com/morluto/rea.git
synced 2026-11-21 14:05:49 +00:00
Use the same parsed method/field operand predicate when producing member edges and comparing call and field shapes. Exclude ldtoken and operands without a value from both interpretations.
19 lines
702 B
TypeScript
19 lines
702 B
TypeScript
/** Facts available on decoded member-reference-bearing CIL instructions. */
|
|
export interface ManagedMemberInstructionFact {
|
|
readonly opcode: string;
|
|
readonly operand_kind: string;
|
|
readonly operand: string | null;
|
|
}
|
|
|
|
/** Whether an instruction contributes a method or field operand fact to member analysis. */
|
|
export const isManagedMemberReferenceInstruction = (
|
|
instruction: ManagedMemberInstructionFact,
|
|
): instruction is ManagedMemberInstructionFact & {
|
|
readonly operand_kind: "method" | "field";
|
|
readonly operand: string;
|
|
} =>
|
|
instruction.opcode !== "ldtoken" &&
|
|
instruction.operand !== null &&
|
|
(instruction.operand_kind === "method" ||
|
|
instruction.operand_kind === "field");
|