@abaplint/cli 2.120.38 → 2.120.40

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 +44 -22
  2. package/package.json +2 -2
package/build/cli.js CHANGED
@@ -26079,6 +26079,21 @@ class CurrentScope {
26079
26079
  }
26080
26080
  this.current.getData().forms.push(...f);
26081
26081
  }
26082
+ /** The FORM definitions are built up front, at that point the program level types are not known.
26083
+ * When the FORM statement is traversed it is replaced with one resolved in the scope of the FORM */
26084
+ updateFormDefinition(f) {
26085
+ let search = this.current;
26086
+ while (search !== undefined) {
26087
+ const forms = search.getData().forms;
26088
+ for (let i = 0; i < forms.length; i++) {
26089
+ if (forms[i].equals(f)) {
26090
+ forms[i] = f;
26091
+ return;
26092
+ }
26093
+ }
26094
+ search = search.getParent();
26095
+ }
26096
+ }
26082
26097
  addInterfaceDefinition(i) {
26083
26098
  if (this.current === undefined) {
26084
26099
  return;
@@ -27025,6 +27040,7 @@ class Procedural {
27025
27040
  scope: _current_scope_1.CurrentScope.buildDefault(this.reg, obj),
27026
27041
  filename: file.getFilename(),
27027
27042
  issues: [],
27043
+ deferred: [],
27028
27044
  };
27029
27045
  for (const found of structure.findAllStructures(Structures.Form)) {
27030
27046
  this.scope.addFormDefinitions([new types_1.FormDefinition(found, input)]);
@@ -36470,6 +36486,7 @@ class FindGlobalDefinitions {
36470
36486
  filename: file.getFilename(),
36471
36487
  scope: _current_scope_1.CurrentScope.buildDefault(this.reg, obj),
36472
36488
  issues: [],
36489
+ deferred: [],
36473
36490
  };
36474
36491
  if (obj instanceof interface_1.Interface) {
36475
36492
  const found = struc.findFirstStructure(Structures.Interface);
@@ -40698,6 +40715,9 @@ class Form {
40698
40715
  }
40699
40716
  input.scope.push(_scope_type_1.ScopeType.Form, name, node.getFirstToken().getStart(), input.filename);
40700
40717
  const form = new form_definition_1.FormDefinition(node, input);
40718
+ // the definitions are built up front, before the program level types are known, replace it
40719
+ // with this one, which is resolved in the scope of the FORM
40720
+ input.scope.updateFormDefinition(form);
40701
40721
  input.scope.addList(form.getUsingParameters());
40702
40722
  input.scope.addList(form.getChangingParameters());
40703
40723
  input.scope.addList(form.getTablesParameters());
@@ -43732,12 +43752,19 @@ class Perform {
43732
43752
  input.scope.addReference(expr.getFirstToken(), found, _reference_1.ReferenceType.FormReference, input.filename);
43733
43753
  ////////////////////////////
43734
43754
  // check parameters match
43735
- // USING and CHANGING are interchangeable, the actual parameters form a single positional list
43736
- if (this.checkParameters(node, tables, found.getTablesParameters(), "TABLES", input) === false) {
43737
- return;
43738
- }
43739
- const formal = found.getUsingParameters().concat(found.getChangingParameters());
43740
- this.checkParameters(node, using.concat(changing), formal, "USING/CHANGING", input);
43755
+ // deferred, the FORM might be defined after the PERFORM, its parameters are only typed
43756
+ // once the FORM statement itself has been traversed
43757
+ input.deferred.push(() => {
43758
+ var _a;
43759
+ // look up again, the definition is replaced when the FORM statement is traversed
43760
+ const def = (_a = input.scope.findFormDefinition(name)) !== null && _a !== void 0 ? _a : found;
43761
+ if (this.checkParameters(node, tables, def.getTablesParameters(), "TABLES", input) === false) {
43762
+ return;
43763
+ }
43764
+ // USING and CHANGING are interchangeable, the actual parameters form a single positional list
43765
+ const formal = def.getUsingParameters().concat(def.getChangingParameters());
43766
+ this.checkParameters(node, using.concat(changing), formal, "USING/CHANGING", input);
43767
+ });
43741
43768
  }
43742
43769
  // returns false if an issue was reported
43743
43770
  checkParameters(node, actual, formal, kind, input) {
@@ -45133,22 +45160,8 @@ class SelectOption {
45133
45160
  return;
45134
45161
  }
45135
45162
  const nameChain = node.findFirstExpression(Expressions.FieldChain);
45136
- let found = new basic_types_1.BasicTypes(input).resolveLikeName(nameChain);
45163
+ const found = new basic_types_1.BasicTypes(input).resolveLikeName(nameChain);
45137
45164
  if (found) {
45138
- if (found instanceof basic_1.StructureType) {
45139
- let length = 0;
45140
- for (const c of found.getComponents()) {
45141
- if (c.type instanceof basic_1.CharacterType) {
45142
- length += c.type.getLength();
45143
- }
45144
- }
45145
- if (length === 0) {
45146
- found = basic_1.VoidType.get("Selectoption, fallback");
45147
- }
45148
- else {
45149
- found = new basic_1.CharacterType(length);
45150
- }
45151
- }
45152
45165
  const stru = new basic_1.StructureType([
45153
45166
  { name: "SIGN", type: new basic_1.CharacterType(1) },
45154
45167
  { name: "OPTION", type: new basic_1.CharacterType(2) },
@@ -48402,6 +48415,7 @@ class SyntaxLogic {
48402
48415
  constructor(reg, object) {
48403
48416
  this.reg = reg;
48404
48417
  this.issues = [];
48418
+ this.deferred = [];
48405
48419
  this.object = object;
48406
48420
  }
48407
48421
  run() {
@@ -48415,6 +48429,7 @@ class SyntaxLogic {
48415
48429
  proc: new _procedural_1.Procedural(this.reg, this.scope),
48416
48430
  };
48417
48431
  this.issues = [];
48432
+ this.deferred = [];
48418
48433
  this.reg.getDDICReferences().clear(this.object);
48419
48434
  this.reg.getMSAGReferences().clear(this.object);
48420
48435
  if (this.object instanceof objects_1.Program && this.object.isInclude()) {
@@ -48422,6 +48437,11 @@ class SyntaxLogic {
48422
48437
  return { issues: [], spaghetti: this.scope.pop(new position_1.Position(Number.MAX_SAFE_INTEGER, Number.MAX_SAFE_INTEGER)) };
48423
48438
  }
48424
48439
  this.traverseObject();
48440
+ // the FORM definitions are now all traversed, ie. their parameters are typed
48441
+ for (const d of this.deferred) {
48442
+ d();
48443
+ }
48444
+ this.deferred = [];
48425
48445
  for (;;) {
48426
48446
  const spaghetti = this.scope.pop(new position_1.Position(Number.MAX_SAFE_INTEGER, Number.MAX_SAFE_INTEGER)); // pop built-in scopes
48427
48447
  if (spaghetti.getTop().getIdentifier().stype === _scope_type_1.ScopeType.BuiltIn) {
@@ -48521,6 +48541,7 @@ class SyntaxLogic {
48521
48541
  scope: this.scope,
48522
48542
  filename,
48523
48543
  issues: this.issues,
48544
+ deferred: this.deferred,
48524
48545
  };
48525
48546
  if (stru instanceof Structures.ClassDefinition) {
48526
48547
  new class_definition_1.ClassDefinition(node, input);
@@ -48572,6 +48593,7 @@ class SyntaxLogic {
48572
48593
  scope: this.scope,
48573
48594
  filename,
48574
48595
  issues: this.issues,
48596
+ deferred: this.deferred,
48575
48597
  };
48576
48598
  // todo, refactor
48577
48599
  if (s instanceof Statements.Type) {
@@ -70152,7 +70174,7 @@ class Registry {
70152
70174
  }
70153
70175
  static abaplintVersion() {
70154
70176
  // magic, see build script "version.js"
70155
- return "2.120.38";
70177
+ return "2.120.40";
70156
70178
  }
70157
70179
  getDDICReferences() {
70158
70180
  return this.ddicReferences;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/cli",
3
- "version": "2.120.38",
3
+ "version": "2.120.40",
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.38",
42
+ "@abaplint/core": "^2.120.40",
43
43
  "@types/chai": "^4.3.20",
44
44
  "@types/minimist": "^1.2.5",
45
45
  "@types/mocha": "^10.0.10",