@abaplint/transpiler-cli 2.8.20 → 2.8.21

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/bundle.js +86 -15
  2. package/package.json +3 -3
package/build/bundle.js CHANGED
@@ -14730,9 +14730,11 @@ exports.Retry = Retry;
14730
14730
  Object.defineProperty(exports, "__esModule", ({ value: true }));
14731
14731
  exports.Return = void 0;
14732
14732
  const combi_1 = __webpack_require__(/*! ../combi */ "./node_modules/@abaplint/core/build/src/abap/2_statements/combi.js");
14733
+ const version_1 = __webpack_require__(/*! ../../../version */ "./node_modules/@abaplint/core/build/src/version.js");
14734
+ const expressions_1 = __webpack_require__(/*! ../expressions */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js");
14733
14735
  class Return {
14734
14736
  getMatcher() {
14735
- return (0, combi_1.str)("RETURN");
14737
+ 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)));
14736
14738
  }
14737
14739
  }
14738
14740
  exports.Return = Return;
@@ -21366,6 +21368,10 @@ class TypeUtils {
21366
21368
  if (tname === sname) {
21367
21369
  return true;
21368
21370
  }
21371
+ /*
21372
+ console.dir(sid);
21373
+ console.dir(tid);
21374
+ */
21369
21375
  if (!(sid instanceof types_1.ClassDefinition || sid instanceof types_1.InterfaceDefinition)) {
21370
21376
  const found = this.scope.findObjectDefinition(sid.getName());
21371
21377
  if (found) {
@@ -21585,7 +21591,11 @@ class TypeUtils {
21585
21591
  }
21586
21592
  }
21587
21593
  else if (source instanceof basic_1.GenericObjectReferenceType) {
21588
- if (target instanceof basic_1.ObjectReferenceType) {
21594
+ if (target instanceof basic_1.ObjectReferenceType
21595
+ || target instanceof basic_1.StringType
21596
+ || target instanceof basic_1.CharacterType
21597
+ || target instanceof basic_1.TableType
21598
+ || target instanceof basic_1.CLikeType) {
21589
21599
  return false;
21590
21600
  }
21591
21601
  }
@@ -23063,6 +23073,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
23063
23073
  exports.ComponentCompareSimple = void 0;
23064
23074
  const Expressions = __webpack_require__(/*! ../../2_statements/expressions */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js");
23065
23075
  const nodes_1 = __webpack_require__(/*! ../../nodes */ "./node_modules/@abaplint/core/build/src/abap/nodes/index.js");
23076
+ const _type_utils_1 = __webpack_require__(/*! ../_type_utils */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_type_utils.js");
23066
23077
  const component_chain_1 = __webpack_require__(/*! ./component_chain */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/component_chain.js");
23067
23078
  const source_1 = __webpack_require__(/*! ./source */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/source.js");
23068
23079
  class ComponentCompareSimple {
@@ -23077,7 +23088,10 @@ class ComponentCompareSimple {
23077
23088
  targetType = undefined;
23078
23089
  }
23079
23090
  else if (c.get() instanceof Expressions.Source) {
23080
- new source_1.Source().runSyntax(c, scope, filename, targetType);
23091
+ const sourceType = new source_1.Source().runSyntax(c, scope, filename, targetType);
23092
+ if (targetType && new _type_utils_1.TypeUtils(scope).isAssignable(sourceType, targetType) === false) {
23093
+ throw new Error("ComponentCompareSimple, incompatible types");
23094
+ }
23081
23095
  }
23082
23096
  else {
23083
23097
  throw "ComponentCompareSimple, unexpected node";
@@ -24839,6 +24853,9 @@ class MethodParameters {
24839
24853
  checkChanging(node, scope, method, filename) {
24840
24854
  var _a;
24841
24855
  for (const item of this.parameterListT(node, scope, filename)) {
24856
+ if (item.target.findFirstExpression(Expressions.InlineData) !== undefined) {
24857
+ throw new Error("CHANGING cannot be inlined");
24858
+ }
24842
24859
  let parameterType = undefined;
24843
24860
  if (method instanceof basic_1.VoidType) {
24844
24861
  parameterType = method;
@@ -26625,6 +26642,7 @@ const field_assignment_1 = __webpack_require__(/*! ./field_assignment */ "./node
26625
26642
  const basic_1 = __webpack_require__(/*! ../../types/basic */ "./node_modules/@abaplint/core/build/src/abap/types/basic/index.js");
26626
26643
  class ValueBody {
26627
26644
  runSyntax(node, scope, filename, targetType) {
26645
+ var _a;
26628
26646
  if (node === undefined) {
26629
26647
  return targetType;
26630
26648
  }
@@ -26640,8 +26658,16 @@ class ValueBody {
26640
26658
  forScopes++;
26641
26659
  }
26642
26660
  }
26661
+ const fields = new Set();
26643
26662
  for (const s of node.findDirectExpressions(Expressions.FieldAssignment)) {
26644
26663
  new field_assignment_1.FieldAssignment().runSyntax(s, scope, filename, targetType);
26664
+ const fieldname = (_a = s.findDirectExpression(Expressions.FieldSub)) === null || _a === void 0 ? void 0 : _a.concatTokens().toUpperCase();
26665
+ if (fieldname) {
26666
+ if (fields.has(fieldname)) {
26667
+ throw new Error("Duplicate field assignment");
26668
+ }
26669
+ fields.add(fieldname);
26670
+ }
26645
26671
  }
26646
26672
  let type = undefined; // todo, this is only correct if there is a single source in the body
26647
26673
  for (const s of node.findDirectExpressions(Expressions.Source)) {
@@ -28774,11 +28800,21 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
28774
28800
  exports.Do = void 0;
28775
28801
  const Expressions = __webpack_require__(/*! ../../2_statements/expressions */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js");
28776
28802
  const source_1 = __webpack_require__(/*! ../expressions/source */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/source.js");
28803
+ const target_1 = __webpack_require__(/*! ../expressions/target */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/target.js");
28804
+ const _type_utils_1 = __webpack_require__(/*! ../_type_utils */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_type_utils.js");
28805
+ const basic_1 = __webpack_require__(/*! ../../types/basic */ "./node_modules/@abaplint/core/build/src/abap/types/basic/index.js");
28777
28806
  class Do {
28778
28807
  runSyntax(node, scope, filename) {
28779
- // just recurse
28808
+ const afterDo = node.findExpressionAfterToken("DO");
28780
28809
  for (const s of node.findDirectExpressions(Expressions.Source)) {
28781
- new source_1.Source().runSyntax(s, scope, filename);
28810
+ const type = new source_1.Source().runSyntax(s, scope, filename);
28811
+ if (s === afterDo
28812
+ && new _type_utils_1.TypeUtils(scope).isAssignable(type, basic_1.IntegerType.get()) === false) {
28813
+ throw new Error("DO TIMES must be numeric");
28814
+ }
28815
+ }
28816
+ for (const t of node.findDirectExpressions(Expressions.Target)) {
28817
+ new target_1.Target().runSyntax(t, scope, filename);
28782
28818
  }
28783
28819
  }
28784
28820
  }
@@ -29540,7 +29576,14 @@ class InsertInternal {
29540
29576
  if (t) {
29541
29577
  targetType = new target_1.Target().runSyntax(t, scope, filename);
29542
29578
  }
29543
- if (targetType instanceof basic_1.TableType
29579
+ if (!(targetType instanceof basic_1.TableType)
29580
+ && !(targetType instanceof basic_1.VoidType)
29581
+ && !(targetType instanceof basic_1.AnyType)
29582
+ && !(targetType instanceof basic_1.UnknownType)
29583
+ && targetType !== undefined) {
29584
+ throw new Error("INSERT target must be a table");
29585
+ }
29586
+ else if (targetType instanceof basic_1.TableType
29544
29587
  && node.findDirectTokenByText("LINES") === undefined) {
29545
29588
  targetType = targetType.getRowType();
29546
29589
  }
@@ -29549,6 +29592,13 @@ class InsertInternal {
29549
29592
  source = node.findDirectExpression(Expressions.Source);
29550
29593
  }
29551
29594
  const sourceType = source ? new source_1.Source().runSyntax(source, scope, filename, targetType) : targetType;
29595
+ if (targetType === undefined
29596
+ && !(sourceType instanceof basic_1.TableType)
29597
+ && !(sourceType instanceof basic_1.VoidType)
29598
+ && !(sourceType instanceof basic_1.AnyType)
29599
+ && !(sourceType instanceof basic_1.UnknownType)) {
29600
+ throw new Error("INSERT target must be a table");
29601
+ }
29552
29602
  const afterAssigning = node.findExpressionAfterToken("ASSIGNING");
29553
29603
  if ((afterAssigning === null || afterAssigning === void 0 ? void 0 : afterAssigning.get()) instanceof Expressions.FSTarget) {
29554
29604
  const inlinefs = afterAssigning === null || afterAssigning === void 0 ? void 0 : afterAssigning.findDirectExpression(Expressions.InlineFS);
@@ -29559,9 +29609,14 @@ class InsertInternal {
29559
29609
  new fstarget_1.FSTarget().runSyntax(afterAssigning, scope, filename, sourceType);
29560
29610
  }
29561
29611
  }
29562
- if (node.findDirectTokenByText("INITIAL") === undefined
29563
- && new _type_utils_1.TypeUtils(scope).isAssignableStrict(sourceType, targetType) === false) {
29564
- throw new Error("Types not compatible");
29612
+ if (node.findDirectTokenByText("INITIAL") === undefined) {
29613
+ if (new _type_utils_1.TypeUtils(scope).isAssignableStrict(sourceType, targetType) === false) {
29614
+ throw new Error("Types not compatible");
29615
+ }
29616
+ else if (sourceType instanceof basic_1.CharacterType && targetType instanceof basic_1.StringType) {
29617
+ // yea, well, INSERT doesnt convert the values automatically, like everything else?
29618
+ throw new Error("Types not compatible");
29619
+ }
29565
29620
  }
29566
29621
  const afterInto = node.findExpressionAfterToken("INTO");
29567
29622
  if ((afterInto === null || afterInto === void 0 ? void 0 : afterInto.get()) instanceof Expressions.Target && sourceType) {
@@ -30663,11 +30718,17 @@ class ReadTable {
30663
30718
  throw new Error("READ TABLE, FROM must be compatible");
30664
30719
  }
30665
30720
  }
30721
+ const afterKey = node.findExpressionAfterToken("KEY");
30666
30722
  for (const s of sources) {
30667
30723
  if (s === firstSource || s === indexSource || s === fromSource) {
30668
30724
  continue;
30669
30725
  }
30670
- new source_1.Source().runSyntax(s, scope, filename);
30726
+ const type = new source_1.Source().runSyntax(s, scope, filename);
30727
+ if (s === afterKey) {
30728
+ if (type instanceof basic_1.StringType || type instanceof basic_1.TableType || type instanceof basic_1.ObjectReferenceType) {
30729
+ throw new Error("Key cannot be string or table or reference");
30730
+ }
30731
+ }
30671
30732
  }
30672
30733
  const target = node.findDirectExpression(Expressions.ReadTableTarget);
30673
30734
  if (target) {
@@ -50322,7 +50383,7 @@ class Registry {
50322
50383
  }
50323
50384
  static abaplintVersion() {
50324
50385
  // magic, see build script "version.sh"
50325
- return "2.106.3";
50386
+ return "2.106.5";
50326
50387
  }
50327
50388
  getDDICReferences() {
50328
50389
  return this.ddicReferences;
@@ -51741,6 +51802,7 @@ const _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ "./
51741
51802
  const Structures = __webpack_require__(/*! ../abap/3_structures/structures */ "./node_modules/@abaplint/core/build/src/abap/3_structures/structures/index.js");
51742
51803
  const Expressions = __webpack_require__(/*! ../abap/2_statements/expressions */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js");
51743
51804
  const Statements = __webpack_require__(/*! ../abap/2_statements/statements */ "./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js");
51805
+ const _statement_1 = __webpack_require__(/*! ../abap/2_statements/statements/_statement */ "./node_modules/@abaplint/core/build/src/abap/2_statements/statements/_statement.js");
51744
51806
  const _irule_1 = __webpack_require__(/*! ./_irule */ "./node_modules/@abaplint/core/build/src/rules/_irule.js");
51745
51807
  const edit_helper_1 = __webpack_require__(/*! ../edit_helper */ "./node_modules/@abaplint/core/build/src/edit_helper.js");
51746
51808
  class BeginEndNamesConf extends _basic_rule_config_1.BasicRuleConfig {
@@ -51777,6 +51839,10 @@ class BeginEndNames extends _abap_rule_1.ABAPRule {
51777
51839
  if (struc === undefined) {
51778
51840
  return [];
51779
51841
  }
51842
+ const containsUnknown = file.getStatements().some(s => s.get() instanceof _statement_1.Unknown);
51843
+ if (containsUnknown === true) {
51844
+ return [];
51845
+ }
51780
51846
  output.push(...this.test(struc, Structures.Data, Statements.DataBegin, Statements.DataEnd, file));
51781
51847
  output.push(...this.test(struc, Structures.ClassData, Statements.ClassDataBegin, Statements.ClassDataEnd, file));
51782
51848
  output.push(...this.test(struc, Structures.Constants, Statements.ConstantBegin, Statements.ConstantEnd, file));
@@ -69978,6 +70044,7 @@ const _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ "./node_modules/@ab
69978
70044
  const _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ "./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js");
69979
70045
  const _statement_1 = __webpack_require__(/*! ../abap/2_statements/statements/_statement */ "./node_modules/@abaplint/core/build/src/abap/2_statements/statements/_statement.js");
69980
70046
  const _irule_1 = __webpack_require__(/*! ./_irule */ "./node_modules/@abaplint/core/build/src/rules/_irule.js");
70047
+ const edit_helper_1 = __webpack_require__(/*! ../edit_helper */ "./node_modules/@abaplint/core/build/src/edit_helper.js");
69981
70048
  class UnnecessaryPragmaConf extends _basic_rule_config_1.BasicRuleConfig {
69982
70049
  constructor() {
69983
70050
  super(...arguments);
@@ -70092,7 +70159,8 @@ DATA: BEGIN OF blah ##NEEDED,
70092
70159
  if (statement.findFirstExpression(Expressions.ConstantString) === undefined
70093
70160
  && statement.findFirstExpression(Expressions.StringTemplate) === undefined) {
70094
70161
  const message = "There is no text, NO_TEXT can be removed";
70095
- return [issue_1.Issue.atToken(file, p, message, this.getMetadata().key, this.getConfig().severity)];
70162
+ const fix = edit_helper_1.EditHelper.deleteToken(file, p);
70163
+ return [issue_1.Issue.atToken(file, p, message, this.getMetadata().key, this.getConfig().severity, fix)];
70096
70164
  }
70097
70165
  return [];
70098
70166
  }
@@ -70104,7 +70172,8 @@ DATA: BEGIN OF blah ##NEEDED,
70104
70172
  const concat = next.concatTokens().toUpperCase();
70105
70173
  if (concat.includes(" SY-SUBRC")) {
70106
70174
  const message = "SUBRC_OK can be removed as sy-subrc is checked";
70107
- return [issue_1.Issue.atToken(file, p, message, this.getMetadata().key, this.getConfig().severity)];
70175
+ const fix = edit_helper_1.EditHelper.deleteToken(file, p);
70176
+ return [issue_1.Issue.atToken(file, p, message, this.getMetadata().key, this.getConfig().severity, fix)];
70108
70177
  }
70109
70178
  return [];
70110
70179
  }
@@ -70131,7 +70200,8 @@ DATA: BEGIN OF blah ##NEEDED,
70131
70200
  && !(statement.get() instanceof Statements.MethodDef)
70132
70201
  && statement.findFirstExpression(Expressions.InlineFS) === undefined) {
70133
70202
  const message = "There is no data definition, NEEDED can be removed";
70134
- return [issue_1.Issue.atToken(file, p, message, this.getMetadata().key, this.getConfig().severity)];
70203
+ const fix = edit_helper_1.EditHelper.deleteToken(file, p);
70204
+ return [issue_1.Issue.atToken(file, p, message, this.getMetadata().key, this.getConfig().severity, fix)];
70135
70205
  }
70136
70206
  return [];
70137
70207
  }
@@ -72599,9 +72669,10 @@ var Version;
72599
72669
  Version["v755"] = "v755";
72600
72670
  Version["v756"] = "v756";
72601
72671
  Version["v757"] = "v757";
72672
+ Version["v758"] = "v758";
72602
72673
  Version["Cloud"] = "Cloud";
72603
72674
  })(Version || (exports.Version = Version = {}));
72604
- exports.defaultVersion = Version.v757;
72675
+ exports.defaultVersion = Version.v758;
72605
72676
  function getPreviousVersion(v) {
72606
72677
  if (v === Version.OpenABAP) {
72607
72678
  return Version.v702;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/transpiler-cli",
3
- "version": "2.8.20",
3
+ "version": "2.8.21",
4
4
  "description": "Transpiler - Command Line Interface",
5
5
  "funding": "https://github.com/sponsors/larshp",
6
6
  "bin": {
@@ -26,12 +26,12 @@
26
26
  "author": "abaplint",
27
27
  "license": "MIT",
28
28
  "devDependencies": {
29
- "@abaplint/transpiler": "^2.8.20",
29
+ "@abaplint/transpiler": "^2.8.21",
30
30
  "@types/glob": "^8.1.0",
31
31
  "glob": "=7.2.0",
32
32
  "@types/progress": "^2.0.7",
33
33
  "@types/node": "^20.11.30",
34
- "@abaplint/core": "^2.106.3",
34
+ "@abaplint/core": "^2.106.5",
35
35
  "progress": "^2.0.3",
36
36
  "webpack": "^5.91.0",
37
37
  "webpack-cli": "^5.1.4",