imxc 0.6.5 → 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/init.js +1 -1
- package/dist/lowering.js +7 -5
- package/dist/templates/custom.js +1 -1
- package/dist/templates/hotreload.js +1 -1
- package/dist/templates/index.js +1 -1
- package/package.json +1 -1
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.
|
|
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 `
|
|
245
|
+
return `std::string(${left}) + std::to_string(${right})`;
|
|
246
246
|
}
|
|
247
247
|
if (!leftIsString && rightIsString) {
|
|
248
|
-
return `
|
|
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
|
|
1168
|
-
|
|
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(
|
|
1174
|
+
args.push(`(${cppExpr}).c_str()`);
|
|
1173
1175
|
}
|
|
1174
1176
|
break;
|
|
1175
1177
|
default:
|
package/dist/templates/custom.js
CHANGED
package/dist/templates/index.js
CHANGED