@abaplint/transpiler 2.13.50 → 2.13.52

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.
@@ -115,6 +115,9 @@ class SourceTranspiler {
115
115
  const context = new _1.TypeNameOrInfer().findType(typ, traversal);
116
116
  ret.appendString(new SourceTranspiler().transpile(c.getFirstChild(), traversal, context).getCode());
117
117
  ret.appendString(")");
118
+ if (this.addGet) {
119
+ ret.appendString(".get()");
120
+ }
118
121
  }
119
122
  else if (c.get() instanceof core_1.Expressions.ValueBody) {
120
123
  continue;
@@ -26,6 +26,10 @@ class ValueBodyTranspiler {
26
26
  let extraFields = "";
27
27
  let baseCode = undefined;
28
28
  const hasLines = body.findDirectExpression(core_1.Expressions.ValueBodyLine) !== undefined;
29
+ const outerLet = body.findDirectExpression(core_1.Expressions.Let);
30
+ const outerLetCode = outerLet === undefined
31
+ ? undefined
32
+ : new let_1.LetTranspiler().transpile(outerLet, traversal).getCode();
29
33
  const children = body.getChildren();
30
34
  for (let i = 0; i < children.length; i++) {
31
35
  const child = children[i];
@@ -68,10 +72,13 @@ class ValueBodyTranspiler {
68
72
  }
69
73
  }
70
74
  i = idx - 1;
71
- const result = this.buildForChain(forNodes, typ, traversal, body, baseCode);
75
+ const result = this.buildForChain(forNodes, typ, traversal, body, baseCode, outerLetCode);
72
76
  ret = result.chunk;
73
77
  post = result.post;
74
78
  }
79
+ else if (child.get() instanceof core_1.Expressions.Let) {
80
+ continue;
81
+ }
75
82
  else if (child instanceof core_1.Nodes.TokenNode && child.getFirstToken().getStr().toUpperCase() === "DEFAULT") {
76
83
  // note: this is last in the body, so its okay to prepend and postpend
77
84
  const sources = body.findDirectExpressions(core_1.Expressions.Source);
@@ -94,10 +101,10 @@ class ValueBodyTranspiler {
94
101
  }
95
102
  return ret.appendString(post);
96
103
  }
97
- buildForChain(forNodes, typ, traversal, body, baseCode) {
104
+ buildForChain(forNodes, typ, traversal, body, baseCode, outerLetCode) {
98
105
  const val = baseCode ?? new type_name_or_infer_1.TypeNameOrInfer().transpile(typ, traversal).getCode();
99
106
  const chunk = new chunk_1.Chunk();
100
- const preLoopDecls = [];
107
+ const preLoopDecls = outerLetCode === undefined ? [] : [outerLetCode];
101
108
  const descriptors = [];
102
109
  const levelIndents = [];
103
110
  let uniqueCounter = 1;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/transpiler",
3
- "version": "2.13.50",
3
+ "version": "2.13.52",
4
4
  "description": "Transpiler",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/src/index.d.ts",
@@ -11,9 +11,9 @@
11
11
  },
12
12
  "scripts": {
13
13
  "compile": "tsc",
14
- "publish:major": "npm --no-git-tag-version version major && rm -rf build && npm install && npm run test && npm publish --access public",
15
- "publish:minor": "npm --no-git-tag-version version minor && rm -rf build && npm install && npm run test && npm publish --access public",
16
- "publish:patch": "npm --no-git-tag-version version patch && rm -rf build && npm install && npm run test && npm publish --access public",
14
+ "publish:major": "npm --no-git-tag-version version major && rimraf build && npm install && npm run test && npm publish --access public",
15
+ "publish:minor": "npm --no-git-tag-version version minor && rimraf build && npm install && npm run test && npm publish --access public",
16
+ "publish:patch": "npm --no-git-tag-version version patch && rimraf build && npm install && npm run test && npm publish --access public",
17
17
  "test": "npm run compile && mocha"
18
18
  },
19
19
  "mocha": {
@@ -29,14 +29,14 @@
29
29
  "author": "abaplint",
30
30
  "license": "MIT",
31
31
  "dependencies": {
32
- "@abaplint/core": "^2.120.18",
32
+ "@abaplint/core": "^2.120.20",
33
33
  "source-map": "^0.7.6"
34
34
  },
35
35
  "devDependencies": {
36
36
  "@types/chai": "^4.3.20",
37
37
  "@types/mocha": "^10.0.10",
38
38
  "chai": "^4.5.0",
39
- "mocha": "^11.7.6",
39
+ "mocha": "^11.8.0",
40
40
  "source-map-support": "^0.5.21",
41
41
  "typescript": "^6.0.3"
42
42
  }