@abaplint/transpiler-cli 2.13.23 → 2.13.25

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 +126 -17
  2. package/package.json +3 -3
package/build/bundle.js CHANGED
@@ -6084,10 +6084,11 @@ exports.Or = Or;
6084
6084
  Object.defineProperty(exports, "__esModule", ({ value: true }));
6085
6085
  exports.ParameterException = void 0;
6086
6086
  const combi_1 = __webpack_require__(/*! ../combi */ "./node_modules/@abaplint/core/build/src/abap/2_statements/combi.js");
6087
+ const tokens_1 = __webpack_require__(/*! ../../1_lexer/tokens */ "./node_modules/@abaplint/core/build/src/abap/1_lexer/tokens/index.js");
6087
6088
  const _1 = __webpack_require__(/*! . */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js");
6088
6089
  class ParameterException extends combi_1.Expression {
6089
6090
  getRunnable() {
6090
- const name = (0, combi_1.altPrio)("OTHERS", _1.ParameterName);
6091
+ const name = (0, combi_1.altPrio)("OTHERS", (0, combi_1.seq)(_1.ParameterName, (0, combi_1.tok)(tokens_1.Dash), _1.ComponentName), _1.ParameterName);
6091
6092
  return (0, combi_1.seq)(name, (0, combi_1.optPrio)((0, combi_1.seq)("=", (0, combi_1.altPrio)(_1.Integer, _1.SimpleFieldChain), (0, combi_1.optPrio)((0, combi_1.seq)("MESSAGE", _1.Target)))));
6092
6093
  }
6093
6094
  }
@@ -22505,6 +22506,7 @@ const table_type_1 = __webpack_require__(/*! ../types/basic/table_type */ "./nod
22505
22506
  const enum_type_1 = __webpack_require__(/*! ../types/basic/enum_type */ "./node_modules/@abaplint/core/build/src/abap/types/basic/enum_type.js");
22506
22507
  const cgeneric_type_1 = __webpack_require__(/*! ../types/basic/cgeneric_type */ "./node_modules/@abaplint/core/build/src/abap/types/basic/cgeneric_type.js");
22507
22508
  const Expressions = __webpack_require__(/*! ../2_statements/expressions */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js");
22509
+ const nodes_1 = __webpack_require__(/*! ../nodes */ "./node_modules/@abaplint/core/build/src/abap/nodes/index.js");
22508
22510
  // todo: refactor to static? for performance
22509
22511
  class TypeUtils {
22510
22512
  constructor(scope) {
@@ -22755,6 +22757,18 @@ class TypeUtils {
22755
22757
  return false;
22756
22758
  }
22757
22759
  */
22760
+ var _a;
22761
+ if (node.getChildren().length === 4
22762
+ && node.getFirstChild() instanceof nodes_1.TokenNodeRegex
22763
+ && ((_a = node.getFirstChild()) === null || _a === void 0 ? void 0 : _a.concatTokens().toUpperCase()) === "BOOLC") {
22764
+ return true;
22765
+ }
22766
+ if (node.getChildren().length >= 3) {
22767
+ const second = node.getChildren()[1];
22768
+ if (second.getFirstToken().getStr() === "&&") {
22769
+ return true;
22770
+ }
22771
+ }
22758
22772
  const calculated = node.findFirstExpression(Expressions.MethodCallChain) !== undefined
22759
22773
  || node.findFirstExpression(Expressions.StringTemplate) !== undefined
22760
22774
  || node.findFirstExpression(Expressions.ArithOperator) !== undefined;
@@ -22768,7 +22782,7 @@ class TypeUtils {
22768
22782
  return this.isAssignable(source, target);
22769
22783
  }
22770
22784
  isAssignableStrict(source, target, node) {
22771
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
22785
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
22772
22786
  const calculated = node ? this.isCalculated(node) : false;
22773
22787
  /*
22774
22788
  console.dir(source);
@@ -22827,16 +22841,15 @@ class TypeUtils {
22827
22841
  else if (source instanceof basic_1.StringType) {
22828
22842
  if (target instanceof basic_1.StructureType && this.structureContainsString(target)) {
22829
22843
  return false;
22830
- /*
22831
- } else if (target instanceof CharacterType) {
22832
- if (source.getAbstractTypeData()?.derivedFromConstant === true) {
22833
- return true;
22844
+ }
22845
+ else if (target instanceof basic_1.CharacterType) {
22846
+ if (((_g = source.getAbstractTypeData()) === null || _g === void 0 ? void 0 : _g.derivedFromConstant) === true) {
22847
+ return true;
22834
22848
  }
22835
22849
  return false;
22836
- */
22837
22850
  }
22838
22851
  else if (target instanceof basic_1.IntegerType) {
22839
- if (((_g = source.getAbstractTypeData()) === null || _g === void 0 ? void 0 : _g.derivedFromConstant) === true) {
22852
+ if (((_h = source.getAbstractTypeData()) === null || _h === void 0 ? void 0 : _h.derivedFromConstant) === true) {
22840
22853
  return true;
22841
22854
  }
22842
22855
  return false;
@@ -22846,7 +22859,7 @@ class TypeUtils {
22846
22859
  return false;
22847
22860
  }
22848
22861
  else if (target instanceof basic_1.XSequenceType || target instanceof basic_1.XStringType) {
22849
- if (((_h = source.getAbstractTypeData()) === null || _h === void 0 ? void 0 : _h.derivedFromConstant) === true) {
22862
+ if (((_j = source.getAbstractTypeData()) === null || _j === void 0 ? void 0 : _j.derivedFromConstant) === true) {
22850
22863
  return true;
22851
22864
  }
22852
22865
  return false;
@@ -22890,7 +22903,7 @@ class TypeUtils {
22890
22903
  return false;
22891
22904
  }
22892
22905
  else if (target instanceof basic_1.Integer8Type || target instanceof basic_1.PackedType) {
22893
- if (((_j = source.getAbstractTypeData()) === null || _j === void 0 ? void 0 : _j.derivedFromConstant) === true) {
22906
+ if (((_k = source.getAbstractTypeData()) === null || _k === void 0 ? void 0 : _k.derivedFromConstant) === true) {
22894
22907
  return true;
22895
22908
  }
22896
22909
  return false;
@@ -25161,8 +25174,8 @@ class FieldChain {
25161
25174
  && node.findDirectExpression(Expressions.ComponentName)) {
25162
25175
  // workaround for names with dashes, eg. "sy-repid"
25163
25176
  const concat = node.concatTokens().replace(/ /g, "");
25164
- const offset = ((_b = node.findDirectExpression(Expressions.FieldOffset)) === null || _b === void 0 ? void 0 : _b.concatTokens()) || "";
25165
- const length = ((_c = node.findDirectExpression(Expressions.FieldLength)) === null || _c === void 0 ? void 0 : _c.concatTokens()) || "";
25177
+ const offset = ((_b = node.findDirectExpression(Expressions.FieldOffset)) === null || _b === void 0 ? void 0 : _b.concatTokens().replace(/ /g, "")) || "";
25178
+ const length = ((_c = node.findDirectExpression(Expressions.FieldLength)) === null || _c === void 0 ? void 0 : _c.concatTokens().replace(/ /g, "")) || "";
25166
25179
  const found = input.scope.findVariable(concat.replace(offset, "").replace(length, ""));
25167
25180
  if (found) {
25168
25181
  if (refType) {
@@ -29754,6 +29767,12 @@ class CallFunction {
29754
29767
  for (const s of node.findDirectExpressions(Expressions.Source)) {
29755
29768
  source_1.Source.runSyntax(s, input);
29756
29769
  }
29770
+ for (const d of node.findDirectExpressions(Expressions.Destination)) {
29771
+ const source = d.findFirstExpression(Expressions.Source);
29772
+ if (source) {
29773
+ source_1.Source.runSyntax(source, input);
29774
+ }
29775
+ }
29757
29776
  const fp = node.findDirectExpression(Expressions.FunctionParameters);
29758
29777
  if (fp) {
29759
29778
  function_parameters_1.FunctionParameters.runSyntax(fp, input);
@@ -31308,11 +31327,15 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
31308
31327
  exports.FetchNextCursor = void 0;
31309
31328
  const Expressions = __webpack_require__(/*! ../../2_statements/expressions */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js");
31310
31329
  const target_1 = __webpack_require__(/*! ../expressions/target */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/target.js");
31330
+ const sql_source_1 = __webpack_require__(/*! ../expressions/sql_source */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/sql_source.js");
31311
31331
  class FetchNextCursor {
31312
31332
  runSyntax(node, input) {
31313
31333
  for (const t of node.findAllExpressions(Expressions.Target)) {
31314
31334
  target_1.Target.runSyntax(t, input);
31315
31335
  }
31336
+ for (const s of node.findAllExpressions(Expressions.SQLSourceSimple)) {
31337
+ sql_source_1.SQLSource.runSyntax(s, input);
31338
+ }
31316
31339
  }
31317
31340
  }
31318
31341
  exports.FetchNextCursor = FetchNextCursor;
@@ -42215,6 +42238,7 @@ class Config {
42215
42238
  skipGeneratedProxyInterfaces: false,
42216
42239
  useApackDependencies: false,
42217
42240
  skipIncludesWithoutMain: false,
42241
+ errorOnDuplicateFilenames: false,
42218
42242
  },
42219
42243
  dependencies: [{
42220
42244
  url: "https://github.com/abaplint/deps",
@@ -42278,6 +42302,9 @@ class Config {
42278
42302
  if (this.config.global.skipIncludesWithoutMain === undefined) {
42279
42303
  this.config.global.skipIncludesWithoutMain = false;
42280
42304
  }
42305
+ if (this.config.global.errorOnDuplicateFilenames === undefined) {
42306
+ this.config.global.errorOnDuplicateFilenames = false;
42307
+ }
42281
42308
  this.checkVersion();
42282
42309
  }
42283
42310
  get() {
@@ -55195,7 +55222,7 @@ class Registry {
55195
55222
  }
55196
55223
  static abaplintVersion() {
55197
55224
  // magic, see build script "version.sh"
55198
- return "2.119.16";
55225
+ return "2.119.19";
55199
55226
  }
55200
55227
  getDDICReferences() {
55201
55228
  return this.ddicReferences;
@@ -55311,6 +55338,9 @@ class Registry {
55311
55338
  continue;
55312
55339
  }
55313
55340
  let found = this.findOrCreate(f.getObjectName(), f.getObjectType());
55341
+ if (this.conf.getGlobal().errorOnDuplicateFilenames === true) {
55342
+ this.checkDuplicateFilename(filename, found.getFiles());
55343
+ }
55314
55344
  if (dependency === false && found && this.isDependency(found)) {
55315
55345
  this.removeDependency(found);
55316
55346
  found = this.findOrCreate(f.getObjectName(), f.getObjectType());
@@ -55319,6 +55349,22 @@ class Registry {
55319
55349
  }
55320
55350
  return this;
55321
55351
  }
55352
+ checkDuplicateFilename(filename, files) {
55353
+ const basename = Registry.filenameBasename(filename);
55354
+ if (basename === "PACKAGE.DEVC.XML") {
55355
+ return;
55356
+ }
55357
+ for (const existingFile of files) {
55358
+ if (Registry.filenameBasename(existingFile.getFilename()) === basename) {
55359
+ throw new Error("Duplicate filename: " + filename + " already exists as " + existingFile.getFilename());
55360
+ }
55361
+ }
55362
+ }
55363
+ static filenameBasename(filename) {
55364
+ const normalized = filename.replace(/\\/g, "/");
55365
+ const last = normalized.split("/").pop();
55366
+ return (last !== null && last !== void 0 ? last : normalized).toUpperCase();
55367
+ }
55322
55368
  addFiles(files) {
55323
55369
  this._addFiles(files, false);
55324
55370
  return this;
@@ -72533,10 +72579,6 @@ class ParserBadExceptions extends _abap_rule_1.ABAPRule {
72533
72579
  title: "Parser Error, bad EXCEPTIONS in CALL FUNCTION",
72534
72580
  shortDescription: `Checks for syntax not recognized by abaplint, related to EXCEPTIONS in CALL FUNCTION.`,
72535
72581
  tags: [_irule_1.RuleTag.Syntax, _irule_1.RuleTag.SingleFile],
72536
- /*
72537
- badExample: `IF ( foo = 'bar').`,
72538
- goodExample: `IF ( foo = 'bar' ).`,
72539
- */
72540
72582
  };
72541
72583
  }
72542
72584
  getConfig() {
@@ -72551,6 +72593,15 @@ class ParserBadExceptions extends _abap_rule_1.ABAPRule {
72551
72593
  if (!(statement.get() instanceof Statements.CallFunction)) {
72552
72594
  continue;
72553
72595
  }
72596
+ const exceptionTokens = this.findExceptionTokens(statement);
72597
+ if (exceptionTokens !== undefined
72598
+ && this.containsMixedExceptionSyntax(statement.findAllExpressions(Expressions.ParameterException))) {
72599
+ const message = "Bad EXCEPTIONS syntax in CALL FUNCTION";
72600
+ for (const token of exceptionTokens) {
72601
+ issues.push(issue_1.Issue.atToken(file, token, message, this.getMetadata().key, this.conf.severity));
72602
+ }
72603
+ continue;
72604
+ }
72554
72605
  for (const e of statement.findAllExpressions(Expressions.ParameterException)) {
72555
72606
  if (e.findDirectTokenByText("=") === undefined) {
72556
72607
  const message = "Bad EXCEPTIONS syntax in CALL FUNCTION";
@@ -72560,6 +72611,18 @@ class ParserBadExceptions extends _abap_rule_1.ABAPRule {
72560
72611
  }
72561
72612
  return issues;
72562
72613
  }
72614
+ containsMixedExceptionSyntax(exceptions) {
72615
+ return exceptions.some(e => e.findDirectTokenByText("=") === undefined)
72616
+ && exceptions.some(e => e.findDirectTokenByText("=") !== undefined);
72617
+ }
72618
+ findExceptionTokens(statement) {
72619
+ const tokens = statement.getTokens();
72620
+ const index = tokens.findIndex(t => t.getStr().toUpperCase() === "EXCEPTIONS");
72621
+ if (index === -1) {
72622
+ return undefined;
72623
+ }
72624
+ return tokens.slice(index).filter(t => t.getStr() !== ".");
72625
+ }
72563
72626
  }
72564
72627
  exports.ParserBadExceptions = ParserBadExceptions;
72565
72628
  //# sourceMappingURL=parser_bad_exceptions.js.map
@@ -76256,6 +76319,7 @@ const _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ "./node_modules/@ab
76256
76319
  const Objects = __webpack_require__(/*! ../objects */ "./node_modules/@abaplint/core/build/src/objects/index.js");
76257
76320
  const _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ "./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js");
76258
76321
  const _irule_1 = __webpack_require__(/*! ./_irule */ "./node_modules/@abaplint/core/build/src/rules/_irule.js");
76322
+ const include_graph_1 = __webpack_require__(/*! ../utils/include_graph */ "./node_modules/@abaplint/core/build/src/utils/include_graph.js");
76259
76323
  class SuperclassFinalConf extends _basic_rule_config_1.BasicRuleConfig {
76260
76324
  }
76261
76325
  exports.SuperclassFinalConf = SuperclassFinalConf;
@@ -76263,6 +76327,7 @@ class SuperclassFinal extends _abap_rule_1.ABAPRule {
76263
76327
  constructor() {
76264
76328
  super(...arguments);
76265
76329
  this.conf = new SuperclassFinalConf();
76330
+ this.graph = undefined;
76266
76331
  }
76267
76332
  getMetadata() {
76268
76333
  return {
@@ -76301,6 +76366,9 @@ class SuperclassFinal extends _abap_rule_1.ABAPRule {
76301
76366
  }
76302
76367
  }
76303
76368
  }
76369
+ if (found === undefined && obj instanceof Objects.Program) {
76370
+ found = this.findInRelatedProgramIncludes(file, sup);
76371
+ }
76304
76372
  if (found === undefined) {
76305
76373
  const clas = this.reg.getObject("CLAS", sup);
76306
76374
  if (clas) {
@@ -76320,6 +76388,33 @@ class SuperclassFinal extends _abap_rule_1.ABAPRule {
76320
76388
  }
76321
76389
  return output;
76322
76390
  }
76391
+ findInRelatedProgramIncludes(file, superClassName) {
76392
+ if (this.graph === undefined) {
76393
+ this.graph = new include_graph_1.IncludeGraph(this.reg);
76394
+ }
76395
+ const mainFilenames = this.graph.listMainForInclude(file.getFilename());
76396
+ if (mainFilenames.length === 0) {
76397
+ return undefined;
76398
+ }
76399
+ for (const object of this.reg.getObjectsByType("PROG")) {
76400
+ if (!(object instanceof Objects.Program)) {
76401
+ continue;
76402
+ }
76403
+ const programFile = object.getMainABAPFile();
76404
+ if (programFile === undefined) {
76405
+ continue;
76406
+ }
76407
+ const programMainFilenames = this.graph.listMainForInclude(programFile.getFilename());
76408
+ if (mainFilenames.some(filename => programMainFilenames.includes(filename)) === false) {
76409
+ continue;
76410
+ }
76411
+ const found = programFile.getInfo().getClassDefinitionByName(superClassName);
76412
+ if (found !== undefined) {
76413
+ return found;
76414
+ }
76415
+ }
76416
+ return undefined;
76417
+ }
76323
76418
  }
76324
76419
  exports.SuperclassFinal = SuperclassFinal;
76325
76420
  //# sourceMappingURL=superclass_final.js.map
@@ -80618,6 +80713,9 @@ class DatabaseSetup {
80618
80713
  const populateTables = new populate_tables_1.PopulateTables(this.reg);
80619
80714
  // INSERT data
80620
80715
  for (const obj of this.reg.getObjects()) {
80716
+ if (options?.populateTables?.tadir !== false) {
80717
+ insert.push(populateTables.insertTADIR(obj));
80718
+ }
80621
80719
  if (obj instanceof abaplint.Objects.MessageClass) {
80622
80720
  insert.push(...populateTables.insertT100(obj));
80623
80721
  }
@@ -80667,6 +80765,7 @@ class PopulateTables {
80667
80765
  hasSEOSUBCOTX;
80668
80766
  hasT000;
80669
80767
  hasT100;
80768
+ hasTADIR;
80670
80769
  hasWWWPARAMS;
80671
80770
  constructor(reg) {
80672
80771
  this.hasREPOSRC = reg.getObject("TABL", "REPOSRC") !== undefined;
@@ -80675,6 +80774,7 @@ class PopulateTables {
80675
80774
  this.hasSEOSUBCOTX = reg.getObject("TABL", "SEOSUBCOTX") !== undefined;
80676
80775
  this.hasT000 = reg.getObject("TABL", "T000") !== undefined;
80677
80776
  this.hasT100 = reg.getObject("TABL", "T100") !== undefined;
80777
+ this.hasTADIR = reg.getObject("TABL", "TADIR") !== undefined;
80678
80778
  this.hasWWWPARAMS = reg.getObject("TABL", "WWWPARAMS") !== undefined;
80679
80779
  }
80680
80780
  insertREPOSRC(obj) {
@@ -80788,6 +80888,15 @@ class PopulateTables {
80788
80888
  // todo, this should take the client number from the json abap_transpile.json settings
80789
80889
  return `INSERT INTO t000 ("mandt", "cccategory", "ccnocliind") VALUES ('123', '', '');`;
80790
80890
  }
80891
+ insertTADIR(obj) {
80892
+ if (!this.hasTADIR) {
80893
+ return "";
80894
+ }
80895
+ const type = obj.getType().toUpperCase();
80896
+ const name = obj.getName().toUpperCase();
80897
+ return `INSERT INTO "tadir" ("pgmid", "object", "obj_name", "devclass", "korrnum", "srcsystem", "delflag", "genflag", "edtflag", "masterlang")
80898
+ VALUES ('R3TR', '${type}', '${this.escape(name)}', '$TMP', '', 'ABC', '', '', '', 'E');`;
80899
+ }
80791
80900
  insertWWWPARAMS(obj) {
80792
80901
  if (!this.hasWWWPARAMS) {
80793
80902
  return [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/transpiler-cli",
3
- "version": "2.13.23",
3
+ "version": "2.13.25",
4
4
  "description": "Transpiler - Command Line Interface",
5
5
  "funding": "https://github.com/sponsors/larshp",
6
6
  "bin": {
@@ -27,8 +27,8 @@
27
27
  "author": "abaplint",
28
28
  "license": "MIT",
29
29
  "devDependencies": {
30
- "@abaplint/core": "^2.119.16",
31
- "@abaplint/transpiler": "^2.13.23",
30
+ "@abaplint/core": "^2.119.19",
31
+ "@abaplint/transpiler": "^2.13.25",
32
32
  "@types/glob": "^8.1.0",
33
33
  "@types/node": "^24.12.2",
34
34
  "@types/progress": "^2.0.7",