@grey-ts/transpiler 0.3.0 → 0.3.1

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.
Files changed (2) hide show
  1. package/dist/index.js +4 -4
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -519,7 +519,7 @@ var utilFunctions2 = {
519
519
  array_push: [
520
520
  "array_push = function(target, items)",
521
521
  "\tfor item in items",
522
- "\t\ttarget.push(item)",
522
+ "\t\ttarget.push(@item)",
523
523
  "\tend for",
524
524
  "\treturn target.len",
525
525
  "end function"
@@ -529,7 +529,7 @@ var utilFunctions2 = {
529
529
  "array_unshift = function(target, items)",
530
530
  "\tif not items.len then return target.len",
531
531
  "\tfor i in range(items.len-1)",
532
- "\t\ttarget.insert(0, items[i])",
532
+ "\t\ttarget.insert(0, @items[i])",
533
533
  "\tend for",
534
534
  "\treturn target.len",
535
535
  "end function"
@@ -984,7 +984,7 @@ function handleCallArgs(callNode, ctx) {
984
984
  } else {
985
985
  const processedItems = [];
986
986
  for (const item of restItems) {
987
- if (item[0] !== "[") {
987
+ if (!item.startsWith("[") || !item.endsWith("]")) {
988
988
  processedItems.push(item);
989
989
  continue;
990
990
  }
@@ -1115,7 +1115,7 @@ function handleUnaryExpression(node) {
1115
1115
  if (operator === "-")
1116
1116
  return `-${operand}`;
1117
1117
  if (operator === "+")
1118
- return `${operand}.val()`;
1118
+ return `str(${operand}).val()`;
1119
1119
  if (operator === "~")
1120
1120
  return `bitwise("~", ${operand})`;
1121
1121
  throw `Couldn't handle this UnaryExpression: ${node.getText()}`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@grey-ts/transpiler",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "author": "Okka",
5
5
  "module": "src/index.ts",
6
6
  "bin": {