@abaplint/transpiler-cli 2.7.25 → 2.7.27

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 +276 -138
  2. package/package.json +5 -5
package/build/bundle.js CHANGED
@@ -19391,7 +19391,7 @@ BuiltIn.methods = [
19391
19391
  },
19392
19392
  optional: {
19393
19393
  "case": new basic_1.CharacterType(1),
19394
- "sep": basic_1.IntegerType.get(),
19394
+ "sep": new basic_1.CLikeType(),
19395
19395
  "min": basic_1.IntegerType.get(),
19396
19396
  },
19397
19397
  return: basic_1.StringType.get(),
@@ -19610,12 +19610,19 @@ class CurrentScope {
19610
19610
  }
19611
19611
  }
19612
19612
  addReference(usage, referencing, type, filename, extra) {
19613
- var _a;
19613
+ var _a, _b;
19614
19614
  if (usage === undefined || type === undefined) {
19615
19615
  return;
19616
19616
  }
19617
19617
  const position = new _identifier_1.Identifier(usage, filename);
19618
- (_a = this.current) === null || _a === void 0 ? void 0 : _a.getData().references.push({ position, resolved: referencing, referenceType: type, extra });
19618
+ if (Array.isArray(type)) {
19619
+ for (const t of type) {
19620
+ (_a = this.current) === null || _a === void 0 ? void 0 : _a.getData().references.push({ position, resolved: referencing, referenceType: t, extra });
19621
+ }
19622
+ }
19623
+ else {
19624
+ (_b = this.current) === null || _b === void 0 ? void 0 : _b.getData().references.push({ position, resolved: referencing, referenceType: type, extra });
19625
+ }
19619
19626
  }
19620
19627
  addSQLConversion(fieldName, message, token) {
19621
19628
  var _a;
@@ -20678,12 +20685,15 @@ class TypeUtils {
20678
20685
  }
20679
20686
  return false;
20680
20687
  }
20681
- isAssignableStrict(source, target) {
20682
- var _a, _b, _c, _d, _e, _f;
20688
+ isAssignableStrict(source, target, calculated = false) {
20689
+ var _a, _b, _c, _d, _e, _f, _g;
20683
20690
  /*
20684
20691
  console.dir(source);
20685
20692
  console.dir(target);
20686
20693
  */
20694
+ if (calculated) {
20695
+ return this.isAssignable(source, target);
20696
+ }
20687
20697
  if (source instanceof basic_1.CharacterType) {
20688
20698
  if (target instanceof basic_1.CharacterType) {
20689
20699
  if (((_a = source.getAbstractTypeData()) === null || _a === void 0 ? void 0 : _a.derivedFromConstant) === true) {
@@ -20722,12 +20732,18 @@ class TypeUtils {
20722
20732
  if (target instanceof basic_1.StructureType && this.structureContainsString(target)) {
20723
20733
  return false;
20724
20734
  }
20725
- else if (target instanceof basic_1.XSequenceType || target instanceof basic_1.XStringType) {
20735
+ else if (target instanceof basic_1.IntegerType) {
20726
20736
  if (((_f = source.getAbstractTypeData()) === null || _f === void 0 ? void 0 : _f.derivedFromConstant) === true) {
20727
20737
  return true;
20728
20738
  }
20729
20739
  return false;
20730
20740
  }
20741
+ else if (target instanceof basic_1.XSequenceType || target instanceof basic_1.XStringType) {
20742
+ if (((_g = source.getAbstractTypeData()) === null || _g === void 0 ? void 0 : _g.derivedFromConstant) === true) {
20743
+ return true;
20744
+ }
20745
+ return false;
20746
+ }
20731
20747
  return true;
20732
20748
  }
20733
20749
  else if (source instanceof basic_1.StructureType && target instanceof basic_1.StructureType) {
@@ -20748,6 +20764,11 @@ class TypeUtils {
20748
20764
  return false;
20749
20765
  }
20750
20766
  }
20767
+ else if (source instanceof basic_1.FloatType) {
20768
+ if (target instanceof basic_1.IntegerType) {
20769
+ return false;
20770
+ }
20771
+ }
20751
20772
  else if (source instanceof basic_1.XStringType) {
20752
20773
  if (target instanceof basic_1.CLikeType) {
20753
20774
  return false;
@@ -21854,7 +21875,9 @@ class AttributeChain {
21854
21875
  if (context === undefined) {
21855
21876
  throw new Error("Attribute or constant \"" + name + "\" not found in \"" + def.getName() + "\"");
21856
21877
  }
21857
- scope.addReference(nameToken, context, type, filename);
21878
+ for (const t of type) {
21879
+ scope.addReference(nameToken, context, t, filename);
21880
+ }
21858
21881
  // todo, loop, handle ArrowOrDash, ComponentName, TableExpression
21859
21882
  return context.getType();
21860
21883
  }
@@ -23655,10 +23678,12 @@ class MethodCallParam {
23655
23678
  if (child.get() instanceof Expressions.Source) {
23656
23679
  sourceType = new source_1.Source().runSyntax(child, scope, filename, targetType);
23657
23680
  }
23681
+ const calculated = child.findFirstExpression(Expressions.MethodCallChain) !== undefined
23682
+ || child.findFirstExpression(Expressions.ArithOperator) !== undefined;
23658
23683
  if (sourceType === undefined) {
23659
23684
  throw new Error("No source type determined, method source");
23660
23685
  }
23661
- else if (new _type_utils_1.TypeUtils(scope).isAssignableStrict(sourceType, targetType) === false) {
23686
+ else if (new _type_utils_1.TypeUtils(scope).isAssignableStrict(sourceType, targetType, calculated) === false) {
23662
23687
  throw new Error("Method parameter type not compatible");
23663
23688
  }
23664
23689
  }
@@ -24563,7 +24588,7 @@ const _typed_identifier_1 = __webpack_require__(/*! ../../types/_typed_identifie
24563
24588
  * DATA(bar) = VALUE #( ... ). give error, no type can be derived
24564
24589
  */
24565
24590
  class Source {
24566
- runSyntax(node, scope, filename, targetType) {
24591
+ runSyntax(node, scope, filename, targetType, writeReference = false) {
24567
24592
  if (node === undefined) {
24568
24593
  return undefined;
24569
24594
  }
@@ -24690,33 +24715,41 @@ class Source {
24690
24715
  return undefined;
24691
24716
  }
24692
24717
  let context = new unknown_type_1.UnknownType("todo, Source type");
24718
+ const type = [_reference_1.ReferenceType.DataReadReference];
24719
+ if (writeReference) {
24720
+ type.push(_reference_1.ReferenceType.DataWriteReference);
24721
+ }
24693
24722
  while (children.length >= 0) {
24694
24723
  if (first instanceof nodes_1.ExpressionNode && first.get() instanceof Expressions.MethodCallChain) {
24695
24724
  context = new method_call_chain_1.MethodCallChain().runSyntax(first, scope, filename, targetType);
24696
24725
  }
24697
24726
  else if (first instanceof nodes_1.ExpressionNode && first.get() instanceof Expressions.FieldChain) {
24698
- context = new field_chain_1.FieldChain().runSyntax(first, scope, filename, _reference_1.ReferenceType.DataReadReference);
24727
+ context = new field_chain_1.FieldChain().runSyntax(first, scope, filename, type);
24699
24728
  }
24700
24729
  else if (first instanceof nodes_1.ExpressionNode && first.get() instanceof Expressions.StringTemplate) {
24701
24730
  context = new string_template_1.StringTemplate().runSyntax(first, scope, filename);
24702
24731
  }
24703
24732
  else if (first instanceof nodes_1.ExpressionNode && first.get() instanceof Expressions.Source) {
24704
- context = new Source().runSyntax(first, scope, filename);
24733
+ const found = new Source().runSyntax(first, scope, filename);
24734
+ context = this.infer(context, found);
24705
24735
  }
24706
24736
  else if (first instanceof nodes_1.ExpressionNode && first.get() instanceof Expressions.Constant) {
24707
- context = new constant_1.Constant().runSyntax(first);
24737
+ const found = new constant_1.Constant().runSyntax(first);
24738
+ context = this.infer(context, found);
24708
24739
  }
24709
24740
  else if (first instanceof nodes_1.ExpressionNode && first.get() instanceof Expressions.Dereference) {
24710
24741
  context = new dereference_1.Dereference().runSyntax(context);
24711
24742
  }
24712
- else if (first instanceof nodes_1.ExpressionNode && first.get() instanceof Expressions.ArrowOrDash) {
24713
- // console.dir("dash");
24714
- }
24715
24743
  else if (first instanceof nodes_1.ExpressionNode && first.get() instanceof Expressions.ComponentChain) {
24716
24744
  context = new component_chain_1.ComponentChain().runSyntax(context, first, scope, filename);
24717
24745
  }
24746
+ else if (first instanceof nodes_1.ExpressionNode && first.get() instanceof Expressions.ArithOperator) {
24747
+ if (first.concatTokens() === "**") {
24748
+ context = new basic_1.FloatType();
24749
+ }
24750
+ }
24718
24751
  else if (first instanceof nodes_1.ExpressionNode && first.get() instanceof Expressions.AttributeChain) {
24719
- context = new attribute_chain_1.AttributeChain().runSyntax(context, first, scope, filename, _reference_1.ReferenceType.DataReadReference);
24752
+ context = new attribute_chain_1.AttributeChain().runSyntax(context, first, scope, filename, type);
24720
24753
  }
24721
24754
  first = children.shift();
24722
24755
  if (first === undefined) {
@@ -24729,6 +24762,14 @@ class Source {
24729
24762
  return context;
24730
24763
  }
24731
24764
  ////////////////////////////////
24765
+ infer(context, found) {
24766
+ if (context instanceof basic_1.FloatType && found instanceof basic_1.IntegerType) {
24767
+ return context;
24768
+ }
24769
+ else {
24770
+ return found;
24771
+ }
24772
+ }
24732
24773
  addIfInferred(node, scope, filename, inferredType) {
24733
24774
  const basic = new basic_types_1.BasicTypes(filename, scope);
24734
24775
  const typeExpression = node.findFirstExpression(Expressions.TypeNameOrInfer);
@@ -24870,6 +24911,7 @@ exports.SourceFieldSymbol = SourceFieldSymbol;
24870
24911
  Object.defineProperty(exports, "__esModule", ({ value: true }));
24871
24912
  exports.SQLCompare = void 0;
24872
24913
  const Expressions = __webpack_require__(/*! ../../2_statements/expressions */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js");
24914
+ const nodes_1 = __webpack_require__(/*! ../../nodes */ "./node_modules/@abaplint/core/build/src/abap/nodes/index.js");
24873
24915
  const basic_1 = __webpack_require__(/*! ../../types/basic */ "./node_modules/@abaplint/core/build/src/abap/types/basic/index.js");
24874
24916
  const sql_source_1 = __webpack_require__(/*! ./sql_source */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/sql_source.js");
24875
24917
  class SQLCompare {
@@ -24878,7 +24920,12 @@ class SQLCompare {
24878
24920
  let sourceType;
24879
24921
  let token;
24880
24922
  for (const s of node.findAllExpressions(Expressions.SQLSource)) {
24881
- token = s.getFirstToken();
24923
+ for (const child of s.getChildren()) {
24924
+ if (child instanceof nodes_1.ExpressionNode) {
24925
+ token = child.getFirstToken();
24926
+ break;
24927
+ }
24928
+ }
24882
24929
  sourceType = new sql_source_1.SQLSource().runSyntax(s, scope, filename);
24883
24930
  }
24884
24931
  const fieldName = (_a = node.findDirectExpression(Expressions.SQLFieldName)) === null || _a === void 0 ? void 0 : _a.concatTokens();
@@ -28341,19 +28388,19 @@ const dynamic_1 = __webpack_require__(/*! ../expressions/dynamic */ "./node_modu
28341
28388
  const loop_group_by_1 = __webpack_require__(/*! ../expressions/loop_group_by */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/loop_group_by.js");
28342
28389
  class Loop {
28343
28390
  runSyntax(node, scope, filename) {
28344
- var _a;
28345
28391
  const loopTarget = node.findDirectExpression(Expressions.LoopTarget);
28346
28392
  let target = loopTarget === null || loopTarget === void 0 ? void 0 : loopTarget.findDirectExpression(Expressions.Target);
28347
28393
  const targetType = target ? new target_1.Target().runSyntax(target, scope, filename) : undefined;
28348
28394
  if (target === undefined) {
28349
28395
  target = node.findDirectExpression(Expressions.FSTarget);
28350
28396
  }
28397
+ const write = (loopTarget === null || loopTarget === void 0 ? void 0 : loopTarget.findDirectTokenByText("ASSIGNING")) !== undefined;
28351
28398
  const sources = node.findDirectExpressions(Expressions.Source);
28352
28399
  let firstSource = node.findDirectExpression(Expressions.SimpleSource2);
28353
28400
  if (firstSource === undefined) {
28354
28401
  firstSource = sources[0];
28355
28402
  }
28356
- let sourceType = firstSource ? new source_1.Source().runSyntax(firstSource, scope, filename, targetType) : undefined;
28403
+ let sourceType = firstSource ? new source_1.Source().runSyntax(firstSource, scope, filename, targetType, write) : undefined;
28357
28404
  let rowType = undefined;
28358
28405
  const concat = node.concatTokens().toUpperCase();
28359
28406
  if (sourceType === undefined) {
@@ -28374,14 +28421,24 @@ class Loop {
28374
28421
  && concat.startsWith("LOOP AT GROUP ") === false) {
28375
28422
  throw new Error("Loop, not a table type");
28376
28423
  }
28424
+ else if (loopTarget === undefined
28425
+ && sourceType instanceof basic_1.TableType
28426
+ && sourceType.isWithHeader() === false) {
28427
+ throw new Error("Loop, no header");
28428
+ }
28429
+ const targetConcat = loopTarget === null || loopTarget === void 0 ? void 0 : loopTarget.concatTokens().toUpperCase();
28377
28430
  if (sourceType instanceof basic_1.TableType) {
28378
- const targetConcat = (_a = node.findDirectExpression(Expressions.LoopTarget)) === null || _a === void 0 ? void 0 : _a.concatTokens().toUpperCase();
28379
28431
  rowType = sourceType.getRowType();
28380
28432
  sourceType = rowType;
28381
28433
  if (targetConcat === null || targetConcat === void 0 ? void 0 : targetConcat.startsWith("REFERENCE INTO ")) {
28382
28434
  sourceType = new basic_1.DataReference(sourceType);
28383
28435
  }
28384
28436
  }
28437
+ if (targetConcat
28438
+ && targetConcat.startsWith("TRANSPORTING ")
28439
+ && node.findDirectTokenByText("WHERE") === undefined) {
28440
+ throw new Error("Loop, TRANSPORTING NO FIELDS only with WHERE");
28441
+ }
28385
28442
  const inline = target === null || target === void 0 ? void 0 : target.findDirectExpression(Expressions.InlineData);
28386
28443
  if (inline) {
28387
28444
  new inline_data_1.InlineData().runSyntax(inline, scope, filename, sourceType);
@@ -47449,7 +47506,7 @@ class Registry {
47449
47506
  }
47450
47507
  static abaplintVersion() {
47451
47508
  // magic, see build script "version.sh"
47452
- return "2.101.16";
47509
+ return "2.101.25";
47453
47510
  }
47454
47511
  getDDICReferences() {
47455
47512
  return this.ddicReferences;
@@ -48121,7 +48178,7 @@ Does not take effect on non functional method calls, use https://rules.abaplint.
48121
48178
 
48122
48179
  If parameters are on the same row, no issues are reported, see
48123
48180
  https://rules.abaplint.org/max_one_method_parameter_per_line/ for splitting parameters to lines`,
48124
- tags: [_irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Whitespace, _irule_1.RuleTag.Styleguide],
48181
+ tags: [_irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Whitespace, _irule_1.RuleTag.Styleguide, _irule_1.RuleTag.Quickfix],
48125
48182
  badExample: `CALL FUNCTION 'FOOBAR'
48126
48183
  EXPORTING
48127
48184
  foo = 2
@@ -48717,6 +48774,10 @@ class AvoidUseConf extends _basic_rule_config_1.BasicRuleConfig {
48717
48774
  this.testSeams = true;
48718
48775
  /** Detects DESCRIBE TABLE LINES, use lines() instead */
48719
48776
  this.describeLines = true;
48777
+ /** Detects EXPORT TO MEMORY */
48778
+ this.exportToMemory = true;
48779
+ /** Detects EXPORT TO DATABASE */
48780
+ this.exportToDatabase = true;
48720
48781
  }
48721
48782
  }
48722
48783
  exports.AvoidUseConf = AvoidUseConf;
@@ -48776,6 +48837,12 @@ TEST-SEAMS: https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md
48776
48837
  else if (this.conf.statics && statement instanceof Statements.StaticEnd) {
48777
48838
  isStaticsBlock = false;
48778
48839
  }
48840
+ else if (this.conf.exportToMemory && statement instanceof Statements.Export && statementNode.concatTokens().includes("TO MEMORY ")) {
48841
+ message = "EXPORT TO MEMORY";
48842
+ }
48843
+ else if (this.conf.exportToDatabase && statement instanceof Statements.Export && statementNode.concatTokens().includes("TO DATABASE ")) {
48844
+ message = "EXPORT TO DATABASE";
48845
+ }
48779
48846
  else if (this.conf.testSeams && statement instanceof Statements.TestSeam) {
48780
48847
  message = "TEST-SEAM";
48781
48848
  }
@@ -52473,6 +52540,10 @@ Make sure to test the downported code, it might not always be completely correct
52473
52540
  return found;
52474
52541
  }
52475
52542
  }
52543
+ found = this.outlineCorresponding(low, high, lowFile, highSyntax);
52544
+ if (found) {
52545
+ return found;
52546
+ }
52476
52547
  found = this.downportSelectFields(low, high, lowFile, highSyntax);
52477
52548
  if (found) {
52478
52549
  return found;
@@ -53105,7 +53176,7 @@ ${indentation}CATCH ${className} INTO ${targetName}.`;
53105
53176
  bar->if_t100_dyn_msg~msgv4 = 'abc'.
53106
53177
  RAISE EXCEPTION bar.
53107
53178
  */
53108
- var _a, _b, _c;
53179
+ var _a, _b, _c, _d, _e, _f, _g;
53109
53180
  if (!(node.get() instanceof Statements.Raise)) {
53110
53181
  return undefined;
53111
53182
  }
@@ -53129,20 +53200,45 @@ ${indentation}CATCH ${className} INTO ${targetName}.`;
53129
53200
  if (s === undefined) {
53130
53201
  return undefined;
53131
53202
  }
53132
- id = "'" + ((_a = s.findDirectExpression(Expressions.MessageClass)) === null || _a === void 0 ? void 0 : _a.concatTokens()) + "'";
53133
- number = "'" + ((_b = s.findDirectExpression(Expressions.MessageTypeAndNumber)) === null || _b === void 0 ? void 0 : _b.concatTokens().substring(1)) + "'";
53203
+ if (s.findDirectExpression(Expressions.MessageClass)) {
53204
+ id = "'" + ((_b = (_a = s.findDirectExpression(Expressions.MessageClass)) === null || _a === void 0 ? void 0 : _a.concatTokens()) === null || _b === void 0 ? void 0 : _b.toUpperCase()) + "'";
53205
+ }
53206
+ else {
53207
+ id = (_c = s.findExpressionAfterToken("ID")) === null || _c === void 0 ? void 0 : _c.concatTokens();
53208
+ }
53209
+ if (s.findDirectExpression(Expressions.MessageTypeAndNumber)) {
53210
+ number = "'" + ((_d = s.findDirectExpression(Expressions.MessageTypeAndNumber)) === null || _d === void 0 ? void 0 : _d.concatTokens().substring(1)) + "'";
53211
+ }
53212
+ else {
53213
+ number = (_e = s.findExpressionAfterToken("NUMBER")) === null || _e === void 0 ? void 0 : _e.concatTokens();
53214
+ }
53134
53215
  startToken = node.getFirstToken();
53135
53216
  }
53136
- const className = ((_c = node.findDirectExpression(Expressions.ClassName)) === null || _c === void 0 ? void 0 : _c.concatTokens()) || "ERROR";
53217
+ const withs = ((_f = node.findDirectExpression(Expressions.RaiseWith)) === null || _f === void 0 ? void 0 : _f.findDirectExpressions(Expressions.Source)) || [];
53218
+ const className = ((_g = node.findDirectExpression(Expressions.ClassName)) === null || _g === void 0 ? void 0 : _g.concatTokens()) || "ERROR";
53137
53219
  const uniqueName1 = this.uniqueName(node.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
53138
53220
  const uniqueName2 = this.uniqueName(node.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
53139
53221
  const indentation = " ".repeat(node.getFirstToken().getStart().getCol() - 1);
53140
- const abap = `DATA ${uniqueName1} LIKE if_t100_message=>t100key.
53141
- ${indentation}${uniqueName1}-msgid = ${id === null || id === void 0 ? void 0 : id.toUpperCase()}.
53142
- ${indentation}${uniqueName1}-msgno = ${number}.
53143
- ${indentation}DATA ${uniqueName2} TYPE REF TO ${className}.
53144
- ${indentation}CREATE OBJECT ${uniqueName2} EXPORTING textid = ${uniqueName1}.
53145
- ${indentation}RAISE EXCEPTION ${uniqueName2}.`;
53222
+ let abap = `DATA ${uniqueName1} LIKE if_t100_message=>t100key.
53223
+ ${indentation}${uniqueName1}-msgid = ${id}.
53224
+ ${indentation}${uniqueName1}-msgno = ${number}.\n`;
53225
+ if (withs.length > 0) {
53226
+ abap += `${indentation}${uniqueName1}-attr1 = 'IF_T100_DYN_MSG~MSGV1'.
53227
+ ${indentation}${uniqueName1}-attr2 = 'IF_T100_DYN_MSG~MSGV2'.
53228
+ ${indentation}${uniqueName1}-attr3 = 'IF_T100_DYN_MSG~MSGV3'.
53229
+ ${indentation}${uniqueName1}-attr4 = 'IF_T100_DYN_MSG~MSGV4'.\n`;
53230
+ }
53231
+ abap += `${indentation}DATA ${uniqueName2} TYPE REF TO ${className}.
53232
+ ${indentation}CREATE OBJECT ${uniqueName2} EXPORTING textid = ${uniqueName1}.\n`;
53233
+ if (withs.length > 0) {
53234
+ abap += `${indentation}${uniqueName2}->if_t100_dyn_msg~msgty = 'E'.\n`;
53235
+ }
53236
+ let count = 1;
53237
+ for (const w of withs) {
53238
+ abap += `${indentation}${uniqueName2}->if_t100_dyn_msg~msgv${count} = ${w.concatTokens()}.\n`;
53239
+ count++;
53240
+ }
53241
+ abap += `${indentation}RAISE EXCEPTION ${uniqueName2}.`;
53146
53242
  const fix = edit_helper_1.EditHelper.replaceRange(lowFile, node.getStart(), node.getEnd(), abap);
53147
53243
  return issue_1.Issue.atToken(lowFile, startToken, "Downport RAISE MESSAGE", this.getMetadata().key, this.conf.severity, fix);
53148
53244
  }
@@ -53612,50 +53708,36 @@ ${indentation}${uniqueName}`;
53612
53708
  }
53613
53709
  // must be very simple string templates, like "|{ ls_line-no ALPHA = IN }|"
53614
53710
  stringTemplateAlpha(low, high, lowFile, highSyntax) {
53615
- var _a, _b, _c;
53711
+ var _a, _b;
53616
53712
  if (!(low.get() instanceof _statement_1.Unknown)) {
53617
53713
  return undefined;
53618
53714
  }
53619
53715
  else if (!(high.get() instanceof Statements.Move)) {
53620
53716
  return undefined;
53621
53717
  }
53622
- const topSource = high.findDirectExpression(Expressions.Source);
53623
- if (topSource === undefined || topSource.getChildren().length !== 1) {
53624
- return undefined;
53625
- }
53626
- let top = true;
53627
- let child = topSource.getFirstChild();
53628
- if (!(child.get() instanceof Expressions.StringTemplate)) {
53629
- child = child.findFirstExpression(Expressions.StringTemplate);
53630
- top = false;
53631
- }
53632
- if (child === undefined || !(child.get() instanceof Expressions.StringTemplate)) {
53633
- return undefined;
53634
- }
53635
- const templateTokens = child.getChildren();
53636
- if (templateTokens.length !== 3
53637
- || templateTokens[0].getFirstToken().getStr() !== "|{"
53638
- || templateTokens[2].getFirstToken().getStr() !== "}|") {
53639
- return undefined;
53640
- }
53641
- const templateSource = child.findDirectExpression(Expressions.StringTemplateSource);
53642
- const formatting = (_a = templateSource === null || templateSource === void 0 ? void 0 : templateSource.findDirectExpression(Expressions.StringTemplateFormatting)) === null || _a === void 0 ? void 0 : _a.concatTokens();
53643
- let functionName = "";
53644
- switch (formatting) {
53645
- case "ALPHA = IN":
53646
- functionName = "CONVERSION_EXIT_ALPHA_INPUT";
53647
- break;
53648
- case "ALPHA = OUT":
53649
- functionName = "CONVERSION_EXIT_ALPHA_OUTPUT";
53650
- break;
53651
- default:
53718
+ for (const child of high.findAllExpressionsRecursive(Expressions.StringTemplate)) {
53719
+ const templateTokens = child.getChildren();
53720
+ if (templateTokens.length !== 3
53721
+ || templateTokens[0].getFirstToken().getStr() !== "|{"
53722
+ || templateTokens[2].getFirstToken().getStr() !== "}|") {
53652
53723
  return undefined;
53653
- }
53654
- const indentation = " ".repeat(high.getFirstToken().getStart().getCol() - 1);
53655
- const source = (_b = templateSource === null || templateSource === void 0 ? void 0 : templateSource.findDirectExpression(Expressions.Source)) === null || _b === void 0 ? void 0 : _b.concatTokens();
53656
- const topTarget = (_c = high.findDirectExpression(Expressions.Target)) === null || _c === void 0 ? void 0 : _c.concatTokens();
53657
- const uniqueName = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
53658
- if (top === false) {
53724
+ }
53725
+ const templateSource = child.findDirectExpression(Expressions.StringTemplateSource);
53726
+ const formatting = (_a = templateSource === null || templateSource === void 0 ? void 0 : templateSource.findDirectExpression(Expressions.StringTemplateFormatting)) === null || _a === void 0 ? void 0 : _a.concatTokens();
53727
+ let functionName = "";
53728
+ switch (formatting) {
53729
+ case "ALPHA = IN":
53730
+ functionName = "CONVERSION_EXIT_ALPHA_INPUT";
53731
+ break;
53732
+ case "ALPHA = OUT":
53733
+ functionName = "CONVERSION_EXIT_ALPHA_OUTPUT";
53734
+ break;
53735
+ default:
53736
+ return undefined;
53737
+ }
53738
+ const indentation = " ".repeat(high.getFirstToken().getStart().getCol() - 1);
53739
+ const source = (_b = templateSource === null || templateSource === void 0 ? void 0 : templateSource.findDirectExpression(Expressions.Source)) === null || _b === void 0 ? void 0 : _b.concatTokens();
53740
+ const uniqueName = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
53659
53741
  const code = `DATA ${uniqueName} TYPE string.
53660
53742
  ${indentation}CALL FUNCTION '${functionName}'
53661
53743
  ${indentation} EXPORTING
@@ -53667,15 +53749,7 @@ ${indentation} output = ${uniqueName}.\n`;
53667
53749
  const fix = edit_helper_1.EditHelper.merge(fix2, fix1);
53668
53750
  return issue_1.Issue.atToken(lowFile, high.getFirstToken(), "Downport ALPHA", this.getMetadata().key, this.conf.severity, fix);
53669
53751
  }
53670
- else {
53671
- const code = `CALL FUNCTION '${functionName}'
53672
- ${indentation} EXPORTING
53673
- ${indentation} input = ${source}
53674
- ${indentation} IMPORTING
53675
- ${indentation} output = ${topTarget}.`;
53676
- const fix = edit_helper_1.EditHelper.replaceRange(lowFile, high.getFirstToken().getStart(), high.getLastToken().getEnd(), code);
53677
- return issue_1.Issue.atToken(lowFile, high.getFirstToken(), "Downport ALPHA", this.getMetadata().key, this.conf.severity, fix);
53678
- }
53752
+ return undefined;
53679
53753
  }
53680
53754
  outlineLoopInput(low, high, lowFile, highSyntax) {
53681
53755
  if (!(low.get() instanceof _statement_1.Unknown)) {
@@ -54063,6 +54137,43 @@ ${indentation} output = ${topTarget}.`;
54063
54137
  }
54064
54138
  return undefined;
54065
54139
  }
54140
+ outlineCorresponding(low, high, lowFile, highSyntax) {
54141
+ var _a;
54142
+ if (!(low.get() instanceof _statement_1.Unknown)) {
54143
+ return undefined;
54144
+ }
54145
+ const allSources = high.findAllExpressionsRecursive(Expressions.Source);
54146
+ for (const s of allSources) {
54147
+ const firstToken = s.getFirstToken();
54148
+ if (firstToken.getStr().toUpperCase() !== "CORRESPONDING") {
54149
+ continue;
54150
+ }
54151
+ const correspondingBody = s.findDirectExpression(Expressions.CorrespondingBody);
54152
+ const uniqueName = this.uniqueName(firstToken.getStart(), lowFile.getFilename(), highSyntax);
54153
+ const indentation = " ".repeat(high.getFirstToken().getStart().getCol() - 1);
54154
+ let type = this.findType(s, lowFile, highSyntax);
54155
+ if (type === undefined) {
54156
+ if (high.get() instanceof Statements.Move && high.findDirectExpression(Expressions.Source) === s) {
54157
+ type = "LIKE " + ((_a = high.findDirectExpression(Expressions.Target)) === null || _a === void 0 ? void 0 : _a.concatTokens());
54158
+ }
54159
+ if (type === undefined) {
54160
+ continue;
54161
+ }
54162
+ }
54163
+ else {
54164
+ type = "TYPE " + type;
54165
+ }
54166
+ const abap = `DATA ${uniqueName} ${type}.\n` +
54167
+ indentation + `CLEAR ${uniqueName}.\n` + // might be called inside a loop
54168
+ indentation + `MOVE-CORRESPONDING ${correspondingBody === null || correspondingBody === void 0 ? void 0 : correspondingBody.concatTokens()} TO ${uniqueName}.\n` +
54169
+ indentation;
54170
+ const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getFirstToken().getStart(), abap);
54171
+ const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, firstToken.getStart(), s.getLastToken().getEnd(), uniqueName);
54172
+ const fix = edit_helper_1.EditHelper.merge(fix2, fix1);
54173
+ return issue_1.Issue.atToken(lowFile, firstToken, "Downport CORRESPONDING", this.getMetadata().key, this.conf.severity, fix);
54174
+ }
54175
+ return undefined;
54176
+ }
54066
54177
  outlineValue(low, high, lowFile, highSyntax) {
54067
54178
  var _a, _b, _c;
54068
54179
  if (!(low.get() instanceof _statement_1.Unknown)) {
@@ -54188,6 +54299,9 @@ ${indentation} output = ${topTarget}.`;
54188
54299
  indentation + `IF sy-subrc = 0.\n` +
54189
54300
  indentation + ` ${uniqueName} = ${rowName}${after}.\n` +
54190
54301
  indentation + `ENDIF.\n`;
54302
+ if (type.includes("LIKE DATA(")) {
54303
+ type = `LIKE LINE OF ${tabName}`;
54304
+ }
54191
54305
  }
54192
54306
  if (end !== "") {
54193
54307
  indentation = indentation.substring(2);
@@ -60883,7 +60997,6 @@ exports.ObjectNaming = exports.ObjectNamingConf = void 0;
60883
60997
  const issue_1 = __webpack_require__(/*! ../issue */ "./node_modules/@abaplint/core/build/src/issue.js");
60884
60998
  const _naming_rule_config_1 = __webpack_require__(/*! ./_naming_rule_config */ "./node_modules/@abaplint/core/build/src/rules/_naming_rule_config.js");
60885
60999
  const _irule_1 = __webpack_require__(/*! ./_irule */ "./node_modules/@abaplint/core/build/src/rules/_irule.js");
60886
- const Objects = __webpack_require__(/*! ../objects */ "./node_modules/@abaplint/core/build/src/objects/index.js");
60887
61000
  const name_validator_1 = __webpack_require__(/*! ../utils/name_validator */ "./node_modules/@abaplint/core/build/src/utils/name_validator.js");
60888
61001
  class ObjectNamingConf extends _naming_rule_config_1.NamingRuleConfig {
60889
61002
  constructor() {
@@ -60924,6 +61037,34 @@ class ObjectNamingConf extends _naming_rule_config_1.NamingRuleConfig {
60924
61037
  this.ssst = "^Z";
60925
61038
  /** The regex pattern for search helps */
60926
61039
  this.shlp = "^Z";
61040
+ /** The regex pattern for BADI Implementation */
61041
+ this.sxci = "^Z";
61042
+ /** The regex pattern for Enhancement Spot */
61043
+ this.enhs = "^Z";
61044
+ /** The regex pattern for Enhancement Implementation */
61045
+ this.enho = "^Z";
61046
+ /** The regex pattern for Customer enhancement projects */
61047
+ this.cmod = "^Z";
61048
+ /** The regex pattern for SAPscript form */
61049
+ this.form = "^Z";
61050
+ /** The regex pattern for Adobe Form Definition */
61051
+ this.sfpf = "^Z";
61052
+ /** The regex pattern for Adobe Interface Definition */
61053
+ this.sfpi = "^Z";
61054
+ /** The regex pattern for ABAP Query: Query */
61055
+ this.aqqu = "^Z";
61056
+ /** The regex pattern for ABAP Query: Functional area */
61057
+ this.aqsg = "^Z";
61058
+ /** The regex pattern for ABAP Query: User group */
61059
+ this.aqbg = "^Z";
61060
+ /** The regex pattern for Authorization Object */
61061
+ this.suso = "^Z";
61062
+ /** The regex pattern for Authorization Group */
61063
+ this.sucu = "^Z";
61064
+ /** The regex pattern for Web Dynpro Application */
61065
+ this.wdya = "^Z";
61066
+ /** The regex pattern for Web Dynpro Component */
61067
+ this.wdyn = "^Z";
60927
61068
  }
60928
61069
  }
60929
61070
  exports.ObjectNamingConf = ObjectNamingConf;
@@ -60945,6 +61086,9 @@ class ObjectNaming {
60945
61086
  "Object name must not match pattern " + expected + ": " + actual;
60946
61087
  }
60947
61088
  getConfig() {
61089
+ if (typeof this.conf === "boolean" && this.conf === true) {
61090
+ return new ObjectNamingConf();
61091
+ }
60948
61092
  return this.conf;
60949
61093
  }
60950
61094
  setConfig(conf) {
@@ -60955,66 +61099,14 @@ class ObjectNaming {
60955
61099
  }
60956
61100
  run(obj) {
60957
61101
  let message = undefined;
60958
- let pattern = "";
60959
61102
  if (this.conf.patternKind === undefined) {
60960
61103
  this.conf.patternKind = "required";
60961
61104
  }
60962
- const defaults = new ObjectNamingConf();
60963
- if (obj instanceof Objects.Class) {
60964
- pattern = this.getConfig().clas || defaults.clas;
60965
- }
60966
- else if (obj instanceof Objects.Interface) {
60967
- pattern = this.getConfig().intf || defaults.intf;
60968
- }
60969
- else if (obj instanceof Objects.Program) {
60970
- pattern = this.getConfig().prog || defaults.prog;
60971
- }
60972
- else if (obj instanceof Objects.FunctionGroup) {
60973
- pattern = this.getConfig().fugr || defaults.fugr;
60974
- }
60975
- else if (obj instanceof Objects.Table) {
60976
- pattern = this.getConfig().tabl || defaults.tabl;
60977
- }
60978
- else if (obj instanceof Objects.TableType) {
60979
- pattern = this.getConfig().ttyp || defaults.ttyp;
60980
- }
60981
- else if (obj instanceof Objects.DataElement) {
60982
- pattern = this.getConfig().dtel || defaults.dtel;
60983
- }
60984
- else if (obj instanceof Objects.Domain) {
60985
- pattern = this.getConfig().doma || defaults.doma;
60986
- }
60987
- else if (obj instanceof Objects.Transaction) {
60988
- pattern = this.getConfig().tran || defaults.tran;
60989
- }
60990
- else if (obj instanceof Objects.LockObject) {
60991
- pattern = this.getConfig().enqu || defaults.enqu;
60992
- }
60993
- else if (obj instanceof Objects.AuthorizationObject) {
60994
- pattern = this.getConfig().auth || defaults.auth;
60995
- }
60996
- else if (obj instanceof Objects.PackageInterface) {
60997
- pattern = this.getConfig().pinf || defaults.pinf;
60998
- }
60999
- else if (obj instanceof Objects.MessageClass) {
61000
- pattern = this.getConfig().msag || defaults.msag;
61001
- }
61002
- else if (obj instanceof Objects.Idoc) {
61003
- pattern = this.getConfig().idoc || defaults.idoc;
61004
- }
61005
- else if (obj instanceof Objects.Transformation) {
61006
- pattern = this.getConfig().xslt || defaults.xslt;
61007
- }
61008
- else if (obj instanceof Objects.SmartForm) {
61009
- pattern = this.getConfig().ssfo || defaults.ssfo;
61010
- }
61011
- else if (obj instanceof Objects.SmartStyle) {
61012
- pattern = this.getConfig().ssst || defaults.ssst;
61013
- }
61014
- else if (obj instanceof Objects.SearchHelp) {
61015
- pattern = this.getConfig().shlp || defaults.shlp;
61016
- }
61017
- if (pattern === "") {
61105
+ const abapType = obj.getType().toLowerCase();
61106
+ const config = this.getConfig();
61107
+ // @ts-ignore
61108
+ const pattern = config[abapType];
61109
+ if (pattern === undefined) {
61018
61110
  return [];
61019
61111
  }
61020
61112
  const regex = new RegExp(pattern, "i");
@@ -66093,6 +66185,12 @@ const _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ "./
66093
66185
  const _statement_1 = __webpack_require__(/*! ../abap/2_statements/statements/_statement */ "./node_modules/@abaplint/core/build/src/abap/2_statements/statements/_statement.js");
66094
66186
  const _irule_1 = __webpack_require__(/*! ./_irule */ "./node_modules/@abaplint/core/build/src/rules/_irule.js");
66095
66187
  class UnnecessaryPragmaConf extends _basic_rule_config_1.BasicRuleConfig {
66188
+ constructor() {
66189
+ super(...arguments);
66190
+ /** Allow NO_TEXT in global CLAS and INTF definitions,
66191
+ its added automatically by SE24 in some cases where it should not */
66192
+ this.allowNoTextGlobal = false;
66193
+ }
66096
66194
  }
66097
66195
  exports.UnnecessaryPragmaConf = UnnecessaryPragmaConf;
66098
66196
  class UnnecessaryPragma extends _abap_rule_1.ABAPRule {
@@ -66142,6 +66240,7 @@ ENDIF.`,
66142
66240
  runParsed(file) {
66143
66241
  const issues = [];
66144
66242
  let noHandler = false;
66243
+ let globalDefinition = false;
66145
66244
  const statements = file.getStatements();
66146
66245
  for (let i = 0; i < statements.length; i++) {
66147
66246
  const statement = statements[i];
@@ -66149,6 +66248,16 @@ ENDIF.`,
66149
66248
  if (statement.get() instanceof Statements.EndTry) {
66150
66249
  noHandler = false;
66151
66250
  }
66251
+ else if (statement.get() instanceof Statements.ClassDefinition
66252
+ || statement.get() instanceof Statements.Interface) {
66253
+ if (statement.findDirectExpression(Expressions.ClassGlobal)) {
66254
+ globalDefinition = true;
66255
+ }
66256
+ }
66257
+ else if (statement.get() instanceof Statements.EndClass
66258
+ || statement.get() instanceof Statements.EndInterface) {
66259
+ globalDefinition = false;
66260
+ }
66152
66261
  else if (statement.get() instanceof _statement_1.Comment) {
66153
66262
  continue;
66154
66263
  }
@@ -66161,9 +66270,16 @@ ENDIF.`,
66161
66270
  else {
66162
66271
  noHandler = this.containsNoHandler(statement, statements[i + 1]);
66163
66272
  }
66164
- issues.push(...this.checkText(statement, file));
66273
+ if (this.getConfig().allowNoTextGlobal === true && globalDefinition === true) {
66274
+ // skip
66275
+ }
66276
+ else {
66277
+ issues.push(...this.checkText(statement, file));
66278
+ }
66165
66279
  issues.push(...this.checkNeeded(statement, file));
66166
- issues.push(...this.checkSubrc(statement, nextStatement, file));
66280
+ if (globalDefinition === false) {
66281
+ issues.push(...this.checkSubrc(statement, nextStatement, file));
66282
+ }
66167
66283
  }
66168
66284
  return issues;
66169
66285
  }
@@ -74439,6 +74555,27 @@ exports.DeleteInternalTranspiler = DeleteInternalTranspiler;
74439
74555
 
74440
74556
  /***/ }),
74441
74557
 
74558
+ /***/ "./node_modules/@abaplint/transpiler/build/src/statements/delete_report.js":
74559
+ /*!*********************************************************************************!*\
74560
+ !*** ./node_modules/@abaplint/transpiler/build/src/statements/delete_report.js ***!
74561
+ \*********************************************************************************/
74562
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
74563
+
74564
+ "use strict";
74565
+
74566
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
74567
+ exports.DeleteReportTranspiler = void 0;
74568
+ const chunk_1 = __webpack_require__(/*! ../chunk */ "./node_modules/@abaplint/transpiler/build/src/chunk.js");
74569
+ class DeleteReportTranspiler {
74570
+ transpile(_node, _traversal) {
74571
+ return new chunk_1.Chunk(`throw new Error("DeleteReport, not supported, transpiler");`);
74572
+ }
74573
+ }
74574
+ exports.DeleteReportTranspiler = DeleteReportTranspiler;
74575
+ //# sourceMappingURL=delete_report.js.map
74576
+
74577
+ /***/ }),
74578
+
74442
74579
  /***/ "./node_modules/@abaplint/transpiler/build/src/statements/delete_textpool.js":
74443
74580
  /*!***********************************************************************************!*\
74444
74581
  !*** ./node_modules/@abaplint/transpiler/build/src/statements/delete_textpool.js ***!
@@ -75533,6 +75670,7 @@ __exportStar(__webpack_require__(/*! ./data */ "./node_modules/@abaplint/transpi
75533
75670
  __exportStar(__webpack_require__(/*! ./delete_database */ "./node_modules/@abaplint/transpiler/build/src/statements/delete_database.js"), exports);
75534
75671
  __exportStar(__webpack_require__(/*! ./delete_dataset */ "./node_modules/@abaplint/transpiler/build/src/statements/delete_dataset.js"), exports);
75535
75672
  __exportStar(__webpack_require__(/*! ./delete_internal */ "./node_modules/@abaplint/transpiler/build/src/statements/delete_internal.js"), exports);
75673
+ __exportStar(__webpack_require__(/*! ./delete_report */ "./node_modules/@abaplint/transpiler/build/src/statements/delete_report.js"), exports);
75536
75674
  __exportStar(__webpack_require__(/*! ./delete_textpool */ "./node_modules/@abaplint/transpiler/build/src/statements/delete_textpool.js"), exports);
75537
75675
  __exportStar(__webpack_require__(/*! ./describe */ "./node_modules/@abaplint/transpiler/build/src/statements/describe.js"), exports);
75538
75676
  __exportStar(__webpack_require__(/*! ./do */ "./node_modules/@abaplint/transpiler/build/src/statements/do.js"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/transpiler-cli",
3
- "version": "2.7.25",
3
+ "version": "2.7.27",
4
4
  "description": "Transpiler - Command Line Interface",
5
5
  "funding": "https://github.com/sponsors/larshp",
6
6
  "bin": {
@@ -26,14 +26,14 @@
26
26
  "author": "abaplint",
27
27
  "license": "MIT",
28
28
  "devDependencies": {
29
- "@abaplint/transpiler": "^2.7.25",
29
+ "@abaplint/transpiler": "^2.7.27",
30
30
  "@types/glob": "^7.2.0",
31
31
  "glob": "=7.2.0",
32
32
  "@types/progress": "^2.0.5",
33
- "@types/node": "^20.2.5",
34
- "@abaplint/core": "^2.101.16",
33
+ "@types/node": "^20.3.1",
34
+ "@abaplint/core": "^2.101.25",
35
35
  "progress": "^2.0.3",
36
- "webpack": "^5.86.0",
36
+ "webpack": "^5.88.0",
37
37
  "webpack-cli": "^5.1.4",
38
38
  "typescript": "^5.1.3"
39
39
  }