@abaplint/cli 2.106.3 → 2.106.4

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 +78 -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,13 @@ 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
+ throw new Error("INSERT target must be a table");
30643
+ }
30644
+ else if (targetType instanceof basic_1.TableType
30603
30645
  && node.findDirectTokenByText("LINES") === undefined) {
30604
30646
  targetType = targetType.getRowType();
30605
30647
  }
@@ -30618,9 +30660,14 @@ class InsertInternal {
30618
30660
  new fstarget_1.FSTarget().runSyntax(afterAssigning, scope, filename, sourceType);
30619
30661
  }
30620
30662
  }
30621
- if (node.findDirectTokenByText("INITIAL") === undefined
30622
- && new _type_utils_1.TypeUtils(scope).isAssignableStrict(sourceType, targetType) === false) {
30623
- throw new Error("Types not compatible");
30663
+ if (node.findDirectTokenByText("INITIAL") === undefined) {
30664
+ if (new _type_utils_1.TypeUtils(scope).isAssignableStrict(sourceType, targetType) === false) {
30665
+ throw new Error("Types not compatible");
30666
+ }
30667
+ else if (sourceType instanceof basic_1.CharacterType && targetType instanceof basic_1.StringType) {
30668
+ // yea, well, INSERT doesnt convert the values automatically, like everything else?
30669
+ throw new Error("Types not compatible");
30670
+ }
30624
30671
  }
30625
30672
  const afterInto = node.findExpressionAfterToken("INTO");
30626
30673
  if ((afterInto === null || afterInto === void 0 ? void 0 : afterInto.get()) instanceof Expressions.Target && sourceType) {
@@ -31722,11 +31769,17 @@ class ReadTable {
31722
31769
  throw new Error("READ TABLE, FROM must be compatible");
31723
31770
  }
31724
31771
  }
31772
+ const afterKey = node.findExpressionAfterToken("KEY");
31725
31773
  for (const s of sources) {
31726
31774
  if (s === firstSource || s === indexSource || s === fromSource) {
31727
31775
  continue;
31728
31776
  }
31729
- new source_1.Source().runSyntax(s, scope, filename);
31777
+ const type = new source_1.Source().runSyntax(s, scope, filename);
31778
+ if (s === afterKey) {
31779
+ if (type instanceof basic_1.StringType || type instanceof basic_1.TableType || type instanceof basic_1.ObjectReferenceType) {
31780
+ throw new Error("Key cannot be string or table or reference");
31781
+ }
31782
+ }
31730
31783
  }
31731
31784
  const target = node.findDirectExpression(Expressions.ReadTableTarget);
31732
31785
  if (target) {
@@ -51381,7 +51434,7 @@ class Registry {
51381
51434
  }
51382
51435
  static abaplintVersion() {
51383
51436
  // magic, see build script "version.sh"
51384
- return "2.106.3";
51437
+ return "2.106.4";
51385
51438
  }
51386
51439
  getDDICReferences() {
51387
51440
  return this.ddicReferences;
@@ -52800,6 +52853,7 @@ const _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ "./
52800
52853
  const Structures = __webpack_require__(/*! ../abap/3_structures/structures */ "./node_modules/@abaplint/core/build/src/abap/3_structures/structures/index.js");
52801
52854
  const Expressions = __webpack_require__(/*! ../abap/2_statements/expressions */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js");
52802
52855
  const Statements = __webpack_require__(/*! ../abap/2_statements/statements */ "./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js");
52856
+ const _statement_1 = __webpack_require__(/*! ../abap/2_statements/statements/_statement */ "./node_modules/@abaplint/core/build/src/abap/2_statements/statements/_statement.js");
52803
52857
  const _irule_1 = __webpack_require__(/*! ./_irule */ "./node_modules/@abaplint/core/build/src/rules/_irule.js");
52804
52858
  const edit_helper_1 = __webpack_require__(/*! ../edit_helper */ "./node_modules/@abaplint/core/build/src/edit_helper.js");
52805
52859
  class BeginEndNamesConf extends _basic_rule_config_1.BasicRuleConfig {
@@ -52836,6 +52890,10 @@ class BeginEndNames extends _abap_rule_1.ABAPRule {
52836
52890
  if (struc === undefined) {
52837
52891
  return [];
52838
52892
  }
52893
+ const containsUnknown = file.getStatements().some(s => s.get() instanceof _statement_1.Unknown);
52894
+ if (containsUnknown === true) {
52895
+ return [];
52896
+ }
52839
52897
  output.push(...this.test(struc, Structures.Data, Statements.DataBegin, Statements.DataEnd, file));
52840
52898
  output.push(...this.test(struc, Structures.ClassData, Statements.ClassDataBegin, Statements.ClassDataEnd, file));
52841
52899
  output.push(...this.test(struc, Structures.Constants, Statements.ConstantBegin, Statements.ConstantEnd, file));
@@ -71037,6 +71095,7 @@ const _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ "./node_modules/@ab
71037
71095
  const _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ "./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js");
71038
71096
  const _statement_1 = __webpack_require__(/*! ../abap/2_statements/statements/_statement */ "./node_modules/@abaplint/core/build/src/abap/2_statements/statements/_statement.js");
71039
71097
  const _irule_1 = __webpack_require__(/*! ./_irule */ "./node_modules/@abaplint/core/build/src/rules/_irule.js");
71098
+ const edit_helper_1 = __webpack_require__(/*! ../edit_helper */ "./node_modules/@abaplint/core/build/src/edit_helper.js");
71040
71099
  class UnnecessaryPragmaConf extends _basic_rule_config_1.BasicRuleConfig {
71041
71100
  constructor() {
71042
71101
  super(...arguments);
@@ -71151,7 +71210,8 @@ DATA: BEGIN OF blah ##NEEDED,
71151
71210
  if (statement.findFirstExpression(Expressions.ConstantString) === undefined
71152
71211
  && statement.findFirstExpression(Expressions.StringTemplate) === undefined) {
71153
71212
  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)];
71213
+ const fix = edit_helper_1.EditHelper.deleteToken(file, p);
71214
+ return [issue_1.Issue.atToken(file, p, message, this.getMetadata().key, this.getConfig().severity, fix)];
71155
71215
  }
71156
71216
  return [];
71157
71217
  }
@@ -71163,7 +71223,8 @@ DATA: BEGIN OF blah ##NEEDED,
71163
71223
  const concat = next.concatTokens().toUpperCase();
71164
71224
  if (concat.includes(" SY-SUBRC")) {
71165
71225
  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)];
71226
+ const fix = edit_helper_1.EditHelper.deleteToken(file, p);
71227
+ return [issue_1.Issue.atToken(file, p, message, this.getMetadata().key, this.getConfig().severity, fix)];
71167
71228
  }
71168
71229
  return [];
71169
71230
  }
@@ -71190,7 +71251,8 @@ DATA: BEGIN OF blah ##NEEDED,
71190
71251
  && !(statement.get() instanceof Statements.MethodDef)
71191
71252
  && statement.findFirstExpression(Expressions.InlineFS) === undefined) {
71192
71253
  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)];
71254
+ const fix = edit_helper_1.EditHelper.deleteToken(file, p);
71255
+ return [issue_1.Issue.atToken(file, p, message, this.getMetadata().key, this.getConfig().severity, fix)];
71194
71256
  }
71195
71257
  return [];
71196
71258
  }
@@ -73658,9 +73720,10 @@ var Version;
73658
73720
  Version["v755"] = "v755";
73659
73721
  Version["v756"] = "v756";
73660
73722
  Version["v757"] = "v757";
73723
+ Version["v758"] = "v758";
73661
73724
  Version["Cloud"] = "Cloud";
73662
73725
  })(Version || (exports.Version = Version = {}));
73663
- exports.defaultVersion = Version.v757;
73726
+ exports.defaultVersion = Version.v758;
73664
73727
  function getPreviousVersion(v) {
73665
73728
  if (v === Version.OpenABAP) {
73666
73729
  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.4",
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.4",
42
42
  "@types/chai": "^4.3.14",
43
43
  "@types/glob": "^8.1.0",
44
44
  "@types/minimist": "^1.2.5",