@abaplint/transpiler 2.1.18 → 2.1.21

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.
@@ -24,10 +24,11 @@ class SQLiteDatabaseSchema {
24
24
  }
25
25
  const fields = [];
26
26
  for (const field of type.getComponents()) {
27
- fields.push(field.name.toLowerCase() + " " + this.toType(field.type, field.name, tabl.getName()));
27
+ fields.push("'" + field.name.toLowerCase() + "' " + this.toType(field.type, field.name, tabl.getName()));
28
28
  }
29
29
  // assumption: all transparent tables have primary keys
30
- const key = ", PRIMARY KEY(" + tabl.listKeys().map(e => e.toLowerCase()).join(",") + ")";
30
+ // add single quotes to field names to allow for keywords as field names
31
+ const key = ", PRIMARY KEY(" + tabl.listKeys().map(e => "'" + e.toLowerCase() + "'").join(",") + ")";
31
32
  return `CREATE TABLE ${tabl.getName().toLowerCase()} (${fields.join(", ")}${key});\n`;
32
33
  }
33
34
  toType(type, fieldname, table) {
@@ -57,6 +58,10 @@ class SQLiteDatabaseSchema {
57
58
  else if (type instanceof abaplint.BasicTypes.IntegerType) {
58
59
  return `INT`;
59
60
  }
61
+ else if (type instanceof abaplint.BasicTypes.FloatType
62
+ || type instanceof abaplint.BasicTypes.FloatingPointType) {
63
+ return `REAL`;
64
+ }
60
65
  else if (type instanceof abaplint.BasicTypes.PackedType) {
61
66
  return `DECIMAL(${type.getLength()},${type.getDecimals()})`;
62
67
  }
@@ -8,7 +8,7 @@ class TranspileTypes {
8
8
  return "let " + t.getName().toLowerCase() + " = " + this.toType(type) + ";";
9
9
  }
10
10
  toType(type) {
11
- var _a;
11
+ var _a, _b, _c, _d, _e, _f, _g;
12
12
  let resolved = "";
13
13
  let extra = "";
14
14
  if (type instanceof abaplint.BasicTypes.ObjectReferenceType
@@ -25,18 +25,33 @@ class TranspileTypes {
25
25
  }
26
26
  else if (type instanceof abaplint.BasicTypes.IntegerType) {
27
27
  resolved = "Integer";
28
+ if (type.getQualifiedName() !== undefined) {
29
+ extra = "{qualifiedName: \"" + ((_b = type.getQualifiedName()) === null || _b === void 0 ? void 0 : _b.toUpperCase()) + "\"}";
30
+ }
28
31
  }
29
32
  else if (type instanceof abaplint.BasicTypes.StringType) {
30
33
  resolved = "String";
34
+ if (type.getQualifiedName() !== undefined) {
35
+ extra = "{qualifiedName: \"" + ((_c = type.getQualifiedName()) === null || _c === void 0 ? void 0 : _c.toUpperCase()) + "\"}";
36
+ }
31
37
  }
32
38
  else if (type instanceof abaplint.BasicTypes.UTCLongType) {
33
39
  resolved = "UTCLong";
40
+ if (type.getQualifiedName() !== undefined) {
41
+ extra = "{qualifiedName: \"" + ((_d = type.getQualifiedName()) === null || _d === void 0 ? void 0 : _d.toUpperCase()) + "\"}";
42
+ }
34
43
  }
35
44
  else if (type instanceof abaplint.BasicTypes.DateType) {
36
45
  resolved = "Date";
46
+ if (type.getQualifiedName() !== undefined) {
47
+ extra = "{qualifiedName: \"" + ((_e = type.getQualifiedName()) === null || _e === void 0 ? void 0 : _e.toUpperCase()) + "\"}";
48
+ }
37
49
  }
38
50
  else if (type instanceof abaplint.BasicTypes.TimeType) {
39
51
  resolved = "Time";
52
+ if (type.getQualifiedName() !== undefined) {
53
+ extra = "{qualifiedName: \"" + ((_f = type.getQualifiedName()) === null || _f === void 0 ? void 0 : _f.toUpperCase()) + "\"}";
54
+ }
40
55
  }
41
56
  else if (type instanceof abaplint.BasicTypes.DataReference) {
42
57
  resolved = "DataReference";
@@ -97,6 +112,9 @@ class TranspileTypes {
97
112
  }
98
113
  else if (type instanceof abaplint.BasicTypes.XStringType) {
99
114
  resolved = "XString";
115
+ if (type.getQualifiedName() !== undefined) {
116
+ extra = "{qualifiedName: \"" + ((_g = type.getQualifiedName()) === null || _g === void 0 ? void 0 : _g.toUpperCase()) + "\"}";
117
+ }
100
118
  }
101
119
  else if (type instanceof abaplint.BasicTypes.XSequenceType) {
102
120
  // if not supplied itsa a Hex(1)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/transpiler",
3
- "version": "2.1.18",
3
+ "version": "2.1.21",
4
4
  "description": "Transpiler",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/src/index.d.ts",
@@ -28,7 +28,7 @@
28
28
  "author": "abaplint",
29
29
  "license": "MIT",
30
30
  "dependencies": {
31
- "@abaplint/core": "^2.91.19",
31
+ "@abaplint/core": "^2.91.21",
32
32
  "source-map": "^0.7.4"
33
33
  },
34
34
  "devDependencies": {