@abaplint/transpiler 2.13.22 → 2.13.24

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.
@@ -52,6 +52,9 @@ class DatabaseSetup {
52
52
  const populateTables = new populate_tables_1.PopulateTables(this.reg);
53
53
  // INSERT data
54
54
  for (const obj of this.reg.getObjects()) {
55
+ if (options?.populateTables?.tadir !== false) {
56
+ insert.push(populateTables.insertTADIR(obj));
57
+ }
55
58
  if (obj instanceof abaplint.Objects.MessageClass) {
56
59
  insert.push(...populateTables.insertT100(obj));
57
60
  }
@@ -6,6 +6,7 @@ export declare class PopulateTables {
6
6
  private readonly hasSEOSUBCOTX;
7
7
  private readonly hasT000;
8
8
  private readonly hasT100;
9
+ private readonly hasTADIR;
9
10
  private readonly hasWWWPARAMS;
10
11
  constructor(reg: abaplint.IRegistry);
11
12
  insertREPOSRC(obj: abaplint.Objects.Class | abaplint.Objects.Interface): string;
@@ -14,6 +15,7 @@ export declare class PopulateTables {
14
15
  insertSEOSUBCODF(obj: abaplint.Objects.Class | abaplint.Objects.Interface): string[];
15
16
  insertSEOSUBCOTX(obj: abaplint.Objects.Class | abaplint.Objects.Interface): string[];
16
17
  insertT000(): string;
18
+ insertTADIR(obj: abaplint.IObject): string;
17
19
  insertWWWPARAMS(obj: abaplint.Objects.WebMIME): string[];
18
20
  private escape;
19
21
  }
@@ -8,6 +8,7 @@ class PopulateTables {
8
8
  hasSEOSUBCOTX;
9
9
  hasT000;
10
10
  hasT100;
11
+ hasTADIR;
11
12
  hasWWWPARAMS;
12
13
  constructor(reg) {
13
14
  this.hasREPOSRC = reg.getObject("TABL", "REPOSRC") !== undefined;
@@ -16,6 +17,7 @@ class PopulateTables {
16
17
  this.hasSEOSUBCOTX = reg.getObject("TABL", "SEOSUBCOTX") !== undefined;
17
18
  this.hasT000 = reg.getObject("TABL", "T000") !== undefined;
18
19
  this.hasT100 = reg.getObject("TABL", "T100") !== undefined;
20
+ this.hasTADIR = reg.getObject("TABL", "TADIR") !== undefined;
19
21
  this.hasWWWPARAMS = reg.getObject("TABL", "WWWPARAMS") !== undefined;
20
22
  }
21
23
  insertREPOSRC(obj) {
@@ -129,6 +131,14 @@ class PopulateTables {
129
131
  // todo, this should take the client number from the json abap_transpile.json settings
130
132
  return `INSERT INTO t000 ("mandt", "cccategory", "ccnocliind") VALUES ('123', '', '');`;
131
133
  }
134
+ insertTADIR(obj) {
135
+ if (!this.hasTADIR) {
136
+ return "";
137
+ }
138
+ const type = obj.getType().toUpperCase();
139
+ const name = obj.getName().toUpperCase();
140
+ return `INSERT INTO "tadir" ("pgmid", "object", "obj_name", "devclass") VALUES ('R3TR', '${type}', '${this.escape(name)}', '$TMP');`;
141
+ }
132
142
  insertWWWPARAMS(obj) {
133
143
  if (!this.hasWWWPARAMS) {
134
144
  return [];
@@ -10,15 +10,15 @@ class AssignTranspiler {
10
10
  if (node?.findFirstExpression(abaplint.Expressions.TableExpression) === undefined) {
11
11
  return code;
12
12
  }
13
- return `(await (async () => {
14
- try {
15
- return ${code};
16
- } catch (error) {
17
- if (abap.isLineNotFound(error)) {
18
- return undefined;
19
- }
20
- throw error;
21
- }
13
+ return `(await (async () => {
14
+ try {
15
+ return ${code};
16
+ } catch (error) {
17
+ if (abap.isLineNotFound(error)) {
18
+ return undefined;
19
+ }
20
+ throw error;
21
+ }
22
22
  })())`;
23
23
  }
24
24
  transpile(node, traversal) {
@@ -101,26 +101,26 @@ class AssignTranspiler {
101
101
  const firstFirst = first.getChildren()[1];
102
102
  if (firstFirst?.get() instanceof abaplint.Expressions.Constant) {
103
103
  const s = firstFirst.getFirstToken().getStr().toLowerCase().match(/\w+/)?.toString();
104
- options.push(`dynamicSource: (() => {
105
- try { return ${s}; } catch {}
106
- try { return this.${s}; } catch {}
104
+ options.push(`dynamicSource: (() => {
105
+ try { return ${s}; } catch {}
106
+ try { return this.${s}; } catch {}
107
107
  })()`);
108
108
  }
109
109
  else if (firstFirst?.get() instanceof abaplint.Expressions.FieldChain && firstFirst instanceof abaplint.Nodes.ExpressionNode) {
110
110
  const code = new expressions_1.FieldChainTranspiler(true).transpile(firstFirst, traversal).getCode();
111
- options.push(`dynamicSource: (() => {
112
- const name = ${code}.toLowerCase().replace(/[~\\/]/g, "$").match(/[\\w\\$\\/]+/)[0];
113
- try { return eval(name); } catch {}
114
- try { return eval("this." + name); } catch {}
111
+ options.push(`dynamicSource: (() => {
112
+ const name = ${code}.toLowerCase().replace(/[~\\/]/g, "$").match(/[\\w\\$\\/]+/)[0];
113
+ try { return eval(name); } catch {}
114
+ try { return eval("this." + name); } catch {}
115
115
  })()`);
116
116
  }
117
117
  }
118
118
  else if (first?.get() instanceof abaplint.Expressions.Source && first instanceof abaplint.Nodes.ExpressionNode) {
119
119
  // const name = first.concatTokens().toLowerCase();
120
120
  const name = new expressions_1.SourceTranspiler().transpile(first, traversal).getCode();
121
- options.push(`dynamicSource: (() => {
122
- try { return ${name}; } catch {}
123
- try { return this.${name}; } catch {}
121
+ options.push(`dynamicSource: (() => {
122
+ try { return ${name}; } catch {}
123
+ try { return this.${name}; } catch {}
124
124
  })()`);
125
125
  }
126
126
  }
@@ -69,7 +69,9 @@ export interface ITranspilerOptions {
69
69
  seosubcodf?: boolean;
70
70
  /** insert into SEOSUBCOTX, skips if equals false */
71
71
  seosubcotx?: boolean;
72
- /** insert into SEOSUBCOTX, skips if equals false */
72
+ /** insert into TADIR, skips if equals false */
73
+ tadir?: boolean;
74
+ /** insert into WWWPARAMS, skips if equals false */
73
75
  wwwparams?: boolean;
74
76
  };
75
77
  /** ignore source map */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/transpiler",
3
- "version": "2.13.22",
3
+ "version": "2.13.24",
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.119.13",
32
+ "@abaplint/core": "^2.119.19",
33
33
  "source-map": "^0.7.6"
34
34
  },
35
35
  "devDependencies": {