@abaplint/cli 2.120.36 → 2.120.37

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 +32 -4
  2. package/package.json +2 -2
package/build/cli.js CHANGED
@@ -27903,6 +27903,29 @@ class TypeUtils {
27903
27903
  }
27904
27904
  return this.isAssignable(source, target);
27905
27905
  }
27906
+ // Typing with the classic STRUCTURE addition, ie. "FORM foo USING bar STRUCTURE zkey",
27907
+ // is not a compatibility check: ABAP only checks the fragment view up to the end of the
27908
+ // formal structure, so the actual parameter is allowed to be longer. For TABLES parameters
27909
+ // the table key is not part of the check at all.
27910
+ isAssignableStructureTyping(source, target, node) {
27911
+ if (source instanceof basic_1.StructureType && target instanceof basic_1.StructureType) {
27912
+ const sourceComponents = source.getComponents();
27913
+ const targetComponents = target.getComponents();
27914
+ if (sourceComponents.length < targetComponents.length) {
27915
+ return false;
27916
+ }
27917
+ for (let i = 0; i < targetComponents.length; i++) {
27918
+ if (this.isAssignableStrict(sourceComponents[i].type, targetComponents[i].type) === false) {
27919
+ return false;
27920
+ }
27921
+ }
27922
+ return true;
27923
+ }
27924
+ else if (source instanceof basic_1.TableType && target instanceof basic_1.TableType) {
27925
+ return this.isAssignableStructureTyping(source.getRowType(), target.getRowType());
27926
+ }
27927
+ return this.isAssignableStrict(source, target, node);
27928
+ }
27906
27929
  isAssignable(source, target) {
27907
27930
  if (source === undefined || target === undefined) {
27908
27931
  return true;
@@ -31505,7 +31528,7 @@ class FormParam {
31505
31528
  else {
31506
31529
  type = new basic_1.UnknownType("todo, FORM STRUCTURES typing");
31507
31530
  }
31508
- return new _typed_identifier_1.TypedIdentifier(nameToken, input.filename, type, ["form_parameter" /* IdentifierMeta.FormParameter */]);
31531
+ return new _typed_identifier_1.TypedIdentifier(nameToken, input.filename, type, ["form_parameter" /* IdentifierMeta.FormParameter */, "form_parameter_structure" /* IdentifierMeta.FormParameterStructure */]);
31509
31532
  }
31510
31533
  if (node.getChildren().length === 1 && nameToken) {
31511
31534
  // untyped FORM parameter
@@ -43725,7 +43748,11 @@ class Perform {
43725
43748
  continue;
43726
43749
  }
43727
43750
  const parameter = formal[i];
43728
- if (typeUtils.isAssignableStrict(type, parameter.getType(), source) === false) {
43751
+ const structureTyping = parameter.getMeta().includes("form_parameter_structure" /* IdentifierMeta.FormParameterStructure */);
43752
+ const assignable = structureTyping
43753
+ ? typeUtils.isAssignableStructureTyping(type, parameter.getType(), source)
43754
+ : typeUtils.isAssignableStrict(type, parameter.getType(), source);
43755
+ if (assignable === false) {
43729
43756
  const message = `PERFORM parameter type not compatible, ${parameter.getName()}`;
43730
43757
  input.issues.push((0, _syntax_input_1.syntaxIssue)(input, source.getFirstToken(), message));
43731
43758
  return false;
@@ -52608,7 +52635,8 @@ class FormDefinition extends _identifier_1.Identifier {
52608
52635
  else if (!(type instanceof basic_1.UnknownType) && !(type instanceof basic_1.VoidType)) {
52609
52636
  type = new basic_1.UnknownType("FORM TABLES type must be table type");
52610
52637
  }
52611
- ret.push(new _typed_identifier_1.TypedIdentifier(p.getToken(), input.filename, type, ["form_parameter" /* IdentifierMeta.FormParameter */]));
52638
+ // keep the meta from FormParam, so STRUCTURE typing can be recognized later
52639
+ ret.push(new _typed_identifier_1.TypedIdentifier(p.getToken(), input.filename, type, p.getMeta()));
52612
52640
  }
52613
52641
  }
52614
52642
  return ret;
@@ -70119,7 +70147,7 @@ class Registry {
70119
70147
  }
70120
70148
  static abaplintVersion() {
70121
70149
  // magic, see build script "version.js"
70122
- return "2.120.36";
70150
+ return "2.120.37";
70123
70151
  }
70124
70152
  getDDICReferences() {
70125
70153
  return this.ddicReferences;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/cli",
3
- "version": "2.120.36",
3
+ "version": "2.120.37",
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.36",
42
+ "@abaplint/core": "^2.120.37",
43
43
  "@types/chai": "^4.3.20",
44
44
  "@types/minimist": "^1.2.5",
45
45
  "@types/mocha": "^10.0.10",