@abaplint/cli 2.118.3 → 2.118.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 +254 -8
  2. package/package.json +2 -2
package/build/cli.js CHANGED
@@ -16307,7 +16307,9 @@ class ReadTable {
16307
16307
  const key = (0, combi_1.seq)((0, combi_1.altPrio)("WITH KEY", "WITH TABLE KEY"), (0, combi_1.alt)(expressions_1.ComponentCompareSimple, components, (0, combi_1.seq)((0, combi_1.optPrio)("="), expressions_1.Source)));
16308
16308
  const using = (0, combi_1.seq)("USING KEY", (0, combi_1.alt)(expressions_1.Field, expressions_1.Dynamic));
16309
16309
  const from = (0, combi_1.seq)("FROM", expressions_1.Source);
16310
- const perm = (0, combi_1.per)((0, combi_1.alt)(index, key, from), expressions_1.ReadTableTarget, using, comparing, "CASTING", (0, combi_1.seq)("TRANSPORTING", (0, combi_1.altPrio)("ALL FIELDS", "NO FIELDS", transporting_fields_1.TransportingFields)), "BINARY SEARCH");
16310
+ const transporting = (0, combi_1.seq)("TRANSPORTING", (0, combi_1.altPrio)("ALL FIELDS", "NO FIELDS", transporting_fields_1.TransportingFields));
16311
+ const common = [expressions_1.ReadTableTarget, comparing, "CASTING", transporting, "BINARY SEARCH"];
16312
+ const perm = (0, combi_1.alt)((0, combi_1.per)((0, combi_1.alt)(index, from), using, ...common), (0, combi_1.per)(key, ...common), (0, combi_1.per)(...common));
16311
16313
  return (0, combi_1.seq)("READ TABLE", (0, combi_1.alt)(expressions_1.SimpleSource2, (0, combi_1.ver)(version_1.Version.v740sp02, expressions_1.Source, version_1.Version.OpenABAP)), (0, combi_1.opt)(perm));
16312
16314
  }
16313
16315
  }
@@ -21633,7 +21635,7 @@ BuiltIn.methods = {
21633
21635
  "CONCAT_LINES_OF": {
21634
21636
  counter: BuiltIn.counter++,
21635
21637
  mandatory: {
21636
- "table": new basic_1.TableType(basic_1.AnyType.get(), { withHeader: false, keyType: basic_1.TableKeyType.default }),
21638
+ "table": new basic_1.TableType(basic_1.AnyType.get(), { withHeader: false, keyType: basic_1.TableKeyType.user }),
21637
21639
  },
21638
21640
  optional: {
21639
21641
  "sep": basic_1.CLikeType.get(),
@@ -21931,7 +21933,7 @@ BuiltIn.methods = {
21931
21933
  "LINES": {
21932
21934
  counter: BuiltIn.counter++,
21933
21935
  mandatory: {
21934
- "val": new basic_1.TableType(basic_1.AnyType.get(), { withHeader: false, keyType: basic_1.TableKeyType.default }),
21936
+ "val": new basic_1.TableType(basic_1.AnyType.get(), { withHeader: false, keyType: basic_1.TableKeyType.user }),
21935
21937
  },
21936
21938
  return: basic_1.IntegerType.get(),
21937
21939
  },
@@ -22376,6 +22378,7 @@ class CurrentScope {
22376
22378
  }
22377
22379
  }
22378
22380
  constructor(reg, obj) {
22381
+ this.localFriends = new Map();
22379
22382
  this.current = undefined;
22380
22383
  this.parentObj = obj;
22381
22384
  this.reg = reg;
@@ -22799,6 +22802,27 @@ class CurrentScope {
22799
22802
  }
22800
22803
  return false;
22801
22804
  }
22805
+ addLocalFriend(className, friendName) {
22806
+ var _a;
22807
+ const key = className.toUpperCase();
22808
+ const list = (_a = this.localFriends.get(key)) !== null && _a !== void 0 ? _a : [];
22809
+ list.push(friendName.toUpperCase());
22810
+ this.localFriends.set(key, list);
22811
+ }
22812
+ isLocalFriend(className, friendName) {
22813
+ var _a;
22814
+ return ((_a = this.localFriends.get(className.toUpperCase())) === null || _a === void 0 ? void 0 : _a.includes(friendName.toUpperCase())) === true;
22815
+ }
22816
+ getEnclosingClassName() {
22817
+ let curr = this.current;
22818
+ while (curr !== undefined) {
22819
+ if (curr.getIdentifier().stype === _scope_type_1.ScopeType.ClassImplementation) {
22820
+ return curr.getIdentifier().sname;
22821
+ }
22822
+ curr = curr.getParent();
22823
+ }
22824
+ return undefined;
22825
+ }
22802
22826
  isGlobalOO() {
22803
22827
  return this.parentObj.getType() === "INTF" || this.parentObj.getType() === "CLAS";
22804
22828
  }
@@ -23552,6 +23576,8 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
23552
23576
  exports.TypeUtils = void 0;
23553
23577
  const types_1 = __webpack_require__(/*! ../types */ "./node_modules/@abaplint/core/build/src/abap/types/index.js");
23554
23578
  const basic_1 = __webpack_require__(/*! ../types/basic */ "./node_modules/@abaplint/core/build/src/abap/types/basic/index.js");
23579
+ const table_type_1 = __webpack_require__(/*! ../types/basic/table_type */ "./node_modules/@abaplint/core/build/src/abap/types/basic/table_type.js");
23580
+ const enum_type_1 = __webpack_require__(/*! ../types/basic/enum_type */ "./node_modules/@abaplint/core/build/src/abap/types/basic/enum_type.js");
23555
23581
  const cgeneric_type_1 = __webpack_require__(/*! ../types/basic/cgeneric_type */ "./node_modules/@abaplint/core/build/src/abap/types/basic/cgeneric_type.js");
23556
23582
  const Expressions = __webpack_require__(/*! ../2_statements/expressions */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js");
23557
23583
  // todo: refactor to static? for performance
@@ -23628,7 +23654,8 @@ class TypeUtils {
23628
23654
  || type instanceof basic_1.DataType
23629
23655
  || type instanceof basic_1.CLikeType
23630
23656
  || type instanceof basic_1.PackedType
23631
- || type instanceof basic_1.TimeType) {
23657
+ || type instanceof basic_1.TimeType
23658
+ || type instanceof enum_type_1.EnumType) {
23632
23659
  return true;
23633
23660
  }
23634
23661
  return false;
@@ -23978,6 +24005,13 @@ class TypeUtils {
23978
24005
  }
23979
24006
  else if (source instanceof basic_1.TableType) {
23980
24007
  if (target instanceof basic_1.TableType) {
24008
+ const sourceKeyType = source.getOptions().keyType;
24009
+ const targetKeyType = target.getOptions().keyType;
24010
+ if (sourceKeyType !== targetKeyType
24011
+ && sourceKeyType !== table_type_1.TableKeyType.user
24012
+ && targetKeyType !== table_type_1.TableKeyType.user) {
24013
+ return false;
24014
+ }
23981
24015
  return this.isAssignableStrict(source.getRowType(), target.getRowType());
23982
24016
  }
23983
24017
  else if (target instanceof basic_1.UnknownType
@@ -24035,6 +24069,13 @@ class TypeUtils {
24035
24069
  return false;
24036
24070
  }
24037
24071
  }
24072
+ const sourceKeyType = source.getOptions().keyType;
24073
+ const targetKeyType = target.getOptions().keyType;
24074
+ if (sourceKeyType !== targetKeyType
24075
+ && sourceKeyType !== table_type_1.TableKeyType.user
24076
+ && targetKeyType !== table_type_1.TableKeyType.user) {
24077
+ return false;
24078
+ }
24038
24079
  return true;
24039
24080
  }
24040
24081
  return false;
@@ -24706,7 +24747,7 @@ class BasicTypes {
24706
24747
  || text === "TYPE HASHED TABLE"
24707
24748
  || text === "TYPE INDEX TABLE"
24708
24749
  || text === "TYPE ANY TABLE") {
24709
- return new Types.TableType(Types.AnyType.get(), { withHeader: node.concatTokens().toUpperCase().includes("WITH HEADER LINE"), keyType: Types.TableKeyType.default });
24750
+ return new Types.TableType(Types.AnyType.get(), { withHeader: node.concatTokens().toUpperCase().includes("WITH HEADER LINE"), keyType: Types.TableKeyType.user });
24710
24751
  }
24711
24752
  else if (text.startsWith("LIKE ")) {
24712
24753
  let sub = node.findFirstExpression(Expressions.Type);
@@ -27895,6 +27936,7 @@ const _type_utils_1 = __webpack_require__(/*! ../_type_utils */ "./node_modules/
27895
27936
  const _syntax_input_1 = __webpack_require__(/*! ../_syntax_input */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_syntax_input.js");
27896
27937
  const assert_error_1 = __webpack_require__(/*! ../assert_error */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/assert_error.js");
27897
27938
  const _typed_identifier_1 = __webpack_require__(/*! ../../types/_typed_identifier */ "./node_modules/@abaplint/core/build/src/abap/types/_typed_identifier.js");
27939
+ const create_object_1 = __webpack_require__(/*! ../statements/create_object */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/statements/create_object.js");
27898
27940
  class NewObject {
27899
27941
  static runSyntax(node, input, targetType) {
27900
27942
  let ret = undefined;
@@ -27928,6 +27970,13 @@ class NewObject {
27928
27970
  input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
27929
27971
  return basic_1.VoidType.get(_syntax_input_1.CheckSyntaxKey);
27930
27972
  }
27973
+ if (clas) {
27974
+ const err = create_object_1.CreateObject.checkInstantiationAllowed(clas, input);
27975
+ if (err) {
27976
+ input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), err));
27977
+ return basic_1.VoidType.get(_syntax_input_1.CheckSyntaxKey);
27978
+ }
27979
+ }
27931
27980
  }
27932
27981
  else if (typeName === "#" && targetType) {
27933
27982
  ret = targetType;
@@ -27949,6 +27998,13 @@ class NewObject {
27949
27998
  input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
27950
27999
  return basic_1.VoidType.get(_syntax_input_1.CheckSyntaxKey);
27951
28000
  }
28001
+ if (clas) {
28002
+ const err = create_object_1.CreateObject.checkInstantiationAllowed(clas, input);
28003
+ if (err) {
28004
+ input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), err));
28005
+ return basic_1.VoidType.get(_syntax_input_1.CheckSyntaxKey);
28006
+ }
28007
+ }
27952
28008
  ret = objref;
27953
28009
  }
27954
28010
  }
@@ -28714,6 +28770,11 @@ class Source {
28714
28770
  input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
28715
28771
  return basic_1.VoidType.get(_syntax_input_1.CheckSyntaxKey);
28716
28772
  }
28773
+ else if (foundType === null || foundType === void 0 ? void 0 : foundType.isGeneric()) {
28774
+ const message = "Cannot CONV to generic type";
28775
+ input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
28776
+ return basic_1.VoidType.get(_syntax_input_1.CheckSyntaxKey);
28777
+ }
28717
28778
  this.addIfInferred(node, input, foundType);
28718
28779
  return foundType;
28719
28780
  }
@@ -31148,6 +31209,7 @@ const _reference_1 = __webpack_require__(/*! ../_reference */ "./node_modules/@a
31148
31209
  const _syntax_input_1 = __webpack_require__(/*! ../_syntax_input */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_syntax_input.js");
31149
31210
  class ClassLocalFriends {
31150
31211
  runSyntax(node, input) {
31212
+ var _a;
31151
31213
  const classNames = node.findAllExpressions(Expressions.ClassName);
31152
31214
  const found = classNames[0];
31153
31215
  if (found) {
@@ -31178,6 +31240,12 @@ class ClassLocalFriends {
31178
31240
  input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
31179
31241
  return;
31180
31242
  }
31243
+ else {
31244
+ const befriendedName = (_a = classNames[0]) === null || _a === void 0 ? void 0 : _a.getFirstToken().getStr();
31245
+ if (befriendedName) {
31246
+ input.scope.addLocalFriend(befriendedName, className);
31247
+ }
31248
+ }
31181
31249
  }
31182
31250
  }
31183
31251
  }
@@ -31659,6 +31727,7 @@ const types_1 = __webpack_require__(/*! ../../types */ "./node_modules/@abaplint
31659
31727
  const _object_oriented_1 = __webpack_require__(/*! ../_object_oriented */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_object_oriented.js");
31660
31728
  const _type_utils_1 = __webpack_require__(/*! ../_type_utils */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_type_utils.js");
31661
31729
  const _syntax_input_1 = __webpack_require__(/*! ../_syntax_input */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_syntax_input.js");
31730
+ const visibility_1 = __webpack_require__(/*! ../../4_file_information/visibility */ "./node_modules/@abaplint/core/build/src/abap/4_file_information/visibility.js");
31662
31731
  class CreateObject {
31663
31732
  runSyntax(node, input) {
31664
31733
  var _a;
@@ -31755,8 +31824,46 @@ class CreateObject {
31755
31824
  ooName = found.getVoided();
31756
31825
  }
31757
31826
  input.scope.addReference(t === null || t === void 0 ? void 0 : t.getFirstToken(), cdef, _reference_1.ReferenceType.ConstructorReference, input.filename, { ooName: ooName });
31827
+ if (cdef !== undefined) {
31828
+ const err = CreateObject.checkInstantiationAllowed(cdef, input);
31829
+ if (err) {
31830
+ input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), err));
31831
+ return;
31832
+ }
31833
+ }
31758
31834
  this.validateParameters(cdef, node, input);
31759
31835
  }
31836
+ static checkInstantiationAllowed(cdef, input) {
31837
+ var _a, _b;
31838
+ const createVis = cdef.getCreateVisibility();
31839
+ if (createVis === visibility_1.Visibility.Public) {
31840
+ return undefined;
31841
+ }
31842
+ const enclosingClass = input.scope.getEnclosingClassName();
31843
+ if (enclosingClass === undefined) {
31844
+ return cdef.getName() + " cannot be instantiated, class is defined as " +
31845
+ (createVis === visibility_1.Visibility.Private ? "private" : "protected");
31846
+ }
31847
+ if (enclosingClass.toUpperCase() === cdef.getName().toUpperCase()) {
31848
+ return undefined;
31849
+ }
31850
+ if (cdef.getFriends().some(f => f.toUpperCase() === enclosingClass.toUpperCase()) ||
31851
+ input.scope.isLocalFriend(cdef.getName(), enclosingClass)) {
31852
+ return undefined;
31853
+ }
31854
+ if (createVis === visibility_1.Visibility.Protected) {
31855
+ // subclasses are also allowed
31856
+ let sup = (_a = input.scope.findClassDefinition(enclosingClass)) === null || _a === void 0 ? void 0 : _a.getSuperClass();
31857
+ while (sup !== undefined) {
31858
+ if (sup.toUpperCase() === cdef.getName().toUpperCase()) {
31859
+ return undefined;
31860
+ }
31861
+ sup = (_b = input.scope.findClassDefinition(sup)) === null || _b === void 0 ? void 0 : _b.getSuperClass();
31862
+ }
31863
+ }
31864
+ return cdef.getName() + " cannot be instantiated, class is defined as " +
31865
+ (createVis === visibility_1.Visibility.Private ? "private" : "protected");
31866
+ }
31760
31867
  validateParameters(cdef, node, input) {
31761
31868
  var _a, _b, _c, _d;
31762
31869
  if (cdef === undefined) {
@@ -35133,7 +35240,7 @@ const _syntax_input_1 = __webpack_require__(/*! ../_syntax_input */ "./node_modu
35133
35240
  class Split {
35134
35241
  runSyntax(node, input) {
35135
35242
  const intoTable = node.findTokenSequencePosition("INTO", "TABLE") !== undefined;
35136
- const type = intoTable ? new basic_1.TableType(basic_1.StringType.get(), { withHeader: false, keyType: basic_1.TableKeyType.default }) : basic_1.StringType.get();
35243
+ const type = intoTable ? new basic_1.TableType(basic_1.StringType.get(), { withHeader: false, keyType: basic_1.TableKeyType.user }) : basic_1.StringType.get();
35137
35244
  for (const target of node.findAllExpressions(Expressions.Target)) {
35138
35245
  const inline = target.findDirectExpression(Expressions.InlineData);
35139
35246
  if (inline) {
@@ -38907,6 +39014,7 @@ __exportStar(__webpack_require__(/*! ./date_type */ "./node_modules/@abaplint/co
38907
39014
  __exportStar(__webpack_require__(/*! ./decfloat_type */ "./node_modules/@abaplint/core/build/src/abap/types/basic/decfloat_type.js"), exports);
38908
39015
  __exportStar(__webpack_require__(/*! ./decfloat16_type */ "./node_modules/@abaplint/core/build/src/abap/types/basic/decfloat16_type.js"), exports);
38909
39016
  __exportStar(__webpack_require__(/*! ./decfloat34_type */ "./node_modules/@abaplint/core/build/src/abap/types/basic/decfloat34_type.js"), exports);
39017
+ __exportStar(__webpack_require__(/*! ./enum_type */ "./node_modules/@abaplint/core/build/src/abap/types/basic/enum_type.js"), exports);
38910
39018
  __exportStar(__webpack_require__(/*! ./float_type */ "./node_modules/@abaplint/core/build/src/abap/types/basic/float_type.js"), exports);
38911
39019
  __exportStar(__webpack_require__(/*! ./floating_point_type */ "./node_modules/@abaplint/core/build/src/abap/types/basic/floating_point_type.js"), exports);
38912
39020
  __exportStar(__webpack_require__(/*! ./generic_object_reference_type */ "./node_modules/@abaplint/core/build/src/abap/types/basic/generic_object_reference_type.js"), exports);
@@ -39765,6 +39873,7 @@ class Attributes {
39765
39873
  this.instance = [];
39766
39874
  this.constants = [];
39767
39875
  this.aliases = [];
39876
+ this.declaredInterfaces = [];
39768
39877
  this.tlist = [];
39769
39878
  this.filename = input.filename;
39770
39879
  this.parse(node, input);
@@ -39840,8 +39949,15 @@ class Attributes {
39840
39949
  }
39841
39950
  /////////////////////////////
39842
39951
  parse(node, input) {
39952
+ var _a, _b;
39843
39953
  const cdef = node.findDirectStructure(Structures.ClassDefinition);
39844
39954
  if (cdef) {
39955
+ for (const i of cdef.findAllStatements(Statements.InterfaceDef)) {
39956
+ const name = (_a = i.findFirstExpression(Expressions.InterfaceName)) === null || _a === void 0 ? void 0 : _a.getFirstToken().getStr();
39957
+ if (name) {
39958
+ this.declaredInterfaces.push(name.toUpperCase());
39959
+ }
39960
+ }
39845
39961
  this.parseSection(cdef.findDirectStructure(Structures.PublicSection), visibility_1.Visibility.Public, input);
39846
39962
  this.parseSection(cdef.findDirectStructure(Structures.ProtectedSection), visibility_1.Visibility.Protected, input);
39847
39963
  this.parseSection(cdef.findDirectStructure(Structures.PrivateSection), visibility_1.Visibility.Private, input);
@@ -39849,6 +39965,12 @@ class Attributes {
39849
39965
  }
39850
39966
  const idef = node.findDirectStructure(Structures.Interface);
39851
39967
  if (idef) {
39968
+ for (const i of idef.findAllStatements(Statements.InterfaceDef)) {
39969
+ const name = (_b = i.findFirstExpression(Expressions.InterfaceName)) === null || _b === void 0 ? void 0 : _b.getFirstToken().getStr();
39970
+ if (name) {
39971
+ this.declaredInterfaces.push(name.toUpperCase());
39972
+ }
39973
+ }
39852
39974
  this.parseSection(idef.findDirectStructure(Structures.SectionContents), visibility_1.Visibility.Public, input);
39853
39975
  return;
39854
39976
  }
@@ -39957,6 +40079,12 @@ class Attributes {
39957
40079
  input.scope.addNamedIdentifier(aliasName.getStr(), foundAttribute);
39958
40080
  }
39959
40081
  }
40082
+ else if (this.declaredInterfaces.includes(name.toUpperCase()) || input.scope.getDDIC().inErrorNamespace(name) === false) {
40083
+ input.scope.addReference(compToken, undefined, _reference_1.ReferenceType.ObjectOrientedVoidReference, input.filename);
40084
+ }
40085
+ else {
40086
+ throw new Error("Interface " + name + " not found");
40087
+ }
39960
40088
  }
39961
40089
  }
39962
40090
  parseAttribute(node, visibility, input) {
@@ -40030,6 +40158,7 @@ const event_definition_1 = __webpack_require__(/*! ./event_definition */ "./node
40030
40158
  const visibility_1 = __webpack_require__(/*! ../4_file_information/visibility */ "./node_modules/@abaplint/core/build/src/abap/4_file_information/visibility.js");
40031
40159
  const _object_oriented_1 = __webpack_require__(/*! ../5_syntax/_object_oriented */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_object_oriented.js");
40032
40160
  const _reference_1 = __webpack_require__(/*! ../5_syntax/_reference */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_reference.js");
40161
+ const _syntax_input_1 = __webpack_require__(/*! ../5_syntax/_syntax_input */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_syntax_input.js");
40033
40162
  class ClassDefinition extends _identifier_1.Identifier {
40034
40163
  constructor(node, input) {
40035
40164
  var _a;
@@ -40067,6 +40196,15 @@ class ClassDefinition extends _identifier_1.Identifier {
40067
40196
  this.testing = concat.includes(" FOR TESTING");
40068
40197
  this.sharedMemory = concat.includes(" SHARED MEMORY ENABLED");
40069
40198
  this.abstract = (def === null || def === void 0 ? void 0 : def.findDirectTokenByText("ABSTRACT")) !== undefined;
40199
+ if (concat.includes(" CREATE PRIVATE")) {
40200
+ this.createVisibilityValue = visibility_1.Visibility.Private;
40201
+ }
40202
+ else if (concat.includes(" CREATE PROTECTED")) {
40203
+ this.createVisibilityValue = visibility_1.Visibility.Protected;
40204
+ }
40205
+ else {
40206
+ this.createVisibilityValue = visibility_1.Visibility.Public;
40207
+ }
40070
40208
  // perform checks after everything has been initialized
40071
40209
  this.checkMethodsFromSuperClasses(input.scope);
40072
40210
  this.checkMethodNameLength();
@@ -40110,6 +40248,9 @@ class ClassDefinition extends _identifier_1.Identifier {
40110
40248
  isSharedMemory() {
40111
40249
  return this.sharedMemory;
40112
40250
  }
40251
+ getCreateVisibility() {
40252
+ return this.createVisibilityValue;
40253
+ }
40113
40254
  /*
40114
40255
  public getEvents() {
40115
40256
  }
@@ -40165,8 +40306,20 @@ class ClassDefinition extends _identifier_1.Identifier {
40165
40306
  const result = [];
40166
40307
  for (const n of ((_a = def === null || def === void 0 ? void 0 : def.findDirectExpression(Expressions.ClassFriends)) === null || _a === void 0 ? void 0 : _a.findDirectExpressions(Expressions.ClassName)) || []) {
40167
40308
  const token = n.getFirstToken();
40168
- this.addReference(token, input);
40169
40309
  const name = token.getStr();
40310
+ const s = input.scope.findClassDefinition(name);
40311
+ if (s) {
40312
+ input.scope.addReference(token, s, _reference_1.ReferenceType.ObjectOrientedReference, input.filename, { ooName: name.toUpperCase(), ooType: "CLAS" });
40313
+ }
40314
+ else if (input.scope.existsObject(name) !== undefined) {
40315
+ // DEFINITION DEFERRED friend
40316
+ }
40317
+ else if (input.scope.getDDIC().inErrorNamespace(name) === false) {
40318
+ input.scope.addReference(token, undefined, _reference_1.ReferenceType.ObjectOrientedVoidReference, input.filename);
40319
+ }
40320
+ else {
40321
+ input.issues.push((0, _syntax_input_1.syntaxIssue)(input, token, name.toUpperCase() + " does not exist"));
40322
+ }
40170
40323
  result.push(name);
40171
40324
  }
40172
40325
  return result;
@@ -55886,7 +56039,7 @@ class Registry {
55886
56039
  }
55887
56040
  static abaplintVersion() {
55888
56041
  // magic, see build script "version.sh"
55889
- return "2.118.3";
56042
+ return "2.118.5";
55890
56043
  }
55891
56044
  getDDICReferences() {
55892
56045
  return this.ddicReferences;
@@ -58037,6 +58190,98 @@ exports.CallTransactionAuthorityCheck = CallTransactionAuthorityCheck;
58037
58190
 
58038
58191
  /***/ },
58039
58192
 
58193
+ /***/ "./node_modules/@abaplint/core/build/src/rules/catch_and_raise.js"
58194
+ /*!************************************************************************!*\
58195
+ !*** ./node_modules/@abaplint/core/build/src/rules/catch_and_raise.js ***!
58196
+ \************************************************************************/
58197
+ (__unused_webpack_module, exports, __webpack_require__) {
58198
+
58199
+ "use strict";
58200
+
58201
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
58202
+ exports.CatchAndRaise = exports.CatchAndRaiseConf = void 0;
58203
+ const issue_1 = __webpack_require__(/*! ../issue */ "./node_modules/@abaplint/core/build/src/issue.js");
58204
+ const _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ "./node_modules/@abaplint/core/build/src/rules/_abap_rule.js");
58205
+ const _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ "./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js");
58206
+ const _irule_1 = __webpack_require__(/*! ./_irule */ "./node_modules/@abaplint/core/build/src/rules/_irule.js");
58207
+ const Structures = __webpack_require__(/*! ../abap/3_structures/structures */ "./node_modules/@abaplint/core/build/src/abap/3_structures/structures/index.js");
58208
+ const Statements = __webpack_require__(/*! ../abap/2_statements/statements */ "./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js");
58209
+ const Expressions = __webpack_require__(/*! ../abap/2_statements/expressions */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js");
58210
+ class CatchAndRaiseConf extends _basic_rule_config_1.BasicRuleConfig {
58211
+ }
58212
+ exports.CatchAndRaiseConf = CatchAndRaiseConf;
58213
+ class CatchAndRaise extends _abap_rule_1.ABAPRule {
58214
+ constructor() {
58215
+ super(...arguments);
58216
+ this.conf = new CatchAndRaiseConf();
58217
+ }
58218
+ getMetadata() {
58219
+ return {
58220
+ key: "catch_and_raise",
58221
+ title: "Catch and re-raise same exception",
58222
+ shortDescription: `Reports CATCH blocks that only re-raise the caught exception without any handling`,
58223
+ badExample: `TRY.\n something( ).\nCATCH zcx_something INTO DATA(lv_exc).\n RAISE EXCEPTION lv_exc.\nENDTRY.`,
58224
+ goodExample: `TRY.\n something( ).\nCATCH zcx_something.\n " handle exception\nENDTRY.`,
58225
+ tags: [_irule_1.RuleTag.SingleFile],
58226
+ };
58227
+ }
58228
+ getConfig() {
58229
+ return this.conf;
58230
+ }
58231
+ setConfig(conf) {
58232
+ this.conf = conf;
58233
+ }
58234
+ runParsed(file) {
58235
+ const issues = [];
58236
+ const stru = file.getStructure();
58237
+ if (stru === undefined) {
58238
+ return [];
58239
+ }
58240
+ for (const catchStruct of stru.findAllStructures(Structures.Catch)) {
58241
+ const catchStatement = catchStruct.findDirectStatement(Statements.Catch);
58242
+ if (catchStatement === undefined) {
58243
+ continue;
58244
+ }
58245
+ const target = catchStatement.findFirstExpression(Expressions.Target);
58246
+ if (target === undefined) {
58247
+ continue;
58248
+ }
58249
+ const targetField = target.findFirstExpression(Expressions.TargetField);
58250
+ if (targetField === undefined) {
58251
+ continue;
58252
+ }
58253
+ const caughtVar = targetField.getFirstToken().getStr().toUpperCase();
58254
+ const allStatements = catchStruct.findAllStatementNodes();
58255
+ if (allStatements.length !== 2) {
58256
+ continue;
58257
+ }
58258
+ if (!(allStatements[1].get() instanceof Statements.Raise)) {
58259
+ continue;
58260
+ }
58261
+ const raiseStatement = allStatements[1];
58262
+ const raiseConcat = raiseStatement.concatTokens().toUpperCase().replace(/\.$/, "").trim();
58263
+ if (!raiseConcat.startsWith("RAISE EXCEPTION ")) {
58264
+ continue;
58265
+ }
58266
+ const parts = raiseConcat.split(/\s+/);
58267
+ if (parts.length !== 3) {
58268
+ continue;
58269
+ }
58270
+ if (parts[2] === caughtVar) {
58271
+ issues.push(issue_1.Issue.atStatement(file, catchStatement, this.getMessage(), this.getMetadata().key, this.conf.severity));
58272
+ }
58273
+ }
58274
+ return issues;
58275
+ }
58276
+ getMessage() {
58277
+ return "Caught exception is immediately re-raised, CATCH block has no effect";
58278
+ }
58279
+ }
58280
+ exports.CatchAndRaise = CatchAndRaise;
58281
+ //# sourceMappingURL=catch_and_raise.js.map
58282
+
58283
+ /***/ },
58284
+
58040
58285
  /***/ "./node_modules/@abaplint/core/build/src/rules/cds_association_name.js"
58041
58286
  /*!*****************************************************************************!*\
58042
58287
  !*** ./node_modules/@abaplint/core/build/src/rules/cds_association_name.js ***!
@@ -67805,6 +68050,7 @@ __exportStar(__webpack_require__(/*! ./avoid_use */ "./node_modules/@abaplint/co
67805
68050
  __exportStar(__webpack_require__(/*! ./begin_end_names */ "./node_modules/@abaplint/core/build/src/rules/begin_end_names.js"), exports);
67806
68051
  __exportStar(__webpack_require__(/*! ./begin_single_include */ "./node_modules/@abaplint/core/build/src/rules/begin_single_include.js"), exports);
67807
68052
  __exportStar(__webpack_require__(/*! ./call_transaction_authority_check */ "./node_modules/@abaplint/core/build/src/rules/call_transaction_authority_check.js"), exports);
68053
+ __exportStar(__webpack_require__(/*! ./catch_and_raise */ "./node_modules/@abaplint/core/build/src/rules/catch_and_raise.js"), exports);
67808
68054
  __exportStar(__webpack_require__(/*! ./cds_association_name */ "./node_modules/@abaplint/core/build/src/rules/cds_association_name.js"), exports);
67809
68055
  __exportStar(__webpack_require__(/*! ./cds_comment_style */ "./node_modules/@abaplint/core/build/src/rules/cds_comment_style.js"), exports);
67810
68056
  __exportStar(__webpack_require__(/*! ./cds_field_order */ "./node_modules/@abaplint/core/build/src/rules/cds_field_order.js"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/cli",
3
- "version": "2.118.3",
3
+ "version": "2.118.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.118.3",
41
+ "@abaplint/core": "^2.118.5",
42
42
  "@types/chai": "^4.3.20",
43
43
  "@types/minimist": "^1.2.5",
44
44
  "@types/mocha": "^10.0.10",