Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
106f260d18 |
No files matched your search
@@ -38,7 +38,12 @@ export const classifySwiftSymbol = (
|
|||||||
let category: SwiftTypeCategory | null = null;
|
let category: SwiftTypeCategory | null = null;
|
||||||
for (;;) {
|
for (;;) {
|
||||||
const end = identifierEnd(mangling, offset);
|
const end = identifierEnd(mangling, offset);
|
||||||
if (end === undefined) break;
|
if (end === undefined) {
|
||||||
|
// A word-substituted or punycode identifier (`0…`) may name a nested
|
||||||
|
// type of any kind, so the enclosing nominal no longer decides it.
|
||||||
|
if (mangling.charAt(offset) === "0") category = null;
|
||||||
|
break;
|
||||||
|
}
|
||||||
const kind = mangling.charAt(end);
|
const kind = mangling.charAt(end);
|
||||||
const nominal = NOMINAL_CATEGORIES.get(kind);
|
const nominal = NOMINAL_CATEGORIES.get(kind);
|
||||||
if (nominal === undefined) {
|
if (nominal === undefined) {
|
||||||
|
|||||||
@@ -28,6 +28,10 @@ describe("modern Swift category evidence", () => {
|
|||||||
"$sSi4mainE7doubledSiyF",
|
"$sSi4mainE7doubledSiyF",
|
||||||
"$s9999999999999999999999BadVMa",
|
"$s9999999999999999999999BadVMa",
|
||||||
"$s4main04PairVMa",
|
"$s4main04PairVMa",
|
||||||
|
// Nested types named by punycode identifiers inside struct Envelope.
|
||||||
|
"_$s6Nested8EnvelopeV007IhuqBAbO8describeSSyF",
|
||||||
|
"_$s6Nested8EnvelopeV007jvrtDBlCAEycfC",
|
||||||
|
"_$s6Nested8EnvelopeV007jvrtDBlCMa",
|
||||||
];
|
];
|
||||||
const result = categorizeSwiftTypes(
|
const result = categorizeSwiftTypes(
|
||||||
names.map((name, index) => ({ address: String(index), name })),
|
names.map((name, index) => ({ address: String(index), name })),
|
||||||
@@ -52,6 +56,16 @@ describe("modern Swift category evidence", () => {
|
|||||||
).toMatchObject({ total: 0, unclassified: [] });
|
).toMatchObject({ total: 0, unclassified: [] });
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("keeps a nested punycode class unresolved under a class filter", () => {
|
||||||
|
const name = "_$s6Nested8EnvelopeV007jvrtDBlCMa";
|
||||||
|
expect(
|
||||||
|
categorizeSwiftTypes([{ address: "0x1", name }], { category: "classes" }),
|
||||||
|
).toMatchObject({
|
||||||
|
total: 0,
|
||||||
|
unclassified: [{ name, reason: "category_not_decoded" }],
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
it("deduplicates display names after selecting a category", () => {
|
it("deduplicates display names after selecting a category", () => {
|
||||||
expect(
|
expect(
|
||||||
categorizeSwiftTypes(
|
categorizeSwiftTypes(
|
||||||
|
|||||||
Reference in new issue
Block a user