@abaplint/transpiler-cli 2.5.3 → 2.5.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/build/bundle.js +72 -19
  2. package/package.json +3 -3
package/build/bundle.js CHANGED
@@ -8174,6 +8174,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
8174
8174
  exports.Assign = void 0;
8175
8175
  const combi_1 = __webpack_require__(/*! ../combi */ "./node_modules/@abaplint/core/build/src/abap/2_statements/combi.js");
8176
8176
  const expressions_1 = __webpack_require__(/*! ../expressions */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js");
8177
+ const version_1 = __webpack_require__(/*! ../../../version */ "./node_modules/@abaplint/core/build/src/version.js");
8177
8178
  class Assign {
8178
8179
  getMatcher() {
8179
8180
  const type = (0, combi_1.seq)("TYPE", (0, combi_1.altPrio)(expressions_1.Dynamic, expressions_1.TypeName));
@@ -8183,7 +8184,7 @@ class Assign {
8183
8184
  const decimals = (0, combi_1.seq)("DECIMALS", expressions_1.Source);
8184
8185
  const casting = (0, combi_1.seq)("CASTING", (0, combi_1.opt)((0, combi_1.alt)(like, handle, (0, combi_1.per)(type, decimals))));
8185
8186
  const obsoleteType = (0, combi_1.seq)("TYPE", expressions_1.Source, (0, combi_1.optPrio)(decimals));
8186
- const ret = (0, combi_1.seq)("ASSIGN", (0, combi_1.opt)((0, combi_1.seq)(expressions_1.Target, "INCREMENT")), expressions_1.AssignSource, "TO", expressions_1.FSTarget, (0, combi_1.opt)((0, combi_1.altPrio)(casting, obsoleteType)), (0, combi_1.opt)(range));
8187
+ const ret = (0, combi_1.seq)("ASSIGN", (0, combi_1.opt)((0, combi_1.seq)(expressions_1.Target, "INCREMENT")), expressions_1.AssignSource, "TO", expressions_1.FSTarget, (0, combi_1.opt)((0, combi_1.altPrio)(casting, obsoleteType)), (0, combi_1.opt)(range), (0, combi_1.opt)((0, combi_1.ver)(version_1.Version.v757, "ELSE UNASSIGN")));
8187
8188
  return ret;
8188
8189
  }
8189
8190
  }
@@ -21570,9 +21571,31 @@ exports.ComponentChain = ComponentChain;
21570
21571
  Object.defineProperty(exports, "__esModule", ({ value: true }));
21571
21572
  exports.ComponentCompare = void 0;
21572
21573
  const Expressions = __webpack_require__(/*! ../../2_statements/expressions */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js");
21574
+ const basic_1 = __webpack_require__(/*! ../../types/basic */ "./node_modules/@abaplint/core/build/src/abap/types/basic/index.js");
21573
21575
  const source_1 = __webpack_require__(/*! ./source */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/source.js");
21574
21576
  class ComponentCompare {
21575
- runSyntax(node, scope, filename) {
21577
+ runSyntax(node, scope, filename, type) {
21578
+ const chain = node.findDirectExpression(Expressions.ComponentChainSimple);
21579
+ if (chain === undefined) {
21580
+ throw new Error("ComponentCompare, chain not found");
21581
+ }
21582
+ // todo, handle deep chain
21583
+ if (chain.getChildren().length === 1
21584
+ && type !== undefined
21585
+ && !(type instanceof basic_1.VoidType)
21586
+ && !(type instanceof basic_1.UnknownType)
21587
+ && !(type instanceof basic_1.AnyType)) {
21588
+ const fieldName = chain.concatTokens();
21589
+ if (fieldName.toLowerCase() !== "table_line") {
21590
+ if (!(type instanceof basic_1.StructureType)) {
21591
+ throw new Error("ComponentCompare, source not structured");
21592
+ }
21593
+ if (type.getComponentByName(fieldName) === undefined) {
21594
+ throw new Error("Component " + fieldName + " not part of structure");
21595
+ }
21596
+ // todo, check type compatibility
21597
+ }
21598
+ }
21576
21599
  for (const s of node.findDirectExpressions(Expressions.Source)) {
21577
21600
  new source_1.Source().runSyntax(s, scope, filename);
21578
21601
  }
@@ -21636,15 +21659,15 @@ exports.ComponentCond = void 0;
21636
21659
  const Expressions = __webpack_require__(/*! ../../2_statements/expressions */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js");
21637
21660
  const component_compare_1 = __webpack_require__(/*! ./component_compare */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/component_compare.js");
21638
21661
  class ComponentCond {
21639
- runSyntax(node, scope, filename) {
21662
+ runSyntax(node, scope, filename, type) {
21640
21663
  for (const t of node.findDirectExpressions(Expressions.ComponentCondSub)) {
21641
21664
  const c = t.findDirectExpression(Expressions.ComponentCond);
21642
21665
  if (c) {
21643
- new ComponentCond().runSyntax(c, scope, filename);
21666
+ new ComponentCond().runSyntax(c, scope, filename, type);
21644
21667
  }
21645
21668
  }
21646
21669
  for (const t of node.findDirectExpressions(Expressions.ComponentCompare)) {
21647
- new component_compare_1.ComponentCompare().runSyntax(t, scope, filename);
21670
+ new component_compare_1.ComponentCompare().runSyntax(t, scope, filename, type);
21648
21671
  }
21649
21672
  }
21650
21673
  }
@@ -22546,7 +22569,7 @@ const basic_types_1 = __webpack_require__(/*! ../basic_types */ "./node_modules/
22546
22569
  const unknown_type_1 = __webpack_require__(/*! ../../types/basic/unknown_type */ "./node_modules/@abaplint/core/build/src/abap/types/basic/unknown_type.js");
22547
22570
  const _reference_1 = __webpack_require__(/*! ../_reference */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_reference.js");
22548
22571
  class InlineFieldDefinition {
22549
- runSyntax(node, scope, filename) {
22572
+ runSyntax(node, scope, filename, targetType) {
22550
22573
  var _a;
22551
22574
  let type = undefined;
22552
22575
  const field = (_a = node.findDirectExpression(Expressions.Field)) === null || _a === void 0 ? void 0 : _a.getFirstToken();
@@ -22561,6 +22584,9 @@ class InlineFieldDefinition {
22561
22584
  if (typeName) {
22562
22585
  type = new basic_types_1.BasicTypes(filename, scope).parseType(typeName);
22563
22586
  }
22587
+ if (targetType !== undefined) {
22588
+ type = targetType;
22589
+ }
22564
22590
  if (type === undefined) {
22565
22591
  type = new unknown_type_1.UnknownType("InlineFieldDefinition, fallback");
22566
22592
  }
@@ -23681,7 +23707,7 @@ const reduce_next_1 = __webpack_require__(/*! ./reduce_next */ "./node_modules/@
23681
23707
  const let_1 = __webpack_require__(/*! ./let */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/let.js");
23682
23708
  const _scope_type_1 = __webpack_require__(/*! ../_scope_type */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_scope_type.js");
23683
23709
  class ReduceBody {
23684
- runSyntax(node, scope, filename) {
23710
+ runSyntax(node, scope, filename, targetType) {
23685
23711
  if (node === undefined) {
23686
23712
  return;
23687
23713
  }
@@ -23696,7 +23722,7 @@ class ReduceBody {
23696
23722
  scope.push(_scope_type_1.ScopeType.Let, "LET", node.getFirstToken().getStart(), filename);
23697
23723
  scoped = true;
23698
23724
  }
23699
- const found = new inline_field_definition_1.InlineFieldDefinition().runSyntax(i, scope, filename);
23725
+ const found = new inline_field_definition_1.InlineFieldDefinition().runSyntax(i, scope, filename, targetType);
23700
23726
  if (found && first === undefined) {
23701
23727
  first = found;
23702
23728
  }
@@ -23926,7 +23952,7 @@ class Source {
23926
23952
  case "REDUCE":
23927
23953
  {
23928
23954
  const foundType = this.determineType(node, scope, filename, targetType);
23929
- const bodyType = new reduce_body_1.ReduceBody().runSyntax(node.findDirectExpression(Expressions.ReduceBody), scope, filename);
23955
+ const bodyType = new reduce_body_1.ReduceBody().runSyntax(node.findDirectExpression(Expressions.ReduceBody), scope, filename, foundType);
23930
23956
  if (foundType === undefined) {
23931
23957
  this.addIfInferred(node, scope, filename, bodyType);
23932
23958
  }
@@ -27457,7 +27483,6 @@ const source_1 = __webpack_require__(/*! ../expressions/source */ "./node_module
27457
27483
  const inline_data_1 = __webpack_require__(/*! ../expressions/inline_data */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/inline_data.js");
27458
27484
  const inline_fs_1 = __webpack_require__(/*! ../expressions/inline_fs */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/inline_fs.js");
27459
27485
  const fstarget_1 = __webpack_require__(/*! ../expressions/fstarget */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/fstarget.js");
27460
- const component_compare_1 = __webpack_require__(/*! ../expressions/component_compare */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/component_compare.js");
27461
27486
  const component_cond_1 = __webpack_require__(/*! ../expressions/component_cond */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/component_cond.js");
27462
27487
  const dynamic_1 = __webpack_require__(/*! ../expressions/dynamic */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/dynamic.js");
27463
27488
  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");
@@ -27476,6 +27501,7 @@ class Loop {
27476
27501
  firstSource = sources[0];
27477
27502
  }
27478
27503
  let sourceType = firstSource ? new source_1.Source().runSyntax(firstSource, scope, filename, targetType) : undefined;
27504
+ let rowType = undefined;
27479
27505
  const concat = node.concatTokens().toUpperCase();
27480
27506
  if (sourceType === undefined) {
27481
27507
  throw new Error("No source type determined");
@@ -27497,7 +27523,8 @@ class Loop {
27497
27523
  }
27498
27524
  if (sourceType instanceof basic_1.TableType) {
27499
27525
  const targetConcat = (_a = node.findDirectExpression(Expressions.LoopTarget)) === null || _a === void 0 ? void 0 : _a.concatTokens().toUpperCase();
27500
- sourceType = sourceType.getRowType();
27526
+ rowType = sourceType.getRowType();
27527
+ sourceType = rowType;
27501
27528
  if (targetConcat === null || targetConcat === void 0 ? void 0 : targetConcat.startsWith("REFERENCE INTO ")) {
27502
27529
  sourceType = new basic_1.DataReference(sourceType);
27503
27530
  }
@@ -27522,11 +27549,8 @@ class Loop {
27522
27549
  new fstarget_1.FSTarget().runSyntax(fstarget, scope, filename, sourceType);
27523
27550
  }
27524
27551
  }
27525
- for (const t of node.findDirectExpressions(Expressions.ComponentCompare)) {
27526
- new component_compare_1.ComponentCompare().runSyntax(t, scope, filename);
27527
- }
27528
27552
  for (const t of node.findDirectExpressions(Expressions.ComponentCond)) {
27529
- new component_cond_1.ComponentCond().runSyntax(t, scope, filename);
27553
+ new component_cond_1.ComponentCond().runSyntax(t, scope, filename, rowType);
27530
27554
  }
27531
27555
  for (const t of node.findDirectExpressions(Expressions.Dynamic)) {
27532
27556
  new dynamic_1.Dynamic().runSyntax(t, scope, filename);
@@ -46013,7 +46037,7 @@ class Registry {
46013
46037
  }
46014
46038
  static abaplintVersion() {
46015
46039
  // magic, see build script "version.sh"
46016
- return "2.95.22";
46040
+ return "2.95.24";
46017
46041
  }
46018
46042
  getDDICReferences() {
46019
46043
  return this.references;
@@ -64301,6 +64325,7 @@ const objects_1 = __webpack_require__(/*! ../objects */ "./node_modules/@abaplin
64301
64325
  const _reference_1 = __webpack_require__(/*! ../abap/5_syntax/_reference */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_reference.js");
64302
64326
  const visibility_1 = __webpack_require__(/*! ../abap/4_file_information/visibility */ "./node_modules/@abaplint/core/build/src/abap/4_file_information/visibility.js");
64303
64327
  const edit_helper_1 = __webpack_require__(/*! ../edit_helper */ "./node_modules/@abaplint/core/build/src/edit_helper.js");
64328
+ const _statement_1 = __webpack_require__(/*! ../abap/2_statements/statements/_statement */ "./node_modules/@abaplint/core/build/src/abap/2_statements/statements/_statement.js");
64304
64329
  class UnusedMethodsConf extends _basic_rule_config_1.BasicRuleConfig {
64305
64330
  }
64306
64331
  exports.UnusedMethodsConf = UnusedMethodsConf;
@@ -64348,6 +64373,8 @@ class UnusedMethods {
64348
64373
  shortDescription: `Checks for unused methods`,
64349
64374
  extendedInformation: `Checks private and protected methods.
64350
64375
 
64376
+ Unused methods are not reported if the object contains parser or syntax errors.
64377
+
64351
64378
  Skips:
64352
64379
  * methods FOR TESTING
64353
64380
  * methods SETUP + TEARDOWN + CLASS_SETUP + CLASS_TEARDOWN in testclasses
@@ -64380,6 +64407,13 @@ Skips:
64380
64407
  else if (obj instanceof objects_1.Program && obj.isInclude() === true) {
64381
64408
  return [];
64382
64409
  }
64410
+ for (const file of obj.getABAPFiles()) {
64411
+ for (const statement of file.getStatements()) {
64412
+ if (statement.get() instanceof _statement_1.Unknown) {
64413
+ return []; // contains parser errors
64414
+ }
64415
+ }
64416
+ }
64383
64417
  // dont report anything when there are syntax errors
64384
64418
  const syntax = new syntax_1.SyntaxLogic(this.reg, obj).run();
64385
64419
  if (syntax.issues.length > 0) {
@@ -64492,6 +64526,7 @@ const _abap_object_1 = __webpack_require__(/*! ../objects/_abap_object */ "./nod
64492
64526
  const _scope_type_1 = __webpack_require__(/*! ../abap/5_syntax/_scope_type */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_scope_type.js");
64493
64527
  const edit_helper_1 = __webpack_require__(/*! ../edit_helper */ "./node_modules/@abaplint/core/build/src/edit_helper.js");
64494
64528
  const _reference_1 = __webpack_require__(/*! ../abap/5_syntax/_reference */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_reference.js");
64529
+ const _statement_1 = __webpack_require__(/*! ../abap/2_statements/statements/_statement */ "./node_modules/@abaplint/core/build/src/abap/2_statements/statements/_statement.js");
64495
64530
  class WorkArea {
64496
64531
  constructor() {
64497
64532
  this.workarea = [];
@@ -64538,6 +64573,7 @@ class UnusedTypes {
64538
64573
  key: "unused_types",
64539
64574
  title: "Unused types",
64540
64575
  shortDescription: `Checks for unused TYPE definitions`,
64576
+ extendedInformation: `Unused types are not reported if the object contains parser or syntax errors.`,
64541
64577
  tags: [_irule_1.RuleTag.Quickfix],
64542
64578
  pragma: "##NEEDED",
64543
64579
  };
@@ -64559,6 +64595,13 @@ class UnusedTypes {
64559
64595
  if (!(obj instanceof _abap_object_1.ABAPObject)) {
64560
64596
  return [];
64561
64597
  }
64598
+ for (const file of obj.getABAPFiles()) {
64599
+ for (const statement of file.getStatements()) {
64600
+ if (statement.get() instanceof _statement_1.Unknown) {
64601
+ return []; // contains parser errors
64602
+ }
64603
+ }
64604
+ }
64562
64605
  // dont report unused variables when there are syntax errors
64563
64606
  const syntax = new syntax_1.SyntaxLogic(this.reg, obj).run();
64564
64607
  if (syntax.issues.length > 0) {
@@ -64730,7 +64773,9 @@ class UnusedVariables {
64730
64773
 
64731
64774
  Note that this currently does not work if the source code uses macros.
64732
64775
 
64733
- Unused variables are not reported if the object contains syntax errors. Errors found in INCLUDES are reported for the main program.`,
64776
+ Unused variables are not reported if the object contains parser or syntax errors.
64777
+
64778
+ Errors found in INCLUDES are reported for the main program.`,
64734
64779
  tags: [_irule_1.RuleTag.Quickfix],
64735
64780
  pragma: "##NEEDED",
64736
64781
  pseudoComment: "EC NEEDED",
@@ -64756,10 +64801,17 @@ Unused variables are not reported if the object contains syntax errors. Errors f
64756
64801
  else if (obj instanceof objects_1.Interface) { // todo, how to handle interfaces?
64757
64802
  return [];
64758
64803
  }
64804
+ for (const file of obj.getABAPFiles()) {
64805
+ for (const statement of file.getStatements()) {
64806
+ if (statement.get() instanceof _statement_1.Unknown) {
64807
+ return []; // contains parser errors
64808
+ }
64809
+ }
64810
+ }
64759
64811
  // dont report unused variables when there are syntax errors
64760
64812
  const syntax = new syntax_1.SyntaxLogic(this.reg, obj).run();
64761
64813
  if (syntax.issues.length > 0) {
64762
- return [];
64814
+ return []; // contains syntax errors
64763
64815
  }
64764
64816
  this.workarea = new WorkArea();
64765
64817
  const top = syntax.spaghetti.getTop();
@@ -66324,9 +66376,10 @@ var Version;
66324
66376
  Version["v754"] = "v754";
66325
66377
  Version["v755"] = "v755";
66326
66378
  Version["v756"] = "v756";
66379
+ Version["v757"] = "v757";
66327
66380
  Version["Cloud"] = "Cloud";
66328
66381
  })(Version = exports.Version || (exports.Version = {}));
66329
- exports.defaultVersion = Version.v756;
66382
+ exports.defaultVersion = Version.v757;
66330
66383
  function getPreviousVersion(v) {
66331
66384
  if (v === Version.OpenABAP) {
66332
66385
  return Version.v702;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/transpiler-cli",
3
- "version": "2.5.3",
3
+ "version": "2.5.5",
4
4
  "description": "Transpiler - Command Line Interface",
5
5
  "bin": {
6
6
  "abap_transpile": "./abap_transpile"
@@ -25,11 +25,11 @@
25
25
  "author": "abaplint",
26
26
  "license": "MIT",
27
27
  "devDependencies": {
28
- "@abaplint/transpiler": "^2.5.3",
28
+ "@abaplint/transpiler": "^2.5.5",
29
29
  "@types/glob": "^7.2.0",
30
30
  "glob": "=7.2.0",
31
31
  "@types/progress": "^2.0.5",
32
- "@abaplint/core": "^2.95.22",
32
+ "@abaplint/core": "^2.95.24",
33
33
  "progress": "^2.0.3",
34
34
  "webpack": "^5.75.0",
35
35
  "webpack-cli": "^5.0.1",