@abaplint/core 2.102.30 → 2.102.32

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.
@@ -4,6 +4,7 @@ exports.TypeUtils = void 0;
4
4
  const types_1 = require("../types");
5
5
  const basic_1 = require("../types/basic");
6
6
  const cgeneric_type_1 = require("../types/basic/cgeneric_type");
7
+ // todo: refactor to static? for performance
7
8
  class TypeUtils {
8
9
  constructor(scope) {
9
10
  this.scope = scope;
@@ -210,7 +211,7 @@ class TypeUtils {
210
211
  return false;
211
212
  }
212
213
  isAssignableStrict(source, target, calculated = false) {
213
- var _a, _b, _c, _d, _e, _f, _g;
214
+ var _a, _b, _c, _d, _e, _f, _g, _h;
214
215
  /*
215
216
  console.dir(source);
216
217
  console.dir(target);
@@ -298,6 +299,17 @@ class TypeUtils {
298
299
  return false;
299
300
  }
300
301
  }
302
+ else if (source instanceof basic_1.IntegerType) {
303
+ if (target instanceof basic_1.StringType) {
304
+ return false;
305
+ }
306
+ else if (target instanceof basic_1.Integer8Type) {
307
+ if (((_h = source.getAbstractTypeData()) === null || _h === void 0 ? void 0 : _h.derivedFromConstant) === true) {
308
+ return true;
309
+ }
310
+ return false;
311
+ }
312
+ }
301
313
  else if (source instanceof basic_1.FloatType) {
302
314
  if (target instanceof basic_1.IntegerType) {
303
315
  return false;
@@ -7,7 +7,7 @@ class Constant {
7
7
  runSyntax(node) {
8
8
  // todo: ConcatenatedConstant is not used?
9
9
  if (node.findDirectExpression(expressions_1.Integer)) {
10
- return basic_1.IntegerType.get();
10
+ return basic_1.IntegerType.get({ derivedFromConstant: true });
11
11
  }
12
12
  else if (node.getFirstToken().getStr().startsWith("'")) {
13
13
  let len = node.getFirstToken().getStr().length - 2;
@@ -8,6 +8,7 @@ const target_1 = require("../expressions/target");
8
8
  const fstarget_1 = require("../expressions/fstarget");
9
9
  const basic_1 = require("../../types/basic");
10
10
  const inline_data_1 = require("../expressions/inline_data");
11
+ const _type_utils_1 = require("../_type_utils");
11
12
  class InsertInternal {
12
13
  runSyntax(node, scope, filename) {
13
14
  let targetType;
@@ -15,7 +16,7 @@ class InsertInternal {
15
16
  if (t) {
16
17
  targetType = new target_1.Target().runSyntax(t, scope, filename);
17
18
  }
18
- if (targetType instanceof basic_1.TableType) {
19
+ if (targetType instanceof basic_1.TableType && node.findDirectTokenByText("LINES") === undefined) {
19
20
  targetType = targetType.getRowType();
20
21
  }
21
22
  let source = node.findDirectExpression(Expressions.SimpleSource4);
@@ -33,6 +34,9 @@ class InsertInternal {
33
34
  new fstarget_1.FSTarget().runSyntax(afterAssigning, scope, filename, sourceType);
34
35
  }
35
36
  }
37
+ if (new _type_utils_1.TypeUtils(scope).isAssignableStrict(sourceType, targetType) === false) {
38
+ throw new Error("Types not compatible");
39
+ }
36
40
  const afterInto = node.findExpressionAfterToken("INTO");
37
41
  if ((afterInto === null || afterInto === void 0 ? void 0 : afterInto.get()) instanceof Expressions.Target && sourceType) {
38
42
  const inline = afterInto.findDirectExpression(Expressions.InlineData);
@@ -65,7 +65,7 @@ class Registry {
65
65
  }
66
66
  static abaplintVersion() {
67
67
  // magic, see build script "version.sh"
68
- return "2.102.30";
68
+ return "2.102.32";
69
69
  }
70
70
  getDDICReferences() {
71
71
  return this.ddicReferences;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/core",
3
- "version": "2.102.30",
3
+ "version": "2.102.32",
4
4
  "description": "abaplint - Core API",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/abaplint.d.ts",