Skip to content

Commit 8a91789

Browse files
authored
Fix text in C++ default statement (#2623)
* Fix typos * Fix text in C++ default statement * Remove whitespace characters in cpp file
1 parent 472075a commit 8a91789

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

packages/quicktype-core/src/language/CPlusPlus/CPlusPlusRenderer.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ export class CPlusPlusRenderer extends ConvenienceRenderer {
198198
// };
199199
//
200200
// checking to see if the collapse of the variant has
201-
// occured and then doing the isCycleBreakerType check
201+
// occurred and then doing the isCycleBreakerType check
202202
// on the single type the variant would contain seems
203203
// to solve the problem. But does this point to a problem
204204
// with the core library or with the CPlusPlus package
@@ -916,7 +916,7 @@ export class CPlusPlusRenderer extends ConvenienceRenderer {
916916
if (constraints === undefined) return;
917917
const { minMax, minMaxLength, pattern } = constraints;
918918

919-
// TODO is there a better way to check if property.type is an interger or a number?
919+
// TODO is there a better way to check if property.type is an integer or a number?
920920
const cppType = this.cppType(
921921
property.type,
922922
{
@@ -1627,7 +1627,9 @@ export class CPlusPlusRenderer extends ConvenienceRenderer {
16271627
);
16281628
});
16291629
this.emitLine(
1630-
`default: throw std::runtime_error("Unexpected value in enumeration \\"${enumName}\\": " + std::to_string(static_cast<int>(x)));`
1630+
`default: throw std::runtime_error("Unexpected value in enumeration \\"`,
1631+
enumName,
1632+
`\\": " + std::to_string(static_cast<int>(x)));`
16311633
);
16321634
});
16331635
}

packages/quicktype-core/src/rewrites/ExpandStrings.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ export function expandStrings(ctx: RunContext, graph: TypeGraph, inference: Enum
173173
const transformations = mappedStringTypes.transformations;
174174
// FIXME: This is probably wrong, or at least overly conservative. This is for the case
175175
// where some attributes are identity ones, i.e. where we can't merge the primitive types,
176-
// like it happens in the line after the `if`. The case where this occured was with URI
176+
// like it happens in the line after the `if`. The case where this occurred was with URI
177177
// attributes: we had two separate string types with different URI attributes, but because
178178
// both are rewritten via `getPrimitiveType` below without any attributes, they end up
179179
// being the same string type.

test/fixtures/cplusplus/main.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@ int main(int argc, const char * argv[]) {
1414
std::cerr << "Usage: " << argv[0] << " FILE";
1515
return 1;
1616
}
17-
17+
1818
std::ifstream t(argv[1]);
1919
std::string str((std::istreambuf_iterator<char>(t)),
2020
std::istreambuf_iterator<char>());
2121

2222
TopLevel tl = json::parse(str);
2323
json j2 = tl;
24-
24+
2525
std::cout << j2 << std::endl;
2626

2727
return 0;

0 commit comments

Comments
 (0)