quicktype-core 23.3.4 → 23.3.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -732,11 +732,8 @@ class CPlusPlusRenderer extends ConvenienceRenderer_1.ConvenienceRenderer {
732
732
  * a member called 'value' value = value will screw up the compiler
733
733
  */
734
734
  const checkConst = this.lookupGlobalName(utils_1.GlobalNames.CheckConstraint);
735
- if ((property.type instanceof Type_1.UnionType &&
736
- property.type.findMember("null") !== undefined) ||
737
- (property.isOptional &&
738
- property.type.kind !== "null" &&
739
- property.type.kind !== "any")) {
735
+ if (property.type instanceof Type_1.UnionType &&
736
+ property.type.findMember("null") !== undefined) {
740
737
  this.emitLine(rendered, " ", getterName, "() const { return ", name, "; }");
741
738
  if (constraints === null || constraints === void 0 ? void 0 : constraints.has(jsonName)) {
742
739
  this.emitLine("void ", setterName, "(", rendered, " value) { if (value) ", checkConst, "(", this._stringType.createStringLiteral([name]), ", ", this.constraintMember(jsonName), ", *value); this->", name, " = value; }");
@@ -1416,6 +1413,24 @@ class CPlusPlusRenderer extends ConvenienceRenderer_1.ConvenienceRenderer {
1416
1413
  this.ensureBlankLine();
1417
1414
  });
1418
1415
  this.ensureBlankLine();
1416
+ this.emitBlock([
1417
+ "inline void ",
1418
+ checkConst,
1419
+ "(",
1420
+ this._stringType.getConstType(),
1421
+ " name, ",
1422
+ this.withConst(classConstraint),
1423
+ " & c, const ",
1424
+ this._optionalType,
1425
+ "<",
1426
+ cppType,
1427
+ "> & value)",
1428
+ ], false, () => {
1429
+ this.emitBlock(["if (value)"], false, () => {
1430
+ this.emitLine(checkConst, "(name, c, *value);");
1431
+ });
1432
+ });
1433
+ this.ensureBlankLine();
1419
1434
  }
1420
1435
  emitConstraintClasses() {
1421
1436
  const ourQualifier = this.ourQualifier(false);
@@ -1537,6 +1552,24 @@ class CPlusPlusRenderer extends ConvenienceRenderer_1.ConvenienceRenderer {
1537
1552
  });
1538
1553
  this.ensureBlankLine();
1539
1554
  });
1555
+ this.ensureBlankLine();
1556
+ this.emitBlock([
1557
+ "inline void ",
1558
+ checkConst,
1559
+ "(",
1560
+ this._stringType.getConstType(),
1561
+ " name, ",
1562
+ this.withConst(classConstraint),
1563
+ " & c, const ",
1564
+ this._optionalType,
1565
+ "<",
1566
+ this._stringType.getType(),
1567
+ "> & value)",
1568
+ ], false, () => {
1569
+ this.emitBlock(["if (value)"], false, () => {
1570
+ this.emitLine(checkConst, "(name, c, *value);");
1571
+ });
1572
+ });
1540
1573
  }
1541
1574
  emitHelperFunctions() {
1542
1575
  this._stringType.emitHelperFunctions();
@@ -468,7 +468,7 @@ class DartRenderer extends ConvenienceRenderer_1.ConvenienceRenderer {
468
468
  emitFreezedClassDefinition(c, className) {
469
469
  this.emitDescription(this.descriptionForType(c));
470
470
  this.emitLine("@freezed");
471
- this.emitBlock(["class ", className, " with _$", className], () => {
471
+ this.emitBlock(["abstract class ", className, " with _$", className], () => {
472
472
  if (c.getProperties().size === 0) {
473
473
  this.emitLine("const factory ", className, "() = _", className, ";");
474
474
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "quicktype-core",
3
- "version": "23.3.4",
3
+ "version": "23.3.6",
4
4
  "description": "The quicktype engine as a library",
5
5
  "license": "Apache-2.0",
6
6
  "main": "dist/index.js",