@abaplint/cli 2.106.3 → 2.106.5

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 +86 -15
  2. package/package.json +2 -2
package/build/cli.js CHANGED
@@ -15789,9 +15789,11 @@ exports.Retry = Retry;
15789
15789
  Object.defineProperty(exports, "__esModule", ({ value: true }));
15790
15790
  exports.Return = void 0;
15791
15791
  const combi_1 = __webpack_require__(/*! ../combi */ "./node_modules/@abaplint/core/build/src/abap/2_statements/combi.js");
15792
+ const version_1 = __webpack_require__(/*! ../../../version */ "./node_modules/@abaplint/core/build/src/version.js");
15793
+ const expressions_1 = __webpack_require__(/*! ../expressions */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js");
15792
15794
  class Return {
15793
15795
  getMatcher() {
15794
- return (0, combi_1.str)("RETURN");
15796
+ return (0, combi_1.seq)((0, combi_1.str)("RETURN"), (0, combi_1.optPrio)((0, combi_1.ver)(version_1.Version.v758, expressions_1.Source)));
15795
15797
  }
15796
15798
  }
15797
15799
  exports.Return = Return;
@@ -22425,6 +22427,10 @@ class TypeUtils {
22425
22427
  if (tname === sname) {
22426
22428
  return true;
22427
22429
  }
22430
+ /*
22431
+ console.dir(sid);
22432
+ console.dir(tid);
22433
+ */
22428
22434
  if (!(sid instanceof types_1.ClassDefinition || sid instanceof types_1.InterfaceDefinition)) {
22429
22435
  const found = this.scope.findObjectDefinition(sid.getName());
22430
22436
  if (found) {
@@ -22644,7 +22650,11 @@ class TypeUtils {
22644
22650
  }
22645
22651
  }
22646
22652
  else if (source instanceof basic_1.GenericObjectReferenceType) {
22647
- if (target instanceof basic_1.ObjectReferenceType) {
22653
+ if (target instanceof basic_1.ObjectReferenceType
22654
+ || target instanceof basic_1.StringType
22655
+ || target instanceof basic_1.CharacterType
22656
+ || target instanceof basic_1.TableType
22657
+ || target instanceof basic_1.CLikeType) {
22648
22658
  return false;
22649
22659
  }
22650
22660
  }
@@ -24122,6 +24132,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
24122
24132
  exports.ComponentCompareSimple = void 0;
24123
24133
  const Expressions = __webpack_require__(/*! ../../2_statements/expressions */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js");
24124
24134
  const nodes_1 = __webpack_require__(/*! ../../nodes */ "./node_modules/@abaplint/core/build/src/abap/nodes/index.js");
24135
+ const _type_utils_1 = __webpack_require__(/*! ../_type_utils */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_type_utils.js");
24125
24136
  const component_chain_1 = __webpack_require__(/*! ./component_chain */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/component_chain.js");
24126
24137
  const source_1 = __webpack_require__(/*! ./source */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/source.js");
24127
24138
  class ComponentCompareSimple {
@@ -24136,7 +24147,10 @@ class ComponentCompareSimple {
24136
24147
  targetType = undefined;
24137
24148
  }
24138
24149
  else if (c.get() instanceof Expressions.Source) {
24139
- new source_1.Source().runSyntax(c, scope, filename, targetType);
24150
+ const sourceType = new source_1.Source().runSyntax(c, scope, filename, targetType);
24151
+ if (targetType && new _type_utils_1.TypeUtils(scope).isAssignable(sourceType, targetType) === false) {
24152
+ throw new Error("ComponentCompareSimple, incompatible types");
24153
+ }
24140
24154
  }
24141
24155
  else {
24142
24156
  throw "ComponentCompareSimple, unexpected node";
@@ -25898,6 +25912,9 @@ class MethodParameters {
25898
25912
  checkChanging(node, scope, method, filename) {
25899
25913
  var _a;
25900
25914
  for (const item of this.parameterListT(node, scope, filename)) {
25915
+ if (item.target.findFirstExpression(Expressions.InlineData) !== undefined) {
25916
+ throw new Error("CHANGING cannot be inlined");
25917
+ }
25901
25918
  let parameterType = undefined;
25902
25919
  if (method instanceof basic_1.VoidType) {
25903
25920
  parameterType = method;
@@ -27684,6 +27701,7 @@ const field_assignment_1 = __webpack_require__(/*! ./field_assignment */ "./node
27684
27701
  const basic_1 = __webpack_require__(/*! ../../types/basic */ "./node_modules/@abaplint/core/build/src/abap/types/basic/index.js");
27685
27702
  class ValueBody {
27686
27703
  runSyntax(node, scope, filename, targetType) {
27704
+ var _a;
27687
27705
  if (node === undefined) {
27688
27706
  return targetType;
27689
27707
  }
@@ -27699,8 +27717,16 @@ class ValueBody {
27699
27717
  forScopes++;
27700
27718
  }
27701
27719
  }
27720
+ const fields = new Set();
27702
27721
  for (const s of node.findDirectExpressions(Expressions.FieldAssignment)) {
27703
27722
  new field_assignment_1.FieldAssignment().runSyntax(s, scope, filename, targetType);
27723
+ const fieldname = (_a = s.findDirectExpression(Expressions.FieldSub)) === null || _a === void 0 ? void 0 : _a.concatTokens().toUpperCase();
27724
+ if (fieldname) {
27725
+ if (fields.has(fieldname)) {
27726
+ throw new Error("Duplicate field assignment");
27727
+ }
27728
+ fields.add(fieldname);
27729
+ }
27704
27730
  }
27705
27731
  let type = undefined; // todo, this is only correct if there is a single source in the body
27706
27732
  for (const s of node.findDirectExpressions(Expressions.Source)) {
@@ -29833,11 +29859,21 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
29833
29859
  exports.Do = void 0;
29834
29860
  const Expressions = __webpack_require__(/*! ../../2_statements/expressions */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js");
29835
29861
  const source_1 = __webpack_require__(/*! ../expressions/source */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/source.js");
29862
+ const target_1 = __webpack_require__(/*! ../expressions/target */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/target.js");
29863
+ const _type_utils_1 = __webpack_require__(/*! ../_type_utils */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_type_utils.js");
29864
+ const basic_1 = __webpack_require__(/*! ../../types/basic */ "./node_modules/@abaplint/core/build/src/abap/types/basic/index.js");
29836
29865
  class Do {
29837
29866
  runSyntax(node, scope, filename) {
29838
- // just recurse
29867
+ const afterDo = node.findExpressionAfterToken("DO");
29839
29868
  for (const s of node.findDirectExpressions(Expressions.Source)) {
29840
- new source_1.Source().runSyntax(s, scope, filename);
29869
+ const type = new source_1.Source().runSyntax(s, scope, filename);
29870
+ if (s === afterDo
29871
+ && new _type_utils_1.TypeUtils(scope).isAssignable(type, basic_1.IntegerType.get()) === false) {
29872
+ throw new Error("DO TIMES must be numeric");
29873
+ }
29874
+ }
29875
+ for (const t of node.findDirectExpressions(Expressions.Target)) {
29876
+ new target_1.Target().runSyntax(t, scope, filename);
29841
29877
  }
29842
29878
  }
29843
29879
  }
@@ -30599,7 +30635,14 @@ class InsertInternal {
30599
30635
  if (t) {
30600
30636
  targetType = new target_1.Target().runSyntax(t, scope, filename);
30601
30637
  }
30602
- if (targetType instanceof basic_1.TableType
30638
+ if (!(targetType instanceof basic_1.TableType)
30639
+ && !(targetType instanceof basic_1.VoidType)
30640
+ && !(targetType instanceof basic_1.AnyType)
30641
+ && !(targetType instanceof basic_1.UnknownType)
30642
+ && targetType !== undefined) {
30643
+ throw new Error("INSERT target must be a table");
30644
+ }
30645
+ else if (targetType instanceof basic_1.TableType
30603
30646
  && node.findDirectTokenByText("LINES") === undefined) {
30604
30647
  targetType = targetType.getRowType();
30605
30648
  }
@@ -30608,6 +30651,13 @@ class InsertInternal {
30608
30651
  source = node.findDirectExpression(Expressions.Source);
30609
30652
  }
30610
30653
  const sourceType = source ? new source_1.Source().runSyntax(source, scope, filename, targetType) : targetType;
30654
+ if (targetType === undefined
30655
+ && !(sourceType instanceof basic_1.TableType)
30656
+ && !(sourceType instanceof basic_1.VoidType)
30657
+ && !(sourceType instanceof basic_1.AnyType)
30658
+ && !(sourceType instanceof basic_1.UnknownType)) {
30659
+ throw new Error("INSERT target must be a table");
30660
+ }
30611
30661
  const afterAssigning = node.findExpressionAfterToken("ASSIGNING");
30612
30662
  if ((afterAssigning === null || afterAssigning === void 0 ? void 0 : afterAssigning.get()) instanceof Expressions.FSTarget) {
30613
30663
  const inlinefs = afterAssigning === null || afterAssigning === void 0 ? void 0 : afterAssigning.findDirectExpression(Expressions.InlineFS);
@@ -30618,9 +30668,14 @@ class InsertInternal {
30618
30668
  new fstarget_1.FSTarget().runSyntax(afterAssigning, scope, filename, sourceType);
30619
30669
  }
30620
30670
  }
30621
- if (node.findDirectTokenByText("INITIAL") === undefined
30622
- && new _type_utils_1.TypeUtils(scope).isAssignableStrict(sourceType, targetType) === false) {
30623
- throw new Error("Types not compatible");
30671
+ if (node.findDirectTokenByText("INITIAL") === undefined) {
30672
+ if (new _type_utils_1.TypeUtils(scope).isAssignableStrict(sourceType, targetType) === false) {
30673
+ throw new Error("Types not compatible");
30674
+ }
30675
+ else if (sourceType instanceof basic_1.CharacterType && targetType instanceof basic_1.StringType) {
30676
+ // yea, well, INSERT doesnt convert the values automatically, like everything else?
30677
+ throw new Error("Types not compatible");
30678
+ }
30624
30679
  }
30625
30680
  const afterInto = node.findExpressionAfterToken("INTO");
30626
30681
  if ((afterInto === null || afterInto === void 0 ? void 0 : afterInto.get()) instanceof Expressions.Target && sourceType) {
@@ -31722,11 +31777,17 @@ class ReadTable {
31722
31777
  throw new Error("READ TABLE, FROM must be compatible");
31723
31778
  }
31724
31779
  }
31780
+ const afterKey = node.findExpressionAfterToken("KEY");
31725
31781
  for (const s of sources) {
31726
31782
  if (s === firstSource || s === indexSource || s === fromSource) {
31727
31783
  continue;
31728
31784
  }
31729
- new source_1.Source().runSyntax(s, scope, filename);
31785
+ const type = new source_1.Source().runSyntax(s, scope, filename);
31786
+ if (s === afterKey) {
31787
+ if (type instanceof basic_1.StringType || type instanceof basic_1.TableType || type instanceof basic_1.ObjectReferenceType) {
31788
+ throw new Error("Key cannot be string or table or reference");
31789
+ }
31790
+ }
31730
31791
  }
31731
31792
  const target = node.findDirectExpression(Expressions.ReadTableTarget);
31732
31793
  if (target) {
@@ -51381,7 +51442,7 @@ class Registry {
51381
51442
  }
51382
51443
  static abaplintVersion() {
51383
51444
  // magic, see build script "version.sh"
51384
- return "2.106.3";
51445
+ return "2.106.5";
51385
51446
  }
51386
51447
  getDDICReferences() {
51387
51448
  return this.ddicReferences;
@@ -52800,6 +52861,7 @@ const _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ "./
52800
52861
  const Structures = __webpack_require__(/*! ../abap/3_structures/structures */ "./node_modules/@abaplint/core/build/src/abap/3_structures/structures/index.js");
52801
52862
  const Expressions = __webpack_require__(/*! ../abap/2_statements/expressions */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js");
52802
52863
  const Statements = __webpack_require__(/*! ../abap/2_statements/statements */ "./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js");
52864
+ const _statement_1 = __webpack_require__(/*! ../abap/2_statements/statements/_statement */ "./node_modules/@abaplint/core/build/src/abap/2_statements/statements/_statement.js");
52803
52865
  const _irule_1 = __webpack_require__(/*! ./_irule */ "./node_modules/@abaplint/core/build/src/rules/_irule.js");
52804
52866
  const edit_helper_1 = __webpack_require__(/*! ../edit_helper */ "./node_modules/@abaplint/core/build/src/edit_helper.js");
52805
52867
  class BeginEndNamesConf extends _basic_rule_config_1.BasicRuleConfig {
@@ -52836,6 +52898,10 @@ class BeginEndNames extends _abap_rule_1.ABAPRule {
52836
52898
  if (struc === undefined) {
52837
52899
  return [];
52838
52900
  }
52901
+ const containsUnknown = file.getStatements().some(s => s.get() instanceof _statement_1.Unknown);
52902
+ if (containsUnknown === true) {
52903
+ return [];
52904
+ }
52839
52905
  output.push(...this.test(struc, Structures.Data, Statements.DataBegin, Statements.DataEnd, file));
52840
52906
  output.push(...this.test(struc, Structures.ClassData, Statements.ClassDataBegin, Statements.ClassDataEnd, file));
52841
52907
  output.push(...this.test(struc, Structures.Constants, Statements.ConstantBegin, Statements.ConstantEnd, file));
@@ -71037,6 +71103,7 @@ const _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ "./node_modules/@ab
71037
71103
  const _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ "./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js");
71038
71104
  const _statement_1 = __webpack_require__(/*! ../abap/2_statements/statements/_statement */ "./node_modules/@abaplint/core/build/src/abap/2_statements/statements/_statement.js");
71039
71105
  const _irule_1 = __webpack_require__(/*! ./_irule */ "./node_modules/@abaplint/core/build/src/rules/_irule.js");
71106
+ const edit_helper_1 = __webpack_require__(/*! ../edit_helper */ "./node_modules/@abaplint/core/build/src/edit_helper.js");
71040
71107
  class UnnecessaryPragmaConf extends _basic_rule_config_1.BasicRuleConfig {
71041
71108
  constructor() {
71042
71109
  super(...arguments);
@@ -71151,7 +71218,8 @@ DATA: BEGIN OF blah ##NEEDED,
71151
71218
  if (statement.findFirstExpression(Expressions.ConstantString) === undefined
71152
71219
  && statement.findFirstExpression(Expressions.StringTemplate) === undefined) {
71153
71220
  const message = "There is no text, NO_TEXT can be removed";
71154
- return [issue_1.Issue.atToken(file, p, message, this.getMetadata().key, this.getConfig().severity)];
71221
+ const fix = edit_helper_1.EditHelper.deleteToken(file, p);
71222
+ return [issue_1.Issue.atToken(file, p, message, this.getMetadata().key, this.getConfig().severity, fix)];
71155
71223
  }
71156
71224
  return [];
71157
71225
  }
@@ -71163,7 +71231,8 @@ DATA: BEGIN OF blah ##NEEDED,
71163
71231
  const concat = next.concatTokens().toUpperCase();
71164
71232
  if (concat.includes(" SY-SUBRC")) {
71165
71233
  const message = "SUBRC_OK can be removed as sy-subrc is checked";
71166
- return [issue_1.Issue.atToken(file, p, message, this.getMetadata().key, this.getConfig().severity)];
71234
+ const fix = edit_helper_1.EditHelper.deleteToken(file, p);
71235
+ return [issue_1.Issue.atToken(file, p, message, this.getMetadata().key, this.getConfig().severity, fix)];
71167
71236
  }
71168
71237
  return [];
71169
71238
  }
@@ -71190,7 +71259,8 @@ DATA: BEGIN OF blah ##NEEDED,
71190
71259
  && !(statement.get() instanceof Statements.MethodDef)
71191
71260
  && statement.findFirstExpression(Expressions.InlineFS) === undefined) {
71192
71261
  const message = "There is no data definition, NEEDED can be removed";
71193
- return [issue_1.Issue.atToken(file, p, message, this.getMetadata().key, this.getConfig().severity)];
71262
+ const fix = edit_helper_1.EditHelper.deleteToken(file, p);
71263
+ return [issue_1.Issue.atToken(file, p, message, this.getMetadata().key, this.getConfig().severity, fix)];
71194
71264
  }
71195
71265
  return [];
71196
71266
  }
@@ -73658,9 +73728,10 @@ var Version;
73658
73728
  Version["v755"] = "v755";
73659
73729
  Version["v756"] = "v756";
73660
73730
  Version["v757"] = "v757";
73731
+ Version["v758"] = "v758";
73661
73732
  Version["Cloud"] = "Cloud";
73662
73733
  })(Version || (exports.Version = Version = {}));
73663
- exports.defaultVersion = Version.v757;
73734
+ exports.defaultVersion = Version.v758;
73664
73735
  function getPreviousVersion(v) {
73665
73736
  if (v === Version.OpenABAP) {
73666
73737
  return Version.v702;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/cli",
3
- "version": "2.106.3",
3
+ "version": "2.106.5",
4
4
  "description": "abaplint - Command Line Interface",
5
5
  "funding": "https://github.com/sponsors/larshp",
6
6
  "bin": {
@@ -38,7 +38,7 @@
38
38
  },
39
39
  "homepage": "https://abaplint.org",
40
40
  "devDependencies": {
41
- "@abaplint/core": "^2.106.3",
41
+ "@abaplint/core": "^2.106.5",
42
42
  "@types/chai": "^4.3.14",
43
43
  "@types/glob": "^8.1.0",
44
44
  "@types/minimist": "^1.2.5",