@abaplint/transpiler 2.10.56 → 2.10.58

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.
@@ -22,14 +22,6 @@ class Chunk {
22
22
  this.appendString(str);
23
23
  }
24
24
  }
25
- /*
26
- public copy(): Chunk {
27
- const ret = new Chunk();
28
- ret.raw = this.raw;
29
- ret.mappings = [...this.mappings];
30
- return ret;
31
- }
32
- */
33
25
  join(chunks, str = ", ") {
34
26
  for (let i = 0; i < chunks.length; i++) {
35
27
  this.appendChunk(chunks[i]);
@@ -7,8 +7,16 @@ class ClearTranspiler {
7
7
  transpile(node, traversal) {
8
8
  const target = traversal.traverse(node.findDirectExpression(abaplint.Expressions.Target));
9
9
  const ret = new chunk_1.Chunk();
10
+ /*
10
11
  ret.appendChunk(target);
11
- ret.append(".clear();", node.getLastToken(), traversal);
12
+ ret.append(".clear();", node.getLastToken().getEnd(), traversal);
13
+ */
14
+ ret.append(target.getCode() + ".clear();", node.getLastToken().getEnd(), traversal);
15
+ // ret.append(target.getCode() + ".clear();", node, traversal);
16
+ /*
17
+ ret.append(target.getCode(), node.getFirstToken().getStart(), traversal);
18
+ ret.append(".clear();", node.getLastToken().getEnd(), traversal);
19
+ */
12
20
  return ret;
13
21
  }
14
22
  }
@@ -40,9 +40,15 @@ class MessageTranspiler {
40
40
  }
41
41
  }
42
42
  else {
43
- // exception based
43
+ // exception or constant based
44
44
  const exception = node.findDirectExpression(abaplint.Expressions.SimpleSource3);
45
- options.push("exception: " + traversal.traverse(exception).getCode());
45
+ const str = exception?.findFirstExpression(abaplint.Expressions.Constant);
46
+ if (str) {
47
+ options.push("text: " + traversal.traverse(str).getCode());
48
+ }
49
+ else {
50
+ options.push("exception: " + traversal.traverse(exception).getCode());
51
+ }
46
52
  const type = node.findExpressionAfterToken("TYPE");
47
53
  if (type) {
48
54
  options.push("type: " + traversal.traverse(type).getCode());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/transpiler",
3
- "version": "2.10.56",
3
+ "version": "2.10.58",
4
4
  "description": "Transpiler",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/src/index.d.ts",
@@ -29,14 +29,14 @@
29
29
  "author": "abaplint",
30
30
  "license": "MIT",
31
31
  "dependencies": {
32
- "@abaplint/core": "^2.113.121",
32
+ "@abaplint/core": "^2.113.125",
33
33
  "source-map": "^0.7.4"
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.4.0",
39
+ "mocha": "^11.5.0",
40
40
  "source-map-support": "^0.5.21",
41
41
  "typescript": "^5.8.3"
42
42
  }