@abaplint/transpiler-cli 2.6.42 → 2.6.44

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 +91 -32
  2. package/package.json +6 -6
package/build/bundle.js CHANGED
@@ -21625,7 +21625,23 @@ class BasicTypes {
21625
21625
  }
21626
21626
  const constant = val.findFirstExpression(Expressions.Constant);
21627
21627
  if (constant) {
21628
- return constant.concatTokens();
21628
+ const conc = val.findFirstExpression(Expressions.ConcatenatedConstant);
21629
+ if (conc) {
21630
+ const first = conc.getFirstToken().getStr().substring(0, 1);
21631
+ let result = "";
21632
+ for (const token of conc.getAllTokens()) {
21633
+ if (token.getStr() === "&") {
21634
+ continue;
21635
+ }
21636
+ else {
21637
+ result += token.getStr().substring(1, token.getStr().length - 1);
21638
+ }
21639
+ }
21640
+ return first + result + first;
21641
+ }
21642
+ else {
21643
+ return constant.concatTokens();
21644
+ }
21629
21645
  }
21630
21646
  const chain = val.findFirstExpression(Expressions.SimpleFieldChain);
21631
21647
  if (chain) {
@@ -29756,7 +29772,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
29756
29772
  exports.Tables = void 0;
29757
29773
  const Expressions = __webpack_require__(/*! ../../2_statements/expressions */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js");
29758
29774
  const _typed_identifier_1 = __webpack_require__(/*! ../../types/_typed_identifier */ "./node_modules/@abaplint/core/build/src/abap/types/_typed_identifier.js");
29759
- const basic_1 = __webpack_require__(/*! ../../types/basic */ "./node_modules/@abaplint/core/build/src/abap/types/basic/index.js");
29775
+ const unknown_type_1 = __webpack_require__(/*! ../../types/basic/unknown_type */ "./node_modules/@abaplint/core/build/src/abap/types/basic/unknown_type.js");
29760
29776
  class Tables {
29761
29777
  runSyntax(node, scope, filename) {
29762
29778
  var _a, _b;
@@ -29768,13 +29784,15 @@ class Tables {
29768
29784
  if (name.startsWith("*")) {
29769
29785
  name = name.substr(1);
29770
29786
  }
29787
+ // lookupTableOrView will also give Unknown and Void
29771
29788
  const found = (_b = scope.getDDIC()) === null || _b === void 0 ? void 0 : _b.lookupTableOrView(name);
29772
29789
  if (found) {
29773
29790
  scope.getDDICReferences().addUsing(scope.getParentObj(), { object: found.object, filename: filename, token: nameToken });
29774
29791
  scope.addIdentifier(new _typed_identifier_1.TypedIdentifier(nameToken, filename, found.type));
29775
29792
  return;
29776
29793
  }
29777
- scope.addIdentifier(new _typed_identifier_1.TypedIdentifier(nameToken, filename, new basic_1.UnknownType("Tables, fallback")));
29794
+ // this should never happen,
29795
+ scope.addIdentifier(new _typed_identifier_1.TypedIdentifier(nameToken, filename, new unknown_type_1.UnknownType("Tables, fallback")));
29778
29796
  }
29779
29797
  }
29780
29798
  exports.Tables = Tables;
@@ -38419,21 +38437,27 @@ class LSPLookup {
38419
38437
  const hover = "Method Definition \"" + method.getName() + "\"";
38420
38438
  return { hover, definition: found, definitionId: method, scope: bottomScope };
38421
38439
  }
38440
+ let hoverValue = "";
38441
+ const ddicRefs = reg.getDDICReferences().listByFilename(cursor.identifier.getFilename(), cursor.identifier.getStart().getRow());
38442
+ for (const d of ddicRefs) {
38443
+ if (d.object && d.token && d.token.getStart().equals(cursor.identifier.getStart())) {
38444
+ hoverValue += `DDIC: ${d.object.getType()} ${d.object.getName()}`;
38445
+ }
38446
+ }
38422
38447
  const variable = bottomScope.findVariable(cursor.token.getStr());
38423
38448
  if (variable !== undefined && variable.getStart().equals(cursor.token.getStart())) {
38424
38449
  const hover = "Variable Definition\n\n" + this.dumpType(variable);
38450
+ if (hoverValue !== "") {
38451
+ hoverValue = hover + "\n_________________\n" + hoverValue;
38452
+ }
38453
+ else {
38454
+ hoverValue = hover;
38455
+ }
38425
38456
  let location = undefined;
38426
38457
  if (variable.getMeta().includes("built-in" /* IdentifierMeta.BuiltIn */) === false) {
38427
38458
  location = _lsp_utils_1.LSPUtils.identiferToLocation(variable);
38428
38459
  }
38429
- return { hover, definition: location, implementation: location, definitionId: variable, scope: bottomScope };
38430
- }
38431
- let hoverValue = "";
38432
- const ddicRefs = reg.getDDICReferences().listByFilename(cursor.identifier.getFilename(), cursor.identifier.getStart().getRow());
38433
- for (const d of ddicRefs) {
38434
- if (d.object && d.token && d.token.getStart().equals(cursor.identifier.getStart())) {
38435
- hoverValue += `DDIC: ${d.object.getType()} ${d.object.getName()}`;
38436
- }
38460
+ return { hover: hoverValue, definition: location, implementation: location, definitionId: variable, scope: bottomScope };
38437
38461
  }
38438
38462
  const refs = this.searchReferences(bottomScope, cursor.token);
38439
38463
  if (refs.length > 0) {
@@ -44021,10 +44045,6 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
44021
44045
  exports.Program = void 0;
44022
44046
  const _abap_object_1 = __webpack_require__(/*! ./_abap_object */ "./node_modules/@abaplint/core/build/src/objects/_abap_object.js");
44023
44047
  class Program extends _abap_object_1.ABAPObject {
44024
- constructor() {
44025
- super(...arguments);
44026
- this.isIncludeValue = undefined;
44027
- }
44028
44048
  getType() {
44029
44049
  return "PROG";
44030
44050
  }
@@ -44046,15 +44066,25 @@ class Program extends _abap_object_1.ABAPObject {
44046
44066
  };
44047
44067
  }
44048
44068
  setDirty() {
44049
- this.isIncludeValue = undefined;
44069
+ this.parsedXML = undefined;
44050
44070
  super.setDirty();
44051
44071
  }
44052
44072
  isInclude() {
44053
- if (this.isIncludeValue === undefined) {
44073
+ this.parseXML();
44074
+ return this.parsedXML.isInclude;
44075
+ }
44076
+ isModulePool() {
44077
+ this.parseXML();
44078
+ return this.parsedXML.isModulePool;
44079
+ }
44080
+ parseXML() {
44081
+ if (this.parsedXML === undefined) {
44054
44082
  const file = this.getXMLFile();
44055
- this.isIncludeValue = file ? file.getRaw().includes("<SUBC>I</SUBC>") : false;
44083
+ this.parsedXML = {
44084
+ isInclude: file ? file.getRaw().includes("<SUBC>I</SUBC>") : false,
44085
+ isModulePool: file ? file.getRaw().includes("<SUBC>M</SUBC>") : false,
44086
+ };
44056
44087
  }
44057
- return this.isIncludeValue;
44058
44088
  }
44059
44089
  }
44060
44090
  exports.Program = Program;
@@ -46629,7 +46659,7 @@ class Registry {
46629
46659
  }
46630
46660
  static abaplintVersion() {
46631
46661
  // magic, see build script "version.sh"
46632
- return "2.99.6";
46662
+ return "2.99.9";
46633
46663
  }
46634
46664
  getDDICReferences() {
46635
46665
  return this.references;
@@ -57942,7 +57972,9 @@ class MainFileContents {
57942
57972
  if (stru === undefined) {
57943
57973
  return [];
57944
57974
  }
57945
- if (obj instanceof Objects.Program && obj.isInclude() === false) {
57975
+ if (obj instanceof Objects.Program
57976
+ && obj.isInclude() === false
57977
+ && obj.isModulePool() === false) {
57946
57978
  let count = 0;
57947
57979
  let first = main.getStatements()[count];
57948
57980
  while (first !== undefined && first.get() instanceof _statement_1.Comment) {
@@ -63954,7 +63986,7 @@ https://help.sap.com/doc/abapdocu_751_index_htm/7.51/en-us/abenopensql_strict_mo
63954
63986
  Also see separate rule sql_escape_host_variables
63955
63987
 
63956
63988
  Activates from v750 and up`,
63957
- tags: [_irule_1.RuleTag.Upport, _irule_1.RuleTag.Syntax, _irule_1.RuleTag.Quickfix],
63989
+ tags: [_irule_1.RuleTag.Upport, _irule_1.RuleTag.Quickfix],
63958
63990
  };
63959
63991
  }
63960
63992
  getConfig() {
@@ -63997,7 +64029,6 @@ Activates from v750 and up`,
63997
64029
  const message = "INTO/APPENDING must be last in strict SQL";
63998
64030
  const issue = issue_1.Issue.atToken(file, s.getFirstToken(), message, this.getMetadata().key, this.conf.severity, fix);
63999
64031
  issues.push(issue);
64000
- break;
64001
64032
  }
64002
64033
  }
64003
64034
  return issues;
@@ -68700,14 +68731,14 @@ class ConstantTranspiler {
68700
68731
  return new chunk_1.Chunk().append(code, node, traversal);
68701
68732
  }
68702
68733
  else if (res.startsWith("`") && this.addGet === false) {
68703
- const code = "new abap.types.String().set(" + this.escape(res) + ")";
68734
+ const code = "new abap.types.String().set(" + ConstantTranspiler.escape(res) + ")";
68704
68735
  return new chunk_1.Chunk().append(code, node, traversal);
68705
68736
  }
68706
68737
  else {
68707
68738
  if (res.startsWith("'")) {
68708
68739
  res = "'" + res.substring(1, res.length - 1).trimEnd() + "'";
68709
68740
  }
68710
- const code = this.escape(res);
68741
+ const code = ConstantTranspiler.escape(res);
68711
68742
  return new chunk_1.Chunk().append(code, node, traversal);
68712
68743
  }
68713
68744
  }
@@ -68728,7 +68759,7 @@ class ConstantTranspiler {
68728
68759
  chunk.append(code, node, traversal);
68729
68760
  }
68730
68761
  else if (res.startsWith("`") && this.addGet === false) {
68731
- const code = "new abap.types.String().set(" + this.escape(res) + ")";
68762
+ const code = "new abap.types.String().set(" + ConstantTranspiler.escape(res) + ")";
68732
68763
  chunk.append(code, node, traversal);
68733
68764
  }
68734
68765
  }
@@ -68744,10 +68775,10 @@ class ConstantTranspiler {
68744
68775
  // note: Characters cannot have length = zero, 1 is minimum
68745
68776
  length = 1;
68746
68777
  }
68747
- const code = "new abap.types.Character(" + length + ").set(" + this.escape(res) + ")";
68778
+ const code = "new abap.types.Character(" + length + ").set(" + ConstantTranspiler.escape(res) + ")";
68748
68779
  return code;
68749
68780
  }
68750
- escape(str) {
68781
+ static escape(str) {
68751
68782
  str = str.replace(/\\/g, "\\\\");
68752
68783
  if (str.startsWith("'")) {
68753
68784
  const reg = new RegExp(/(.+)''(.+)/g);
@@ -71872,6 +71903,27 @@ exports.AtTranspiler = AtTranspiler;
71872
71903
 
71873
71904
  /***/ }),
71874
71905
 
71906
+ /***/ "./node_modules/@abaplint/transpiler/build/src/statements/at_selection_screen.js":
71907
+ /*!***************************************************************************************!*\
71908
+ !*** ./node_modules/@abaplint/transpiler/build/src/statements/at_selection_screen.js ***!
71909
+ \***************************************************************************************/
71910
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
71911
+
71912
+ "use strict";
71913
+
71914
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
71915
+ exports.AtSelectionScreenTranspiler = void 0;
71916
+ const chunk_1 = __webpack_require__(/*! ../chunk */ "./node_modules/@abaplint/transpiler/build/src/chunk.js");
71917
+ class AtSelectionScreenTranspiler {
71918
+ transpile(_node, _traversal) {
71919
+ return new chunk_1.Chunk(`throw new Error("AtSelectionScreen, not supported, transpiler");`);
71920
+ }
71921
+ }
71922
+ exports.AtSelectionScreenTranspiler = AtSelectionScreenTranspiler;
71923
+ //# sourceMappingURL=at_selection_screen.js.map
71924
+
71925
+ /***/ }),
71926
+
71875
71927
  /***/ "./node_modules/@abaplint/transpiler/build/src/statements/authority_check.js":
71876
71928
  /*!***********************************************************************************!*\
71877
71929
  !*** ./node_modules/@abaplint/transpiler/build/src/statements/authority_check.js ***!
@@ -72900,7 +72952,13 @@ class DataTranspiler {
72900
72952
  if (found === undefined) {
72901
72953
  throw new Error("DataTranspiler, var not found, \"" + token.getStr() + "\"");
72902
72954
  }
72903
- const value = DataTranspiler.buildValue(node, found.getName().toLowerCase(), traversal);
72955
+ let value = "";
72956
+ if (found.getValue() !== undefined && node.concatTokens().includes(" & ")) {
72957
+ value = "\n" + traversal.setValues(found, found.getName());
72958
+ }
72959
+ else {
72960
+ value = DataTranspiler.buildValue(node, found.getName().toLowerCase(), traversal);
72961
+ }
72904
72962
  const ret = new chunk_1.Chunk()
72905
72963
  .appendString("let ")
72906
72964
  .append(found.getName().toLowerCase(), token, traversal)
@@ -72918,7 +72976,7 @@ class DataTranspiler {
72918
72976
  int = val.findFirstExpression(abaplint.Expressions.ConstantString);
72919
72977
  }
72920
72978
  if (int) {
72921
- const escaped = new constant_1.ConstantTranspiler().escape(int.concatTokens());
72979
+ const escaped = constant_1.ConstantTranspiler.escape(int.concatTokens());
72922
72980
  value = "\n" + name + ".set(" + escaped + ");";
72923
72981
  }
72924
72982
  else if (val.getChildren()[1].get() instanceof abaplint.Expressions.SimpleFieldChain) {
@@ -74114,6 +74172,7 @@ __exportStar(__webpack_require__(/*! ./add */ "./node_modules/@abaplint/transpil
74114
74172
  __exportStar(__webpack_require__(/*! ./append */ "./node_modules/@abaplint/transpiler/build/src/statements/append.js"), exports);
74115
74173
  __exportStar(__webpack_require__(/*! ./assert */ "./node_modules/@abaplint/transpiler/build/src/statements/assert.js"), exports);
74116
74174
  __exportStar(__webpack_require__(/*! ./assign */ "./node_modules/@abaplint/transpiler/build/src/statements/assign.js"), exports);
74175
+ __exportStar(__webpack_require__(/*! ./at_selection_screen */ "./node_modules/@abaplint/transpiler/build/src/statements/at_selection_screen.js"), exports);
74117
74176
  __exportStar(__webpack_require__(/*! ./at */ "./node_modules/@abaplint/transpiler/build/src/statements/at.js"), exports);
74118
74177
  __exportStar(__webpack_require__(/*! ./authority_check */ "./node_modules/@abaplint/transpiler/build/src/statements/authority_check.js"), exports);
74119
74178
  __exportStar(__webpack_require__(/*! ./break_id */ "./node_modules/@abaplint/transpiler/build/src/statements/break_id.js"), exports);
@@ -77560,7 +77619,7 @@ class InterfaceTranspiler {
77560
77619
  const valExpression = constantStatement === null || constantStatement === void 0 ? void 0 : constantStatement.findFirstExpression(abaplint.Expressions.Value);
77561
77620
  if ((valExpression === null || valExpression === void 0 ? void 0 : valExpression.getChildren()[1].get()) instanceof abaplint.Expressions.SimpleFieldChain) {
77562
77621
  const s = new expressions_1.FieldChainTranspiler().transpile(valExpression.getChildren()[1], traversal, false).getCode();
77563
- const e = new expressions_1.ConstantTranspiler().escape(s);
77622
+ const e = expressions_1.ConstantTranspiler.escape(s);
77564
77623
  ret += name + ".set(" + e + ");\n";
77565
77624
  continue;
77566
77625
  }
@@ -78593,7 +78652,7 @@ class Traversal {
78593
78652
  let ret = "";
78594
78653
  const handle = (val, name) => {
78595
78654
  if (typeof val === "string") {
78596
- const e = new expressions_1.ConstantTranspiler().escape(val);
78655
+ const e = expressions_1.ConstantTranspiler.escape(val);
78597
78656
  ret += name + ".set(" + e + ");\n";
78598
78657
  }
78599
78658
  else if (typeof val === "object") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/transpiler-cli",
3
- "version": "2.6.42",
3
+ "version": "2.6.44",
4
4
  "description": "Transpiler - Command Line Interface",
5
5
  "bin": {
6
6
  "abap_transpile": "./abap_transpile"
@@ -25,15 +25,15 @@
25
25
  "author": "abaplint",
26
26
  "license": "MIT",
27
27
  "devDependencies": {
28
- "@abaplint/transpiler": "^2.6.42",
28
+ "@abaplint/transpiler": "^2.6.44",
29
29
  "@types/glob": "^7.2.0",
30
30
  "glob": "=7.2.0",
31
31
  "@types/progress": "^2.0.5",
32
- "@types/node": "^20.0.0",
33
- "@abaplint/core": "^2.99.6",
32
+ "@types/node": "^20.1.2",
33
+ "@abaplint/core": "^2.99.9",
34
34
  "progress": "^2.0.3",
35
- "webpack": "^5.82.0",
36
- "webpack-cli": "^5.0.2",
35
+ "webpack": "^5.82.1",
36
+ "webpack-cli": "^5.1.1",
37
37
  "typescript": "^5.0.4"
38
38
  }
39
39
  }