@abaplint/transpiler 2.6.15 → 2.6.17

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.
@@ -4,7 +4,6 @@ export declare class Chunk {
4
4
  private raw;
5
5
  mappings: sourceMap.Mapping[];
6
6
  constructor(str?: string);
7
- copy(): Chunk;
8
7
  join(chunks: Chunk[], str?: string): Chunk;
9
8
  appendChunk(append: Chunk): Chunk;
10
9
  append(input: string, pos: abaplint.Position | abaplint.INode | abaplint.Token, traversal: {
@@ -22,12 +22,14 @@ class Chunk {
22
22
  this.appendString(str);
23
23
  }
24
24
  }
25
- copy() {
25
+ /*
26
+ public copy(): Chunk {
26
27
  const ret = new Chunk();
27
28
  ret.raw = this.raw;
28
29
  ret.mappings = [...this.mappings];
29
30
  return ret;
30
- }
31
+ }
32
+ */
31
33
  join(chunks, str = ", ") {
32
34
  for (let i = 0; i < chunks.length; i++) {
33
35
  this.appendChunk(chunks[i]);
@@ -44,7 +46,7 @@ class Chunk {
44
46
  const lines = this.raw.split("\n");
45
47
  const lineCount = lines.length;
46
48
  const lastLine = lines[lines.length - 1];
47
- append.mappings.forEach(m => {
49
+ for (const m of append.mappings) {
48
50
  // original stays the same, but adjust the generated positions
49
51
  const add = m;
50
52
  if (add.generated.line === 1 && this.raw.endsWith("\n") === false) {
@@ -54,7 +56,7 @@ class Chunk {
54
56
  add.generated.line += lineCount - 1;
55
57
  }
56
58
  this.mappings.push(add);
57
- });
59
+ }
58
60
  this.raw += append.getCode();
59
61
  return this;
60
62
  }
@@ -88,6 +88,7 @@ class TranspileTypes {
88
88
  }
89
89
  }
90
90
  else if (type instanceof abaplint.BasicTypes.CLikeType
91
+ || type instanceof abaplint.BasicTypes.CGenericType
91
92
  || type instanceof abaplint.BasicTypes.CSequenceType) {
92
93
  // if not supplied its a Character(1)
93
94
  resolved = "Character";
@@ -257,21 +257,28 @@ class Traversal {
257
257
  if (ref === undefined) {
258
258
  return undefined;
259
259
  }
260
- // local classes
260
+ // local
261
261
  if (ref.getFilename() === this.getFilename()) {
262
262
  const scope = this.findCurrentScopeByToken(ref.getToken());
263
263
  if ((scope === null || scope === void 0 ? void 0 : scope.getIdentifier().stype) === abaplint.ScopeType.Interface) {
264
264
  return scope === null || scope === void 0 ? void 0 : scope.getIdentifier().sname;
265
265
  }
266
266
  }
267
- // global classes
268
- const file = this.reg.getFileByName(ref.getFilename());
269
- if (file) {
270
- const obj = this.reg.findObjectForFile(file);
271
- if ((obj === null || obj === void 0 ? void 0 : obj.getType()) === "INTF") {
267
+ // global
268
+ for (const obj of this.reg.getObjectsByType("INTF")) {
269
+ if (obj.getFiles().some(f => f.getFilename() === ref.getFilename())) {
272
270
  return obj.getName().toLowerCase();
273
271
  }
274
272
  }
273
+ /*
274
+ const file = this.reg.getFileByName(ref.getFilename());
275
+ if (file) {
276
+ const obj = this.reg.findObjectForFile(file);
277
+ if (obj?.getType() === "INTF") {
278
+ return obj.getName().toLowerCase();
279
+ }
280
+ }
281
+ */
275
282
  return undefined;
276
283
  }
277
284
  findReadOrWriteReference(token) {
@@ -453,7 +460,7 @@ class Traversal {
453
460
  }
454
461
  const name = def.getName();
455
462
  if (def.isGlobal() === false) {
456
- const prefix = this.buildPrefix(def);
463
+ const prefix = this.buildPrefix();
457
464
  return `abap.Classes['${prefix}-${name.toUpperCase()}'] = ${Traversal.escapeNamespace(name.toLowerCase())};`;
458
465
  }
459
466
  else {
@@ -499,7 +506,7 @@ class Traversal {
499
506
  }
500
507
  if (def) {
501
508
  if (def.isGlobal() === false) {
502
- const prefix = this.buildPrefix(def);
509
+ const prefix = this.buildPrefix();
503
510
  return `abap.Classes['${prefix}-${(_a = def === null || def === void 0 ? void 0 : def.getName()) === null || _a === void 0 ? void 0 : _a.toUpperCase()}']`;
504
511
  }
505
512
  else {
@@ -511,13 +518,8 @@ class Traversal {
511
518
  return "abap.Classes['" + name.toUpperCase() + "']";
512
519
  }
513
520
  }
514
- buildPrefix(def) {
515
- const file = this.reg.getFileByName(def.getFilename());
516
- if (file === undefined) {
517
- return "NOT_FOUND";
518
- }
519
- const obj = this.reg.findObjectForFile(file);
520
- return (obj === null || obj === void 0 ? void 0 : obj.getType()) + "-" + (obj === null || obj === void 0 ? void 0 : obj.getName());
521
+ buildPrefix() {
522
+ return this.obj.getType() + "-" + this.obj.getName();
521
523
  }
522
524
  ////////////////////////////
523
525
  traverseStructure(node) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/transpiler",
3
- "version": "2.6.15",
3
+ "version": "2.6.17",
4
4
  "description": "Transpiler",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/src/index.d.ts",
@@ -28,7 +28,7 @@
28
28
  "author": "abaplint",
29
29
  "license": "MIT",
30
30
  "dependencies": {
31
- "@abaplint/core": "^2.97.7",
31
+ "@abaplint/core": "^2.97.12",
32
32
  "source-map": "^0.7.4"
33
33
  },
34
34
  "devDependencies": {