imxc 0.6.4 → 0.6.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.
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
1
  #!/usr/bin/env node
2
2
  import { runCli } from './cli.js';
3
3
  const exitCode = await runCli(process.argv.slice(2));
4
- process.exit(exitCode);
4
+ process.exitCode = exitCode;
package/dist/init.js CHANGED
@@ -39,7 +39,7 @@ export function addToProject(projectDir) {
39
39
  console.log(' include(FetchContent)');
40
40
  console.log(' FetchContent_Declare(imx');
41
41
  console.log(' GIT_REPOSITORY https://github.com/bgocumlu/imx.git');
42
- console.log(' GIT_TAG v0.6.4');
42
+ console.log(' GIT_TAG v0.6.6');
43
43
  console.log(' )');
44
44
  console.log(' FetchContent_MakeAvailable(imx)');
45
45
  console.log(' include(ImxCompile)');
package/dist/lowering.js CHANGED
@@ -242,10 +242,10 @@ export function exprToCpp(node, ctx) {
242
242
  const leftIsString = ts.isStringLiteral(node.left) || ts.isNoSubstitutionTemplateLiteral(node.left) || inferExprType(node.left, ctx) === 'string';
243
243
  const rightIsString = ts.isStringLiteral(node.right) || ts.isNoSubstitutionTemplateLiteral(node.right) || inferExprType(node.right, ctx) === 'string';
244
244
  if (leftIsString && !rightIsString) {
245
- return `(std::string(${left}) + std::to_string(${right})).c_str()`;
245
+ return `std::string(${left}) + std::to_string(${right})`;
246
246
  }
247
247
  if (!leftIsString && rightIsString) {
248
- return `(std::to_string(${left}) + std::string(${right})).c_str()`;
248
+ return `std::to_string(${left}) + std::string(${right})`;
249
249
  }
250
250
  }
251
251
  return `${left} ${op} ${right}`;
@@ -1164,12 +1164,14 @@ function lowerTextElement(node, body, ctx, loc) {
1164
1164
  break;
1165
1165
  case 'string':
1166
1166
  format += '%s';
1167
- // String literals and ternaries of literals are already const char*
1168
- if (cppExpr.startsWith('"') || isCharPtrExpression(expr)) {
1167
+ // String literals, literal-only ternaries, and pre-converted char* values
1168
+ // should be passed through unchanged. Other string expressions stay as
1169
+ // std::string until this point and need a single .c_str().
1170
+ if (cppExpr.startsWith('"') || cppExpr.endsWith('.c_str()') || isCharPtrExpression(expr)) {
1169
1171
  args.push(cppExpr);
1170
1172
  }
1171
1173
  else {
1172
- args.push(`${cppExpr}.c_str()`);
1174
+ args.push(`(${cppExpr}).c_str()`);
1173
1175
  }
1174
1176
  break;
1175
1177
  default:
@@ -428,7 +428,7 @@ set(FETCHCONTENT_QUIET OFF)
428
428
  FetchContent_Declare(
429
429
  imx
430
430
  GIT_REPOSITORY https://github.com/bgocumlu/imx.git
431
- GIT_TAG v0.6.4
431
+ GIT_TAG v0.6.6
432
432
  GIT_SHALLOW TRUE
433
433
  GIT_PROGRESS TRUE
434
434
  )
@@ -313,7 +313,7 @@ set(FETCHCONTENT_QUIET OFF)
313
313
  FetchContent_Declare(
314
314
  imx
315
315
  GIT_REPOSITORY https://github.com/bgocumlu/imx.git
316
- GIT_TAG v0.6.4
316
+ GIT_TAG v0.6.6
317
317
  GIT_SHALLOW TRUE
318
318
  GIT_PROGRESS TRUE
319
319
  )
@@ -402,7 +402,7 @@ set(FETCHCONTENT_QUIET OFF)
402
402
  FetchContent_Declare(
403
403
  imx
404
404
  GIT_REPOSITORY ${repoUrl}
405
- GIT_TAG v0.6.4
405
+ GIT_TAG v0.6.6
406
406
  GIT_SHALLOW TRUE
407
407
  GIT_PROGRESS TRUE
408
408
  )
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "imxc",
3
- "version": "0.6.4",
3
+ "version": "0.6.6",
4
4
  "description": "Compiler for IMX — compiles React-like .tsx to native Dear ImGui C++",
5
5
  "type": "module",
6
6
  "bin": {