@abaplint/transpiler 2.2.19 → 2.3.0

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.
@@ -0,0 +1,5 @@
1
+ import * as abaplint from "@abaplint/core";
2
+ import { IOutputFile } from "../types";
3
+ export declare class HandleEnqu {
4
+ runObject(obj: abaplint.Objects.LockObject, _reg: abaplint.IRegistry): IOutputFile[];
5
+ }
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.HandleEnqu = void 0;
4
+ const chunk_1 = require("../chunk");
5
+ // view, much like the tables
6
+ class HandleEnqu {
7
+ runObject(obj, _reg) {
8
+ var _a;
9
+ const filename = (_a = obj.getXMLFile()) === null || _a === void 0 ? void 0 : _a.getFilename().replace(".xml", ".mjs").toLowerCase();
10
+ if (filename === undefined) {
11
+ return [];
12
+ }
13
+ const chunk = new chunk_1.Chunk().appendString(`// enqueue object
14
+ abap.FunctionModules["ENQUEUE_${obj.getName().toUpperCase()}_LOCK"] = async (INPUT) => {
15
+ const lookup = abap.Classes["KERNEL_LOCK"];
16
+ if (lookup === undefined) {
17
+ throw new Error("Lock, kernel class missing");
18
+ }
19
+ await lookup.enqueue(INPUT);
20
+ };
21
+ abap.FunctionModules["DEQUEUE_${obj.getName().toUpperCase()}_LOCK"] = async (INPUT) => {
22
+ const lookup = abap.Classes["KERNEL_LOCK"];
23
+ if (lookup === undefined) {
24
+ throw new Error("Lock, kernel class missing");
25
+ }
26
+ await lookup.dequeue(INPUT);
27
+ };`);
28
+ const output = {
29
+ object: {
30
+ name: obj.getName(),
31
+ type: obj.getType(),
32
+ },
33
+ filename: filename,
34
+ chunk: chunk,
35
+ requires: [],
36
+ exports: [],
37
+ };
38
+ return [output];
39
+ }
40
+ }
41
+ exports.HandleEnqu = HandleEnqu;
42
+ //# sourceMappingURL=handle_enqu.js.map
@@ -12,6 +12,7 @@ const handle_abap_1 = require("./handlers/handle_abap");
12
12
  const handle_data_element_1 = require("./handlers/handle_data_element");
13
13
  const handle_table_type_1 = require("./handlers/handle_table_type");
14
14
  const handle_view_1 = require("./handlers/handle_view");
15
+ const handle_enqu_1 = require("./handlers/handle_enqu");
15
16
  class Transpiler {
16
17
  constructor(options) {
17
18
  this.options = options;
@@ -63,6 +64,9 @@ class Transpiler {
63
64
  else if (obj instanceof abaplint.Objects.View) {
64
65
  output.objects.push(...new handle_view_1.HandleView().runObject(obj, reg));
65
66
  }
67
+ else if (obj instanceof abaplint.Objects.LockObject) {
68
+ output.objects.push(...new handle_enqu_1.HandleEnqu().runObject(obj, reg));
69
+ }
66
70
  else if (obj instanceof abaplint.Objects.DataElement) {
67
71
  output.objects.push(...new handle_data_element_1.HandleDataElement().runObject(obj, reg));
68
72
  }
@@ -194,6 +194,7 @@ run().then(() => {
194
194
  for (const obj of reg.getObjects()) {
195
195
  if (obj instanceof abaplint.Objects.Table
196
196
  || obj instanceof abaplint.Objects.DataElement
197
+ || obj instanceof abaplint.Objects.LockObject
197
198
  || obj instanceof abaplint.Objects.TableType) {
198
199
  list.push(imp(`${this.escapeNamespace(obj.getName().toLowerCase())}.${obj.getType().toLowerCase()}`));
199
200
  }
@@ -16,7 +16,6 @@ exports.config = {
16
16
  "rules": {
17
17
  "when_others_last": true,
18
18
  "avoid_use": {
19
- // "define": true,
20
19
  "execSQL": true,
21
20
  "kernelCall": true,
22
21
  "communication": true,
@@ -28,19 +27,12 @@ exports.config = {
28
27
  },
29
28
  "parser_error": true,
30
29
  "allowed_object_types": {
31
- "allowed": ["INTF", "CLAS", "PROG", "DEVC", "TABL", "SHLP", "VIEW", "XSLT", "SHMA", "SICF", "NROB", "TYPE", "DTEL", "DOMA", "TTYP", "MSAG", "FUGR"],
30
+ "allowed": ["INTF", "CLAS", "PROG", "DEVC", "TABL", "SHLP", "VIEW", "XSLT", "ENQU", "SHMA", "SICF", "NROB", "TYPE", "DTEL", "DOMA", "TTYP", "MSAG", "FUGR"],
32
31
  },
33
- /*
34
- "exit_or_check": {
35
- "allowCheck": true,
36
- "allowExit": false,
37
- },
38
- */
39
32
  "unknown_types": true,
40
33
  "ambiguous_statement": true,
41
34
  "implement_methods": true,
42
35
  "begin_end_names": true,
43
- // "no_chained_assignment": true,
44
36
  "check_syntax": true,
45
37
  "form_no_dash": true,
46
38
  "omit_preceding_zeros": true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/transpiler",
3
- "version": "2.2.19",
3
+ "version": "2.3.0",
4
4
  "description": "Transpiler",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/src/index.d.ts",