@abaplint/core 2.97.15 → 2.97.16

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.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @abaplint/core
2
2
 
3
- [abaplint](https://abaplint.org/) core library
3
+ [abaplint](https://abaplint.org) core library
4
4
 
5
5
  Exposes functionality like the parser and rules, which can be used in other projects.
6
6
 
@@ -99,6 +99,7 @@ export declare abstract class AbstractType {
99
99
  getAbstractTypeData(): AbstractTypeData | undefined;
100
100
  /** fully qualified symbolic name of the type */
101
101
  getQualifiedName(): string | undefined;
102
+ getRTTIName(): string | undefined;
102
103
  getConversionExit(): string | undefined;
103
104
  getDDICName(): string | undefined;
104
105
  abstract toText(level: number): string;
@@ -113,6 +114,7 @@ declare type AbstractTypeData = {
113
114
  conversionExit?: string;
114
115
  derivedFromConstant?: boolean;
115
116
  ddicName?: string;
117
+ RTTIName?: string;
116
118
  };
117
119
 
118
120
  declare class ActivationVariant extends AbstractObject {
@@ -1280,6 +1282,7 @@ export declare class CurrentScope {
1280
1282
  id?: Identifier;
1281
1283
  type?: ReferenceType;
1282
1284
  ooType?: IReferenceExtras["ooType"];
1285
+ RTTIName?: string;
1283
1286
  };
1284
1287
  /** Lookup class in local and global scope */
1285
1288
  findClassDefinition(name: string | undefined): IClassDefinition | undefined;
@@ -4181,7 +4184,7 @@ declare class ObjectCharacteristic extends AbstractObject {
4181
4184
 
4182
4185
  declare class ObjectReferenceType extends AbstractType {
4183
4186
  private readonly identifier;
4184
- constructor(id: Identifier, qualifiedName?: string);
4187
+ constructor(id: Identifier, extra?: AbstractTypeData);
4185
4188
  getIdentifierName(): string;
4186
4189
  toText(): string;
4187
4190
  toABAP(): string;
@@ -181,21 +181,28 @@ class CurrentScope {
181
181
  if (name === undefined) {
182
182
  return { found: false };
183
183
  }
184
+ let RTTIPrefix = "";
185
+ if (this.parentObj.getType() === "PROG") {
186
+ RTTIPrefix = "\\PROGRAM=" + this.parentObj.getName();
187
+ }
188
+ else if (this.parentObj.getType() === "CLAS") {
189
+ RTTIPrefix = "\\CLASS-POOL=" + this.parentObj.getName();
190
+ }
184
191
  const findLocalClass = (_a = this.current) === null || _a === void 0 ? void 0 : _a.findClassDefinition(name);
185
192
  if (findLocalClass) {
186
- return { found: true, id: findLocalClass, type: _reference_1.ReferenceType.ObjectOrientedReference, ooType: "CLAS" };
193
+ return { found: true, id: findLocalClass, type: _reference_1.ReferenceType.ObjectOrientedReference, ooType: "CLAS", RTTIName: RTTIPrefix + "\\CLASS=" + findLocalClass.getName() };
187
194
  }
188
195
  const globalClas = this.reg.getObject("CLAS", name);
189
196
  if (globalClas) {
190
- return { found: true, id: globalClas.getIdentifier(), type: _reference_1.ReferenceType.ObjectOrientedReference, ooType: "CLAS" };
197
+ return { found: true, id: globalClas.getIdentifier(), type: _reference_1.ReferenceType.ObjectOrientedReference, ooType: "CLAS", RTTIName: "\\CLASS=" + globalClas.getName() };
191
198
  }
192
199
  const findLocalInterface = (_b = this.current) === null || _b === void 0 ? void 0 : _b.findInterfaceDefinition(name);
193
200
  if (findLocalInterface) {
194
- return { found: true, id: findLocalInterface, type: _reference_1.ReferenceType.ObjectOrientedReference, ooType: "INTF" };
201
+ return { found: true, id: findLocalInterface, type: _reference_1.ReferenceType.ObjectOrientedReference, ooType: "INTF", RTTIName: RTTIPrefix + "\\INTERFACE=" + findLocalInterface.getName() };
195
202
  }
196
203
  const globalIntf = this.reg.getObject("INTF", name);
197
204
  if (globalIntf) {
198
- return { found: true, id: globalIntf.getIdentifier(), type: _reference_1.ReferenceType.ObjectOrientedReference, ooType: "INTF" };
205
+ return { found: true, id: globalIntf.getIdentifier(), type: _reference_1.ReferenceType.ObjectOrientedReference, ooType: "INTF", RTTIName: "\\INTERFACE=" + globalIntf.getName() };
199
206
  }
200
207
  const def = (_c = this.current) === null || _c === void 0 ? void 0 : _c.findDeferred(name);
201
208
  if (def !== undefined) {
@@ -91,6 +91,7 @@ class TypeUtils {
91
91
  else if (type instanceof basic_1.XStringType
92
92
  || type instanceof basic_1.HexType
93
93
  || type instanceof basic_1.VoidType
94
+ || type instanceof basic_1.XSequenceType
94
95
  || type instanceof basic_1.AnyType
95
96
  || type instanceof basic_1.UnknownType) {
96
97
  return true;
@@ -813,7 +813,7 @@ class BasicTypes {
813
813
  const search = this.scope.existsObject(name);
814
814
  if (search.found === true && search.id) {
815
815
  this.scope.addReference(chain.getFirstToken(), search.id, _reference_1.ReferenceType.ObjectOrientedReference, this.filename, { ooType: search.ooType, ooName: name });
816
- return new Types.ObjectReferenceType(search.id, name);
816
+ return new Types.ObjectReferenceType(search.id, { qualifiedName: name, RTTIName: search.RTTIName });
817
817
  }
818
818
  }
819
819
  const found = this.resolveTypeName(chain);
@@ -31,7 +31,7 @@ class Cast {
31
31
  if (tt === undefined || tt instanceof basic_1.VoidType || tt instanceof basic_1.UnknownType) {
32
32
  const found = scope.findObjectDefinition(typeName);
33
33
  if (found) {
34
- tt = new basic_1.ObjectReferenceType(found, typeName);
34
+ tt = new basic_1.ObjectReferenceType(found, { qualifiedName: typeName });
35
35
  }
36
36
  }
37
37
  else {
@@ -4,10 +4,23 @@ exports.StringTemplate = void 0;
4
4
  const basic_1 = require("../../types/basic");
5
5
  const Expressions = require("../../2_statements/expressions");
6
6
  const source_1 = require("./source");
7
+ const _type_utils_1 = require("../_type_utils");
7
8
  class StringTemplate {
8
9
  runSyntax(node, scope, filename) {
9
- for (const s of node.findAllExpressions(Expressions.Source)) {
10
- new source_1.Source().runSyntax(s, scope, filename, new basic_1.StringType({ qualifiedName: "STRING" }));
10
+ var _a;
11
+ const typeUtils = new _type_utils_1.TypeUtils(scope);
12
+ for (const templateSource of node.findAllExpressions(Expressions.StringTemplateSource)) {
13
+ const s = templateSource.findDirectExpression(Expressions.Source);
14
+ const type = new source_1.Source().runSyntax(s, scope, filename, new basic_1.StringType({ qualifiedName: "STRING" }));
15
+ if (type === undefined) {
16
+ throw new Error("No target type determined");
17
+ }
18
+ else if (typeUtils.isCharLike(type) === false && typeUtils.isHexLike(type) === false) {
19
+ throw new Error("Not character like, " + type.constructor.name);
20
+ }
21
+ for (const formatSource of ((_a = templateSource.findDirectExpression(Expressions.StringTemplateFormatting)) === null || _a === void 0 ? void 0 : _a.findAllExpressions(Expressions.Source)) || []) {
22
+ new source_1.Source().runSyntax(formatSource, scope, filename);
23
+ }
11
24
  }
12
25
  return new basic_1.StringType({ qualifiedName: "STRING" });
13
26
  }
@@ -13,6 +13,10 @@ class AbstractType {
13
13
  var _a;
14
14
  return (_a = this.data) === null || _a === void 0 ? void 0 : _a.qualifiedName;
15
15
  }
16
+ getRTTIName() {
17
+ var _a;
18
+ return (_a = this.data) === null || _a === void 0 ? void 0 : _a.RTTIName;
19
+ }
16
20
  getConversionExit() {
17
21
  var _a;
18
22
  return (_a = this.data) === null || _a === void 0 ? void 0 : _a.conversionExit;
@@ -4,8 +4,8 @@ exports.ObjectReferenceType = void 0;
4
4
  const _abstract_type_1 = require("./_abstract_type");
5
5
  // use GenericObjectReferenceType for REF TO OBJECT
6
6
  class ObjectReferenceType extends _abstract_type_1.AbstractType {
7
- constructor(id, qualifiedName) {
8
- super({ qualifiedName: qualifiedName });
7
+ constructor(id, extra) {
8
+ super(extra);
9
9
  this.identifier = id;
10
10
  }
11
11
  getIdentifierName() {
package/build/src/ddic.js CHANGED
@@ -128,12 +128,18 @@ class DDIC {
128
128
  const clas = this.reg.getObject("CLAS", name);
129
129
  const globalClas = clas === null || clas === void 0 ? void 0 : clas.getIdentifier();
130
130
  if (globalClas) {
131
- return { type: new basic_1.ObjectReferenceType(globalClas, name), object: clas };
131
+ return {
132
+ type: new basic_1.ObjectReferenceType(globalClas, { qualifiedName: name, RTTIName: "\\CLASS=" + name }),
133
+ object: clas,
134
+ };
132
135
  }
133
136
  const intf = this.reg.getObject("INTF", name);
134
137
  const globalIntf = intf === null || intf === void 0 ? void 0 : intf.getIdentifier();
135
138
  if (globalIntf) {
136
- return { type: new basic_1.ObjectReferenceType(globalIntf, name), object: intf };
139
+ return {
140
+ type: new basic_1.ObjectReferenceType(globalIntf, { qualifiedName: name, RTTIName: "\\INTERFACE=" + name }),
141
+ object: intf,
142
+ };
137
143
  }
138
144
  if (this.inErrorNamespace(name) === true) {
139
145
  return { type: new basic_1.UnknownType(name) };
@@ -123,6 +123,9 @@ class LSPLookup {
123
123
  if (variable.getType().getQualifiedName()) {
124
124
  value += "\n\nQualified Type Name: ```" + variable.getType().getQualifiedName() + "```";
125
125
  }
126
+ if (variable.getType().getRTTIName()) {
127
+ value += "\n\nRTTI Name: ```" + variable.getType().getRTTIName() + "```";
128
+ }
126
129
  if (variable.getType().isGeneric() === true) {
127
130
  value += "\n\nIs Generic Type";
128
131
  }
@@ -63,7 +63,7 @@ class Registry {
63
63
  }
64
64
  static abaplintVersion() {
65
65
  // magic, see build script "version.sh"
66
- return "2.97.15";
66
+ return "2.97.16";
67
67
  }
68
68
  getDDICReferences() {
69
69
  return this.references;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/core",
3
- "version": "2.97.15",
3
+ "version": "2.97.16",
4
4
  "description": "abaplint - Core API",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/abaplint.d.ts",
@@ -50,9 +50,9 @@
50
50
  "@microsoft/api-extractor": "^7.34.4",
51
51
  "@types/chai": "^4.3.4",
52
52
  "@types/mocha": "^10.0.1",
53
- "@types/node": "^18.15.11",
53
+ "@types/node": "^18.15.13",
54
54
  "chai": "^4.3.7",
55
- "eslint": "^8.38.0",
55
+ "eslint": "^8.39.0",
56
56
  "mocha": "^10.2.0",
57
57
  "c8": "^7.13.0",
58
58
  "source-map-support": "^0.5.21",
@@ -60,7 +60,7 @@
60
60
  "typescript": "^5.0.4"
61
61
  },
62
62
  "dependencies": {
63
- "fast-xml-parser": "^4.2.0",
63
+ "fast-xml-parser": "^4.2.2",
64
64
  "json5": "^2.2.3",
65
65
  "vscode-languageserver-types": "^3.17.3"
66
66
  }