From 0b5924db1d3858d6f4abe5923cce53b2f4e581aa Mon Sep 17 00:00:00 2001 From: black-desk Date: Fri, 1 Mar 2024 15:25:23 +0800 Subject: [PATCH] C++: force include for types in vector and map (#2403) Related: #2402 Signed-off-by: black-desk Co-authored-by: David Siegel --- packages/quicktype-core/src/language/CPlusPlus.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/quicktype-core/src/language/CPlusPlus.ts b/packages/quicktype-core/src/language/CPlusPlus.ts index 03cdf6285..5adff56d2 100644 --- a/packages/quicktype-core/src/language/CPlusPlus.ts +++ b/packages/quicktype-core/src/language/CPlusPlus.ts @@ -1078,7 +1078,7 @@ export class CPlusPlusRenderer extends ConvenienceRenderer { const result: TypeRecord[] = []; const recur = (forceInclude: boolean, isVariant: boolean, l: number, t: Type) => { if (t instanceof ArrayType) { - recur(forceInclude, isVariant, l + 1, t.items); + recur(true, isVariant, l + 1, t.items); } else if (t instanceof ClassType) { result.push({ name: this.nameForNamedType(t), @@ -1088,7 +1088,7 @@ export class CPlusPlusRenderer extends ConvenienceRenderer { forceInclude }); } else if (t instanceof MapType) { - recur(forceInclude, isVariant, l + 1, t.values); + recur(true, isVariant, l + 1, t.values); } else if (t instanceof EnumType) { result.push({ name: this.nameForNamedType(t),