@abaplint/transpiler-cli 2.8.25 → 2.8.26

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 +121 -31
  2. package/package.json +4 -4
package/build/bundle.js CHANGED
@@ -1921,7 +1921,7 @@ class Star {
1921
1921
  return this.sta.getUsing();
1922
1922
  }
1923
1923
  run(r) {
1924
- const result = r;
1924
+ let result = r;
1925
1925
  try {
1926
1926
  let res = r;
1927
1927
  let input = [];
@@ -1931,7 +1931,13 @@ class Star {
1931
1931
  if (res.length === 0) {
1932
1932
  break;
1933
1933
  }
1934
- result.push(...res);
1934
+ if (res.length > 1000) {
1935
+ // avoid stack overflow
1936
+ result = result.concat(res);
1937
+ }
1938
+ else {
1939
+ result.push(...res);
1940
+ }
1935
1941
  }
1936
1942
  }
1937
1943
  catch (err) {
@@ -2064,7 +2070,7 @@ class Sequence {
2064
2070
  return this.list.reduce((a, c) => { return a.concat(c.getUsing()); }, []);
2065
2071
  }
2066
2072
  run(r) {
2067
- const result = [];
2073
+ let result = [];
2068
2074
  for (const input of r) {
2069
2075
  let temp = [input];
2070
2076
  let match = true;
@@ -2076,7 +2082,13 @@ class Sequence {
2076
2082
  }
2077
2083
  }
2078
2084
  if (match === true) {
2079
- result.push(...temp);
2085
+ if (temp.length > 1000) {
2086
+ // avoid stack overflow
2087
+ result = result.concat(temp);
2088
+ }
2089
+ else {
2090
+ result.push(...temp);
2091
+ }
2080
2092
  }
2081
2093
  }
2082
2094
  return result;
@@ -16900,7 +16912,7 @@ class Sequence {
16900
16912
  }
16901
16913
  run(statements, parent) {
16902
16914
  let inn = statements;
16903
- const out = [];
16915
+ let out = [];
16904
16916
  for (const i of this.list) {
16905
16917
  const match = i.run(inn, parent);
16906
16918
  if (match.error) {
@@ -16912,7 +16924,14 @@ class Sequence {
16912
16924
  errorMatched: out.length,
16913
16925
  };
16914
16926
  }
16915
- out.push(...match.matched);
16927
+ if (match.matched.length < 100) {
16928
+ out.push(...match.matched);
16929
+ }
16930
+ else {
16931
+ // avoid using the spread operator, it might trigger "Maximum call stack size exceeded"
16932
+ // when the number of matched elements is very large
16933
+ out = out.concat(match.matched);
16934
+ }
16916
16935
  inn = match.unmatched;
16917
16936
  }
16918
16937
  return {
@@ -17044,7 +17063,7 @@ class Star {
17044
17063
  }
17045
17064
  run(statements, parent) {
17046
17065
  let inn = statements;
17047
- const out = [];
17066
+ let out = [];
17048
17067
  while (true) {
17049
17068
  if (inn.length === 0) {
17050
17069
  return {
@@ -17076,7 +17095,14 @@ class Star {
17076
17095
  };
17077
17096
  }
17078
17097
  }
17079
- out.push(...match.matched);
17098
+ if (match.matched.length < 100) {
17099
+ out.push(...match.matched);
17100
+ }
17101
+ else {
17102
+ // avoid using the spread operator, it might trigger "Maximum call stack size exceeded"
17103
+ // when the number of matched elements is very large
17104
+ out = out.concat(match.matched);
17105
+ }
17080
17106
  inn = match.unmatched;
17081
17107
  }
17082
17108
  }
@@ -49707,6 +49733,10 @@ const Types = __webpack_require__(/*! ../abap/types/basic */ "./node_modules/@ab
49707
49733
  const _abstract_object_1 = __webpack_require__(/*! ./_abstract_object */ "./node_modules/@abaplint/core/build/src/objects/_abstract_object.js");
49708
49734
  const xml_utils_1 = __webpack_require__(/*! ../xml_utils */ "./node_modules/@abaplint/core/build/src/xml_utils.js");
49709
49735
  const ddic_1 = __webpack_require__(/*! ../ddic */ "./node_modules/@abaplint/core/build/src/ddic.js");
49736
+ var ViewClass;
49737
+ (function (ViewClass) {
49738
+ ViewClass["ExternalView"] = "X";
49739
+ })(ViewClass || (ViewClass = {}));
49710
49740
  class View extends _abstract_object_1.AbstractObject {
49711
49741
  getType() {
49712
49742
  return "VIEW";
@@ -49750,6 +49780,16 @@ class View extends _abstract_object_1.AbstractObject {
49750
49780
  // ignore, this is a special case of old style .INCLUDE
49751
49781
  continue;
49752
49782
  }
49783
+ else if (this.parsedData.header.VIEWCLASS === ViewClass.ExternalView) {
49784
+ components.push({
49785
+ name: field.VIEWFIELD,
49786
+ type: new Types.VoidType("ExternalView")
49787
+ });
49788
+ continue;
49789
+ }
49790
+ else if (field.TABNAME === this.getName()) {
49791
+ throw new Error("Unexpected self reference in view " + this.getName() + ", " + field.FIELDNAME + " " + field.FIELDNAME);
49792
+ }
49753
49793
  const lookup = ddic.lookupTableOrView(field.TABNAME);
49754
49794
  let found = lookup.type;
49755
49795
  if (lookup.object) {
@@ -49785,13 +49825,23 @@ class View extends _abstract_object_1.AbstractObject {
49785
49825
  }
49786
49826
  ///////////////
49787
49827
  parseXML() {
49788
- var _a, _b;
49789
- this.parsedData = { fields: [], join: [] };
49828
+ var _a, _b, _c;
49829
+ this.parsedData = {
49830
+ header: {
49831
+ VIEWCLASS: "",
49832
+ },
49833
+ fields: [],
49834
+ join: [],
49835
+ };
49790
49836
  const parsed = super.parseRaw2();
49791
49837
  if (parsed === undefined || parsed.abapGit === undefined) {
49792
49838
  return;
49793
49839
  }
49794
- const fields = (_a = parsed.abapGit["asx:abap"]["asx:values"]) === null || _a === void 0 ? void 0 : _a.DD27P_TABLE;
49840
+ const header = (_a = parsed.abapGit["asx:abap"]["asx:values"]) === null || _a === void 0 ? void 0 : _a.DD25V;
49841
+ this.parsedData.header = {
49842
+ VIEWCLASS: (header === null || header === void 0 ? void 0 : header.VIEWCLASS) || "",
49843
+ };
49844
+ const fields = (_b = parsed.abapGit["asx:abap"]["asx:values"]) === null || _b === void 0 ? void 0 : _b.DD27P_TABLE;
49795
49845
  for (const field of (0, xml_utils_1.xmlToArray)(fields === null || fields === void 0 ? void 0 : fields.DD27P)) {
49796
49846
  this.parsedData.fields.push({
49797
49847
  VIEWFIELD: field.VIEWFIELD,
@@ -49799,7 +49849,7 @@ class View extends _abstract_object_1.AbstractObject {
49799
49849
  FIELDNAME: field.FIELDNAME,
49800
49850
  });
49801
49851
  }
49802
- const join = (_b = parsed.abapGit["asx:abap"]["asx:values"]) === null || _b === void 0 ? void 0 : _b.DD28J_TABLE;
49852
+ const join = (_c = parsed.abapGit["asx:abap"]["asx:values"]) === null || _c === void 0 ? void 0 : _c.DD28J_TABLE;
49803
49853
  for (const j of (0, xml_utils_1.xmlToArray)(join === null || join === void 0 ? void 0 : join.DD28J)) {
49804
49854
  this.parsedData.join.push({
49805
49855
  LTAB: j.LTAB,
@@ -50533,7 +50583,7 @@ class Registry {
50533
50583
  }
50534
50584
  static abaplintVersion() {
50535
50585
  // magic, see build script "version.sh"
50536
- return "2.108.8";
50586
+ return "2.108.12";
50537
50587
  }
50538
50588
  getDDICReferences() {
50539
50589
  return this.ddicReferences;
@@ -53398,7 +53448,7 @@ If sy-dbcnt is checked after database statements, it is considered okay.
53398
53448
  If IS ASSIGNED is checked after assigning, it is considered okay.
53399
53449
 
53400
53450
  FIND statement with MATCH COUNT is considered okay if subrc is not checked`,
53401
- tags: [_irule_1.RuleTag.SingleFile],
53451
+ tags: [_irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Quickfix],
53402
53452
  pseudoComment: "EC CI_SUBRC",
53403
53453
  pragma: "##SUBRC_OK",
53404
53454
  };
@@ -68225,7 +68275,9 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
68225
68275
  exports.SelectSingleFullKey = exports.SelectSingleFullKeyConf = void 0;
68226
68276
  const issue_1 = __webpack_require__(/*! ../issue */ "./node_modules/@abaplint/core/build/src/issue.js");
68227
68277
  const _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ "./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js");
68278
+ const _irule_1 = __webpack_require__(/*! ./_irule */ "./node_modules/@abaplint/core/build/src/rules/_irule.js");
68228
68279
  const __1 = __webpack_require__(/*! .. */ "./node_modules/@abaplint/core/build/src/index.js");
68280
+ const edit_helper_1 = __webpack_require__(/*! ../edit_helper */ "./node_modules/@abaplint/core/build/src/edit_helper.js");
68229
68281
  class SelectSingleFullKeyConf extends _basic_rule_config_1.BasicRuleConfig {
68230
68282
  constructor() {
68231
68283
  super(...arguments);
@@ -68246,7 +68298,7 @@ class SelectSingleFullKey {
68246
68298
 
68247
68299
  If the statement contains a JOIN it is not checked`,
68248
68300
  pseudoComment: "EC CI_NOORDER",
68249
- tags: [],
68301
+ tags: [_irule_1.RuleTag.Quickfix],
68250
68302
  };
68251
68303
  }
68252
68304
  initialize(reg) {
@@ -68267,6 +68319,12 @@ If the statement contains a JOIN it is not checked`,
68267
68319
  setConfig(conf) {
68268
68320
  this.conf = conf;
68269
68321
  }
68322
+ buildFix(file, statement) {
68323
+ return {
68324
+ description: `Add "#EC CI_NOORDER`,
68325
+ edit: edit_helper_1.EditHelper.insertAt(file, statement.getLastToken().getStart(), ` "#EC CI_NOORDER`),
68326
+ };
68327
+ }
68270
68328
  run(obj) {
68271
68329
  var _a, _b;
68272
68330
  if (!(obj instanceof __1.ABAPObject)) {
@@ -68328,7 +68386,8 @@ If the statement contains a JOIN it is not checked`,
68328
68386
  }
68329
68387
  }
68330
68388
  if (set.size > 0) {
68331
- issues.push(issue_1.Issue.atStatement(file, s, message, this.getMetadata().key, this.getConfig().severity));
68389
+ const fix = this.buildFix(file, s);
68390
+ issues.push(issue_1.Issue.atStatement(file, s, message, this.getMetadata().key, this.getConfig().severity, undefined, [fix]));
68332
68391
  }
68333
68392
  }
68334
68393
  }
@@ -70793,7 +70852,13 @@ const _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ "./
70793
70852
  const _irule_1 = __webpack_require__(/*! ./_irule */ "./node_modules/@abaplint/core/build/src/rules/_irule.js");
70794
70853
  const Statements = __webpack_require__(/*! ../abap/2_statements/statements */ "./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js");
70795
70854
  const edit_helper_1 = __webpack_require__(/*! ../edit_helper */ "./node_modules/@abaplint/core/build/src/edit_helper.js");
70855
+ const _statement_1 = __webpack_require__(/*! ../abap/2_statements/statements/_statement */ "./node_modules/@abaplint/core/build/src/abap/2_statements/statements/_statement.js");
70796
70856
  class UnnecessaryReturnConf extends _basic_rule_config_1.BasicRuleConfig {
70857
+ constructor() {
70858
+ super(...arguments);
70859
+ /** Allow empty METHODs + FORMs + FUNCTION-MODULEs */
70860
+ this.allowEmpty = false;
70861
+ }
70797
70862
  }
70798
70863
  exports.UnnecessaryReturnConf = UnnecessaryReturnConf;
70799
70864
  class UnnecessaryReturn extends _abap_rule_1.ABAPRule {
@@ -70837,15 +70902,29 @@ ENDFORM.`,
70837
70902
  }
70838
70903
  const message = "Unnecessary RETURN";
70839
70904
  const statements = file.getStatements();
70905
+ let statementCounter = 0;
70840
70906
  for (let i = 0; i < statements.length; i++) {
70841
70907
  const node = statements[i];
70842
- if (!(node.get() instanceof Statements.EndMethod
70843
- || node.get() instanceof Statements.EndForm
70844
- || node.get() instanceof Statements.EndFunction)) {
70908
+ const nodeType = node.get();
70909
+ if ((nodeType instanceof Statements.MethodImplementation
70910
+ || nodeType instanceof Statements.Form
70911
+ || nodeType instanceof Statements.FunctionModule)) {
70912
+ statementCounter = 0;
70913
+ continue;
70914
+ }
70915
+ if (!(nodeType instanceof _statement_1.Comment)) {
70916
+ statementCounter++;
70917
+ }
70918
+ if (!(nodeType instanceof Statements.EndMethod
70919
+ || nodeType instanceof Statements.EndForm
70920
+ || nodeType instanceof Statements.EndFunction)) {
70845
70921
  continue;
70846
70922
  }
70847
70923
  const prev = statements[i - 1];
70848
70924
  if (prev && prev.get() instanceof Statements.Return) {
70925
+ if (this.conf.allowEmpty === true && statementCounter === 2) {
70926
+ continue;
70927
+ }
70849
70928
  const fix = edit_helper_1.EditHelper.deleteStatement(file, prev);
70850
70929
  issues.push(issue_1.Issue.atStatement(file, prev, message, this.getMetadata().key, this.getConfig().severity, fix));
70851
70930
  }
@@ -77551,12 +77630,12 @@ class Transpiler {
77551
77630
  progress?.set(reg.getObjectCount(false), "Building");
77552
77631
  for (const obj of reg.getObjects()) {
77553
77632
  await progress?.tick("Building, " + obj.getName());
77554
- if (obj instanceof abaplint.ABAPObject && !(obj instanceof abaplint.Objects.TypePool)) {
77555
- output.objects.push(...new handle_abap_1.HandleABAP(this.options).runObject(obj, reg));
77556
- }
77557
- else if (obj instanceof abaplint.Objects.TypePool) {
77633
+ if (obj instanceof abaplint.Objects.TypePool) {
77558
77634
  output.objects.push(...new handle_type_pool_1.HandleTypePool().runObject(obj, reg));
77559
77635
  }
77636
+ else if (obj instanceof abaplint.ABAPObject) {
77637
+ output.objects.push(...new handle_abap_1.HandleABAP(this.options).runObject(obj, reg));
77638
+ }
77560
77639
  else if (obj instanceof abaplint.Objects.Oauth2Profile) {
77561
77640
  output.objects.push(...new handle_oa2p_1.HandleOA2P().runObject(obj, reg));
77562
77641
  }
@@ -85833,28 +85912,29 @@ async function run() {
85833
85912
  for (const st of this.getSortedTests(reg)) {
85834
85913
  ret += `// --------------------------------------------\n`;
85835
85914
  ret += ` clas = unit.addObject("${st.obj.getName()}");\n`;
85915
+ const lc = st.localClass.toLowerCase();
85836
85916
  ret += ` {
85837
- const {${st.localClass}} = await import("./${this.escapeNamespace(st.obj.getName().toLowerCase())}.${st.obj.getType().toLowerCase()}.testclasses.mjs");
85838
- locl = clas.addTestClass("${st.localClass}");
85839
- if (${st.localClass}.class_setup) await ${st.localClass}.class_setup();\n`;
85917
+ const {${lc}} = await import("./${this.escapeNamespace(st.obj.getName().toLowerCase())}.${st.obj.getType().toLowerCase()}.testclasses.mjs");
85918
+ locl = clas.addTestClass("${lc}");
85919
+ if (${lc}.class_setup) await ${lc}.class_setup();\n`;
85840
85920
  for (const m of st.methods) {
85841
- const skipThis = (skip || []).some(a => a.object === st.obj.getName() && a.class === st.localClass && a.method === m);
85921
+ const skipThis = (skip || []).some(a => a.object === st.obj.getName() && a.class === lc && a.method === m);
85842
85922
  if (skipThis) {
85843
- ret += ` console.log('${st.obj.getName()}: running ${st.localClass}->${m}, skipped');\n`;
85923
+ ret += ` console.log('${st.obj.getName()}: running ${lc}->${m}, skipped');\n`;
85844
85924
  ret += ` meth = locl.addMethod("${m}");\n`;
85845
85925
  ret += ` meth.skip();\n`;
85846
85926
  continue;
85847
85927
  }
85848
- ret += ` {\n const test = await (new ${st.localClass}()).constructor_();\n`;
85928
+ ret += ` {\n const test = await (new ${lc}()).constructor_();\n`;
85849
85929
  ret += ` if (test.setup) await test.setup();\n`;
85850
- ret += ` console.log("${st.obj.getName()}: running ${st.localClass}->${m}");\n`;
85930
+ ret += ` console.log("${st.obj.getName()}: running ${lc}->${m}");\n`;
85851
85931
  ret += ` meth = locl.addMethod("${m}");\n`;
85852
85932
  ret += ` await test.${m}();\n`;
85853
85933
  ret += ` meth.pass();\n`;
85854
85934
  ret += ` if (test.teardown) await test.teardown();\n`;
85855
85935
  ret += ` }\n`;
85856
85936
  }
85857
- ret += ` if (${st.localClass}.class_teardown) await ${st.localClass}.class_teardown();\n`;
85937
+ ret += ` if (${lc}.class_teardown) await ${lc}.class_teardown();\n`;
85858
85938
  ret += ` }\n`;
85859
85939
  }
85860
85940
  /*
@@ -86676,6 +86756,8 @@ exports.validate = function (xmlData, options) {
86676
86756
  return getErrorObject('InvalidTag', "Closing tag '"+tagName+"' doesn't have proper closing.", getLineNumberForPosition(xmlData, i));
86677
86757
  } else if (attrStr.trim().length > 0) {
86678
86758
  return getErrorObject('InvalidTag', "Closing tag '"+tagName+"' can't have attributes or invalid starting.", getLineNumberForPosition(xmlData, tagStartPos));
86759
+ } else if (tags.length === 0) {
86760
+ return getErrorObject('InvalidTag', "Closing tag '"+tagName+"' has not been opened.", getLineNumberForPosition(xmlData, tagStartPos));
86679
86761
  } else {
86680
86762
  const otg = tags.pop();
86681
86763
  if (tagName !== otg.tagName) {
@@ -87963,10 +88045,18 @@ const parseXml = function(xmlData) {
87963
88045
  let tagContent = "";
87964
88046
  //self-closing tag
87965
88047
  if(tagExp.length > 0 && tagExp.lastIndexOf("/") === tagExp.length - 1){
88048
+ if(tagName[tagName.length - 1] === "/"){ //remove trailing '/'
88049
+ tagName = tagName.substr(0, tagName.length - 1);
88050
+ jPath = jPath.substr(0, jPath.length - 1);
88051
+ tagExp = tagName;
88052
+ }else{
88053
+ tagExp = tagExp.substr(0, tagExp.length - 1);
88054
+ }
87966
88055
  i = result.closeIndex;
87967
88056
  }
87968
88057
  //unpaired tag
87969
88058
  else if(this.options.unpairedTags.indexOf(tagName) !== -1){
88059
+
87970
88060
  i = result.closeIndex;
87971
88061
  }
87972
88062
  //normal tag
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/transpiler-cli",
3
- "version": "2.8.25",
3
+ "version": "2.8.26",
4
4
  "description": "Transpiler - Command Line Interface",
5
5
  "funding": "https://github.com/sponsors/larshp",
6
6
  "bin": {
@@ -26,12 +26,12 @@
26
26
  "author": "abaplint",
27
27
  "license": "MIT",
28
28
  "devDependencies": {
29
- "@abaplint/transpiler": "^2.8.25",
29
+ "@abaplint/transpiler": "^2.8.26",
30
30
  "@types/glob": "^8.1.0",
31
31
  "glob": "=7.2.0",
32
32
  "@types/progress": "^2.0.7",
33
- "@types/node": "^20.12.12",
34
- "@abaplint/core": "^2.108.8",
33
+ "@types/node": "^20.14.0",
34
+ "@abaplint/core": "^2.108.12",
35
35
  "progress": "^2.0.3",
36
36
  "webpack": "^5.91.0",
37
37
  "webpack-cli": "^5.1.4",