@abaplint/transpiler-cli 2.6.26 → 2.6.27

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.
Files changed (2) hide show
  1. package/build/bundle.js +80 -42
  2. package/package.json +4 -4
package/build/bundle.js CHANGED
@@ -19568,21 +19568,28 @@ class CurrentScope {
19568
19568
  if (name === undefined) {
19569
19569
  return { found: false };
19570
19570
  }
19571
+ let RTTIPrefix = "";
19572
+ if (this.parentObj.getType() === "PROG") {
19573
+ RTTIPrefix = "\\PROGRAM=" + this.parentObj.getName();
19574
+ }
19575
+ else if (this.parentObj.getType() === "CLAS") {
19576
+ RTTIPrefix = "\\CLASS-POOL=" + this.parentObj.getName();
19577
+ }
19571
19578
  const findLocalClass = (_a = this.current) === null || _a === void 0 ? void 0 : _a.findClassDefinition(name);
19572
19579
  if (findLocalClass) {
19573
- return { found: true, id: findLocalClass, type: _reference_1.ReferenceType.ObjectOrientedReference, ooType: "CLAS" };
19580
+ return { found: true, id: findLocalClass, type: _reference_1.ReferenceType.ObjectOrientedReference, ooType: "CLAS", RTTIName: RTTIPrefix + "\\CLASS=" + findLocalClass.getName() };
19574
19581
  }
19575
19582
  const globalClas = this.reg.getObject("CLAS", name);
19576
19583
  if (globalClas) {
19577
- return { found: true, id: globalClas.getIdentifier(), type: _reference_1.ReferenceType.ObjectOrientedReference, ooType: "CLAS" };
19584
+ return { found: true, id: globalClas.getIdentifier(), type: _reference_1.ReferenceType.ObjectOrientedReference, ooType: "CLAS", RTTIName: "\\CLASS=" + globalClas.getName() };
19578
19585
  }
19579
19586
  const findLocalInterface = (_b = this.current) === null || _b === void 0 ? void 0 : _b.findInterfaceDefinition(name);
19580
19587
  if (findLocalInterface) {
19581
- return { found: true, id: findLocalInterface, type: _reference_1.ReferenceType.ObjectOrientedReference, ooType: "INTF" };
19588
+ return { found: true, id: findLocalInterface, type: _reference_1.ReferenceType.ObjectOrientedReference, ooType: "INTF", RTTIName: RTTIPrefix + "\\INTERFACE=" + findLocalInterface.getName() };
19582
19589
  }
19583
19590
  const globalIntf = this.reg.getObject("INTF", name);
19584
19591
  if (globalIntf) {
19585
- return { found: true, id: globalIntf.getIdentifier(), type: _reference_1.ReferenceType.ObjectOrientedReference, ooType: "INTF" };
19592
+ return { found: true, id: globalIntf.getIdentifier(), type: _reference_1.ReferenceType.ObjectOrientedReference, ooType: "INTF", RTTIName: "\\INTERFACE=" + globalIntf.getName() };
19586
19593
  }
19587
19594
  const def = (_c = this.current) === null || _c === void 0 ? void 0 : _c.findDeferred(name);
19588
19595
  if (def !== undefined) {
@@ -20436,6 +20443,7 @@ class TypeUtils {
20436
20443
  else if (type instanceof basic_1.XStringType
20437
20444
  || type instanceof basic_1.HexType
20438
20445
  || type instanceof basic_1.VoidType
20446
+ || type instanceof basic_1.XSequenceType
20439
20447
  || type instanceof basic_1.AnyType
20440
20448
  || type instanceof basic_1.UnknownType) {
20441
20449
  return true;
@@ -21530,7 +21538,7 @@ class BasicTypes {
21530
21538
  const search = this.scope.existsObject(name);
21531
21539
  if (search.found === true && search.id) {
21532
21540
  this.scope.addReference(chain.getFirstToken(), search.id, _reference_1.ReferenceType.ObjectOrientedReference, this.filename, { ooType: search.ooType, ooName: name });
21533
- return new Types.ObjectReferenceType(search.id, name);
21541
+ return new Types.ObjectReferenceType(search.id, { qualifiedName: name, RTTIName: search.RTTIName });
21534
21542
  }
21535
21543
  }
21536
21544
  const found = this.resolveTypeName(chain);
@@ -21793,7 +21801,7 @@ class Cast {
21793
21801
  if (tt === undefined || tt instanceof basic_1.VoidType || tt instanceof basic_1.UnknownType) {
21794
21802
  const found = scope.findObjectDefinition(typeName);
21795
21803
  if (found) {
21796
- tt = new basic_1.ObjectReferenceType(found, typeName);
21804
+ tt = new basic_1.ObjectReferenceType(found, { qualifiedName: typeName });
21797
21805
  }
21798
21806
  }
21799
21807
  else {
@@ -24678,10 +24686,23 @@ exports.StringTemplate = void 0;
24678
24686
  const basic_1 = __webpack_require__(/*! ../../types/basic */ "./node_modules/@abaplint/core/build/src/abap/types/basic/index.js");
24679
24687
  const Expressions = __webpack_require__(/*! ../../2_statements/expressions */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js");
24680
24688
  const source_1 = __webpack_require__(/*! ./source */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/source.js");
24689
+ const _type_utils_1 = __webpack_require__(/*! ../_type_utils */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_type_utils.js");
24681
24690
  class StringTemplate {
24682
24691
  runSyntax(node, scope, filename) {
24683
- for (const s of node.findAllExpressions(Expressions.Source)) {
24684
- new source_1.Source().runSyntax(s, scope, filename, new basic_1.StringType({ qualifiedName: "STRING" }));
24692
+ var _a;
24693
+ const typeUtils = new _type_utils_1.TypeUtils(scope);
24694
+ for (const templateSource of node.findAllExpressions(Expressions.StringTemplateSource)) {
24695
+ const s = templateSource.findDirectExpression(Expressions.Source);
24696
+ const type = new source_1.Source().runSyntax(s, scope, filename, new basic_1.StringType({ qualifiedName: "STRING" }));
24697
+ if (type === undefined) {
24698
+ throw new Error("No target type determined");
24699
+ }
24700
+ else if (typeUtils.isCharLike(type) === false && typeUtils.isHexLike(type) === false) {
24701
+ throw new Error("Not character like, " + type.constructor.name);
24702
+ }
24703
+ for (const formatSource of ((_a = templateSource.findDirectExpression(Expressions.StringTemplateFormatting)) === null || _a === void 0 ? void 0 : _a.findAllExpressions(Expressions.Source)) || []) {
24704
+ new source_1.Source().runSyntax(formatSource, scope, filename);
24705
+ }
24685
24706
  }
24686
24707
  return new basic_1.StringType({ qualifiedName: "STRING" });
24687
24708
  }
@@ -32771,6 +32792,10 @@ class AbstractType {
32771
32792
  var _a;
32772
32793
  return (_a = this.data) === null || _a === void 0 ? void 0 : _a.qualifiedName;
32773
32794
  }
32795
+ getRTTIName() {
32796
+ var _a;
32797
+ return (_a = this.data) === null || _a === void 0 ? void 0 : _a.RTTIName;
32798
+ }
32774
32799
  getConversionExit() {
32775
32800
  var _a;
32776
32801
  return (_a = this.data) === null || _a === void 0 ? void 0 : _a.conversionExit;
@@ -33517,8 +33542,8 @@ exports.ObjectReferenceType = void 0;
33517
33542
  const _abstract_type_1 = __webpack_require__(/*! ./_abstract_type */ "./node_modules/@abaplint/core/build/src/abap/types/basic/_abstract_type.js");
33518
33543
  // use GenericObjectReferenceType for REF TO OBJECT
33519
33544
  class ObjectReferenceType extends _abstract_type_1.AbstractType {
33520
- constructor(id, qualifiedName) {
33521
- super({ qualifiedName: qualifiedName });
33545
+ constructor(id, extra) {
33546
+ super(extra);
33522
33547
  this.identifier = id;
33523
33548
  }
33524
33549
  getIdentifierName() {
@@ -36901,12 +36926,18 @@ class DDIC {
36901
36926
  const clas = this.reg.getObject("CLAS", name);
36902
36927
  const globalClas = clas === null || clas === void 0 ? void 0 : clas.getIdentifier();
36903
36928
  if (globalClas) {
36904
- return { type: new basic_1.ObjectReferenceType(globalClas, name), object: clas };
36929
+ return {
36930
+ type: new basic_1.ObjectReferenceType(globalClas, { qualifiedName: name, RTTIName: "\\CLASS=" + name }),
36931
+ object: clas,
36932
+ };
36905
36933
  }
36906
36934
  const intf = this.reg.getObject("INTF", name);
36907
36935
  const globalIntf = intf === null || intf === void 0 ? void 0 : intf.getIdentifier();
36908
36936
  if (globalIntf) {
36909
- return { type: new basic_1.ObjectReferenceType(globalIntf, name), object: intf };
36937
+ return {
36938
+ type: new basic_1.ObjectReferenceType(globalIntf, { qualifiedName: name, RTTIName: "\\INTERFACE=" + name }),
36939
+ object: intf,
36940
+ };
36910
36941
  }
36911
36942
  if (this.inErrorNamespace(name) === true) {
36912
36943
  return { type: new basic_1.UnknownType(name) };
@@ -38360,6 +38391,9 @@ class LSPLookup {
38360
38391
  if (variable.getType().getQualifiedName()) {
38361
38392
  value += "\n\nQualified Type Name: ```" + variable.getType().getQualifiedName() + "```";
38362
38393
  }
38394
+ if (variable.getType().getRTTIName()) {
38395
+ value += "\n\nRTTI Name: ```" + variable.getType().getRTTIName() + "```";
38396
+ }
38363
38397
  if (variable.getType().isGeneric() === true) {
38364
38398
  value += "\n\nIs Generic Type";
38365
38399
  }
@@ -46483,7 +46517,7 @@ class Registry {
46483
46517
  }
46484
46518
  static abaplintVersion() {
46485
46519
  // magic, see build script "version.sh"
46486
- return "2.97.15";
46520
+ return "2.97.16";
46487
46521
  }
46488
46522
  getDDICReferences() {
46489
46523
  return this.references;
@@ -77499,15 +77533,14 @@ class TranspileTypes {
77499
77533
  return pre + t.getName().toLowerCase() + " = " + code + ";\n";
77500
77534
  }
77501
77535
  toType(type) {
77502
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
77536
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
77503
77537
  let resolved = "";
77504
77538
  let extra = "";
77505
77539
  if (type instanceof abaplint.BasicTypes.ObjectReferenceType
77506
77540
  || type instanceof abaplint.BasicTypes.GenericObjectReferenceType) {
77507
77541
  resolved = "ABAPObject";
77508
- if (type.getQualifiedName() !== undefined) {
77509
- extra = "{qualifiedName: \"" + ((_a = type.getQualifiedName()) === null || _a === void 0 ? void 0 : _a.toUpperCase()) + "\"}";
77510
- }
77542
+ extra = "{qualifiedName: " + JSON.stringify((_a = type.getQualifiedName()) === null || _a === void 0 ? void 0 : _a.toUpperCase()) +
77543
+ ", RTTIName: " + JSON.stringify((_b = type.getRTTIName()) === null || _b === void 0 ? void 0 : _b.toUpperCase()) + "}";
77511
77544
  }
77512
77545
  else if (type instanceof abaplint.BasicTypes.TableType) {
77513
77546
  resolved = "Table";
@@ -77521,31 +77554,31 @@ class TranspileTypes {
77521
77554
  else if (type instanceof abaplint.BasicTypes.IntegerType) {
77522
77555
  resolved = "Integer";
77523
77556
  if (type.getQualifiedName() !== undefined) {
77524
- extra = "{qualifiedName: \"" + ((_b = type.getQualifiedName()) === null || _b === void 0 ? void 0 : _b.toUpperCase()) + "\"}";
77557
+ extra = "{qualifiedName: \"" + ((_c = type.getQualifiedName()) === null || _c === void 0 ? void 0 : _c.toUpperCase()) + "\"}";
77525
77558
  }
77526
77559
  }
77527
77560
  else if (type instanceof abaplint.BasicTypes.StringType) {
77528
77561
  resolved = "String";
77529
77562
  if (type.getQualifiedName() !== undefined) {
77530
- extra = "{qualifiedName: \"" + ((_c = type.getQualifiedName()) === null || _c === void 0 ? void 0 : _c.toUpperCase()) + "\"}";
77563
+ extra = "{qualifiedName: \"" + ((_d = type.getQualifiedName()) === null || _d === void 0 ? void 0 : _d.toUpperCase()) + "\"}";
77531
77564
  }
77532
77565
  }
77533
77566
  else if (type instanceof abaplint.BasicTypes.UTCLongType) {
77534
77567
  resolved = "UTCLong";
77535
77568
  if (type.getQualifiedName() !== undefined) {
77536
- extra = "{qualifiedName: \"" + ((_d = type.getQualifiedName()) === null || _d === void 0 ? void 0 : _d.toUpperCase()) + "\"}";
77569
+ extra = "{qualifiedName: \"" + ((_e = type.getQualifiedName()) === null || _e === void 0 ? void 0 : _e.toUpperCase()) + "\"}";
77537
77570
  }
77538
77571
  }
77539
77572
  else if (type instanceof abaplint.BasicTypes.DateType) {
77540
77573
  resolved = "Date";
77541
77574
  if (type.getQualifiedName() !== undefined) {
77542
- extra = "{qualifiedName: \"" + ((_e = type.getQualifiedName()) === null || _e === void 0 ? void 0 : _e.toUpperCase()) + "\"}";
77575
+ extra = "{qualifiedName: \"" + ((_f = type.getQualifiedName()) === null || _f === void 0 ? void 0 : _f.toUpperCase()) + "\"}";
77543
77576
  }
77544
77577
  }
77545
77578
  else if (type instanceof abaplint.BasicTypes.TimeType) {
77546
77579
  resolved = "Time";
77547
77580
  if (type.getQualifiedName() !== undefined) {
77548
- extra = "{qualifiedName: \"" + ((_f = type.getQualifiedName()) === null || _f === void 0 ? void 0 : _f.toUpperCase()) + "\"}";
77581
+ extra = "{qualifiedName: \"" + ((_g = type.getQualifiedName()) === null || _g === void 0 ? void 0 : _g.toUpperCase()) + "\"}";
77549
77582
  }
77550
77583
  }
77551
77584
  else if (type instanceof abaplint.BasicTypes.DataReference) {
@@ -77616,7 +77649,7 @@ class TranspileTypes {
77616
77649
  else if (type instanceof abaplint.BasicTypes.XStringType) {
77617
77650
  resolved = "XString";
77618
77651
  if (type.getQualifiedName() !== undefined) {
77619
- extra = "{qualifiedName: \"" + ((_g = type.getQualifiedName()) === null || _g === void 0 ? void 0 : _g.toUpperCase()) + "\"}";
77652
+ extra = "{qualifiedName: \"" + ((_h = type.getQualifiedName()) === null || _h === void 0 ? void 0 : _h.toUpperCase()) + "\"}";
77620
77653
  }
77621
77654
  }
77622
77655
  else if (type instanceof abaplint.BasicTypes.XSequenceType) {
@@ -77632,13 +77665,13 @@ class TranspileTypes {
77632
77665
  else if (type instanceof abaplint.BasicTypes.FloatType) {
77633
77666
  resolved = "Float";
77634
77667
  if (type.getQualifiedName() !== undefined) {
77635
- extra = "{qualifiedName: \"" + ((_h = type.getQualifiedName()) === null || _h === void 0 ? void 0 : _h.toUpperCase()) + "\"}";
77668
+ extra = "{qualifiedName: \"" + ((_j = type.getQualifiedName()) === null || _j === void 0 ? void 0 : _j.toUpperCase()) + "\"}";
77636
77669
  }
77637
77670
  }
77638
77671
  else if (type instanceof abaplint.BasicTypes.FloatingPointType) {
77639
77672
  resolved = "Float";
77640
77673
  if (type.getQualifiedName() !== undefined) {
77641
- extra = "{qualifiedName: \"" + ((_j = type.getQualifiedName()) === null || _j === void 0 ? void 0 : _j.toUpperCase()) + "\"}";
77674
+ extra = "{qualifiedName: \"" + ((_k = type.getQualifiedName()) === null || _k === void 0 ? void 0 : _k.toUpperCase()) + "\"}";
77642
77675
  }
77643
77676
  }
77644
77677
  else if (type instanceof abaplint.BasicTypes.DecFloat34Type) {
@@ -78149,14 +78182,8 @@ class Traversal {
78149
78182
  if (def === undefined) {
78150
78183
  return "";
78151
78184
  }
78152
- const name = def.getName();
78153
- if (def.isGlobal() === false) {
78154
- const prefix = this.buildPrefix();
78155
- return `abap.Classes['${prefix}-${name.toUpperCase()}'] = ${Traversal.escapeNamespace(name.toLowerCase())};`;
78156
- }
78157
- else {
78158
- return `abap.Classes['${name.toUpperCase()}'] = ${Traversal.escapeNamespace(name.toLowerCase())};`;
78159
- }
78185
+ const name = this.buildInternalName(def.getName(), def);
78186
+ return `abap.Classes['${name}'] = ${Traversal.escapeNamespace(def.getName().toLowerCase())};`;
78160
78187
  }
78161
78188
  setValues(identifier, name) {
78162
78189
  return Traversal.setValues(identifier, name);
@@ -80369,8 +80396,20 @@ const parseXml = function(xmlData) {
80369
80396
  textData = this.saveTextToParentTag(textData, currentNode, jPath);
80370
80397
  }
80371
80398
 
80372
- jPath = jPath.substr(0, jPath.lastIndexOf("."));
80373
-
80399
+ //check if last tag of nested tag was unpaired tag
80400
+ const lastTagName = jPath.substring(jPath.lastIndexOf(".")+1);
80401
+ if(tagName && this.options.unpairedTags.indexOf(tagName) !== -1 ){
80402
+ throw new Error(`Unpaired tag can not be used as closing tag: </${tagName}>`);
80403
+ }
80404
+ let propIndex = 0
80405
+ if(lastTagName && this.options.unpairedTags.indexOf(lastTagName) !== -1 ){
80406
+ propIndex = jPath.lastIndexOf('.', jPath.lastIndexOf('.')-1)
80407
+ this.tagsNodeStack.pop();
80408
+ }else{
80409
+ propIndex = jPath.lastIndexOf(".");
80410
+ }
80411
+ jPath = jPath.substring(0, propIndex);
80412
+
80374
80413
  currentNode = this.tagsNodeStack.pop();//avoid recursion, set the parent tag scope
80375
80414
  textData = "";
80376
80415
  i = closeIndex;
@@ -80447,23 +80486,22 @@ const parseXml = function(xmlData) {
80447
80486
  }
80448
80487
  }
80449
80488
 
80450
- if(tagName !== xmlObj.tagname){
80451
- jPath += jPath ? "." + tagName : tagName;
80452
- }
80453
-
80454
80489
  //check if last tag was unpaired tag
80455
80490
  const lastTag = currentNode;
80456
80491
  if(lastTag && this.options.unpairedTags.indexOf(lastTag.tagname) !== -1 ){
80457
80492
  currentNode = this.tagsNodeStack.pop();
80493
+ jPath = jPath.substring(0, jPath.lastIndexOf("."));
80494
+ }
80495
+ if(tagName !== xmlObj.tagname){
80496
+ jPath += jPath ? "." + tagName : tagName;
80458
80497
  }
80459
-
80460
80498
  if (this.isItStopNode(this.options.stopNodes, jPath, tagName)) { //TODO: namespace
80461
80499
  let tagContent = "";
80462
80500
  //self-closing tag
80463
80501
  if(tagExp.length > 0 && tagExp.lastIndexOf("/") === tagExp.length - 1){
80464
80502
  i = result.closeIndex;
80465
80503
  }
80466
- //boolean tag
80504
+ //unpaired tag
80467
80505
  else if(this.options.unpairedTags.indexOf(tagName) !== -1){
80468
80506
  i = result.closeIndex;
80469
80507
  }
@@ -80506,8 +80544,8 @@ const parseXml = function(xmlData) {
80506
80544
  if(tagName !== tagExp && attrExpPresent){
80507
80545
  childNode[":@"] = this.buildAttributesMap(tagExp, jPath, tagName);
80508
80546
  }
80509
- jPath = jPath.substr(0, jPath.lastIndexOf("."));
80510
80547
  this.addChild(currentNode, childNode, jPath)
80548
+ jPath = jPath.substr(0, jPath.lastIndexOf("."));
80511
80549
  }
80512
80550
  //opening tag
80513
80551
  else{
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/transpiler-cli",
3
- "version": "2.6.26",
3
+ "version": "2.6.27",
4
4
  "description": "Transpiler - Command Line Interface",
5
5
  "bin": {
6
6
  "abap_transpile": "./abap_transpile"
@@ -25,15 +25,15 @@
25
25
  "author": "abaplint",
26
26
  "license": "MIT",
27
27
  "devDependencies": {
28
- "@abaplint/transpiler": "^2.6.26",
28
+ "@abaplint/transpiler": "^2.6.27",
29
29
  "@types/glob": "^7.2.0",
30
30
  "glob": "=7.2.0",
31
31
  "@types/progress": "^2.0.5",
32
32
  "@types/node": "^18.15.13",
33
- "@abaplint/core": "^2.97.15",
33
+ "@abaplint/core": "^2.97.16",
34
34
  "progress": "^2.0.3",
35
35
  "webpack": "^5.80.0",
36
- "webpack-cli": "^5.0.1",
36
+ "webpack-cli": "^5.0.2",
37
37
  "typescript": "^5.0.4"
38
38
  }
39
39
  }