@abaplint/transpiler-cli 2.7.83 → 2.7.84

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.
Files changed (2) hide show
  1. package/build/bundle.js +36 -10
  2. package/package.json +3 -3
package/build/bundle.js CHANGED
@@ -8667,7 +8667,7 @@ class CallFunction {
8667
8667
  const update = (0, combi_1.verNot)(version_1.Version.Cloud, (0, combi_1.str)("IN UPDATE TASK"));
8668
8668
  const unit = (0, combi_1.seq)("UNIT", expressions_1.Source);
8669
8669
  const background = (0, combi_1.verNot)(version_1.Version.Cloud, (0, combi_1.seq)("IN BACKGROUND", (0, combi_1.altPrio)("TASK", unit)));
8670
- const calling = (0, combi_1.seq)("CALLING", expressions_1.MethodName, "ON END OF TASK");
8670
+ const calling = (0, combi_1.seq)("CALLING", expressions_1.MethodSource, "ON END OF TASK");
8671
8671
  const performing = (0, combi_1.seq)("PERFORMING", expressions_1.FormName, "ON END OF TASK");
8672
8672
  const separate = (0, combi_1.str)("AS SEPARATE UNIT");
8673
8673
  const keeping = (0, combi_1.str)("KEEPING LOGICAL UNIT OF WORK");
@@ -19570,6 +19570,9 @@ class CurrentScope {
19570
19570
  if (this.current.getData().types[upper] !== undefined) {
19571
19571
  throw new Error(`Type name "${name}" already defined`);
19572
19572
  }
19573
+ else if (this.isOO() && this.current.getData().vars[upper] !== undefined) {
19574
+ throw new Error(`"${name}" already defined`);
19575
+ }
19573
19576
  this.current.getData().types[upper] = type;
19574
19577
  }
19575
19578
  addExtraLikeType(type) {
@@ -19619,6 +19622,9 @@ class CurrentScope {
19619
19622
  if (this.current.getData().vars[upper] !== undefined) {
19620
19623
  throw new Error(`Variable name "${name}" already defined`);
19621
19624
  }
19625
+ else if (this.isOO() && this.current.getData().types[upper] !== undefined) {
19626
+ throw new Error(`"${name}" already defined`);
19627
+ }
19622
19628
  this.current.getData().vars[upper] = identifier;
19623
19629
  }
19624
19630
  addIdentifier(identifier) {
@@ -19885,7 +19891,7 @@ class CurrentScope {
19885
19891
  while (curr !== undefined) {
19886
19892
  const stype = curr.getIdentifier().stype;
19887
19893
  if (stype === _scope_type_1.ScopeType.ClassDefinition
19888
- || stype === _scope_type_1.ScopeType.ClassImplementation
19894
+ // || stype === ScopeType.ClassImplementation
19889
19895
  || stype === _scope_type_1.ScopeType.Interface) {
19890
19896
  return true;
19891
19897
  }
@@ -20529,6 +20535,7 @@ exports.TypeUtils = void 0;
20529
20535
  const types_1 = __webpack_require__(/*! ../types */ "./node_modules/@abaplint/core/build/src/abap/types/index.js");
20530
20536
  const basic_1 = __webpack_require__(/*! ../types/basic */ "./node_modules/@abaplint/core/build/src/abap/types/basic/index.js");
20531
20537
  const cgeneric_type_1 = __webpack_require__(/*! ../types/basic/cgeneric_type */ "./node_modules/@abaplint/core/build/src/abap/types/basic/cgeneric_type.js");
20538
+ // todo: refactor to static? for performance
20532
20539
  class TypeUtils {
20533
20540
  constructor(scope) {
20534
20541
  this.scope = scope;
@@ -20735,7 +20742,7 @@ class TypeUtils {
20735
20742
  return false;
20736
20743
  }
20737
20744
  isAssignableStrict(source, target, calculated = false) {
20738
- var _a, _b, _c, _d, _e, _f, _g;
20745
+ var _a, _b, _c, _d, _e, _f, _g, _h;
20739
20746
  /*
20740
20747
  console.dir(source);
20741
20748
  console.dir(target);
@@ -20823,6 +20830,17 @@ class TypeUtils {
20823
20830
  return false;
20824
20831
  }
20825
20832
  }
20833
+ else if (source instanceof basic_1.IntegerType) {
20834
+ if (target instanceof basic_1.StringType) {
20835
+ return false;
20836
+ }
20837
+ else if (target instanceof basic_1.Integer8Type) {
20838
+ if (((_h = source.getAbstractTypeData()) === null || _h === void 0 ? void 0 : _h.derivedFromConstant) === true) {
20839
+ return true;
20840
+ }
20841
+ return false;
20842
+ }
20843
+ }
20826
20844
  else if (source instanceof basic_1.FloatType) {
20827
20845
  if (target instanceof basic_1.IntegerType) {
20828
20846
  return false;
@@ -22478,7 +22496,7 @@ class Constant {
22478
22496
  runSyntax(node) {
22479
22497
  // todo: ConcatenatedConstant is not used?
22480
22498
  if (node.findDirectExpression(expressions_1.Integer)) {
22481
- return basic_1.IntegerType.get();
22499
+ return basic_1.IntegerType.get({ derivedFromConstant: true });
22482
22500
  }
22483
22501
  else if (node.getFirstToken().getStr().startsWith("'")) {
22484
22502
  let len = node.getFirstToken().getStr().length - 2;
@@ -28369,6 +28387,7 @@ const target_1 = __webpack_require__(/*! ../expressions/target */ "./node_module
28369
28387
  const fstarget_1 = __webpack_require__(/*! ../expressions/fstarget */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/fstarget.js");
28370
28388
  const basic_1 = __webpack_require__(/*! ../../types/basic */ "./node_modules/@abaplint/core/build/src/abap/types/basic/index.js");
28371
28389
  const inline_data_1 = __webpack_require__(/*! ../expressions/inline_data */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/inline_data.js");
28390
+ const _type_utils_1 = __webpack_require__(/*! ../_type_utils */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_type_utils.js");
28372
28391
  class InsertInternal {
28373
28392
  runSyntax(node, scope, filename) {
28374
28393
  let targetType;
@@ -28376,7 +28395,7 @@ class InsertInternal {
28376
28395
  if (t) {
28377
28396
  targetType = new target_1.Target().runSyntax(t, scope, filename);
28378
28397
  }
28379
- if (targetType instanceof basic_1.TableType) {
28398
+ if (targetType instanceof basic_1.TableType && node.findDirectTokenByText("LINES") === undefined) {
28380
28399
  targetType = targetType.getRowType();
28381
28400
  }
28382
28401
  let source = node.findDirectExpression(Expressions.SimpleSource4);
@@ -28394,6 +28413,9 @@ class InsertInternal {
28394
28413
  new fstarget_1.FSTarget().runSyntax(afterAssigning, scope, filename, sourceType);
28395
28414
  }
28396
28415
  }
28416
+ if (new _type_utils_1.TypeUtils(scope).isAssignableStrict(sourceType, targetType) === false) {
28417
+ throw new Error("Types not compatible");
28418
+ }
28397
28419
  const afterInto = node.findExpressionAfterToken("INTO");
28398
28420
  if ((afterInto === null || afterInto === void 0 ? void 0 : afterInto.get()) instanceof Expressions.Target && sourceType) {
28399
28421
  const inline = afterInto.findDirectExpression(Expressions.InlineData);
@@ -47797,7 +47819,7 @@ class Registry {
47797
47819
  }
47798
47820
  static abaplintVersion() {
47799
47821
  // magic, see build script "version.sh"
47800
- return "2.102.29";
47822
+ return "2.102.32";
47801
47823
  }
47802
47824
  getDDICReferences() {
47803
47825
  return this.ddicReferences;
@@ -70644,7 +70666,14 @@ class ConstantTranspiler {
70644
70666
  const int = node.findFirstExpression(core_1.Expressions.Integer);
70645
70667
  if (int) {
70646
70668
  const concat = int.concatTokens().trim();
70647
- let code = `new abap.types.Integer().set(${concat})`;
70669
+ const parsed = Number.parseInt(concat, 10);
70670
+ let code = "";
70671
+ if (parsed > 2147483647 || parsed < -2147483648) {
70672
+ code = `new abap.types.Integer8().set(${concat})`;
70673
+ }
70674
+ else {
70675
+ code = `new abap.types.Integer().set(${concat})`;
70676
+ }
70648
70677
  if (this.addGet === true) {
70649
70678
  code += ".get()";
70650
70679
  }
@@ -77483,7 +77512,6 @@ class PerformTranspiler {
77483
77512
  const params = [];
77484
77513
  let index = 0;
77485
77514
  for (const t of ((_a = node.findDirectExpression(abaplint.Expressions.PerformTables)) === null || _a === void 0 ? void 0 : _a.findDirectExpressions(abaplint.Expressions.Source)) || []) {
77486
- console.dir(t);
77487
77515
  const name = def === null || def === void 0 ? void 0 : def.getTablesParameters()[index].getName().toLowerCase();
77488
77516
  if (name === undefined) {
77489
77517
  continue;
@@ -77493,7 +77521,6 @@ class PerformTranspiler {
77493
77521
  }
77494
77522
  index = 0;
77495
77523
  for (const u of ((_b = node.findDirectExpression(abaplint.Expressions.PerformUsing)) === null || _b === void 0 ? void 0 : _b.findDirectExpressions(abaplint.Expressions.Source)) || []) {
77496
- console.dir(u);
77497
77524
  const name = def === null || def === void 0 ? void 0 : def.getUsingParameters()[index].getName().toLowerCase();
77498
77525
  if (name === undefined) {
77499
77526
  continue;
@@ -77503,7 +77530,6 @@ class PerformTranspiler {
77503
77530
  }
77504
77531
  index = 0;
77505
77532
  for (const c of ((_c = node.findDirectExpression(abaplint.Expressions.PerformChanging)) === null || _c === void 0 ? void 0 : _c.findDirectExpressions(abaplint.Expressions.Source)) || []) {
77506
- console.dir(c);
77507
77533
  const name = def === null || def === void 0 ? void 0 : def.getChangingParameters()[index].getName().toLowerCase();
77508
77534
  if (name === undefined) {
77509
77535
  continue;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/transpiler-cli",
3
- "version": "2.7.83",
3
+ "version": "2.7.84",
4
4
  "description": "Transpiler - Command Line Interface",
5
5
  "funding": "https://github.com/sponsors/larshp",
6
6
  "bin": {
@@ -26,12 +26,12 @@
26
26
  "author": "abaplint",
27
27
  "license": "MIT",
28
28
  "devDependencies": {
29
- "@abaplint/transpiler": "^2.7.83",
29
+ "@abaplint/transpiler": "^2.7.84",
30
30
  "@types/glob": "^7.2.0",
31
31
  "glob": "=7.2.0",
32
32
  "@types/progress": "^2.0.5",
33
33
  "@types/node": "^20.5.7",
34
- "@abaplint/core": "^2.102.29",
34
+ "@abaplint/core": "^2.102.32",
35
35
  "progress": "^2.0.3",
36
36
  "webpack": "^5.88.2",
37
37
  "webpack-cli": "^5.1.4",