@abaplint/cli 2.120.34 → 2.120.36

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/cli.js +52 -4
  2. package/package.json +2 -2
package/build/cli.js CHANGED
@@ -28657,7 +28657,7 @@ class BasicTypes {
28657
28657
  return Types.VoidType.get((_f = node.findFirstExpression(Expressions.TypeStructure)) === null || _f === void 0 ? void 0 : _f.concatTokens());
28658
28658
  }
28659
28659
  else if (text.startsWith("LIKE LINE OF ")) {
28660
- const name = (_g = node.findFirstExpression(Expressions.FieldChain)) === null || _g === void 0 ? void 0 : _g.concatTokens();
28660
+ let name = (_g = node.findFirstExpression(Expressions.FieldChain)) === null || _g === void 0 ? void 0 : _g.concatTokens();
28661
28661
  let e = node.findFirstExpression(Expressions.Type);
28662
28662
  if (e === undefined) {
28663
28663
  e = node.findFirstExpression(Expressions.FormParamType);
@@ -28665,19 +28665,32 @@ class BasicTypes {
28665
28665
  if (e === undefined) {
28666
28666
  e = node.findFirstExpression(Expressions.FieldChain);
28667
28667
  }
28668
+ if (e === undefined) {
28669
+ // old style, eg "LIKE LINE OF tab OCCURS 0 WITH HEADER LINE", it is parsed as TypeName
28670
+ e = typeName;
28671
+ name = typeName === null || typeName === void 0 ? void 0 : typeName.concatTokens();
28672
+ }
28668
28673
  const type = this.resolveLikeName(e, false);
28674
+ let row = undefined;
28669
28675
  if (type === undefined) {
28670
28676
  return new Types.UnknownType("Type error, could not resolve \"" + name + "\", parseType");
28671
28677
  }
28672
28678
  else if (type instanceof Types.TableType) {
28673
- return type.getRowType();
28679
+ row = type.getRowType();
28674
28680
  }
28675
28681
  else if (type instanceof Types.VoidType) {
28676
- return type;
28682
+ row = type;
28677
28683
  }
28678
28684
  else {
28679
28685
  return new Types.UnknownType("Type error, not a table type " + name);
28680
28686
  }
28687
+ if (this.isOccurs(node)) {
28688
+ return new Types.TableType(row, {
28689
+ withHeader: text.includes(" WITH HEADER LINE"),
28690
+ keyType: Types.TableKeyType.default
28691
+ }, qualifiedName);
28692
+ }
28693
+ return row;
28681
28694
  }
28682
28695
  else if (text.startsWith("LIKE REF TO ")) {
28683
28696
  const name = (_h = node.findFirstExpression(Expressions.FieldChain)) === null || _h === void 0 ? void 0 : _h.concatTokens();
@@ -51699,6 +51712,7 @@ const constants_1 = __webpack_require__(/*! ../5_syntax/structures/constants */
51699
51712
  const type_definitions_1 = __webpack_require__(/*! ./type_definitions */ "../core/build/src/abap/types/type_definitions.js");
51700
51713
  const types_1 = __webpack_require__(/*! ../5_syntax/structures/types */ "../core/build/src/abap/5_syntax/structures/types.js");
51701
51714
  const type_1 = __webpack_require__(/*! ../5_syntax/statements/type */ "../core/build/src/abap/5_syntax/statements/type.js");
51715
+ const _syntax_input_1 = __webpack_require__(/*! ../5_syntax/_syntax_input */ "../core/build/src/abap/5_syntax/_syntax_input.js");
51702
51716
  const _reference_1 = __webpack_require__(/*! ../5_syntax/_reference */ "../core/build/src/abap/5_syntax/_reference.js");
51703
51717
  const alias_1 = __webpack_require__(/*! ./alias */ "../core/build/src/abap/types/alias.js");
51704
51718
  class Attributes {
@@ -51920,6 +51934,13 @@ class Attributes {
51920
51934
  if (foundAttribute) {
51921
51935
  input.scope.addNamedIdentifier(aliasName.getStr(), foundAttribute);
51922
51936
  }
51937
+ const component = compName.split("~")[1];
51938
+ if (foundType === undefined
51939
+ && foundAttribute === undefined
51940
+ && this.existsInInterface(idef, component, input, []) === false) {
51941
+ const message = "Component " + component + " not found in interface " + idef.getName();
51942
+ input.issues.push((0, _syntax_input_1.syntaxIssue)(input, compToken, message));
51943
+ }
51923
51944
  }
51924
51945
  else if (this.declaredInterfaces.includes(name.toUpperCase()) || input.scope.getDDIC().inErrorNamespace(name) === false) {
51925
51946
  input.scope.addReference(compToken, undefined, _reference_1.ReferenceType.ObjectOrientedVoidReference, input.filename);
@@ -51929,6 +51950,33 @@ class Attributes {
51929
51950
  }
51930
51951
  }
51931
51952
  }
51953
+ /** does the component exist in the interface, or in one of its aliases or included interfaces? */
51954
+ existsInInterface(idef, component, input, visited) {
51955
+ const upperName = idef.getName().toUpperCase();
51956
+ if (visited.includes(upperName)) {
51957
+ return false;
51958
+ }
51959
+ visited.push(upperName);
51960
+ const upper = component.toUpperCase();
51961
+ if (idef.getTypeDefinitions().getByName(component) !== undefined
51962
+ || idef.getAttributes().findByName(component) !== undefined
51963
+ || idef.getMethodDefinitions().getByName(component) !== undefined
51964
+ || idef.getEvents().some(e => e.getName().toUpperCase() === upper)
51965
+ || idef.getAliases().some(a => a.getName().toUpperCase() === upper)) {
51966
+ return true;
51967
+ }
51968
+ for (const i of idef.getImplementing()) {
51969
+ const sub = input.scope.findInterfaceDefinition(i.name);
51970
+ if (sub === undefined) {
51971
+ // voided or not found, assume the component exists
51972
+ return true;
51973
+ }
51974
+ else if (this.existsInInterface(sub, component, input, visited)) {
51975
+ return true;
51976
+ }
51977
+ }
51978
+ return false;
51979
+ }
51932
51980
  parseAttribute(node, visibility, input) {
51933
51981
  let found = undefined;
51934
51982
  const s = node.get();
@@ -70071,7 +70119,7 @@ class Registry {
70071
70119
  }
70072
70120
  static abaplintVersion() {
70073
70121
  // magic, see build script "version.js"
70074
- return "2.120.34";
70122
+ return "2.120.36";
70075
70123
  }
70076
70124
  getDDICReferences() {
70077
70125
  return this.ddicReferences;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/cli",
3
- "version": "2.120.34",
3
+ "version": "2.120.36",
4
4
  "description": "abaplint - Command Line Interface",
5
5
  "funding": "https://github.com/sponsors/larshp",
6
6
  "bin": {
@@ -39,7 +39,7 @@
39
39
  },
40
40
  "homepage": "https://abaplint.org",
41
41
  "devDependencies": {
42
- "@abaplint/core": "^2.120.34",
42
+ "@abaplint/core": "^2.120.36",
43
43
  "@types/chai": "^4.3.20",
44
44
  "@types/minimist": "^1.2.5",
45
45
  "@types/mocha": "^10.0.10",