@abaplint/transpiler 2.13.2 → 2.13.4

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.
@@ -77,9 +77,11 @@ class PopulateTables {
77
77
  else if (parameter.getMeta().includes("exporting" /* abaplint.IdentifierMeta.MethodExporting */)) {
78
78
  pardecltyp = "1";
79
79
  }
80
- const paroptionl = optionalParameters.includes(parameter.getName()) ? "X" : " ";
80
+ const name = parameter.getName().toUpperCase();
81
+ const paroptionl = (optionalParameters.some(o => o.toUpperCase() === name) || method.getParameters().getParameterDefault(name) !== undefined) ? "X" : " ";
81
82
  const type = parameter.getType().getQualifiedName()?.toUpperCase() || "";
82
- ret.push(`INSERT INTO "seosubcodf" ("clsname", "cmpname", "sconame", "version", "editorder", "pardecltyp", "type", "paroptionl") VALUES ('${obj.getName()}', '${method.getName().toUpperCase()}', '${parameter.getName().toUpperCase()}', '1', ${editorder}, '${pardecltyp}', '${type}', '${paroptionl}');`);
83
+ const parvalue = method.getParameters().getParameterDefault(name)?.concatTokens() || "";
84
+ ret.push(`INSERT INTO "seosubcodf" ("clsname", "cmpname", "sconame", "version", "editorder", "pardecltyp", "type", "paroptionl", "parvalue") VALUES ('${obj.getName()}', '${method.getName().toUpperCase()}', '${name}', '1', ${editorder}, '${pardecltyp}', '${type}', '${paroptionl}', '${this.escape(parvalue)}');`);
83
85
  }
84
86
  }
85
87
  return ret;
@@ -90,9 +92,32 @@ class PopulateTables {
90
92
  if (def === undefined || !this.hasSEOSUBCOTX) {
91
93
  return [];
92
94
  }
95
+ const descriptions = [];
96
+ const xml = obj.getXML();
97
+ if (xml) {
98
+ const parsed = obj.parseRaw2();
99
+ const sub = parsed?.abapGit["asx:abap"]["asx:values"]?.DESCRIPTIONS?.SEOSUBCOTX;
100
+ if (sub) {
101
+ if (Array.isArray(sub)) {
102
+ descriptions.push(...sub);
103
+ }
104
+ else {
105
+ descriptions.push(sub);
106
+ }
107
+ }
108
+ }
93
109
  for (const method of def.getMethodDefinitions().getAll()) {
94
110
  for (const parameter of method.getParameters().getAll()) {
95
- ret.push(`INSERT INTO "seosubcotx" ("clsname", "cmpname", "sconame", "langu", "descript") VALUES ('${obj.getName()}', '${method.getName().toUpperCase()}', '${parameter.getName().toUpperCase()}', 'E', 'todo');`);
111
+ const mName = method.getName().toUpperCase();
112
+ const pName = parameter.getName().toUpperCase();
113
+ let descript = "";
114
+ for (const d of descriptions) {
115
+ if (d.CMPNAME?.toUpperCase() === mName && d.SCONAME?.toUpperCase() === pName) {
116
+ descript = d.DESCRIPT || "";
117
+ break;
118
+ }
119
+ }
120
+ ret.push(`INSERT INTO "seosubcotx" ("clsname", "cmpname", "sconame", "langu", "descript") VALUES ('${obj.getName()}', '${mName}', '${pName}', 'E', '${this.escape(descript)}');`);
96
121
  }
97
122
  }
98
123
  return ret;
@@ -108,7 +108,7 @@ class Rearranger {
108
108
  return;
109
109
  }
110
110
  let splitAt;
111
- // multiplication/division and left to right
111
+ // lowest precedence: +, - (skip **, *, /, MOD, DIV)
112
112
  for (let i = arith.length - 1; i >= 0; i--) {
113
113
  const a = arith[i];
114
114
  const concat = a.concatTokens().toUpperCase();
@@ -122,7 +122,19 @@ class Rearranger {
122
122
  splitAt = a;
123
123
  break;
124
124
  }
125
- // fallback
125
+ // medium precedence: *, /, MOD, DIV (skip only **)
126
+ if (splitAt === undefined) {
127
+ for (let i = arith.length - 1; i >= 0; i--) {
128
+ const a = arith[i];
129
+ const concat = a.concatTokens().toUpperCase();
130
+ if (concat === "**") {
131
+ continue;
132
+ }
133
+ splitAt = a;
134
+ break;
135
+ }
136
+ }
137
+ // fallback: all ** operators
126
138
  if (splitAt === undefined) {
127
139
  splitAt = arith[arith.length - 1];
128
140
  }
@@ -23,7 +23,7 @@ class TypeEnumTranspiler {
23
23
  }
24
24
  }
25
25
  const fields = values.map(v => `"${v}": new abap.types.String()`).join(",\n");
26
- let ret = `let ${traversal_1.Traversal.prefixVariable(structureName)} = new abap.types.Structure({
26
+ let ret = `let ${traversal_1.Traversal.prefixVariable(structureName)} = new abap.types.Structure({
27
27
  ${fields}});\n`;
28
28
  for (const v of values) {
29
29
  ret += `${traversal_1.Traversal.prefixVariable(structureName)}.get().${v}.set("${v.toUpperCase()}");\n`;
@@ -176,9 +176,15 @@ class TranspileTypes {
176
176
  }
177
177
  else if (type instanceof abaplint.BasicTypes.HexType) {
178
178
  resolved = featureHexUInt8 ? "HexUInt8" : "Hex";
179
- if (type.getLength() !== 1) {
179
+ if (type.getLength() !== 1 && type.getQualifiedName() !== undefined) {
180
+ extra = "{length: " + type.getLength() + ", qualifiedName: \"" + type.getQualifiedName()?.toUpperCase() + "\"}";
181
+ }
182
+ else if (type.getLength() !== 1) {
180
183
  extra = "{length: " + type.getLength() + "}";
181
184
  }
185
+ else if (type.getQualifiedName() !== undefined) {
186
+ extra = "{qualifiedName: \"" + type.getQualifiedName()?.toUpperCase() + "\"}";
187
+ }
182
188
  }
183
189
  else if (type instanceof abaplint.BasicTypes.FloatType) {
184
190
  resolved = "Float";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/transpiler",
3
- "version": "2.13.2",
3
+ "version": "2.13.4",
4
4
  "description": "Transpiler",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/src/index.d.ts",
@@ -29,7 +29,7 @@
29
29
  "author": "abaplint",
30
30
  "license": "MIT",
31
31
  "dependencies": {
32
- "@abaplint/core": "^2.118.7",
32
+ "@abaplint/core": "^2.118.8",
33
33
  "source-map": "^0.7.6"
34
34
  },
35
35
  "devDependencies": {