@abaplint/cli 2.120.101 → 2.120.102

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 +45 -3
  2. package/package.json +2 -2
package/build/cli.js CHANGED
@@ -30779,10 +30779,15 @@ const _syntax_input_1 = __webpack_require__(/*! ../_syntax_input */ "../core/bui
30779
30779
  // a syntax error. Other types, a dynamic offset or length and "*" (undefined) are left alone, as is
30780
30780
  // length 0. The offset is applied first, so the length is compared to what remains after the offset.
30781
30781
  // A substring of a date, time or numeric text field has type n; its bounds are not checked.
30782
- // An offset or length on a numeric field (i, int8, p, f, decfloat) is a syntax error, whatever its value.
30782
+ // An offset or length on a numeric field (i, int8, p, f, decfloat) is a syntax error, whatever its value,
30783
+ // except a length without offset covering the full packed field, eg. "lv_p(5)" for "lv_p(5) TYPE p".
30783
30784
  function substringType(context, offset, length, node, input) {
30784
30785
  const numericName = numericTypeName(context);
30785
- if (numericName !== undefined) {
30786
+ if (context instanceof basic_1.PackedType && offset === undefined && length === context.getLength()) {
30787
+ // the offset is checked in a separate call before the length, so this is a length without offset
30788
+ return context;
30789
+ }
30790
+ else if (numericName !== undefined) {
30786
30791
  const message = `Offset or length specification not possible on a field of numeric type "${numericName}"`;
30787
30792
  input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
30788
30793
  return basic_1.VoidType.get(_syntax_input_1.CheckSyntaxKey);
@@ -44533,6 +44538,7 @@ var __importStar = (this && this.__importStar) || (function () {
44533
44538
  Object.defineProperty(exports, "__esModule", ({ value: true }));
44534
44539
  exports.Loop = void 0;
44535
44540
  const Expressions = __importStar(__webpack_require__(/*! ../../2_statements/expressions */ "../core/build/src/abap/2_statements/expressions/index.js"));
44541
+ const nodes_1 = __webpack_require__(/*! ../../nodes */ "../core/build/src/abap/nodes/index.js");
44536
44542
  const basic_1 = __webpack_require__(/*! ../../types/basic */ "../core/build/src/abap/types/basic/index.js");
44537
44543
  const target_1 = __webpack_require__(/*! ../expressions/target */ "../core/build/src/abap/5_syntax/expressions/target.js");
44538
44544
  const source_1 = __webpack_require__(/*! ../expressions/source */ "../core/build/src/abap/5_syntax/expressions/source.js");
@@ -44644,6 +44650,17 @@ class Loop {
44644
44650
  input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
44645
44651
  return;
44646
44652
  }
44653
+ if (key.type === basic_1.TableAccessType.sorted && key.keyFields.length > 0) {
44654
+ // the first component of a sorted secondary key must be compared with = or IS INITIAL
44655
+ // in a part of the condition joined by AND, otherwise the WHERE cannot be optimized
44656
+ const first = key.keyFields[0].toUpperCase();
44657
+ if (this.hasKeyCompare(cond, first) === false) {
44658
+ const message = "Loop, WHERE cannot be optimized for secondary key " + name +
44659
+ ", key component " + first + " needs a comparison with = or IS INITIAL joined by AND";
44660
+ input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
44661
+ return;
44662
+ }
44663
+ }
44647
44664
  if (!(0, version_1.releaseAtLeast)(input.scope.getRelease(), version_1.Release.v740sp02)) {
44648
44665
  const compares = cond.findAllExpressionsRecursive(Expressions.ComponentCompare).map(c => c.concatTokens().toUpperCase());
44649
44666
  for (const keyField of key.keyFields) {
@@ -44684,6 +44701,31 @@ class Loop {
44684
44701
  loop_group_by_1.LoopGroupBy.runSyntax(group, input);
44685
44702
  }
44686
44703
  }
44704
+ // true if a conjunct reachable through AND only, ie. not under OR or NOT, compares the component with = or IS INITIAL
44705
+ hasKeyCompare(cond, component) {
44706
+ if (cond.findDirectTokenByText("OR") !== undefined) {
44707
+ return false;
44708
+ }
44709
+ for (const child of cond.getChildren()) {
44710
+ if (child.get() instanceof Expressions.ComponentCompare && child instanceof nodes_1.ExpressionNode) {
44711
+ const concat = child.concatTokens().toUpperCase().replace(/\s+/g, " ");
44712
+ if (concat.startsWith(component + " = ")
44713
+ || concat.startsWith(component + " EQ ")
44714
+ || concat === component + " IS INITIAL") {
44715
+ return true;
44716
+ }
44717
+ }
44718
+ else if (child.get() instanceof Expressions.ComponentCondSub
44719
+ && child instanceof nodes_1.ExpressionNode
44720
+ && child.findDirectTokenByText("NOT") === undefined) {
44721
+ const sub = child.findDirectExpression(Expressions.ComponentCond);
44722
+ if (sub !== undefined && this.hasKeyCompare(sub, component)) {
44723
+ return true;
44724
+ }
44725
+ }
44726
+ }
44727
+ return false;
44728
+ }
44687
44729
  }
44688
44730
  exports.Loop = Loop;
44689
44731
  //# sourceMappingURL=loop.js.map
@@ -73556,7 +73598,7 @@ class Registry {
73556
73598
  }
73557
73599
  static abaplintVersion() {
73558
73600
  // magic, see build script "version.js"
73559
- return "2.120.101";
73601
+ return "2.120.102";
73560
73602
  }
73561
73603
  getDDICReferences() {
73562
73604
  return this.ddicReferences;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/cli",
3
- "version": "2.120.101",
3
+ "version": "2.120.102",
4
4
  "description": "abaplint - Command Line Interface",
5
5
  "funding": "https://github.com/sponsors/larshp",
6
6
  "bin": {
@@ -39,7 +39,7 @@
39
39
  },
40
40
  "homepage": "https://abaplint.org",
41
41
  "devDependencies": {
42
- "@abaplint/core": "^2.120.101",
42
+ "@abaplint/core": "^2.120.102",
43
43
  "@types/chai": "^4.3.20",
44
44
  "@types/minimist": "^1.2.5",
45
45
  "@types/mocha": "^10.0.10",