@abaplint/cli 2.101.17 → 2.101.19

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/cli.js +54 -13
  2. package/package.json +3 -3
package/build/cli.js CHANGED
@@ -21632,13 +21632,13 @@ class TypeUtils {
21632
21632
  }
21633
21633
  return false;
21634
21634
  }
21635
- isAssignableStrict(source, target, containsMethodCall = false) {
21636
- var _a, _b, _c, _d, _e, _f;
21635
+ isAssignableStrict(source, target, calculated = false) {
21636
+ var _a, _b, _c, _d, _e, _f, _g;
21637
21637
  /*
21638
21638
  console.dir(source);
21639
21639
  console.dir(target);
21640
21640
  */
21641
- if (containsMethodCall) {
21641
+ if (calculated) {
21642
21642
  return this.isAssignable(source, target);
21643
21643
  }
21644
21644
  if (source instanceof basic_1.CharacterType) {
@@ -21679,12 +21679,18 @@ class TypeUtils {
21679
21679
  if (target instanceof basic_1.StructureType && this.structureContainsString(target)) {
21680
21680
  return false;
21681
21681
  }
21682
- else if (target instanceof basic_1.XSequenceType || target instanceof basic_1.XStringType) {
21682
+ else if (target instanceof basic_1.IntegerType) {
21683
21683
  if (((_f = source.getAbstractTypeData()) === null || _f === void 0 ? void 0 : _f.derivedFromConstant) === true) {
21684
21684
  return true;
21685
21685
  }
21686
21686
  return false;
21687
21687
  }
21688
+ else if (target instanceof basic_1.XSequenceType || target instanceof basic_1.XStringType) {
21689
+ if (((_g = source.getAbstractTypeData()) === null || _g === void 0 ? void 0 : _g.derivedFromConstant) === true) {
21690
+ return true;
21691
+ }
21692
+ return false;
21693
+ }
21688
21694
  return true;
21689
21695
  }
21690
21696
  else if (source instanceof basic_1.StructureType && target instanceof basic_1.StructureType) {
@@ -21705,6 +21711,11 @@ class TypeUtils {
21705
21711
  return false;
21706
21712
  }
21707
21713
  }
21714
+ else if (source instanceof basic_1.FloatType) {
21715
+ if (target instanceof basic_1.IntegerType) {
21716
+ return false;
21717
+ }
21718
+ }
21708
21719
  else if (source instanceof basic_1.XStringType) {
21709
21720
  if (target instanceof basic_1.CLikeType) {
21710
21721
  return false;
@@ -24614,10 +24625,12 @@ class MethodCallParam {
24614
24625
  if (child.get() instanceof Expressions.Source) {
24615
24626
  sourceType = new source_1.Source().runSyntax(child, scope, filename, targetType);
24616
24627
  }
24628
+ const calculated = child.findFirstExpression(Expressions.MethodCallChain) !== undefined
24629
+ || child.findFirstExpression(Expressions.ArithOperator) !== undefined;
24617
24630
  if (sourceType === undefined) {
24618
24631
  throw new Error("No source type determined, method source");
24619
24632
  }
24620
- else if (new _type_utils_1.TypeUtils(scope).isAssignableStrict(sourceType, targetType, child.findFirstExpression(Expressions.MethodCallChain) !== undefined) === false) {
24633
+ else if (new _type_utils_1.TypeUtils(scope).isAssignableStrict(sourceType, targetType, calculated) === false) {
24621
24634
  throw new Error("Method parameter type not compatible");
24622
24635
  }
24623
24636
  }
@@ -25664,19 +25677,24 @@ class Source {
25664
25677
  context = new string_template_1.StringTemplate().runSyntax(first, scope, filename);
25665
25678
  }
25666
25679
  else if (first instanceof nodes_1.ExpressionNode && first.get() instanceof Expressions.Source) {
25667
- context = new Source().runSyntax(first, scope, filename);
25680
+ const found = new Source().runSyntax(first, scope, filename);
25681
+ context = this.infer(context, found);
25668
25682
  }
25669
25683
  else if (first instanceof nodes_1.ExpressionNode && first.get() instanceof Expressions.Constant) {
25670
- context = new constant_1.Constant().runSyntax(first);
25684
+ const found = new constant_1.Constant().runSyntax(first);
25685
+ context = this.infer(context, found);
25671
25686
  }
25672
25687
  else if (first instanceof nodes_1.ExpressionNode && first.get() instanceof Expressions.Dereference) {
25673
25688
  context = new dereference_1.Dereference().runSyntax(context);
25674
- // } else if (first instanceof ExpressionNode && first.get() instanceof Expressions.ArrowOrDash) {
25675
- // console.dir("dash");
25676
25689
  }
25677
25690
  else if (first instanceof nodes_1.ExpressionNode && first.get() instanceof Expressions.ComponentChain) {
25678
25691
  context = new component_chain_1.ComponentChain().runSyntax(context, first, scope, filename);
25679
25692
  }
25693
+ else if (first instanceof nodes_1.ExpressionNode && first.get() instanceof Expressions.ArithOperator) {
25694
+ if (first.concatTokens() === "**") {
25695
+ context = new basic_1.FloatType();
25696
+ }
25697
+ }
25680
25698
  else if (first instanceof nodes_1.ExpressionNode && first.get() instanceof Expressions.AttributeChain) {
25681
25699
  context = new attribute_chain_1.AttributeChain().runSyntax(context, first, scope, filename, type);
25682
25700
  }
@@ -25691,6 +25709,14 @@ class Source {
25691
25709
  return context;
25692
25710
  }
25693
25711
  ////////////////////////////////
25712
+ infer(context, found) {
25713
+ if (context instanceof basic_1.FloatType && found instanceof basic_1.IntegerType) {
25714
+ return context;
25715
+ }
25716
+ else {
25717
+ return found;
25718
+ }
25719
+ }
25694
25720
  addIfInferred(node, scope, filename, inferredType) {
25695
25721
  const basic = new basic_types_1.BasicTypes(filename, scope);
25696
25722
  const typeExpression = node.findFirstExpression(Expressions.TypeNameOrInfer);
@@ -25832,6 +25858,7 @@ exports.SourceFieldSymbol = SourceFieldSymbol;
25832
25858
  Object.defineProperty(exports, "__esModule", ({ value: true }));
25833
25859
  exports.SQLCompare = void 0;
25834
25860
  const Expressions = __webpack_require__(/*! ../../2_statements/expressions */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js");
25861
+ const nodes_1 = __webpack_require__(/*! ../../nodes */ "./node_modules/@abaplint/core/build/src/abap/nodes/index.js");
25835
25862
  const basic_1 = __webpack_require__(/*! ../../types/basic */ "./node_modules/@abaplint/core/build/src/abap/types/basic/index.js");
25836
25863
  const sql_source_1 = __webpack_require__(/*! ./sql_source */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/sql_source.js");
25837
25864
  class SQLCompare {
@@ -25840,7 +25867,12 @@ class SQLCompare {
25840
25867
  let sourceType;
25841
25868
  let token;
25842
25869
  for (const s of node.findAllExpressions(Expressions.SQLSource)) {
25843
- token = s.getFirstToken();
25870
+ for (const child of s.getChildren()) {
25871
+ if (child instanceof nodes_1.ExpressionNode) {
25872
+ token = child.getFirstToken();
25873
+ break;
25874
+ }
25875
+ }
25844
25876
  sourceType = new sql_source_1.SQLSource().runSyntax(s, scope, filename);
25845
25877
  }
25846
25878
  const fieldName = (_a = node.findDirectExpression(Expressions.SQLFieldName)) === null || _a === void 0 ? void 0 : _a.concatTokens();
@@ -29303,7 +29335,6 @@ const dynamic_1 = __webpack_require__(/*! ../expressions/dynamic */ "./node_modu
29303
29335
  const loop_group_by_1 = __webpack_require__(/*! ../expressions/loop_group_by */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/loop_group_by.js");
29304
29336
  class Loop {
29305
29337
  runSyntax(node, scope, filename) {
29306
- var _a;
29307
29338
  const loopTarget = node.findDirectExpression(Expressions.LoopTarget);
29308
29339
  let target = loopTarget === null || loopTarget === void 0 ? void 0 : loopTarget.findDirectExpression(Expressions.Target);
29309
29340
  const targetType = target ? new target_1.Target().runSyntax(target, scope, filename) : undefined;
@@ -29337,14 +29368,24 @@ class Loop {
29337
29368
  && concat.startsWith("LOOP AT GROUP ") === false) {
29338
29369
  throw new Error("Loop, not a table type");
29339
29370
  }
29371
+ else if (loopTarget === undefined
29372
+ && sourceType instanceof basic_1.TableType
29373
+ && sourceType.isWithHeader() === false) {
29374
+ throw new Error("Loop, no header");
29375
+ }
29376
+ const targetConcat = loopTarget === null || loopTarget === void 0 ? void 0 : loopTarget.concatTokens().toUpperCase();
29340
29377
  if (sourceType instanceof basic_1.TableType) {
29341
- const targetConcat = (_a = node.findDirectExpression(Expressions.LoopTarget)) === null || _a === void 0 ? void 0 : _a.concatTokens().toUpperCase();
29342
29378
  rowType = sourceType.getRowType();
29343
29379
  sourceType = rowType;
29344
29380
  if (targetConcat === null || targetConcat === void 0 ? void 0 : targetConcat.startsWith("REFERENCE INTO ")) {
29345
29381
  sourceType = new basic_1.DataReference(sourceType);
29346
29382
  }
29347
29383
  }
29384
+ if (targetConcat
29385
+ && targetConcat.startsWith("TRANSPORTING ")
29386
+ && node.findDirectTokenByText("WHERE") === undefined) {
29387
+ throw new Error("Loop, TRANSPORTING NO FIELDS only with WHERE");
29388
+ }
29348
29389
  const inline = target === null || target === void 0 ? void 0 : target.findDirectExpression(Expressions.InlineData);
29349
29390
  if (inline) {
29350
29391
  new inline_data_1.InlineData().runSyntax(inline, scope, filename, sourceType);
@@ -48412,7 +48453,7 @@ class Registry {
48412
48453
  }
48413
48454
  static abaplintVersion() {
48414
48455
  // magic, see build script "version.sh"
48415
- return "2.101.17";
48456
+ return "2.101.19";
48416
48457
  }
48417
48458
  getDDICReferences() {
48418
48459
  return this.ddicReferences;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/cli",
3
- "version": "2.101.17",
3
+ "version": "2.101.19",
4
4
  "description": "abaplint - Command Line Interface",
5
5
  "funding": "https://github.com/sponsors/larshp",
6
6
  "bin": {
@@ -38,12 +38,12 @@
38
38
  },
39
39
  "homepage": "https://abaplint.org",
40
40
  "devDependencies": {
41
- "@abaplint/core": "^2.101.17",
41
+ "@abaplint/core": "^2.101.19",
42
42
  "@types/chai": "^4.3.5",
43
43
  "@types/glob": "^7.2.0",
44
44
  "@types/minimist": "^1.2.2",
45
45
  "@types/mocha": "^10.0.1",
46
- "@types/node": "^20.2.6",
46
+ "@types/node": "^20.3.1",
47
47
  "@types/progress": "^2.0.5",
48
48
  "chai": "^4.3.7",
49
49
  "chalk": "^5.2.0",