@abaplint/core 2.93.72 → 2.93.73

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.
@@ -1391,6 +1391,10 @@ declare class DDIC {
1391
1391
  inErrorNamespace(name: string | undefined): boolean;
1392
1392
  lookupObject(name: string): ILookupResult;
1393
1393
  lookupNoVoid(name: string): ILookupResult | undefined;
1394
+ lookupDDLS(name?: string): {
1395
+ type: AbstractType;
1396
+ object: DataDefinition;
1397
+ } | undefined;
1394
1398
  /** lookup with voiding and unknown types */
1395
1399
  lookup(name: string): ILookupResult;
1396
1400
  lookupDomain(name: string, parent?: string): ILookupResult;
@@ -18,7 +18,7 @@ class TypeTable extends combi_1.Expression {
18
18
  // "WITH" is not allowed as a field name in keys
19
19
  const typetable = (0, combi_1.seq)(normal1, (0, combi_1.alt)((0, combi_1.opt)((0, combi_1.per)(header, initial, (0, combi_1.plusPrio)(type_table_key_1.TypeTableKey))), (0, combi_1.seq)((0, combi_1.plus)(type_table_key_1.TypeTableKey), (0, combi_1.optPrio)(initial))));
20
20
  const occurs = (0, combi_1.seq)("OCCURS", _1.Integer);
21
- const derived = (0, combi_1.ver)(version_1.Version.v754, (0, combi_1.seq)("TABLE FOR", (0, combi_1.altPrio)("CREATE", "FAILED", "LOCK", "ACTION IMPORT", "UPDATE", "READ RESULT", "ACTION RESULT"), _1.TypeName));
21
+ const derived = (0, combi_1.ver)(version_1.Version.v754, (0, combi_1.seq)("TABLE FOR", (0, combi_1.altPrio)("ACTION IMPORT", "ACTION RESULT", "CREATE", "FAILED", "LOCK", "READ RESULT", "UPDATE"), _1.TypeName));
22
22
  const oldType = (0, combi_1.seq)((0, combi_1.opt)("REF TO"), _1.TypeName, (0, combi_1.alt)((0, combi_1.seq)(occurs, (0, combi_1.opt)(header)), header));
23
23
  const oldLike = (0, combi_1.seq)((0, combi_1.opt)("REF TO"), field_chain_1.FieldChain, (0, combi_1.alt)((0, combi_1.seq)(occurs, (0, combi_1.opt)(header)), header));
24
24
  const ret = (0, combi_1.altPrio)((0, combi_1.seq)(occurs, (0, combi_1.opt)(header)), (0, combi_1.seq)("LIKE", (0, combi_1.alt)(oldLike, likeType, rangeLike)), (0, combi_1.seq)("TYPE", (0, combi_1.alt)(oldType, typetable, rangeType, derived)));
@@ -262,7 +262,7 @@ class BasicTypes {
262
262
  return undefined;
263
263
  }
264
264
  parseTable(node, name) {
265
- var _a;
265
+ var _a, _b;
266
266
  const typename = node.findFirstExpression(Expressions.TypeName);
267
267
  const text = (_a = node.findFirstExpression(Expressions.TypeTable)) === null || _a === void 0 ? void 0 : _a.concatTokens().toUpperCase();
268
268
  if (text === undefined) {
@@ -354,6 +354,20 @@ class BasicTypes {
354
354
  ], name);
355
355
  return new Types.TableType(structure, options);
356
356
  }
357
+ else if (typename && (text.startsWith("TYPE TABLE FOR CREATE ")
358
+ || text.startsWith("TYPE TABLE FOR UPDATE "))) {
359
+ const name = typename.concatTokens();
360
+ const type = (_b = this.scope.getDDIC().lookupDDLS(name)) === null || _b === void 0 ? void 0 : _b.type;
361
+ if (type) {
362
+ return new Types.TableType(type, options);
363
+ }
364
+ else if (this.scope.getDDIC().inErrorNamespace(name)) {
365
+ return new Types.UnknownType(`DDLS ${name} not found`);
366
+ }
367
+ else {
368
+ return new Types.VoidType(name);
369
+ }
370
+ }
357
371
  // fallback to old style syntax, OCCURS etc
358
372
  return this.parseType(node, name);
359
373
  }
@@ -555,7 +569,16 @@ class BasicTypes {
555
569
  const foo = varVar === null || varVar === void 0 ? void 0 : varVar.getType();
556
570
  if (foo instanceof basic_1.ObjectReferenceType) {
557
571
  const typeName = subs[0];
558
- const id = foo.getIdentifier();
572
+ let id = foo.getIdentifier();
573
+ if (!(id instanceof types_1.ClassDefinition || id instanceof types_1.InterfaceDefinition)) {
574
+ const found = this.scope.findObjectDefinition(foo.getIdentifierName());
575
+ if (found) {
576
+ id = found;
577
+ }
578
+ else {
579
+ return new Types.UnknownType(foo.getIdentifierName() + " not found in scope");
580
+ }
581
+ }
559
582
  if (id instanceof types_1.ClassDefinition || id instanceof types_1.InterfaceDefinition) {
560
583
  const type = id instanceof types_1.ClassDefinition ? "CLAS" : "INTF";
561
584
  this.scope.addReference(expr.getFirstToken(), id, _reference_1.ReferenceType.ObjectOrientedReference, this.filename, { ooType: type, ooName: id.getName() });
@@ -574,7 +597,7 @@ class BasicTypes {
574
597
  return new Types.UnknownType(className + " not found in scope");
575
598
  }
576
599
  else {
577
- return new Types.UnknownType("Not a object reference, " + className);
600
+ return new Types.UnknownType("Not a object reference, " + className + ", " + foo.constructor.name);
578
601
  }
579
602
  }
580
603
  else {
package/build/src/ddic.js CHANGED
@@ -143,7 +143,6 @@ class DDIC {
143
143
  }
144
144
  }
145
145
  lookupNoVoid(name) {
146
- var _a;
147
146
  const foundTABL = this.reg.getObject("TABL", name);
148
147
  if (foundTABL) {
149
148
  return { type: foundTABL.parseType(this.reg), object: foundTABL };
@@ -160,11 +159,22 @@ class DDIC {
160
159
  if (foundDTEL) {
161
160
  return { type: foundDTEL.parseType(this.reg), object: foundDTEL };
162
161
  }
162
+ const foundDDLS = this.lookupDDLS(name);
163
+ if (foundDDLS) {
164
+ return foundDDLS;
165
+ }
166
+ return undefined;
167
+ }
168
+ lookupDDLS(name) {
169
+ var _a;
170
+ if (name === undefined) {
171
+ return undefined;
172
+ }
163
173
  const upper = name.toUpperCase();
164
174
  for (const obj of this.reg.getObjectsByType("DDLS")) {
165
175
  const ddls = obj;
166
176
  if (ddls.getSQLViewName() === upper || ((_a = ddls.getDefinitionName()) === null || _a === void 0 ? void 0 : _a.toUpperCase()) === upper) {
167
- return { type: ddls.parseType(this.reg), object: obj };
177
+ return { type: ddls.parseType(this.reg), object: ddls };
168
178
  }
169
179
  }
170
180
  return undefined;
@@ -210,7 +220,6 @@ class DDIC {
210
220
  }
211
221
  }
212
222
  lookupTableOrView(name) {
213
- var _a;
214
223
  if (name === undefined) {
215
224
  return { type: new Types.UnknownType("undefined, lookupTableOrView") };
216
225
  }
@@ -218,18 +227,14 @@ class DDIC {
218
227
  if (foundTABL) {
219
228
  return { type: foundTABL.parseType(this.reg), object: foundTABL };
220
229
  }
221
- const upper = name.toUpperCase();
222
- for (const obj of this.reg.getObjectsByType("DDLS")) {
223
- const ddls = obj;
224
- if (ddls.getSQLViewName() === upper || ((_a = ddls.getDefinitionName()) === null || _a === void 0 ? void 0 : _a.toUpperCase()) === upper) {
225
- return { type: ddls.parseType(this.reg), object: ddls };
226
- }
230
+ const foundDDLS = this.lookupDDLS(name);
231
+ if (foundDDLS) {
232
+ return foundDDLS;
227
233
  }
228
234
  return this.lookupView(name);
229
235
  }
230
236
  /** this method only looks up the object, does not parse the type */
231
237
  lookupTableOrView2(name) {
232
- var _a;
233
238
  if (name === undefined) {
234
239
  return undefined;
235
240
  }
@@ -241,12 +246,9 @@ class DDIC {
241
246
  if (foundVIEW) {
242
247
  return foundVIEW;
243
248
  }
244
- const upper = name.toUpperCase();
245
- for (const obj of this.reg.getObjectsByType("DDLS")) {
246
- const ddls = obj;
247
- if (ddls.getSQLViewName() === upper || ((_a = ddls.getDefinitionName()) === null || _a === void 0 ? void 0 : _a.toUpperCase()) === upper) {
248
- return ddls;
249
- }
249
+ const foundDDLS = this.lookupDDLS(name);
250
+ if (foundDDLS) {
251
+ return foundDDLS.object;
250
252
  }
251
253
  return undefined;
252
254
  }
@@ -63,7 +63,7 @@ class Registry {
63
63
  }
64
64
  static abaplintVersion() {
65
65
  // magic, see build script "version.sh"
66
- return "2.93.72";
66
+ return "2.93.73";
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.93.72",
3
+ "version": "2.93.73",
4
4
  "description": "abaplint - Core API",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/abaplint.d.ts",