@abaplint/transpiler 2.13.49 → 2.13.51

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.
@@ -3,3 +3,4 @@ export interface DatabaseSchemaGenerator {
3
3
  buildVIEW(view: abaplint.Objects.View): string;
4
4
  buildTABL(view: abaplint.Objects.Table): string;
5
5
  }
6
+ export declare function packedTypeToDatabase(type: abaplint.BasicTypes.PackedType): string;
@@ -1,3 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.packedTypeToDatabase = packedTypeToDatabase;
4
+ function packedTypeToDatabase(type) {
5
+ const precision = type.getLength() * 2 - 1;
6
+ return `DECIMAL(${precision},${type.getDecimals()})`;
7
+ }
3
8
  //# sourceMappingURL=database_schema_generator.js.map
@@ -35,6 +35,7 @@ var __importStar = (this && this.__importStar) || (function () {
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.PGDatabaseSchema = void 0;
37
37
  const abaplint = __importStar(require("@abaplint/core"));
38
+ const database_schema_generator_1 = require("./database_schema_generator");
38
39
  const _database_schema_reuse_1 = require("./_database_schema_reuse");
39
40
  const QUOTE = "\"";
40
41
  class PGDatabaseSchema {
@@ -99,7 +100,7 @@ class PGDatabaseSchema {
99
100
  return `REAL`;
100
101
  }
101
102
  else if (type instanceof abaplint.BasicTypes.PackedType) {
102
- return `DECIMAL(${type.getLength()},${type.getDecimals()})`;
103
+ return (0, database_schema_generator_1.packedTypeToDatabase)(type);
103
104
  }
104
105
  else if (type instanceof abaplint.BasicTypes.VoidType) {
105
106
  throw `Type of ${errorInfo}-${fieldname} is VoidType(${type.getVoided()}), make sure the type is known, enable strict syntax checking`;
@@ -35,6 +35,7 @@ var __importStar = (this && this.__importStar) || (function () {
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.SnowflakeDatabaseSchema = void 0;
37
37
  const abaplint = __importStar(require("@abaplint/core"));
38
+ const database_schema_generator_1 = require("./database_schema_generator");
38
39
  class SnowflakeDatabaseSchema {
39
40
  reg;
40
41
  constructor(reg) {
@@ -98,7 +99,7 @@ class SnowflakeDatabaseSchema {
98
99
  return `REAL`;
99
100
  }
100
101
  else if (type instanceof abaplint.BasicTypes.PackedType) {
101
- return `DECIMAL(${type.getLength()},${type.getDecimals()})`;
102
+ return (0, database_schema_generator_1.packedTypeToDatabase)(type);
102
103
  }
103
104
  else if (type instanceof abaplint.BasicTypes.VoidType) {
104
105
  throw `Type of ${errorInfo}-${fieldname} is VoidType(${type.getVoided()}), make sure the type is known, enable strict syntax checking`;
@@ -35,6 +35,7 @@ var __importStar = (this && this.__importStar) || (function () {
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.SQLiteDatabaseSchema = void 0;
37
37
  const abaplint = __importStar(require("@abaplint/core"));
38
+ const database_schema_generator_1 = require("./database_schema_generator");
38
39
  const _database_schema_reuse_1 = require("./_database_schema_reuse");
39
40
  const QUOTE = "'";
40
41
  class SQLiteDatabaseSchema {
@@ -100,7 +101,7 @@ class SQLiteDatabaseSchema {
100
101
  return `REAL`;
101
102
  }
102
103
  else if (type instanceof abaplint.BasicTypes.PackedType) {
103
- return `DECIMAL(${type.getLength()},${type.getDecimals()})`;
104
+ return (0, database_schema_generator_1.packedTypeToDatabase)(type);
104
105
  }
105
106
  else if (type instanceof abaplint.BasicTypes.VoidType) {
106
107
  throw `Type of ${errorInfo}-${fieldname} is VoidType(${type.getVoided()}), make sure the type is known, enable strict syntax checking`;
@@ -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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/transpiler",
3
- "version": "2.13.49",
3
+ "version": "2.13.51",
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
  }