mirror of
https://github.com/morluto/rea.git
synced 2026-11-03 05:16:16 +00:00
fix(comparison): preserve decoding uncertainty and known string facts
Preserve format and Evidence semantics at their owning boundaries, with focused regression coverage and documentation where applicable. Fixes #6774
This commit is contained in:
1 parent
a06dbd509d
commit
40c235c642
5 files changed
+581
-27
No files matched your search
@@ -93,21 +93,33 @@ export const commentProjection = (
|
||||
return values.some(({ offset }) => offset === null) ? null : sorted(values);
|
||||
};
|
||||
|
||||
export const stringAndNameProjection = (
|
||||
export const referencedStringProjection = (snapshot: FunctionSnapshot) => {
|
||||
const values = snapshot.dossier.referenced_strings.map(
|
||||
({ source_address: sourceAddress, value, decoding, string }) => ({
|
||||
source_offset: relativeAddress(
|
||||
sourceAddress,
|
||||
snapshot.dossier.procedure.address,
|
||||
),
|
||||
content: decoding === undefined ? value : null,
|
||||
decoding_reason: decoding?.reason ?? null,
|
||||
metadata:
|
||||
string === undefined
|
||||
? null
|
||||
: {
|
||||
encoding: string.encoding,
|
||||
termination: string.termination,
|
||||
byte_length: string.byte_length,
|
||||
},
|
||||
}),
|
||||
);
|
||||
return sorted(values);
|
||||
};
|
||||
|
||||
export const nameAndSwiftProjection = (
|
||||
snapshot: FunctionSnapshot,
|
||||
includeSwiftLiterals = true,
|
||||
): readonly unknown[] | null => {
|
||||
const values = [
|
||||
...snapshot.dossier.referenced_strings.map(
|
||||
({ source_address: sourceAddress, value }) => ({
|
||||
kind: "string",
|
||||
source_offset: relativeAddress(
|
||||
sourceAddress,
|
||||
snapshot.dossier.procedure.address,
|
||||
),
|
||||
value,
|
||||
}),
|
||||
),
|
||||
...snapshot.dossier.referenced_names.map(
|
||||
({ source_address: sourceAddress, value }) => ({
|
||||
kind: "name",
|
||||
|
||||
Reference in new issue
Block a user