breeze-bindgen 1.1.28 → 1.1.30

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.
package/dist/cli.mjs CHANGED
@@ -335,13 +335,14 @@ declare module '${tsModuleName}' {
335
335
  const methodName = node.name;
336
336
  const getterMatch = methodName.match(/^get_(.+)$/) || (methodName.match(/^get([A-Z].*)$/) ? [null, methodName[3].toLowerCase() + methodName.slice(4)] : null);
337
337
  const setterMatch = methodName.match(/^set_(.+)$/) || (methodName.match(/^set([A-Z].*)$/) ? [null, methodName[3].toLowerCase() + methodName.slice(4)] : null);
338
+ const isStatic = node.storageClass === "static";
338
339
  if (getterMatch && parsed.args.length === 0) {
339
340
  const propName = getterMatch[1];
340
341
  methods.push({
341
342
  name: methodName,
342
343
  returnType: ctypeToQualified(parsed.returnType, [...path, node.name]),
343
344
  args: [],
344
- static: false,
345
+ static: isStatic,
345
346
  comment: comment.length > 0 ? comment : void 0,
346
347
  argNames: [],
347
348
  isGetter: true,
@@ -353,7 +354,7 @@ declare module '${tsModuleName}' {
353
354
  name: methodName,
354
355
  returnType: ctypeToQualified(parsed.returnType, [...path, node.name]),
355
356
  args: parsed.args.map((arg) => ctypeToQualified(arg, [...path, node_struct.name])),
356
- static: false,
357
+ static: isStatic,
357
358
  comment: comment.length > 0 ? comment : void 0,
358
359
  argNames,
359
360
  isSetter: true,
@@ -364,7 +365,7 @@ declare module '${tsModuleName}' {
364
365
  name: methodName,
365
366
  returnType: ctypeToQualified(parsed.returnType, [...path, node.name]),
366
367
  args: parsed.args.map((arg) => ctypeToQualified(arg, [...path, node_struct.name])),
367
- static: node.storageClass === "static",
368
+ static: isStatic,
368
369
  comment: comment.length > 0 ? comment : void 0,
369
370
  argNames
370
371
  });
@@ -428,19 +429,30 @@ template<> struct js_bind<${fullName}> {
428
429
  }
429
430
  }
430
431
  for (const [propName, { getter, setter }] of properties) {
431
- if (setter) {
432
- binding += `
433
- .property<&${fullName}::${getter.name}, &${fullName}::${setter.name}>("${propName}")`;
432
+ if (setter.static !== getter.static) {
433
+ throw new Error(`Found setter ${setter.name} with different staticness than getter for property ${propName}`);
434
+ }
435
+ if (getter.static) {
436
+ if (setter) {
437
+ binding += `
438
+ .static_property<&${fullName}::${getter.name}, &${fullName}::${setter.name}>("${propName}")`;
439
+ } else {
440
+ binding += `
441
+ .static_property<&${fullName}::${getter.name}>("${propName}")`;
442
+ }
434
443
  } else {
435
- binding += `
436
- .property<&${fullName}::${getter.name}>("${propName}")`;
444
+ if (setter) {
445
+ binding += `
446
+ .property<&${fullName}::${getter.name}, &${fullName}::${setter.name}>("${propName}")`;
447
+ } else {
448
+ binding += `
449
+ .property<&${fullName}::${getter.name}>("${propName}")`;
450
+ }
437
451
  }
438
452
  }
439
453
  for (const method of methods) {
440
- if (!method.isGetter && !method.isSetter) {
441
- binding += `
454
+ binding += `
442
455
  .${method.static ? "static_" : ""}fun<&${fullName}::${method.name}>("${method.name}")`;
443
- }
444
456
  }
445
457
  for (const field of fields) {
446
458
  binding += `
package/dist/core.cjs CHANGED
@@ -545,13 +545,14 @@ declare module '${tsModuleName}' {
545
545
  const methodName = node.name;
546
546
  const getterMatch = methodName.match(/^get_(.+)$/) || (methodName.match(/^get([A-Z].*)$/) ? [null, methodName[3].toLowerCase() + methodName.slice(4)] : null);
547
547
  const setterMatch = methodName.match(/^set_(.+)$/) || (methodName.match(/^set([A-Z].*)$/) ? [null, methodName[3].toLowerCase() + methodName.slice(4)] : null);
548
+ const isStatic = node.storageClass === "static";
548
549
  if (getterMatch && parsed.args.length === 0) {
549
550
  const propName = getterMatch[1];
550
551
  methods.push({
551
552
  name: methodName,
552
553
  returnType: ctypeToQualified(parsed.returnType, [...path, node.name]),
553
554
  args: [],
554
- static: false,
555
+ static: isStatic,
555
556
  comment: comment.length > 0 ? comment : void 0,
556
557
  argNames: [],
557
558
  isGetter: true,
@@ -563,7 +564,7 @@ declare module '${tsModuleName}' {
563
564
  name: methodName,
564
565
  returnType: ctypeToQualified(parsed.returnType, [...path, node.name]),
565
566
  args: parsed.args.map((arg) => ctypeToQualified(arg, [...path, node_struct.name])),
566
- static: false,
567
+ static: isStatic,
567
568
  comment: comment.length > 0 ? comment : void 0,
568
569
  argNames,
569
570
  isSetter: true,
@@ -574,7 +575,7 @@ declare module '${tsModuleName}' {
574
575
  name: methodName,
575
576
  returnType: ctypeToQualified(parsed.returnType, [...path, node.name]),
576
577
  args: parsed.args.map((arg) => ctypeToQualified(arg, [...path, node_struct.name])),
577
- static: node.storageClass === "static",
578
+ static: isStatic,
578
579
  comment: comment.length > 0 ? comment : void 0,
579
580
  argNames
580
581
  });
@@ -638,19 +639,30 @@ template<> struct js_bind<${fullName}> {
638
639
  }
639
640
  }
640
641
  for (const [propName, { getter, setter }] of properties) {
641
- if (setter) {
642
- binding += `
643
- .property<&${fullName}::${getter.name}, &${fullName}::${setter.name}>("${propName}")`;
642
+ if (setter.static !== getter.static) {
643
+ throw new Error(`Found setter ${setter.name} with different staticness than getter for property ${propName}`);
644
+ }
645
+ if (getter.static) {
646
+ if (setter) {
647
+ binding += `
648
+ .static_property<&${fullName}::${getter.name}, &${fullName}::${setter.name}>("${propName}")`;
649
+ } else {
650
+ binding += `
651
+ .static_property<&${fullName}::${getter.name}>("${propName}")`;
652
+ }
644
653
  } else {
645
- binding += `
646
- .property<&${fullName}::${getter.name}>("${propName}")`;
654
+ if (setter) {
655
+ binding += `
656
+ .property<&${fullName}::${getter.name}, &${fullName}::${setter.name}>("${propName}")`;
657
+ } else {
658
+ binding += `
659
+ .property<&${fullName}::${getter.name}>("${propName}")`;
660
+ }
647
661
  }
648
662
  }
649
663
  for (const method of methods) {
650
- if (!method.isGetter && !method.isSetter) {
651
- binding += `
664
+ binding += `
652
665
  .${method.static ? "static_" : ""}fun<&${fullName}::${method.name}>("${method.name}")`;
653
- }
654
666
  }
655
667
  for (const field of fields) {
656
668
  binding += `
package/dist/core.mjs CHANGED
@@ -541,13 +541,14 @@ declare module '${tsModuleName}' {
541
541
  const methodName = node.name;
542
542
  const getterMatch = methodName.match(/^get_(.+)$/) || (methodName.match(/^get([A-Z].*)$/) ? [null, methodName[3].toLowerCase() + methodName.slice(4)] : null);
543
543
  const setterMatch = methodName.match(/^set_(.+)$/) || (methodName.match(/^set([A-Z].*)$/) ? [null, methodName[3].toLowerCase() + methodName.slice(4)] : null);
544
+ const isStatic = node.storageClass === "static";
544
545
  if (getterMatch && parsed.args.length === 0) {
545
546
  const propName = getterMatch[1];
546
547
  methods.push({
547
548
  name: methodName,
548
549
  returnType: ctypeToQualified(parsed.returnType, [...path, node.name]),
549
550
  args: [],
550
- static: false,
551
+ static: isStatic,
551
552
  comment: comment.length > 0 ? comment : void 0,
552
553
  argNames: [],
553
554
  isGetter: true,
@@ -559,7 +560,7 @@ declare module '${tsModuleName}' {
559
560
  name: methodName,
560
561
  returnType: ctypeToQualified(parsed.returnType, [...path, node.name]),
561
562
  args: parsed.args.map((arg) => ctypeToQualified(arg, [...path, node_struct.name])),
562
- static: false,
563
+ static: isStatic,
563
564
  comment: comment.length > 0 ? comment : void 0,
564
565
  argNames,
565
566
  isSetter: true,
@@ -570,7 +571,7 @@ declare module '${tsModuleName}' {
570
571
  name: methodName,
571
572
  returnType: ctypeToQualified(parsed.returnType, [...path, node.name]),
572
573
  args: parsed.args.map((arg) => ctypeToQualified(arg, [...path, node_struct.name])),
573
- static: node.storageClass === "static",
574
+ static: isStatic,
574
575
  comment: comment.length > 0 ? comment : void 0,
575
576
  argNames
576
577
  });
@@ -634,19 +635,30 @@ template<> struct js_bind<${fullName}> {
634
635
  }
635
636
  }
636
637
  for (const [propName, { getter, setter }] of properties) {
637
- if (setter) {
638
- binding += `
639
- .property<&${fullName}::${getter.name}, &${fullName}::${setter.name}>("${propName}")`;
638
+ if (setter.static !== getter.static) {
639
+ throw new Error(`Found setter ${setter.name} with different staticness than getter for property ${propName}`);
640
+ }
641
+ if (getter.static) {
642
+ if (setter) {
643
+ binding += `
644
+ .static_property<&${fullName}::${getter.name}, &${fullName}::${setter.name}>("${propName}")`;
645
+ } else {
646
+ binding += `
647
+ .static_property<&${fullName}::${getter.name}>("${propName}")`;
648
+ }
640
649
  } else {
641
- binding += `
642
- .property<&${fullName}::${getter.name}>("${propName}")`;
650
+ if (setter) {
651
+ binding += `
652
+ .property<&${fullName}::${getter.name}, &${fullName}::${setter.name}>("${propName}")`;
653
+ } else {
654
+ binding += `
655
+ .property<&${fullName}::${getter.name}>("${propName}")`;
656
+ }
643
657
  }
644
658
  }
645
659
  for (const method of methods) {
646
- if (!method.isGetter && !method.isSetter) {
647
- binding += `
660
+ binding += `
648
661
  .${method.static ? "static_" : ""}fun<&${fullName}::${method.name}>("${method.name}")`;
649
- }
650
662
  }
651
663
  for (const field of fields) {
652
664
  binding += `
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e",
3
3
  "name": "breeze-bindgen",
4
- "version": "1.1.28",
4
+ "version": "1.1.30",
5
5
  "main": "dist/core.cjs",
6
6
  "module": "dist/core.mjs",
7
7
  "types": "dist/core.d.ts",