@abaplint/transpiler 2.2.6 → 2.2.8

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.
@@ -77,6 +77,7 @@ class DatabaseSetup {
77
77
  // statements are inside a javascript string stemplate
78
78
  ret = ret.replace(/\\/g, "\\\\");
79
79
  ret = ret.replace(/`/g, "\\`");
80
+ ret = ret.replace(/\${/g, "\\${");
80
81
  return ret;
81
82
  }
82
83
  }
@@ -44,7 +44,7 @@ class SQLiteDatabaseSchema {
44
44
  previous = j.LTAB + "," + j.RTAB;
45
45
  }
46
46
  from = from.trim();
47
- return `CREATE VIEW ${view.getName().toLowerCase()} AS SELECT ${columns} FROM ${from};\n`;
47
+ return `CREATE VIEW '${view.getName().toLowerCase()}' AS SELECT ${columns} FROM ${from};\n`;
48
48
  }
49
49
  buildTABL(tabl) {
50
50
  const type = tabl.parseType(this.reg);
@@ -58,7 +58,7 @@ class SQLiteDatabaseSchema {
58
58
  // assumption: all transparent tables have primary keys
59
59
  // add single quotes to field names to allow for keywords as field names
60
60
  const key = ", PRIMARY KEY(" + tabl.listKeys().map(e => "'" + e.toLowerCase() + "'").join(",") + ")";
61
- return `CREATE TABLE ${tabl.getName().toLowerCase()} (${fields.join(", ")}${key});\n`;
61
+ return `CREATE TABLE '${tabl.getName().toLowerCase()}' (${fields.join(", ")}${key});\n`;
62
62
  }
63
63
  toType(type, fieldname, errorInfo) {
64
64
  if (type instanceof abaplint.BasicTypes.CharacterType) {
@@ -7,6 +7,7 @@ class TryTranspiler {
7
7
  transpile(node, traversal) {
8
8
  const ret = new chunk_1.Chunk();
9
9
  const catches = node.findDirectStructures(abaplint.Structures.Catch);
10
+ const cleanup = node.findDirectStructures(abaplint.Structures.Cleanup);
10
11
  let catchCode = this.buildCatchCode(catches, traversal);
11
12
  for (const c of node.getChildren()) {
12
13
  if (c.get() instanceof abaplint.Structures.Catch) {
@@ -18,12 +19,20 @@ class TryTranspiler {
18
19
  else if (c.get() instanceof abaplint.Structures.Cleanup) {
19
20
  ret.appendString(`} finally {\n// Transpiler todo: CLEANUP ignored\n`);
20
21
  }
22
+ else if (c.get() instanceof abaplint.Statements.Try
23
+ || c.get() instanceof abaplint.Statements.EndTry) {
24
+ if (catches.length === 0 && cleanup.length === 0) {
25
+ continue;
26
+ }
27
+ ret.appendChunk(traversal.traverse(c));
28
+ }
21
29
  else {
22
30
  ret.appendChunk(traversal.traverse(c));
23
31
  }
24
32
  }
25
33
  return ret;
26
34
  }
35
+ /////////////////////
27
36
  buildCatchCode(nodes, traversal) {
28
37
  let ret = "";
29
38
  let first = true;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/transpiler",
3
- "version": "2.2.6",
3
+ "version": "2.2.8",
4
4
  "description": "Transpiler",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/src/index.d.ts",