@abaplint/cli 2.112.4 → 2.112.5

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 +75 -130
  2. package/package.json +2 -2
package/build/cli.js CHANGED
@@ -21426,6 +21426,7 @@ class CurrentScope {
21426
21426
  }
21427
21427
  const upper = name.toUpperCase();
21428
21428
  if (this.current.getData().vars[upper] !== undefined) {
21429
+ // console.dir(new Error().stack);
21429
21430
  throw new Error(`Variable name "${name}" already defined`);
21430
21431
  }
21431
21432
  else if (this.isOO() && this.current.getData().types[upper] !== undefined) {
@@ -21815,7 +21816,7 @@ class ObjectOriented {
21815
21816
  return ret;
21816
21817
  }
21817
21818
  addAliasedAttributes(classDefinition) {
21818
- for (const alias of classDefinition.getAliases().getAll()) {
21819
+ for (const alias of classDefinition.getAliases()) {
21819
21820
  const comp = alias.getComponent();
21820
21821
  const idef = this.scope.findInterfaceDefinition(comp.split("~")[0]);
21821
21822
  if (idef) {
@@ -21833,18 +21834,6 @@ class ObjectOriented {
21833
21834
  }
21834
21835
  }
21835
21836
  }
21836
- addAliasedTypes(aliases) {
21837
- for (const alias of aliases.getAll()) {
21838
- const comp = alias.getComponent();
21839
- const idef = this.scope.findInterfaceDefinition(comp.split("~")[0]);
21840
- if (idef) {
21841
- const found = idef.getTypeDefinitions().getByName(comp.split("~")[1]);
21842
- if (found) {
21843
- this.scope.addTypeNamed(alias.getName(), found);
21844
- }
21845
- }
21846
- }
21847
- }
21848
21837
  findMethodInInterface(interfaceName, methodName) {
21849
21838
  const idef = this.scope.findInterfaceDefinition(interfaceName);
21850
21839
  if (idef) {
@@ -21859,7 +21848,7 @@ class ObjectOriented {
21859
21848
  return undefined;
21860
21849
  }
21861
21850
  findMethodViaAlias(methodName, def) {
21862
- for (const a of def.getAliases().getAll()) {
21851
+ for (const a of def.getAliases()) {
21863
21852
  if (a.getName().toUpperCase() === methodName.toUpperCase()) {
21864
21853
  const comp = a.getComponent();
21865
21854
  const res = this.findMethodInInterface(comp.split("~")[0], comp.split("~")[1]);
@@ -21902,7 +21891,6 @@ class ObjectOriented {
21902
21891
  return ret;
21903
21892
  }
21904
21893
  searchEvent(def, name) {
21905
- var _a;
21906
21894
  if (def === undefined || name === undefined) {
21907
21895
  return undefined;
21908
21896
  }
@@ -21910,7 +21898,7 @@ class ObjectOriented {
21910
21898
  if (found) {
21911
21899
  return found;
21912
21900
  }
21913
- for (const a of ((_a = def.getAliases()) === null || _a === void 0 ? void 0 : _a.getAll()) || []) {
21901
+ for (const a of def.getAliases() || []) {
21914
21902
  if (a.getName().toUpperCase() === name.toUpperCase()) {
21915
21903
  const comp = a.getComponent();
21916
21904
  const res = this.searchEvent(this.scope.findObjectDefinition(comp.split("~")[0]), comp.split("~")[1]);
@@ -21927,7 +21915,6 @@ class ObjectOriented {
21927
21915
  }
21928
21916
  // search in via super class, interfaces and aliases
21929
21917
  searchAttributeName(def, name) {
21930
- var _a;
21931
21918
  if (def === undefined || name === undefined) {
21932
21919
  return undefined;
21933
21920
  }
@@ -21937,7 +21924,7 @@ class ObjectOriented {
21937
21924
  return a;
21938
21925
  }
21939
21926
  }
21940
- for (const a of ((_a = def.getAliases()) === null || _a === void 0 ? void 0 : _a.getAll()) || []) {
21927
+ for (const a of def.getAliases() || []) {
21941
21928
  if (a.getName().toUpperCase() === upper) {
21942
21929
  const comp = a.getComponent();
21943
21930
  const res = this.searchAttributeName(this.scope.findObjectDefinition(comp.split("~")[0]), comp.split("~")[1]);
@@ -21990,7 +21977,7 @@ class ObjectOriented {
21990
21977
  return a;
21991
21978
  }
21992
21979
  }
21993
- for (const a of def.getAliases().getAll()) {
21980
+ for (const a of def.getAliases()) {
21994
21981
  if (a.getName().toUpperCase() === upper) {
21995
21982
  const comp = a.getComponent();
21996
21983
  const res = this.searchConstantName(this.scope.findObjectDefinition(comp.split("~")[0]), comp.split("~")[1]);
@@ -36479,77 +36466,6 @@ exports.Alias = Alias;
36479
36466
 
36480
36467
  /***/ }),
36481
36468
 
36482
- /***/ "./node_modules/@abaplint/core/build/src/abap/types/aliases.js":
36483
- /*!*********************************************************************!*\
36484
- !*** ./node_modules/@abaplint/core/build/src/abap/types/aliases.js ***!
36485
- \*********************************************************************/
36486
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
36487
-
36488
- "use strict";
36489
-
36490
- Object.defineProperty(exports, "__esModule", ({ value: true }));
36491
- exports.Aliases = void 0;
36492
- const alias_1 = __webpack_require__(/*! ./alias */ "./node_modules/@abaplint/core/build/src/abap/types/alias.js");
36493
- const Structures = __webpack_require__(/*! ../3_structures/structures */ "./node_modules/@abaplint/core/build/src/abap/3_structures/structures/index.js");
36494
- const Statements = __webpack_require__(/*! ../2_statements/statements */ "./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js");
36495
- const Expressions = __webpack_require__(/*! ../2_statements/expressions */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js");
36496
- const visibility_1 = __webpack_require__(/*! ../4_file_information/visibility */ "./node_modules/@abaplint/core/build/src/abap/4_file_information/visibility.js");
36497
- const _reference_1 = __webpack_require__(/*! ../5_syntax/_reference */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_reference.js");
36498
- class Aliases {
36499
- constructor(node, filename, scope) {
36500
- this.aliases = [];
36501
- this.filename = filename;
36502
- this.parse(node, scope, filename);
36503
- }
36504
- getAll() {
36505
- return this.aliases;
36506
- }
36507
- getByName(name) {
36508
- for (const a of this.aliases) {
36509
- if (a.getName().toLowerCase() === name.toLowerCase()) {
36510
- return a;
36511
- }
36512
- }
36513
- return undefined;
36514
- }
36515
- /////////////////////////
36516
- parse(node, scope, filename) {
36517
- const cdef = node.findFirstStructure(Structures.ClassDefinition);
36518
- if (cdef) {
36519
- this.parseSection(cdef.findFirstStructure(Structures.PublicSection), visibility_1.Visibility.Public, scope, filename);
36520
- this.parseSection(cdef.findFirstStructure(Structures.PrivateSection), visibility_1.Visibility.Private, scope, filename);
36521
- this.parseSection(cdef.findFirstStructure(Structures.ProtectedSection), visibility_1.Visibility.Protected, scope, filename);
36522
- }
36523
- const idef = node.findFirstStructure(Structures.Interface);
36524
- if (idef) {
36525
- this.parseSection(idef, visibility_1.Visibility.Public, scope, filename);
36526
- }
36527
- }
36528
- parseSection(node, visibility, scope, filename) {
36529
- if (!node) {
36530
- return;
36531
- }
36532
- const list = node.findAllStatements(Statements.Aliases);
36533
- for (const a of list) {
36534
- const name = a.findFirstExpression(Expressions.SimpleName).getFirstToken();
36535
- const compToken = a.findFirstExpression(Expressions.Field).getFirstToken();
36536
- const compName = compToken.getStr();
36537
- this.aliases.push(new alias_1.Alias(name, visibility, compName, this.filename));
36538
- if (compName.includes("~")) {
36539
- const name = compName.split("~")[0];
36540
- const idef = scope.findInterfaceDefinition(name);
36541
- if (idef) {
36542
- scope.addReference(compToken, idef, _reference_1.ReferenceType.ObjectOrientedReference, filename, { ooName: name.toUpperCase(), ooType: "INTF" });
36543
- }
36544
- }
36545
- }
36546
- }
36547
- }
36548
- exports.Aliases = Aliases;
36549
- //# sourceMappingURL=aliases.js.map
36550
-
36551
- /***/ }),
36552
-
36553
36469
  /***/ "./node_modules/@abaplint/core/build/src/abap/types/basic/_abstract_type.js":
36554
36470
  /*!**********************************************************************************!*\
36555
36471
  !*** ./node_modules/@abaplint/core/build/src/abap/types/basic/_abstract_type.js ***!
@@ -38019,6 +37935,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
38019
37935
  exports.Attributes = void 0;
38020
37936
  const Structures = __webpack_require__(/*! ../3_structures/structures */ "./node_modules/@abaplint/core/build/src/abap/3_structures/structures/index.js");
38021
37937
  const Statements = __webpack_require__(/*! ../2_statements/statements */ "./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js");
37938
+ const Expressions = __webpack_require__(/*! ../2_statements/expressions */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js");
38022
37939
  const class_attribute_1 = __webpack_require__(/*! ./class_attribute */ "./node_modules/@abaplint/core/build/src/abap/types/class_attribute.js");
38023
37940
  const class_constant_1 = __webpack_require__(/*! ./class_constant */ "./node_modules/@abaplint/core/build/src/abap/types/class_constant.js");
38024
37941
  const nodes_1 = __webpack_require__(/*! ../nodes */ "./node_modules/@abaplint/core/build/src/abap/nodes/index.js");
@@ -38033,13 +37950,16 @@ const constants_1 = __webpack_require__(/*! ../5_syntax/structures/constants */
38033
37950
  const type_definitions_1 = __webpack_require__(/*! ./type_definitions */ "./node_modules/@abaplint/core/build/src/abap/types/type_definitions.js");
38034
37951
  const types_1 = __webpack_require__(/*! ../5_syntax/structures/types */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/structures/types.js");
38035
37952
  const type_1 = __webpack_require__(/*! ../5_syntax/statements/type */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/statements/type.js");
37953
+ const _reference_1 = __webpack_require__(/*! ../5_syntax/_reference */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_reference.js");
37954
+ const alias_1 = __webpack_require__(/*! ./alias */ "./node_modules/@abaplint/core/build/src/abap/types/alias.js");
38036
37955
  class Attributes {
38037
37956
  constructor(node, input) {
38038
37957
  this.static = [];
38039
37958
  this.instance = [];
38040
37959
  this.constants = [];
38041
- this.filename = input.filename;
37960
+ this.aliases = [];
38042
37961
  this.tlist = [];
37962
+ this.filename = input.filename;
38043
37963
  this.parse(node, input);
38044
37964
  this.types = new type_definitions_1.TypeDefinitions(this.tlist);
38045
37965
  }
@@ -38049,6 +37969,9 @@ class Attributes {
38049
37969
  getStatic() {
38050
37970
  return this.static;
38051
37971
  }
37972
+ getAliases() {
37973
+ return this.aliases;
37974
+ }
38052
37975
  getAll() {
38053
37976
  let res = [];
38054
37977
  res = res.concat(this.static);
@@ -38187,6 +38110,9 @@ class Attributes {
38187
38110
  else if (ctyp instanceof Statements.ClassData) {
38188
38111
  this.static.push(this.parseAttribute(c, visibility, input));
38189
38112
  }
38113
+ else if (ctyp instanceof Statements.Aliases) {
38114
+ this.parseAlias(c, visibility, input);
38115
+ }
38190
38116
  else if (ctyp instanceof Statements.Constant) {
38191
38117
  const found = new constant_1.Constant().runSyntax(c, input);
38192
38118
  if (found) {
@@ -38205,6 +38131,27 @@ class Attributes {
38205
38131
  }
38206
38132
  }
38207
38133
  }
38134
+ parseAlias(node, visibility, input) {
38135
+ const aliasName = node.findFirstExpression(Expressions.SimpleName).getFirstToken();
38136
+ const compToken = node.findFirstExpression(Expressions.Field).getFirstToken();
38137
+ const compName = compToken.getStr();
38138
+ this.aliases.push(new alias_1.Alias(aliasName, visibility, compName, this.filename));
38139
+ if (compName.includes("~")) {
38140
+ const name = compName.split("~")[0];
38141
+ const idef = input.scope.findInterfaceDefinition(name);
38142
+ if (idef) {
38143
+ input.scope.addReference(compToken, idef, _reference_1.ReferenceType.ObjectOrientedReference, input.filename, { ooName: name.toUpperCase(), ooType: "INTF" });
38144
+ const foundType = idef.getTypeDefinitions().getByName(compName.split("~")[1]);
38145
+ if (foundType) {
38146
+ input.scope.addTypeNamed(aliasName.getStr(), foundType);
38147
+ }
38148
+ const foundAttribute = idef.getAttributes().findByName(compName.split("~")[1]);
38149
+ if (foundAttribute) {
38150
+ input.scope.addNamedIdentifier(aliasName.getStr(), foundAttribute);
38151
+ }
38152
+ }
38153
+ }
38154
+ }
38208
38155
  parseAttribute(node, visibility, input) {
38209
38156
  let found = undefined;
38210
38157
  const s = node.get();
@@ -38271,7 +38218,6 @@ const Structures = __webpack_require__(/*! ../3_structures/structures */ "./node
38271
38218
  const Expressions = __webpack_require__(/*! ../2_statements/expressions */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js");
38272
38219
  const class_attributes_1 = __webpack_require__(/*! ./class_attributes */ "./node_modules/@abaplint/core/build/src/abap/types/class_attributes.js");
38273
38220
  const _identifier_1 = __webpack_require__(/*! ../4_file_information/_identifier */ "./node_modules/@abaplint/core/build/src/abap/4_file_information/_identifier.js");
38274
- const aliases_1 = __webpack_require__(/*! ./aliases */ "./node_modules/@abaplint/core/build/src/abap/types/aliases.js");
38275
38221
  const _scope_type_1 = __webpack_require__(/*! ../5_syntax/_scope_type */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_scope_type.js");
38276
38222
  const event_definition_1 = __webpack_require__(/*! ./event_definition */ "./node_modules/@abaplint/core/build/src/abap/types/event_definition.js");
38277
38223
  const visibility_1 = __webpack_require__(/*! ../4_file_information/visibility */ "./node_modules/@abaplint/core/build/src/abap/4_file_information/visibility.js");
@@ -38296,9 +38242,9 @@ class ClassDefinition extends _identifier_1.Identifier {
38296
38242
  this.parse(input, node);
38297
38243
  const helper = new _object_oriented_1.ObjectOriented(input.scope);
38298
38244
  helper.fromSuperClassesAndInterfaces(this);
38299
- helper.addAliasedTypes(this.aliases);
38300
38245
  this.attributes = new class_attributes_1.Attributes(node, input);
38301
38246
  this.types = this.attributes.getTypes();
38247
+ this.aliases = this.attributes.getAliases();
38302
38248
  const events = node.findAllStatements(Statements.Events);
38303
38249
  for (const e of events) {
38304
38250
  this.events.push(new event_definition_1.EventDefinition(e, visibility_1.Visibility.Public, input)); // todo, all these are not Public
@@ -38379,7 +38325,7 @@ class ClassDefinition extends _identifier_1.Identifier {
38379
38325
  }
38380
38326
  names.add(name);
38381
38327
  }
38382
- for (const a of (cdef === null || cdef === void 0 ? void 0 : cdef.getAliases().getAll()) || []) {
38328
+ for (const a of (cdef === null || cdef === void 0 ? void 0 : cdef.getAliases()) || []) {
38383
38329
  names.add(a.getName().toUpperCase());
38384
38330
  }
38385
38331
  sup = cdef === null || cdef === void 0 ? void 0 : cdef.getSuperClass();
@@ -38434,7 +38380,6 @@ class ClassDefinition extends _identifier_1.Identifier {
38434
38380
  input.scope.addReference(token, undefined, _reference_1.ReferenceType.ObjectOrientedUnknownReference, input.filename, { ooName: name.toUpperCase(), ooType: "INTF" });
38435
38381
  }
38436
38382
  }
38437
- this.aliases = new aliases_1.Aliases(inputNode, this.filename, input.scope);
38438
38383
  }
38439
38384
  }
38440
38385
  exports.ClassDefinition = ClassDefinition;
@@ -38784,11 +38729,7 @@ const visibility_1 = __webpack_require__(/*! ../4_file_information/visibility */
38784
38729
  const _scope_type_1 = __webpack_require__(/*! ../5_syntax/_scope_type */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_scope_type.js");
38785
38730
  const event_definition_1 = __webpack_require__(/*! ./event_definition */ "./node_modules/@abaplint/core/build/src/abap/types/event_definition.js");
38786
38731
  const method_definitions_1 = __webpack_require__(/*! ./method_definitions */ "./node_modules/@abaplint/core/build/src/abap/types/method_definitions.js");
38787
- const aliases_1 = __webpack_require__(/*! ./aliases */ "./node_modules/@abaplint/core/build/src/abap/types/aliases.js");
38788
38732
  const _reference_1 = __webpack_require__(/*! ../5_syntax/_reference */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_reference.js");
38789
- const class_constant_1 = __webpack_require__(/*! ./class_constant */ "./node_modules/@abaplint/core/build/src/abap/types/class_constant.js");
38790
- const _typed_identifier_1 = __webpack_require__(/*! ./_typed_identifier */ "./node_modules/@abaplint/core/build/src/abap/types/_typed_identifier.js");
38791
- const tokens_1 = __webpack_require__(/*! ../1_lexer/tokens */ "./node_modules/@abaplint/core/build/src/abap/1_lexer/tokens/index.js");
38792
38733
  class InterfaceDefinition extends _identifier_1.Identifier {
38793
38734
  constructor(node, input) {
38794
38735
  if (!(node.get() instanceof Structures.Interface)) {
@@ -38832,37 +38773,8 @@ class InterfaceDefinition extends _identifier_1.Identifier {
38832
38773
  return this.methodDefinitions;
38833
38774
  }
38834
38775
  /////////////////
38835
- parse(input, node) {
38776
+ checkInterfacesExists(input, node) {
38836
38777
  var _a;
38837
- // todo, proper sequencing, the statements should be processed line by line
38838
- this.attributes = new class_attributes_1.Attributes(node, input);
38839
- this.typeDefinitions = this.attributes.getTypes();
38840
- this.aliases = new aliases_1.Aliases(node, this.filename, input.scope);
38841
- // todo, cleanup aliases, vs "object_oriented.ts" vs "class_implementation.ts"
38842
- // this adds the aliased types to scope?
38843
- for (const a of this.aliases.getAll()) {
38844
- const [objName, fieldName] = a.getComponent().split("~");
38845
- const idef = input.scope.findInterfaceDefinition(objName);
38846
- if (idef) {
38847
- const foundType = idef.getTypeDefinitions().getByName(fieldName);
38848
- if (foundType) {
38849
- input.scope.addTypeNamed(a.getName(), foundType);
38850
- }
38851
- else {
38852
- const foundField = idef.getAttributes().findByName(fieldName);
38853
- if (foundField && foundField instanceof class_constant_1.ClassConstant) {
38854
- const token = new tokens_1.Identifier(a.getStart(), a.getName());
38855
- const id = new _typed_identifier_1.TypedIdentifier(token, input.filename, foundField.getType());
38856
- const constant = new class_constant_1.ClassConstant(id, visibility_1.Visibility.Public, foundField.getValue());
38857
- input.scope.addIdentifier(constant);
38858
- }
38859
- }
38860
- }
38861
- }
38862
- const events = node.findAllStatements(Statements.Events);
38863
- for (const e of events) {
38864
- this.events.push(new event_definition_1.EventDefinition(e, visibility_1.Visibility.Public, input));
38865
- }
38866
38778
  for (const i of node.findAllStatements(Statements.InterfaceDef)) {
38867
38779
  const token = (_a = i.findDirectExpression(Expressions.InterfaceName)) === null || _a === void 0 ? void 0 : _a.getFirstToken();
38868
38780
  const name = token === null || token === void 0 ? void 0 : token.getStr();
@@ -38880,6 +38792,39 @@ class InterfaceDefinition extends _identifier_1.Identifier {
38880
38792
  }
38881
38793
  }
38882
38794
  }
38795
+ }
38796
+ parse(input, node) {
38797
+ this.checkInterfacesExists(input, node);
38798
+ // todo, proper sequencing, the statements should be processed line by line
38799
+ this.attributes = new class_attributes_1.Attributes(node, input);
38800
+ this.typeDefinitions = this.attributes.getTypes();
38801
+ this.aliases = this.attributes.getAliases();
38802
+ // todo, cleanup aliases, vs "object_oriented.ts" vs "class_implementation.ts"
38803
+ // this adds the aliased types to scope?
38804
+ /*
38805
+ for (const a of this.aliases) {
38806
+ const [objName, fieldName] = a.getComponent().split("~");
38807
+ const idef = input.scope.findInterfaceDefinition(objName);
38808
+ if (idef) {
38809
+ const foundType = idef.getTypeDefinitions().getByName(fieldName);
38810
+ if (foundType) {
38811
+ input.scope.addTypeNamed(a.getName(), foundType);
38812
+ } else {
38813
+ const foundField = idef.getAttributes().findByName(fieldName);
38814
+ if (foundField && foundField instanceof ClassConstant) {
38815
+ const token = new TokenIdentifier(a.getStart(), a.getName());
38816
+ const id = new TypedIdentifier(token, input.filename, foundField.getType());
38817
+ const constant = new ClassConstant(id, Visibility.Public, foundField.getValue());
38818
+ input.scope.addIdentifier(constant);
38819
+ }
38820
+ }
38821
+ }
38822
+ }
38823
+ */
38824
+ const events = node.findAllStatements(Statements.Events);
38825
+ for (const e of events) {
38826
+ this.events.push(new event_definition_1.EventDefinition(e, visibility_1.Visibility.Public, input));
38827
+ }
38883
38828
  this.methodDefinitions = new method_definitions_1.MethodDefinitions(node, input);
38884
38829
  if (this.methodDefinitions.getByName("CONSTRUCTOR") !== undefined) {
38885
38830
  throw new Error("Interfaces cannot have constructor methods");
@@ -52405,7 +52350,7 @@ class Registry {
52405
52350
  }
52406
52351
  static abaplintVersion() {
52407
52352
  // magic, see build script "version.sh"
52408
- return "2.112.4";
52353
+ return "2.112.5";
52409
52354
  }
52410
52355
  getDDICReferences() {
52411
52356
  return this.ddicReferences;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/cli",
3
- "version": "2.112.4",
3
+ "version": "2.112.5",
4
4
  "description": "abaplint - Command Line Interface",
5
5
  "funding": "https://github.com/sponsors/larshp",
6
6
  "bin": {
@@ -38,7 +38,7 @@
38
38
  },
39
39
  "homepage": "https://abaplint.org",
40
40
  "devDependencies": {
41
- "@abaplint/core": "^2.112.4",
41
+ "@abaplint/core": "^2.112.5",
42
42
  "@types/chai": "^4.3.16",
43
43
  "@types/glob": "^8.1.0",
44
44
  "@types/minimist": "^1.2.5",