@gwigz/slua-tstl-plugin 0.1.2 → 0.2.0
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 +10 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -308,6 +308,16 @@ const CALL_TRANSFORMS = [
|
|
|
308
308
|
return createNamespacedCall("string", "sub", args, node);
|
|
309
309
|
},
|
|
310
310
|
},
|
|
311
|
+
// str.replaceAll(search, replacement) -> ll.ReplaceSubString(str, search, replacement, 0)
|
|
312
|
+
{
|
|
313
|
+
match: (node, checker) => isMethodCall(node, checker, isStringType, "replaceAll", 2),
|
|
314
|
+
emit: (node, context) => {
|
|
315
|
+
const str = context.transformExpression(node.expression.expression);
|
|
316
|
+
const search = context.transformExpression(node.arguments[0]);
|
|
317
|
+
const replacement = context.transformExpression(node.arguments[1]);
|
|
318
|
+
return createNamespacedCall("ll", "ReplaceSubString", [str, search, replacement, tstl.createNumericLiteral(0)], node);
|
|
319
|
+
},
|
|
320
|
+
},
|
|
311
321
|
// arr.includes(val) -> table.find(arr, val) ~= nil
|
|
312
322
|
{
|
|
313
323
|
match: (node, checker) => isMethodCall(node, checker, isArrayType, "includes", 1),
|