@abaplint/core 2.84.2 → 2.84.3

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.
@@ -1155,6 +1155,7 @@ export declare class CurrentScope {
1155
1155
  getType(): ScopeType;
1156
1156
  push(stype: ScopeType, sname: string, start: Position, filename: string): void;
1157
1157
  isOO(): boolean;
1158
+ isTypePool(): boolean;
1158
1159
  setAllowHeaderUse(name: string): void;
1159
1160
  isAllowHeaderUse(name: string): boolean;
1160
1161
  pop(end: Position): SpaghettiScope;
@@ -1286,7 +1287,7 @@ declare class DataEnd implements IStatement {
1286
1287
 
1287
1288
  declare class DataReference extends AbstractType {
1288
1289
  private readonly type;
1289
- constructor(type: AbstractType, name?: string);
1290
+ constructor(type: AbstractType, qualifiedName?: string);
1290
1291
  toText(level: number): string;
1291
1292
  getType(): AbstractType;
1292
1293
  toABAP(): string;
@@ -1307,7 +1308,7 @@ declare class DDIC {
1307
1308
  private readonly reg;
1308
1309
  constructor(reg: IRegistry);
1309
1310
  isException(def: InfoClassDefinition | undefined, _obj: ABAPObject): boolean;
1310
- lookupBuiltinType(name: string, length?: number, decimals?: number): AbstractType | undefined;
1311
+ lookupBuiltinType(name: string, length?: number, decimals?: number, qualifiedName?: string): AbstractType | undefined;
1311
1312
  inErrorNamespace(name: string | undefined): boolean;
1312
1313
  lookupObject(name: string): ILookupResult;
1313
1314
  lookupNoVoid(name: string): ILookupResult | undefined;
@@ -4531,6 +4532,7 @@ export declare enum ScopeType {
4531
4532
  Dummy = "_dummy",
4532
4533
  Global = "_global",
4533
4534
  Program = "_program",
4535
+ TypePool = "_type_pool",
4534
4536
  FunctionGroup = "_function_group",
4535
4537
  ClassDefinition = "class_definition",
4536
4538
  Interface = "interface",
@@ -206,6 +206,7 @@ class CurrentScope {
206
206
  return undefined;
207
207
  }
208
208
  findTypePoolConstant(name) {
209
+ var _a;
209
210
  if (name === undefined || name.includes("_") === undefined) {
210
211
  return undefined;
211
212
  }
@@ -214,12 +215,12 @@ class CurrentScope {
214
215
  if (typePool === undefined) {
215
216
  return undefined;
216
217
  }
217
- const spag = new syntax_1.SyntaxLogic(this.reg, typePool).run().spaghetti.getFirstChild();
218
+ const spag = (_a = new syntax_1.SyntaxLogic(this.reg, typePool).run().spaghetti.getFirstChild()) === null || _a === void 0 ? void 0 : _a.getFirstChild();
218
219
  const found = spag === null || spag === void 0 ? void 0 : spag.findVariable(name);
219
220
  return found;
220
221
  }
221
222
  findTypePoolType(name) {
222
- var _a;
223
+ var _a, _b;
223
224
  if (name.includes("_") === undefined) {
224
225
  return undefined;
225
226
  }
@@ -228,8 +229,8 @@ class CurrentScope {
228
229
  if (typePool === undefined) {
229
230
  return undefined;
230
231
  }
231
- const spag = new syntax_1.SyntaxLogic(this.reg, typePool).run().spaghetti.getFirstChild();
232
- const found = (_a = spag === null || spag === void 0 ? void 0 : spag.findType(name)) === null || _a === void 0 ? void 0 : _a.getType();
232
+ const spag = (_a = new syntax_1.SyntaxLogic(this.reg, typePool).run().spaghetti.getFirstChild()) === null || _a === void 0 ? void 0 : _a.getFirstChild();
233
+ const found = (_b = spag === null || spag === void 0 ? void 0 : spag.findType(name)) === null || _b === void 0 ? void 0 : _b.getType();
233
234
  return found;
234
235
  }
235
236
  /** Lookup interface in local and global scope */
@@ -321,6 +322,10 @@ class CurrentScope {
321
322
  }
322
323
  return false;
323
324
  }
325
+ isTypePool() {
326
+ var _a;
327
+ return ((_a = this.current) === null || _a === void 0 ? void 0 : _a.getIdentifier().filename.endsWith(".type.abap")) === true || false;
328
+ }
324
329
  setAllowHeaderUse(name) {
325
330
  // workaround for SELECT FOR ALL ENTRIES
326
331
  this.allowHeaderUse = name;
@@ -7,6 +7,7 @@ var ScopeType;
7
7
  ScopeType["Dummy"] = "_dummy";
8
8
  ScopeType["Global"] = "_global";
9
9
  ScopeType["Program"] = "_program";
10
+ ScopeType["TypePool"] = "_type_pool";
10
11
  ScopeType["FunctionGroup"] = "_function_group";
11
12
  ScopeType["ClassDefinition"] = "class_definition";
12
13
  ScopeType["Interface"] = "interface";
@@ -140,7 +140,7 @@ class BasicTypes {
140
140
  }
141
141
  return type;
142
142
  }
143
- resolveTypeName(typeName, length, decimals) {
143
+ resolveTypeName(typeName, length, decimals, name) {
144
144
  if (typeName === undefined) {
145
145
  return undefined;
146
146
  }
@@ -149,7 +149,7 @@ class BasicTypes {
149
149
  return chain;
150
150
  }
151
151
  const chainText = typeName.concatTokens().toUpperCase();
152
- const f = this.scope.getDDIC().lookupBuiltinType(chainText, length, decimals);
152
+ const f = this.scope.getDDIC().lookupBuiltinType(chainText, length, decimals, name);
153
153
  if (f !== undefined) {
154
154
  return f;
155
155
  }
@@ -196,7 +196,7 @@ class BasicTypes {
196
196
  if (nameExpr.countTokens() > 1) { // workaround for names with dashes
197
197
  name = new identifier_1.Identifier(name.getStart(), nameExpr.concatTokens());
198
198
  }
199
- const found = this.parseType(node);
199
+ const found = this.parseType(node, this.scope.isTypePool() ? name.getStr() : undefined);
200
200
  if (found) {
201
201
  return new _typed_identifier_1.TypedIdentifier(name, this.filename, found);
202
202
  }
@@ -344,7 +344,7 @@ class BasicTypes {
344
344
  if (type === undefined) {
345
345
  return new Types.UnknownType("Type error, could not resolve \"" + name + "\", parseType");
346
346
  }
347
- return new Types.DataReference(type);
347
+ return new Types.DataReference(type, name);
348
348
  }
349
349
  else if (text === "TYPE STANDARD TABLE"
350
350
  || text === "TYPE SORTED TABLE"
@@ -392,7 +392,7 @@ class BasicTypes {
392
392
  found = this.resolveTypeRef(typename);
393
393
  }
394
394
  else if (text.startsWith("TYPE")) {
395
- found = this.resolveTypeName(typename, this.findLength(node), this.findDecimals(node));
395
+ found = this.resolveTypeName(typename, this.findLength(node), this.findDecimals(node), name);
396
396
  const concat = node.concatTokens().toUpperCase();
397
397
  if (found && concat.includes(" OCCURS ")) {
398
398
  found = new Types.TableType(found, { withHeader: concat.includes("WITH HEADER LINE") }, name);
@@ -297,6 +297,12 @@ class SyntaxLogic {
297
297
  this.scope.push(stype, this.object.getName(), new position_1.Position(1, 1), main.getFilename());
298
298
  }
299
299
  }
300
+ else if (this.object instanceof objects_1.TypePool) {
301
+ const main = this.object.getMainABAPFile();
302
+ if (main !== undefined) {
303
+ this.scope.push(_scope_type_1.ScopeType.TypePool, this.object.getName(), new position_1.Position(1, 1), main.getFilename());
304
+ }
305
+ }
300
306
  for (const file of traversal) {
301
307
  this.currentFile = file;
302
308
  const structure = this.currentFile.getStructure();
@@ -3,8 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.DataReference = void 0;
4
4
  const _abstract_type_1 = require("./_abstract_type");
5
5
  class DataReference extends _abstract_type_1.AbstractType {
6
- constructor(type, name) {
7
- super(name);
6
+ constructor(type, qualifiedName) {
7
+ super(qualifiedName);
8
8
  this.type = type;
9
9
  }
10
10
  toText(level) {
package/build/src/ddic.js CHANGED
@@ -43,7 +43,7 @@ class DDIC {
43
43
  const isException = ((superClassName === null || superClassName === void 0 ? void 0 : superClassName.match(/^.?cx_.*$/i)) || (superClassName === null || superClassName === void 0 ? void 0 : superClassName.match(/^\/.+\/cx_.*$/i))) ? true : false;
44
44
  return isException;
45
45
  }
46
- lookupBuiltinType(name, length, decimals) {
46
+ lookupBuiltinType(name, length, decimals, qualifiedName) {
47
47
  switch (name) {
48
48
  case "STRING":
49
49
  return new Types.StringType(name);
@@ -54,31 +54,31 @@ class DDIC {
54
54
  case "T":
55
55
  return new Types.TimeType(name);
56
56
  case "XSEQUENCE":
57
- return new Types.XSequenceType();
57
+ return new Types.XSequenceType(qualifiedName);
58
58
  case "CLIKE":
59
- return new Types.CLikeType();
59
+ return new Types.CLikeType(qualifiedName);
60
60
  case "DECFLOAT":
61
- return new Types.DecFloatType();
61
+ return new Types.DecFloatType(qualifiedName);
62
62
  case "ANY":
63
- return new Types.AnyType();
63
+ return new Types.AnyType(qualifiedName);
64
64
  case "SIMPLE":
65
- return new Types.SimpleType();
65
+ return new Types.SimpleType(qualifiedName);
66
66
  case "%_C_POINTER":
67
- return new Types.HexType(8);
67
+ return new Types.HexType(8, qualifiedName);
68
68
  case "TABLE":
69
69
  return new Types.TableType(new Types.AnyType(), { withHeader: false });
70
70
  case "DATA":
71
- return new Types.AnyType();
71
+ return new Types.AnyType(qualifiedName);
72
72
  case "NUMERIC":
73
- return new Types.NumericGenericType();
73
+ return new Types.NumericGenericType(qualifiedName);
74
74
  case "UTCLONG": // todo, take version into account
75
- return new Types.UTCLongType();
75
+ return new Types.UTCLongType(qualifiedName);
76
76
  case "DECFLOAT16":
77
- return new Types.DecFloat16Type();
77
+ return new Types.DecFloat16Type(qualifiedName);
78
78
  case "DECFLOAT34":
79
- return new Types.DecFloat34Type();
79
+ return new Types.DecFloat34Type(qualifiedName);
80
80
  case "CSEQUENCE":
81
- return new Types.CSequenceType();
81
+ return new Types.CSequenceType(qualifiedName);
82
82
  case "I":
83
83
  case "INT8": // todo, take version into account
84
84
  return new Types.IntegerType(name);
@@ -86,34 +86,34 @@ class DDIC {
86
86
  return new Types.FloatType(name);
87
87
  case "P":
88
88
  if (length && decimals) {
89
- return new Types.PackedType(length, decimals);
89
+ return new Types.PackedType(length, decimals, qualifiedName);
90
90
  }
91
91
  else if (length) {
92
- return new Types.PackedType(length, 0);
92
+ return new Types.PackedType(length, 0, qualifiedName);
93
93
  }
94
94
  else {
95
- return new Types.PackedType(1, 0);
95
+ return new Types.PackedType(1, 0, qualifiedName);
96
96
  }
97
97
  case "C":
98
98
  if (length) {
99
- return new Types.CharacterType(length);
99
+ return new Types.CharacterType(length, qualifiedName);
100
100
  }
101
101
  else {
102
- return new Types.CharacterType(1);
102
+ return new Types.CharacterType(1, qualifiedName);
103
103
  }
104
104
  case "X":
105
105
  if (length) {
106
- return new Types.HexType(length);
106
+ return new Types.HexType(length, qualifiedName);
107
107
  }
108
108
  else {
109
- return new Types.HexType(1);
109
+ return new Types.HexType(1, qualifiedName);
110
110
  }
111
111
  case "N":
112
112
  if (length) {
113
- return new Types.NumericType(length);
113
+ return new Types.NumericType(length, qualifiedName);
114
114
  }
115
115
  else {
116
- return new Types.NumericType(1);
116
+ return new Types.NumericType(1, qualifiedName);
117
117
  }
118
118
  }
119
119
  return undefined;
@@ -68,7 +68,7 @@ class Registry {
68
68
  }
69
69
  static abaplintVersion() {
70
70
  // magic, see build script "version.sh"
71
- return "2.84.2";
71
+ return "2.84.3";
72
72
  }
73
73
  getDDICReferences() {
74
74
  return this.references;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/core",
3
- "version": "2.84.2",
3
+ "version": "2.84.3",
4
4
  "description": "abaplint - Core API",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/abaplint.d.ts",
@@ -48,7 +48,7 @@
48
48
  "@microsoft/api-extractor": "^7.19.4",
49
49
  "@types/chai": "^4.3.0",
50
50
  "@types/mocha": "^9.0.0",
51
- "@types/node": "^17.0.9",
51
+ "@types/node": "^17.0.10",
52
52
  "chai": "^4.3.4",
53
53
  "eslint": "^8.7.0",
54
54
  "mocha": "^9.1.4",