@abaplint/cli 2.101.2 → 2.101.4

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 -29
  2. package/package.json +3 -3
package/build/cli.js CHANGED
@@ -18917,7 +18917,7 @@ class ABAPFileInformation {
18917
18917
  }
18918
18918
  }
18919
18919
  parseClasses(structure) {
18920
- var _a, _b, _c;
18920
+ var _a;
18921
18921
  for (const found of structure.findAllStructures(Structures.ClassDefinition)) {
18922
18922
  const className = found.findFirstStatement(Statements.ClassDefinition).findFirstExpression(Expressions.ClassName).getFirstToken();
18923
18923
  const methods = this.parseMethodDefinition(found.findFirstStructure(Structures.PublicSection), visibility_1.Visibility.Public);
@@ -18936,8 +18936,26 @@ class ABAPFileInformation {
18936
18936
  const containsGlobal = found.findFirstExpression(Expressions.ClassGlobal);
18937
18937
  const cdef = found.findFirstStatement(Statements.ClassDefinition);
18938
18938
  const concat = (cdef === null || cdef === void 0 ? void 0 : cdef.concatTokens().toUpperCase()) || "";
18939
- const duration = (_b = cdef === null || cdef === void 0 ? void 0 : cdef.findExpressionAfterToken("DURATION")) === null || _b === void 0 ? void 0 : _b.concatTokens().toUpperCase();
18940
- const riskLevel = (_c = cdef === null || cdef === void 0 ? void 0 : cdef.findExpressionAfterToken("LEVEL")) === null || _c === void 0 ? void 0 : _c.concatTokens().toUpperCase();
18939
+ let riskLevel;
18940
+ if (concat.includes("RISK LEVEL CRITICAL")) {
18941
+ riskLevel = _abap_file_information_1.RiskLevel.critical;
18942
+ }
18943
+ else if (concat.includes("RISK LEVEL DANGEROUS")) {
18944
+ riskLevel = _abap_file_information_1.RiskLevel.dangerous;
18945
+ }
18946
+ else if (concat.includes("RISK LEVEL HARMLESS")) {
18947
+ riskLevel = _abap_file_information_1.RiskLevel.harmless;
18948
+ }
18949
+ let duration;
18950
+ if (concat.includes("DURATION SHORT")) {
18951
+ duration = _abap_file_information_1.Duration.short;
18952
+ }
18953
+ else if (concat.includes("DURATION LONG")) {
18954
+ duration = _abap_file_information_1.Duration.long;
18955
+ }
18956
+ else if (concat.includes("DURATION MEDIUM")) {
18957
+ duration = _abap_file_information_1.Duration.medium;
18958
+ }
18941
18959
  this.classes.push({
18942
18960
  name: className.getStr(),
18943
18961
  identifier: new _identifier_1.Identifier(className, this.filename),
@@ -29791,45 +29809,50 @@ const _reference_1 = __webpack_require__(/*! ../_reference */ "./node_modules/@a
29791
29809
  const basic_1 = __webpack_require__(/*! ../../types/basic */ "./node_modules/@abaplint/core/build/src/abap/types/basic/index.js");
29792
29810
  const message_source_1 = __webpack_require__(/*! ../expressions/message_source */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/message_source.js");
29793
29811
  const raise_with_1 = __webpack_require__(/*! ../expressions/raise_with */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/raise_with.js");
29812
+ const _object_oriented_1 = __webpack_require__(/*! ../_object_oriented */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_object_oriented.js");
29813
+ const method_parameters_1 = __webpack_require__(/*! ../expressions/method_parameters */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/method_parameters.js");
29794
29814
  class Raise {
29795
29815
  runSyntax(node, scope, filename) {
29796
29816
  // todo
29797
- var _a, _b, _c;
29817
+ var _a, _b, _c, _d, _e;
29818
+ const helper = new _object_oriented_1.ObjectOriented(scope);
29819
+ let method;
29798
29820
  const classTok = (_a = node.findDirectExpression(Expressions.ClassName)) === null || _a === void 0 ? void 0 : _a.getFirstToken();
29799
- const classNam = classTok === null || classTok === void 0 ? void 0 : classTok.getStr();
29800
- if (classNam) {
29801
- const found = scope.existsObject(classNam);
29821
+ const className = classTok === null || classTok === void 0 ? void 0 : classTok.getStr();
29822
+ if (className) {
29823
+ const found = scope.existsObject(className);
29802
29824
  if (found.found === true && found.id) {
29803
29825
  scope.addReference(classTok, found.id, found.type, filename);
29826
+ const def = scope.findObjectDefinition(className);
29827
+ method = (_b = helper.searchMethodName(def, "CONSTRUCTOR")) === null || _b === void 0 ? void 0 : _b.method;
29804
29828
  }
29805
- else if (scope.getDDIC().inErrorNamespace(classNam) === false) {
29806
- const extra = { ooName: classNam, ooType: "Void" };
29829
+ else if (scope.getDDIC().inErrorNamespace(className) === false) {
29830
+ const extra = { ooName: className, ooType: "Void" };
29807
29831
  scope.addReference(classTok, undefined, _reference_1.ReferenceType.ObjectOrientedVoidReference, filename, extra);
29832
+ method = new basic_1.VoidType(className);
29808
29833
  }
29809
29834
  else {
29810
- throw new Error("RAISE, unknown class " + classNam);
29835
+ throw new Error("RAISE, unknown class " + className);
29811
29836
  }
29812
29837
  }
29813
- let prev = "";
29814
- for (const c of node.getChildren()) {
29815
- if (c instanceof nodes_1.ExpressionNode
29816
- && (c.get() instanceof Expressions.SimpleSource2 || c.get() instanceof Expressions.Source)) {
29817
- const type = new source_1.Source().runSyntax(c, scope, filename);
29818
- if (prev === "EXCEPTION"
29819
- && type
29820
- && !(type instanceof basic_1.VoidType)
29821
- && !(type instanceof basic_1.ObjectReferenceType)) {
29822
- throw new Error("RAISE EXCEPTION, must be object reference, got " + type.constructor.name);
29823
- }
29838
+ const c = node.findExpressionAfterToken("EXCEPTION");
29839
+ if (c instanceof nodes_1.ExpressionNode && (c.get() instanceof Expressions.SimpleSource2 || c.get() instanceof Expressions.Source)) {
29840
+ const type = new source_1.Source().runSyntax(c, scope, filename);
29841
+ if (type instanceof basic_1.VoidType) {
29842
+ method = type;
29843
+ }
29844
+ else if (type instanceof basic_1.ObjectReferenceType) {
29845
+ const def = scope.findObjectDefinition(type.getIdentifierName());
29846
+ method = (_c = helper.searchMethodName(def, "CONSTRUCTOR")) === null || _c === void 0 ? void 0 : _c.method;
29847
+ }
29848
+ else if (type !== undefined) {
29849
+ throw new Error("RAISE EXCEPTION, must be object reference, got " + type.constructor.name);
29824
29850
  }
29825
- prev = c.concatTokens().toUpperCase();
29826
29851
  }
29827
- // todo, check parameters vs constructor
29852
+ // check parameters vs constructor
29828
29853
  const param = node.findDirectExpression(Expressions.ParameterListS);
29829
29854
  if (param) {
29830
- for (const s of param.findAllExpressions(Expressions.Source)) {
29831
- new source_1.Source().runSyntax(s, scope, filename);
29832
- }
29855
+ new method_parameters_1.MethodParameters().checkExporting(param, scope, method, filename, true);
29833
29856
  }
29834
29857
  for (const s of node.findDirectExpressions(Expressions.RaiseWith)) {
29835
29858
  new raise_with_1.RaiseWith().runSyntax(s, scope, filename);
@@ -29843,8 +29866,8 @@ class Raise {
29843
29866
  for (const s of node.findDirectExpressions(Expressions.MessageSource)) {
29844
29867
  new message_source_1.MessageSource().runSyntax(s, scope, filename);
29845
29868
  }
29846
- const id = (_b = node.findExpressionAfterToken("ID")) === null || _b === void 0 ? void 0 : _b.concatTokens();
29847
- const number = (_c = node.findDirectExpression(Expressions.MessageNumber)) === null || _c === void 0 ? void 0 : _c.concatTokens();
29869
+ const id = (_d = node.findExpressionAfterToken("ID")) === null || _d === void 0 ? void 0 : _d.concatTokens();
29870
+ const number = (_e = node.findDirectExpression(Expressions.MessageNumber)) === null || _e === void 0 ? void 0 : _e.concatTokens();
29848
29871
  if ((id === null || id === void 0 ? void 0 : id.startsWith("'")) && number) {
29849
29872
  const messageClass = id.substring(1, id.length - 1).toUpperCase();
29850
29873
  scope.getMSAGReferences().addUsing(filename, node.getFirstToken(), messageClass, number);
@@ -47991,7 +48014,7 @@ class Registry {
47991
48014
  }
47992
48015
  static abaplintVersion() {
47993
48016
  // magic, see build script "version.sh"
47994
- return "2.101.2";
48017
+ return "2.101.4";
47995
48018
  }
47996
48019
  getDDICReferences() {
47997
48020
  return this.ddicReferences;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/cli",
3
- "version": "2.101.2",
3
+ "version": "2.101.4",
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.101.2",
41
+ "@abaplint/core": "^2.101.4",
42
42
  "@types/chai": "^4.3.5",
43
43
  "@types/glob": "^7.2.0",
44
44
  "@types/minimist": "^1.2.2",
@@ -55,7 +55,7 @@
55
55
  "mocha": "^10.2.0",
56
56
  "progress": "^2.0.3",
57
57
  "typescript": "^5.0.4",
58
- "webpack": "^5.83.1",
58
+ "webpack": "^5.84.0",
59
59
  "webpack-cli": "^5.1.1",
60
60
  "xml-js": "^1.6.11"
61
61
  },