@abaplint/transpiler-cli 2.6.34 → 2.6.36

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 +177 -9
  2. package/package.json +4 -4
package/build/bundle.js CHANGED
@@ -4120,6 +4120,7 @@ __exportStar(__webpack_require__(/*! ./component_compare */ "./node_modules/@aba
4120
4120
  __exportStar(__webpack_require__(/*! ./component_cond_sub */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/component_cond_sub.js"), exports);
4121
4121
  __exportStar(__webpack_require__(/*! ./component_cond */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/component_cond.js"), exports);
4122
4122
  __exportStar(__webpack_require__(/*! ./component_name */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/component_name.js"), exports);
4123
+ __exportStar(__webpack_require__(/*! ./sql_fields */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/sql_fields.js"), exports);
4123
4124
  __exportStar(__webpack_require__(/*! ./concatenated_constant */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/concatenated_constant.js"), exports);
4124
4125
  __exportStar(__webpack_require__(/*! ./cond_body */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/cond_body.js"), exports);
4125
4126
  __exportStar(__webpack_require__(/*! ./cond_sub */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/cond_sub.js"), exports);
@@ -5753,10 +5754,14 @@ class Select extends combi_1.Expression {
5753
5754
  const where = (0, combi_1.seq)("WHERE", _1.SQLCond);
5754
5755
  const offset = (0, combi_1.ver)(version_1.Version.v751, (0, combi_1.seq)("OFFSET", _1.SQLSource));
5755
5756
  const bypass = (0, combi_1.str)("BYPASSING BUFFER");
5756
- const fields = (0, combi_1.seq)("FIELDS", _1.SQLFieldList);
5757
+ const fields = (0, combi_1.ver)(version_1.Version.v750, _1.SQLFields);
5757
5758
  const perm = (0, combi_1.per)(_1.SQLFrom, into, _1.SQLForAllEntries, where, _1.SQLOrderBy, sql_up_to_1.SQLUpTo, offset, _1.SQLClient, _1.SQLHaving, bypass, sql_group_by_1.SQLGroupBy, fields, _1.DatabaseConnection);
5759
+ const permSingle = (0, combi_1.per)(_1.SQLFrom, sql_into_structure_1.SQLIntoStructure, where, _1.SQLClient, bypass, fields, _1.DatabaseConnection);
5758
5760
  const paren = (0, combi_1.seq)((0, combi_1.tok)(tokens_1.WParenLeftW), sql_field_name_1.SQLFieldName, (0, combi_1.tok)(tokens_1.WParenRightW));
5759
- const ret = (0, combi_1.seq)("SELECT", (0, combi_1.altPrio)("DISTINCT", (0, combi_1.optPrio)((0, combi_1.seq)("SINGLE", (0, combi_1.optPrio)("FOR UPDATE")))), (0, combi_1.optPrio)((0, combi_1.altPrio)(_1.SQLFieldList, paren)), perm, (0, combi_1.optPrio)(_1.SQLHints));
5761
+ const fieldList = (0, combi_1.optPrio)((0, combi_1.altPrio)(_1.SQLFieldList, paren));
5762
+ const single = (0, combi_1.seq)("SINGLE", (0, combi_1.optPrio)("FOR UPDATE"), fieldList, permSingle);
5763
+ const other = (0, combi_1.seq)((0, combi_1.optPrio)("DISTINCT"), fieldList, perm);
5764
+ const ret = (0, combi_1.seq)("SELECT", (0, combi_1.altPrio)(single, other), (0, combi_1.optPrio)(_1.SQLHints));
5760
5765
  return ret;
5761
5766
  }
5762
5767
  }
@@ -5780,10 +5785,10 @@ const _1 = __webpack_require__(/*! . */ "./node_modules/@abaplint/core/build/src
5780
5785
  const sql_order_by_1 = __webpack_require__(/*! ./sql_order_by */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/sql_order_by.js");
5781
5786
  const sql_having_1 = __webpack_require__(/*! ./sql_having */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/sql_having.js");
5782
5787
  const sql_into_structure_1 = __webpack_require__(/*! ./sql_into_structure */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/sql_into_structure.js");
5783
- const sql_field_list_1 = __webpack_require__(/*! ./sql_field_list */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/sql_field_list.js");
5784
5788
  const sql_hints_1 = __webpack_require__(/*! ./sql_hints */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/sql_hints.js");
5785
5789
  const sql_field_list_loop_1 = __webpack_require__(/*! ./sql_field_list_loop */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/sql_field_list_loop.js");
5786
5790
  const sql_up_to_1 = __webpack_require__(/*! ./sql_up_to */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/sql_up_to.js");
5791
+ const version_1 = __webpack_require__(/*! ../../../version */ "./node_modules/@abaplint/core/build/src/version.js");
5787
5792
  class SelectLoop extends combi_1.Expression {
5788
5793
  getRunnable() {
5789
5794
  const where = (0, combi_1.seq)("WHERE", _1.SQLCond);
@@ -5792,7 +5797,7 @@ class SelectLoop extends combi_1.Expression {
5792
5797
  const tab = (0, combi_1.seq)(_1.SQLIntoTable, (0, combi_1.alt)(pack, (0, combi_1.seq)(_1.SQLFrom, pack), (0, combi_1.seq)(pack, _1.SQLFrom)));
5793
5798
  const packTab = (0, combi_1.seq)(pack, _1.SQLIntoTable);
5794
5799
  const perm = (0, combi_1.per)(_1.SQLFrom, where, sql_up_to_1.SQLUpTo, sql_order_by_1.SQLOrderBy, sql_having_1.SQLHaving, _1.SQLClient, bypass, _1.SQLGroupBy, _1.SQLForAllEntries, (0, combi_1.alt)(tab, sql_into_structure_1.SQLIntoStructure, packTab));
5795
- const strict = (0, combi_1.seq)(_1.SQLFrom, "FIELDS", sql_field_list_1.SQLFieldList, where, sql_into_structure_1.SQLIntoStructure, sql_up_to_1.SQLUpTo);
5800
+ const strict = (0, combi_1.seq)(_1.SQLFrom, (0, combi_1.ver)(version_1.Version.v750, _1.SQLFields), where, sql_into_structure_1.SQLIntoStructure, sql_up_to_1.SQLUpTo);
5796
5801
  const ret = (0, combi_1.seq)("SELECT", (0, combi_1.altPrio)((0, combi_1.seq)((0, combi_1.optPrio)("DISTINCT"), sql_field_list_loop_1.SQLFieldListLoop, perm), strict), (0, combi_1.optPrio)(sql_hints_1.SQLHints));
5797
5802
  return ret;
5798
5803
  }
@@ -6498,6 +6503,28 @@ exports.SQLFieldName = SQLFieldName;
6498
6503
 
6499
6504
  /***/ }),
6500
6505
 
6506
+ /***/ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/sql_fields.js":
6507
+ /*!*******************************************************************************************!*\
6508
+ !*** ./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/sql_fields.js ***!
6509
+ \*******************************************************************************************/
6510
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
6511
+
6512
+ "use strict";
6513
+
6514
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
6515
+ exports.SQLFields = void 0;
6516
+ const combi_1 = __webpack_require__(/*! ../combi */ "./node_modules/@abaplint/core/build/src/abap/2_statements/combi.js");
6517
+ const _1 = __webpack_require__(/*! . */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js");
6518
+ class SQLFields extends combi_1.Expression {
6519
+ getRunnable() {
6520
+ return (0, combi_1.seq)("FIELDS", _1.SQLFieldList);
6521
+ }
6522
+ }
6523
+ exports.SQLFields = SQLFields;
6524
+ //# sourceMappingURL=sql_fields.js.map
6525
+
6526
+ /***/ }),
6527
+
6501
6528
  /***/ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/sql_for_all_entries.js":
6502
6529
  /*!****************************************************************************************************!*\
6503
6530
  !*** ./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/sql_for_all_entries.js ***!
@@ -46523,7 +46550,7 @@ class Registry {
46523
46550
  }
46524
46551
  static abaplintVersion() {
46525
46552
  // magic, see build script "version.sh"
46526
- return "2.97.17";
46553
+ return "2.98.3";
46527
46554
  }
46528
46555
  getDDICReferences() {
46529
46556
  return this.references;
@@ -47056,7 +47083,7 @@ https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#abap-doc-on
47056
47083
  var _a, _b;
47057
47084
  const issues = [];
47058
47085
  const rows = file.getRawRows();
47059
- const regexEmptyTags = '^\\"! .*<[^>]*><';
47086
+ const regexEmptyTags = '^\\"! .*<[^/>]*><\\/';
47060
47087
  const regexEmptyAbapdoc = '^\\"!.+$';
47061
47088
  const regexEmptyParameterName = '^\\"! @parameter .+\\|';
47062
47089
  let methods = [];
@@ -49761,6 +49788,8 @@ class ColonMissingSpace extends _abap_rule_1.ABAPRule {
49761
49788
  title: "Colon missing space",
49762
49789
  shortDescription: `Checks for missing spaces after colons in chained statements.`,
49763
49790
  tags: [_irule_1.RuleTag.Whitespace, _irule_1.RuleTag.Quickfix, _irule_1.RuleTag.SingleFile],
49791
+ badExample: `WRITE:hello, world.`,
49792
+ goodExample: `WRITE: hello, world.`,
49764
49793
  };
49765
49794
  }
49766
49795
  getMessage() {
@@ -51519,6 +51548,10 @@ Only one transformation is applied to a statement at a time, so multiple steps m
51519
51548
  return found;
51520
51549
  }
51521
51550
  }
51551
+ found = this.downportSelectFields(low, high, lowFile, highSyntax);
51552
+ if (found) {
51553
+ return found;
51554
+ }
51522
51555
  found = this.outlineSwitch(low, high, lowFile, highSyntax);
51523
51556
  if (found) {
51524
51557
  return found;
@@ -51688,6 +51721,27 @@ Only one transformation is applied to a statement at a time, so multiple steps m
51688
51721
  }
51689
51722
  return undefined;
51690
51723
  }
51724
+ downportSelectFields(low, high, lowFile, _highSyntax) {
51725
+ var _a;
51726
+ if (!(low.get() instanceof _statement_1.Unknown)) {
51727
+ return undefined;
51728
+ }
51729
+ else if (!(high.get() instanceof Statements.Select)) {
51730
+ return undefined;
51731
+ }
51732
+ const fields = high.findFirstExpression(Expressions.SQLFields);
51733
+ if (fields === undefined) {
51734
+ return undefined;
51735
+ }
51736
+ const code = (_a = fields.getLastChild()) === null || _a === void 0 ? void 0 : _a.concatTokens();
51737
+ if (code === undefined) {
51738
+ return undefined;
51739
+ }
51740
+ const fix1 = edit_helper_1.EditHelper.deleteRange(lowFile, fields.getFirstToken().getStart(), fields.getLastToken().getEnd());
51741
+ const fix2 = edit_helper_1.EditHelper.insertAt(lowFile, high.getFirstToken().getEnd(), " " + code);
51742
+ const fix = edit_helper_1.EditHelper.merge(fix1, fix2);
51743
+ return issue_1.Issue.atToken(lowFile, fields.getFirstToken(), "Replace FIELDS", this.getMetadata().key, this.conf.severity, fix);
51744
+ }
51691
51745
  downportSelectSingleInline(low, high, lowFile, _highSyntax) {
51692
51746
  var _a, _b, _c, _d;
51693
51747
  if (!(low.get() instanceof _statement_1.Unknown)) {
@@ -54899,7 +54953,7 @@ DATA lt_bar TYPE STANDARD TABLE OF ty.`,
54899
54953
  const message = "Specify table type";
54900
54954
  issues.push(issue_1.Issue.atStatement(file, statement, message, this.getMetadata().key, this.conf.severity));
54901
54955
  }
54902
- else if (concat.includes(" WITH ") === false) {
54956
+ else if (concat.includes(" WITH ") === false && concat.includes(" RANGE OF ") === false) {
54903
54957
  const message = "Specify table key";
54904
54958
  issues.push(issue_1.Issue.atStatement(file, statement, message, this.getMetadata().key, this.conf.severity));
54905
54959
  }
@@ -56478,6 +56532,7 @@ __exportStar(__webpack_require__(/*! ./remove_descriptions */ "./node_modules/@a
56478
56532
  __exportStar(__webpack_require__(/*! ./rfc_error_handling */ "./node_modules/@abaplint/core/build/src/rules/rfc_error_handling.js"), exports);
56479
56533
  __exportStar(__webpack_require__(/*! ./select_add_order_by */ "./node_modules/@abaplint/core/build/src/rules/select_add_order_by.js"), exports);
56480
56534
  __exportStar(__webpack_require__(/*! ./select_performance */ "./node_modules/@abaplint/core/build/src/rules/select_performance.js"), exports);
56535
+ __exportStar(__webpack_require__(/*! ./select_single_full_key */ "./node_modules/@abaplint/core/build/src/rules/select_single_full_key.js"), exports);
56481
56536
  __exportStar(__webpack_require__(/*! ./selection_screen_naming */ "./node_modules/@abaplint/core/build/src/rules/selection_screen_naming.js"), exports);
56482
56537
  __exportStar(__webpack_require__(/*! ./sequential_blank */ "./node_modules/@abaplint/core/build/src/rules/sequential_blank.js"), exports);
56483
56538
  __exportStar(__webpack_require__(/*! ./short_case */ "./node_modules/@abaplint/core/build/src/rules/short_case.js"), exports);
@@ -62628,6 +62683,118 @@ exports.SelectPerformance = SelectPerformance;
62628
62683
 
62629
62684
  /***/ }),
62630
62685
 
62686
+ /***/ "./node_modules/@abaplint/core/build/src/rules/select_single_full_key.js":
62687
+ /*!*******************************************************************************!*\
62688
+ !*** ./node_modules/@abaplint/core/build/src/rules/select_single_full_key.js ***!
62689
+ \*******************************************************************************/
62690
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
62691
+
62692
+ "use strict";
62693
+
62694
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
62695
+ exports.SelectSingleFullKey = exports.SelectSingleFullKeyConf = void 0;
62696
+ const issue_1 = __webpack_require__(/*! ../issue */ "./node_modules/@abaplint/core/build/src/issue.js");
62697
+ const _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ "./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js");
62698
+ const _irule_1 = __webpack_require__(/*! ./_irule */ "./node_modules/@abaplint/core/build/src/rules/_irule.js");
62699
+ const __1 = __webpack_require__(/*! .. */ "./node_modules/@abaplint/core/build/src/index.js");
62700
+ class SelectSingleFullKeyConf extends _basic_rule_config_1.BasicRuleConfig {
62701
+ }
62702
+ exports.SelectSingleFullKeyConf = SelectSingleFullKeyConf;
62703
+ class SelectSingleFullKey {
62704
+ constructor() {
62705
+ this.conf = new SelectSingleFullKeyConf();
62706
+ }
62707
+ getMetadata() {
62708
+ return {
62709
+ key: "select_single_full_key",
62710
+ title: "Detect SELECT SINGLE which are possibily not unique",
62711
+ shortDescription: `Detect SELECT SINGLE which are possibily not unique`,
62712
+ extendedInformation: `Table definitions must be known, ie. inside the errorNamespace`,
62713
+ pseudoComment: "EC CI_NOORDER",
62714
+ tags: [_irule_1.RuleTag.Experimental],
62715
+ };
62716
+ }
62717
+ initialize(reg) {
62718
+ this.reg = reg;
62719
+ return this;
62720
+ }
62721
+ getConfig() {
62722
+ return this.conf;
62723
+ }
62724
+ setConfig(conf) {
62725
+ this.conf = conf;
62726
+ }
62727
+ run(obj) {
62728
+ var _a, _b;
62729
+ if (!(obj instanceof __1.ABAPObject)) {
62730
+ return [];
62731
+ }
62732
+ const syntax = new __1.SyntaxLogic(this.reg, obj).run();
62733
+ if (syntax.issues.length > 0) {
62734
+ return [];
62735
+ }
62736
+ const issues = [];
62737
+ const message = "SELECT SINGLE possibily not unique";
62738
+ for (const file of obj.getABAPFiles()) {
62739
+ const statements = file.getStatements();
62740
+ for (let i = 0; i < statements.length; i++) {
62741
+ const s = statements[i];
62742
+ if (!(s.get() instanceof __1.Statements.Select)) {
62743
+ continue;
62744
+ }
62745
+ else if (s.findTokenSequencePosition("SELECT", "SINGLE") === undefined) {
62746
+ continue;
62747
+ }
62748
+ const databaseTable = s.findFirstExpression(__1.Expressions.DatabaseTable);
62749
+ if (databaseTable === undefined) {
62750
+ continue;
62751
+ }
62752
+ const next = statements[i + 1];
62753
+ if ((next === null || next === void 0 ? void 0 : next.get()) instanceof __1.Comment && next.concatTokens().includes(this.getMetadata().pseudoComment + "")) {
62754
+ continue;
62755
+ }
62756
+ const tabl = this.findReference(databaseTable.getFirstToken().getStart(), syntax.spaghetti, file);
62757
+ const table = this.reg.getObject("TABL", tabl);
62758
+ if (table === undefined) {
62759
+ continue;
62760
+ }
62761
+ const keys = table.listKeys(this.reg);
62762
+ // const type = table.parseType(this.reg);
62763
+ const cond = s.findFirstExpression(__1.Expressions.SQLCond);
62764
+ const set = new Set();
62765
+ for (const key of keys) {
62766
+ if (key === "MANDT") {
62767
+ // todo, it should check for the correct type instead
62768
+ continue;
62769
+ }
62770
+ set.add(key);
62771
+ }
62772
+ for (const compare of (cond === null || cond === void 0 ? void 0 : cond.findAllExpressionsRecursive(__1.Expressions.SQLCompare)) || []) {
62773
+ if (compare.getChildren().length === 3) {
62774
+ const fname = (_a = compare.findDirectExpression(__1.Expressions.SQLFieldName)) === null || _a === void 0 ? void 0 : _a.concatTokens().toUpperCase();
62775
+ const operator = (_b = compare.findDirectExpression(__1.Expressions.SQLCompareOperator)) === null || _b === void 0 ? void 0 : _b.concatTokens().toUpperCase();
62776
+ if (fname && (operator === "=" || operator === "EQ")) {
62777
+ set.delete(fname);
62778
+ }
62779
+ }
62780
+ }
62781
+ if (set.size > 0) {
62782
+ issues.push(issue_1.Issue.atStatement(file, s, message, this.getMetadata().key, this.getConfig().severity));
62783
+ }
62784
+ }
62785
+ }
62786
+ return issues;
62787
+ }
62788
+ findReference(position, spaghetti, file) {
62789
+ const scope = spaghetti.lookupPosition(position, file.getFilename());
62790
+ return scope === null || scope === void 0 ? void 0 : scope.findTableReference(position);
62791
+ }
62792
+ }
62793
+ exports.SelectSingleFullKey = SelectSingleFullKey;
62794
+ //# sourceMappingURL=select_single_full_key.js.map
62795
+
62796
+ /***/ }),
62797
+
62631
62798
  /***/ "./node_modules/@abaplint/core/build/src/rules/selection_screen_naming.js":
62632
62799
  /*!********************************************************************************!*\
62633
62800
  !*** ./node_modules/@abaplint/core/build/src/rules/selection_screen_naming.js ***!
@@ -77912,7 +78079,8 @@ class Traversal {
77912
78079
  default:
77913
78080
  runtime = "U";
77914
78081
  }
77915
- attr.push(`"${prefix + a.getName().toUpperCase()}": {"type": () => {return ${type};}, "visibility": "${runtime}", "is_constant": " "}`);
78082
+ const isClass = a.getMeta().includes("static" /* abaplint.IdentifierMeta.Static */) ? "X" : " ";
78083
+ attr.push(`"${prefix + a.getName().toUpperCase()}": {"type": () => {return ${type};}, "visibility": "${runtime}", "is_constant": " ", "is_class": "${isClass}"}`);
77916
78084
  }
77917
78085
  for (const a of ((_b = def.getAttributes()) === null || _b === void 0 ? void 0 : _b.getConstants()) || []) {
77918
78086
  const type = new transpile_types_1.TranspileTypes().toType(a.getType());
@@ -77927,7 +78095,7 @@ class Traversal {
77927
78095
  default:
77928
78096
  runtime = "U";
77929
78097
  }
77930
- attr.push(`"${prefix + a.getName().toUpperCase()}": {"type": () => {return ${type};}, "visibility": "${runtime}", "is_constant": "X"}`);
78098
+ attr.push(`"${prefix + a.getName().toUpperCase()}": {"type": () => {return ${type};}, "visibility": "${runtime}", "is_constant": "X", "is_class": "X"}`);
77931
78099
  }
77932
78100
  for (const impl of def.getImplementing()) {
77933
78101
  const idef = this.findInterfaceDefinition(impl.name, scope);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/transpiler-cli",
3
- "version": "2.6.34",
3
+ "version": "2.6.36",
4
4
  "description": "Transpiler - Command Line Interface",
5
5
  "bin": {
6
6
  "abap_transpile": "./abap_transpile"
@@ -25,12 +25,12 @@
25
25
  "author": "abaplint",
26
26
  "license": "MIT",
27
27
  "devDependencies": {
28
- "@abaplint/transpiler": "^2.6.34",
28
+ "@abaplint/transpiler": "^2.6.36",
29
29
  "@types/glob": "^7.2.0",
30
30
  "glob": "=7.2.0",
31
31
  "@types/progress": "^2.0.5",
32
- "@types/node": "^18.16.1",
33
- "@abaplint/core": "^2.97.17",
32
+ "@types/node": "^18.16.2",
33
+ "@abaplint/core": "^2.98.3",
34
34
  "progress": "^2.0.3",
35
35
  "webpack": "^5.81.0",
36
36
  "webpack-cli": "^5.0.2",