@abaplint/cli 2.120.101 → 2.120.103

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 +58 -13
  2. package/package.json +2 -2
package/build/cli.js CHANGED
@@ -28178,16 +28178,19 @@ class SortedKeyWrite {
28178
28178
  if (this.procedure === undefined) {
28179
28179
  return;
28180
28180
  }
28181
- // any assignment of a field symbol or reference ends its binding
28182
- for (const fs of node.findAllExpressions(Expressions.FSTarget)) {
28183
- this.unbind(fs.findFirstExpression(Expressions.TargetFieldSymbol), input.scope);
28184
- }
28185
- if (node.get() instanceof Statements.Unassign) {
28186
- this.unbind(node.findDirectExpression(Expressions.TargetFieldSymbol), input.scope);
28187
- }
28188
- for (const target of node.findAllExpressions(Expressions.Target)) {
28189
- if (target.getChildren().length === 1) {
28190
- this.unbind(target.findDirectExpression(Expressions.TargetField), input.scope);
28181
+ // any assignment of a field symbol or reference ends its binding,
28182
+ // skipped when nothing is bound, this runs for every statement
28183
+ if (this.bindings.size > 0) {
28184
+ for (const fs of node.findAllExpressions(Expressions.FSTarget)) {
28185
+ this.unbind(fs.findFirstExpression(Expressions.TargetFieldSymbol), input.scope);
28186
+ }
28187
+ if (node.get() instanceof Statements.Unassign) {
28188
+ this.unbind(node.findDirectExpression(Expressions.TargetFieldSymbol), input.scope);
28189
+ }
28190
+ for (const target of node.findAllExpressions(Expressions.Target)) {
28191
+ if (target.getChildren().length === 1) {
28192
+ this.unbind(target.findDirectExpression(Expressions.TargetField), input.scope);
28193
+ }
28191
28194
  }
28192
28195
  }
28193
28196
  const s = node.get();
@@ -30779,10 +30782,15 @@ const _syntax_input_1 = __webpack_require__(/*! ../_syntax_input */ "../core/bui
30779
30782
  // a syntax error. Other types, a dynamic offset or length and "*" (undefined) are left alone, as is
30780
30783
  // length 0. The offset is applied first, so the length is compared to what remains after the offset.
30781
30784
  // 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.
30785
+ // An offset or length on a numeric field (i, int8, p, f, decfloat) is a syntax error, whatever its value,
30786
+ // except a length without offset covering the full packed field, eg. "lv_p(5)" for "lv_p(5) TYPE p".
30783
30787
  function substringType(context, offset, length, node, input) {
30784
30788
  const numericName = numericTypeName(context);
30785
- if (numericName !== undefined) {
30789
+ if (context instanceof basic_1.PackedType && offset === undefined && length === context.getLength()) {
30790
+ // the offset is checked in a separate call before the length, so this is a length without offset
30791
+ return context;
30792
+ }
30793
+ else if (numericName !== undefined) {
30786
30794
  const message = `Offset or length specification not possible on a field of numeric type "${numericName}"`;
30787
30795
  input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
30788
30796
  return basic_1.VoidType.get(_syntax_input_1.CheckSyntaxKey);
@@ -44533,6 +44541,7 @@ var __importStar = (this && this.__importStar) || (function () {
44533
44541
  Object.defineProperty(exports, "__esModule", ({ value: true }));
44534
44542
  exports.Loop = void 0;
44535
44543
  const Expressions = __importStar(__webpack_require__(/*! ../../2_statements/expressions */ "../core/build/src/abap/2_statements/expressions/index.js"));
44544
+ const nodes_1 = __webpack_require__(/*! ../../nodes */ "../core/build/src/abap/nodes/index.js");
44536
44545
  const basic_1 = __webpack_require__(/*! ../../types/basic */ "../core/build/src/abap/types/basic/index.js");
44537
44546
  const target_1 = __webpack_require__(/*! ../expressions/target */ "../core/build/src/abap/5_syntax/expressions/target.js");
44538
44547
  const source_1 = __webpack_require__(/*! ../expressions/source */ "../core/build/src/abap/5_syntax/expressions/source.js");
@@ -44644,6 +44653,17 @@ class Loop {
44644
44653
  input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
44645
44654
  return;
44646
44655
  }
44656
+ if (key.type === basic_1.TableAccessType.sorted && key.keyFields.length > 0) {
44657
+ // the first component of a sorted secondary key must be compared with = or IS INITIAL
44658
+ // in a part of the condition joined by AND, otherwise the WHERE cannot be optimized
44659
+ const first = key.keyFields[0].toUpperCase();
44660
+ if (this.hasKeyCompare(cond, first) === false) {
44661
+ const message = "Loop, WHERE cannot be optimized for secondary key " + name +
44662
+ ", key component " + first + " needs a comparison with = or IS INITIAL joined by AND";
44663
+ input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
44664
+ return;
44665
+ }
44666
+ }
44647
44667
  if (!(0, version_1.releaseAtLeast)(input.scope.getRelease(), version_1.Release.v740sp02)) {
44648
44668
  const compares = cond.findAllExpressionsRecursive(Expressions.ComponentCompare).map(c => c.concatTokens().toUpperCase());
44649
44669
  for (const keyField of key.keyFields) {
@@ -44684,6 +44704,31 @@ class Loop {
44684
44704
  loop_group_by_1.LoopGroupBy.runSyntax(group, input);
44685
44705
  }
44686
44706
  }
44707
+ // true if a conjunct reachable through AND only, ie. not under OR or NOT, compares the component with = or IS INITIAL
44708
+ hasKeyCompare(cond, component) {
44709
+ if (cond.findDirectTokenByText("OR") !== undefined) {
44710
+ return false;
44711
+ }
44712
+ for (const child of cond.getChildren()) {
44713
+ if (child.get() instanceof Expressions.ComponentCompare && child instanceof nodes_1.ExpressionNode) {
44714
+ const concat = child.concatTokens().toUpperCase().replace(/\s+/g, " ");
44715
+ if (concat.startsWith(component + " = ")
44716
+ || concat.startsWith(component + " EQ ")
44717
+ || concat === component + " IS INITIAL") {
44718
+ return true;
44719
+ }
44720
+ }
44721
+ else if (child.get() instanceof Expressions.ComponentCondSub
44722
+ && child instanceof nodes_1.ExpressionNode
44723
+ && child.findDirectTokenByText("NOT") === undefined) {
44724
+ const sub = child.findDirectExpression(Expressions.ComponentCond);
44725
+ if (sub !== undefined && this.hasKeyCompare(sub, component)) {
44726
+ return true;
44727
+ }
44728
+ }
44729
+ }
44730
+ return false;
44731
+ }
44687
44732
  }
44688
44733
  exports.Loop = Loop;
44689
44734
  //# sourceMappingURL=loop.js.map
@@ -73556,7 +73601,7 @@ class Registry {
73556
73601
  }
73557
73602
  static abaplintVersion() {
73558
73603
  // magic, see build script "version.js"
73559
- return "2.120.101";
73604
+ return "2.120.103";
73560
73605
  }
73561
73606
  getDDICReferences() {
73562
73607
  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.103",
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.103",
43
43
  "@types/chai": "^4.3.20",
44
44
  "@types/minimist": "^1.2.5",
45
45
  "@types/mocha": "^10.0.10",