@abaplint/transpiler-cli 2.6.42 → 2.6.43

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 +34 -12
  2. package/package.json +5 -5
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) {
@@ -46629,7 +46645,7 @@ class Registry {
46629
46645
  }
46630
46646
  static abaplintVersion() {
46631
46647
  // magic, see build script "version.sh"
46632
- return "2.99.6";
46648
+ return "2.99.7";
46633
46649
  }
46634
46650
  getDDICReferences() {
46635
46651
  return this.references;
@@ -63954,7 +63970,7 @@ https://help.sap.com/doc/abapdocu_751_index_htm/7.51/en-us/abenopensql_strict_mo
63954
63970
  Also see separate rule sql_escape_host_variables
63955
63971
 
63956
63972
  Activates from v750 and up`,
63957
- tags: [_irule_1.RuleTag.Upport, _irule_1.RuleTag.Syntax, _irule_1.RuleTag.Quickfix],
63973
+ tags: [_irule_1.RuleTag.Upport, _irule_1.RuleTag.Quickfix],
63958
63974
  };
63959
63975
  }
63960
63976
  getConfig() {
@@ -68700,14 +68716,14 @@ class ConstantTranspiler {
68700
68716
  return new chunk_1.Chunk().append(code, node, traversal);
68701
68717
  }
68702
68718
  else if (res.startsWith("`") && this.addGet === false) {
68703
- const code = "new abap.types.String().set(" + this.escape(res) + ")";
68719
+ const code = "new abap.types.String().set(" + ConstantTranspiler.escape(res) + ")";
68704
68720
  return new chunk_1.Chunk().append(code, node, traversal);
68705
68721
  }
68706
68722
  else {
68707
68723
  if (res.startsWith("'")) {
68708
68724
  res = "'" + res.substring(1, res.length - 1).trimEnd() + "'";
68709
68725
  }
68710
- const code = this.escape(res);
68726
+ const code = ConstantTranspiler.escape(res);
68711
68727
  return new chunk_1.Chunk().append(code, node, traversal);
68712
68728
  }
68713
68729
  }
@@ -68728,7 +68744,7 @@ class ConstantTranspiler {
68728
68744
  chunk.append(code, node, traversal);
68729
68745
  }
68730
68746
  else if (res.startsWith("`") && this.addGet === false) {
68731
- const code = "new abap.types.String().set(" + this.escape(res) + ")";
68747
+ const code = "new abap.types.String().set(" + ConstantTranspiler.escape(res) + ")";
68732
68748
  chunk.append(code, node, traversal);
68733
68749
  }
68734
68750
  }
@@ -68744,10 +68760,10 @@ class ConstantTranspiler {
68744
68760
  // note: Characters cannot have length = zero, 1 is minimum
68745
68761
  length = 1;
68746
68762
  }
68747
- const code = "new abap.types.Character(" + length + ").set(" + this.escape(res) + ")";
68763
+ const code = "new abap.types.Character(" + length + ").set(" + ConstantTranspiler.escape(res) + ")";
68748
68764
  return code;
68749
68765
  }
68750
- escape(str) {
68766
+ static escape(str) {
68751
68767
  str = str.replace(/\\/g, "\\\\");
68752
68768
  if (str.startsWith("'")) {
68753
68769
  const reg = new RegExp(/(.+)''(.+)/g);
@@ -72900,7 +72916,13 @@ class DataTranspiler {
72900
72916
  if (found === undefined) {
72901
72917
  throw new Error("DataTranspiler, var not found, \"" + token.getStr() + "\"");
72902
72918
  }
72903
- const value = DataTranspiler.buildValue(node, found.getName().toLowerCase(), traversal);
72919
+ let value = "";
72920
+ if (found.getValue() !== undefined && node.concatTokens().includes(" & ")) {
72921
+ value = "\n" + traversal.setValues(found, found.getName());
72922
+ }
72923
+ else {
72924
+ value = DataTranspiler.buildValue(node, found.getName().toLowerCase(), traversal);
72925
+ }
72904
72926
  const ret = new chunk_1.Chunk()
72905
72927
  .appendString("let ")
72906
72928
  .append(found.getName().toLowerCase(), token, traversal)
@@ -72918,7 +72940,7 @@ class DataTranspiler {
72918
72940
  int = val.findFirstExpression(abaplint.Expressions.ConstantString);
72919
72941
  }
72920
72942
  if (int) {
72921
- const escaped = new constant_1.ConstantTranspiler().escape(int.concatTokens());
72943
+ const escaped = constant_1.ConstantTranspiler.escape(int.concatTokens());
72922
72944
  value = "\n" + name + ".set(" + escaped + ");";
72923
72945
  }
72924
72946
  else if (val.getChildren()[1].get() instanceof abaplint.Expressions.SimpleFieldChain) {
@@ -77560,7 +77582,7 @@ class InterfaceTranspiler {
77560
77582
  const valExpression = constantStatement === null || constantStatement === void 0 ? void 0 : constantStatement.findFirstExpression(abaplint.Expressions.Value);
77561
77583
  if ((valExpression === null || valExpression === void 0 ? void 0 : valExpression.getChildren()[1].get()) instanceof abaplint.Expressions.SimpleFieldChain) {
77562
77584
  const s = new expressions_1.FieldChainTranspiler().transpile(valExpression.getChildren()[1], traversal, false).getCode();
77563
- const e = new expressions_1.ConstantTranspiler().escape(s);
77585
+ const e = expressions_1.ConstantTranspiler.escape(s);
77564
77586
  ret += name + ".set(" + e + ");\n";
77565
77587
  continue;
77566
77588
  }
@@ -78593,7 +78615,7 @@ class Traversal {
78593
78615
  let ret = "";
78594
78616
  const handle = (val, name) => {
78595
78617
  if (typeof val === "string") {
78596
- const e = new expressions_1.ConstantTranspiler().escape(val);
78618
+ const e = expressions_1.ConstantTranspiler.escape(val);
78597
78619
  ret += name + ".set(" + e + ");\n";
78598
78620
  }
78599
78621
  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.43",
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.43",
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.0",
33
+ "@abaplint/core": "^2.99.7",
34
34
  "progress": "^2.0.3",
35
35
  "webpack": "^5.82.0",
36
- "webpack-cli": "^5.0.2",
36
+ "webpack-cli": "^5.1.0",
37
37
  "typescript": "^5.0.4"
38
38
  }
39
39
  }