@abaplint/transpiler 2.11.90 → 2.11.92

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.
@@ -1,10 +1,18 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.AttributeNameTranspiler = void 0;
4
+ const abaplint = require("@abaplint/core");
4
5
  const chunk_1 = require("../chunk");
5
6
  class AttributeNameTranspiler {
6
7
  transpile(node, traversal) {
7
- return new chunk_1.Chunk().append(node.concatTokens(), node, traversal);
8
+ let concat = node.concatTokens().toLowerCase();
9
+ // todo: this needs to also check the class name is correct
10
+ const ref = traversal.findReadOrWriteReference(node.getFirstToken());
11
+ if (ref instanceof abaplint.Types.ClassAttribute
12
+ && ref.getVisibility() === abaplint.Visibility.Private) {
13
+ concat = "#" + concat;
14
+ }
15
+ return new chunk_1.Chunk().append(concat, node, traversal);
8
16
  }
9
17
  }
10
18
  exports.AttributeNameTranspiler = AttributeNameTranspiler;
@@ -13,7 +13,10 @@ function escapeRegExp(string) {
13
13
  // TODO: currently SELECT into are always handled as CORRESPONDING
14
14
  class SelectTranspiler {
15
15
  transpile(node, traversal, targetOverride) {
16
- if (node.findDirectTokenByText("ALL") !== undefined) {
16
+ if (node.findDirectTokenByText("UNION") !== undefined) {
17
+ return new chunk_1.Chunk(`throw new Error("SELECT UNION, not supported, transpiler, todo");`);
18
+ }
19
+ else if (node.findDirectTokenByText("ALL") !== undefined) {
17
20
  throw new Error("SelectTranspiler, UNION ALL todo");
18
21
  }
19
22
  else if (node.findDirectTokenByText("DISTINCT") !== undefined) {
@@ -38,7 +38,7 @@ export declare class Traversal {
38
38
  private isBuiltinVariable;
39
39
  isTypePool(token: abaplint.Token): string | undefined;
40
40
  isInterfaceAttribute(token: abaplint.Token): string | undefined;
41
- private findReadOrWriteReference;
41
+ findReadOrWriteReference(token: abaplint.Token): abaplint.Identifier | undefined;
42
42
  private findInferredTypeReference;
43
43
  private findTypeReference;
44
44
  private buildThisAttributes;
@@ -390,15 +390,6 @@ class Traversal {
390
390
  return obj.getName().toLowerCase();
391
391
  }
392
392
  }
393
- /*
394
- const file = this.reg.getFileByName(ref.getFilename());
395
- if (file) {
396
- const obj = this.reg.findObjectForFile(file);
397
- if (obj?.getType() === "INTF") {
398
- return obj.getName().toLowerCase();
399
- }
400
- }
401
- */
402
393
  return undefined;
403
394
  }
404
395
  findReadOrWriteReference(token) {
@@ -485,22 +476,6 @@ class Traversal {
485
476
  // NOTE: currently all are needed in the unit test setup
486
477
  ret += `"${name.replace("~", "$")}": this.${methodName}.bind(this),\n`;
487
478
  }
488
- /*
489
- for (const attribute of def.getAttributes()?.getAll() || []) {
490
- if (attribute.getMeta().includes(abaplint.IdentifierMeta.Static) === true) {
491
- // hmm, is this correct?
492
- continue;
493
- }
494
- let privateHash = "";
495
- if (attribute.getVisibility() === abaplint.Visibility.Private) {
496
- privateHash = "#";
497
- } else {
498
- continue;
499
- }
500
- const attributeName = privateHash + Traversal.escapeNamespace(attribute.getName().toLowerCase());
501
- ret += `"${attribute.getName().toLowerCase()}": this.${attributeName},\n`;
502
- }
503
- */
504
479
  ret += "};\n";
505
480
  return ret;
506
481
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/transpiler",
3
- "version": "2.11.90",
3
+ "version": "2.11.92",
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.113.200",
32
+ "@abaplint/core": "^2.113.201",
33
33
  "source-map": "^0.7.6"
34
34
  },
35
35
  "devDependencies": {