@abaplint/cli 2.101.3 → 2.101.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 +52 -31
  2. package/package.json +3 -3
package/build/cli.js CHANGED
@@ -25923,7 +25923,6 @@ const source_1 = __webpack_require__(/*! ./source */ "./node_modules/@abaplint/c
25923
25923
  const _type_utils_1 = __webpack_require__(/*! ../_type_utils */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_type_utils.js");
25924
25924
  class StringTemplate {
25925
25925
  runSyntax(node, scope, filename) {
25926
- var _a;
25927
25926
  const typeUtils = new _type_utils_1.TypeUtils(scope);
25928
25927
  for (const templateSource of node.findAllExpressions(Expressions.StringTemplateSource)) {
25929
25928
  const s = templateSource.findDirectExpression(Expressions.Source);
@@ -25934,9 +25933,22 @@ class StringTemplate {
25934
25933
  else if (typeUtils.isCharLike(type) === false && typeUtils.isHexLike(type) === false) {
25935
25934
  throw new Error("Not character like, " + type.constructor.name);
25936
25935
  }
25937
- for (const formatSource of ((_a = templateSource.findDirectExpression(Expressions.StringTemplateFormatting)) === null || _a === void 0 ? void 0 : _a.findAllExpressions(Expressions.Source)) || []) {
25936
+ const format = templateSource.findDirectExpression(Expressions.StringTemplateFormatting);
25937
+ const formatConcat = format === null || format === void 0 ? void 0 : format.concatTokens();
25938
+ for (const formatSource of (format === null || format === void 0 ? void 0 : format.findAllExpressions(Expressions.Source)) || []) {
25938
25939
  new source_1.Source().runSyntax(formatSource, scope, filename);
25939
25940
  }
25941
+ if ((formatConcat === null || formatConcat === void 0 ? void 0 : formatConcat.includes("ALPHA = "))
25942
+ && !(type instanceof basic_1.UnknownType)
25943
+ && !(type instanceof basic_1.VoidType)
25944
+ && !(type instanceof basic_1.StringType)
25945
+ && !(type instanceof basic_1.CLikeType)
25946
+ && !(type instanceof basic_1.CharacterType)
25947
+ && !(type instanceof basic_1.NumericGenericType)
25948
+ && !(type instanceof basic_1.NumericType)
25949
+ && !(type instanceof basic_1.AnyType)) {
25950
+ throw new Error("Cannot apply ALPHA to this type");
25951
+ }
25940
25952
  }
25941
25953
  return new basic_1.StringType({ qualifiedName: "STRING" });
25942
25954
  }
@@ -29809,45 +29821,50 @@ const _reference_1 = __webpack_require__(/*! ../_reference */ "./node_modules/@a
29809
29821
  const basic_1 = __webpack_require__(/*! ../../types/basic */ "./node_modules/@abaplint/core/build/src/abap/types/basic/index.js");
29810
29822
  const message_source_1 = __webpack_require__(/*! ../expressions/message_source */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/message_source.js");
29811
29823
  const raise_with_1 = __webpack_require__(/*! ../expressions/raise_with */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/raise_with.js");
29824
+ const _object_oriented_1 = __webpack_require__(/*! ../_object_oriented */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_object_oriented.js");
29825
+ const method_parameters_1 = __webpack_require__(/*! ../expressions/method_parameters */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/method_parameters.js");
29812
29826
  class Raise {
29813
29827
  runSyntax(node, scope, filename) {
29814
29828
  // todo
29815
- var _a, _b, _c;
29829
+ var _a, _b, _c, _d, _e;
29830
+ const helper = new _object_oriented_1.ObjectOriented(scope);
29831
+ let method;
29816
29832
  const classTok = (_a = node.findDirectExpression(Expressions.ClassName)) === null || _a === void 0 ? void 0 : _a.getFirstToken();
29817
- const classNam = classTok === null || classTok === void 0 ? void 0 : classTok.getStr();
29818
- if (classNam) {
29819
- const found = scope.existsObject(classNam);
29833
+ const className = classTok === null || classTok === void 0 ? void 0 : classTok.getStr();
29834
+ if (className) {
29835
+ const found = scope.existsObject(className);
29820
29836
  if (found.found === true && found.id) {
29821
29837
  scope.addReference(classTok, found.id, found.type, filename);
29838
+ const def = scope.findObjectDefinition(className);
29839
+ method = (_b = helper.searchMethodName(def, "CONSTRUCTOR")) === null || _b === void 0 ? void 0 : _b.method;
29822
29840
  }
29823
- else if (scope.getDDIC().inErrorNamespace(classNam) === false) {
29824
- const extra = { ooName: classNam, ooType: "Void" };
29841
+ else if (scope.getDDIC().inErrorNamespace(className) === false) {
29842
+ const extra = { ooName: className, ooType: "Void" };
29825
29843
  scope.addReference(classTok, undefined, _reference_1.ReferenceType.ObjectOrientedVoidReference, filename, extra);
29844
+ method = new basic_1.VoidType(className);
29826
29845
  }
29827
29846
  else {
29828
- throw new Error("RAISE, unknown class " + classNam);
29847
+ throw new Error("RAISE, unknown class " + className);
29829
29848
  }
29830
29849
  }
29831
- let prev = "";
29832
- for (const c of node.getChildren()) {
29833
- if (c instanceof nodes_1.ExpressionNode
29834
- && (c.get() instanceof Expressions.SimpleSource2 || c.get() instanceof Expressions.Source)) {
29835
- const type = new source_1.Source().runSyntax(c, scope, filename);
29836
- if (prev === "EXCEPTION"
29837
- && type
29838
- && !(type instanceof basic_1.VoidType)
29839
- && !(type instanceof basic_1.ObjectReferenceType)) {
29840
- throw new Error("RAISE EXCEPTION, must be object reference, got " + type.constructor.name);
29841
- }
29850
+ const c = node.findExpressionAfterToken("EXCEPTION");
29851
+ if (c instanceof nodes_1.ExpressionNode && (c.get() instanceof Expressions.SimpleSource2 || c.get() instanceof Expressions.Source)) {
29852
+ const type = new source_1.Source().runSyntax(c, scope, filename);
29853
+ if (type instanceof basic_1.VoidType) {
29854
+ method = type;
29855
+ }
29856
+ else if (type instanceof basic_1.ObjectReferenceType) {
29857
+ const def = scope.findObjectDefinition(type.getIdentifierName());
29858
+ method = (_c = helper.searchMethodName(def, "CONSTRUCTOR")) === null || _c === void 0 ? void 0 : _c.method;
29859
+ }
29860
+ else if (type !== undefined) {
29861
+ throw new Error("RAISE EXCEPTION, must be object reference, got " + type.constructor.name);
29842
29862
  }
29843
- prev = c.concatTokens().toUpperCase();
29844
29863
  }
29845
- // todo, check parameters vs constructor
29864
+ // check parameters vs constructor
29846
29865
  const param = node.findDirectExpression(Expressions.ParameterListS);
29847
29866
  if (param) {
29848
- for (const s of param.findAllExpressions(Expressions.Source)) {
29849
- new source_1.Source().runSyntax(s, scope, filename);
29850
- }
29867
+ new method_parameters_1.MethodParameters().checkExporting(param, scope, method, filename, true);
29851
29868
  }
29852
29869
  for (const s of node.findDirectExpressions(Expressions.RaiseWith)) {
29853
29870
  new raise_with_1.RaiseWith().runSyntax(s, scope, filename);
@@ -29861,8 +29878,8 @@ class Raise {
29861
29878
  for (const s of node.findDirectExpressions(Expressions.MessageSource)) {
29862
29879
  new message_source_1.MessageSource().runSyntax(s, scope, filename);
29863
29880
  }
29864
- const id = (_b = node.findExpressionAfterToken("ID")) === null || _b === void 0 ? void 0 : _b.concatTokens();
29865
- const number = (_c = node.findDirectExpression(Expressions.MessageNumber)) === null || _c === void 0 ? void 0 : _c.concatTokens();
29881
+ const id = (_d = node.findExpressionAfterToken("ID")) === null || _d === void 0 ? void 0 : _d.concatTokens();
29882
+ const number = (_e = node.findDirectExpression(Expressions.MessageNumber)) === null || _e === void 0 ? void 0 : _e.concatTokens();
29866
29883
  if ((id === null || id === void 0 ? void 0 : id.startsWith("'")) && number) {
29867
29884
  const messageClass = id.substring(1, id.length - 1).toUpperCase();
29868
29885
  scope.getMSAGReferences().addUsing(filename, node.getFirstToken(), messageClass, number);
@@ -48009,7 +48026,7 @@ class Registry {
48009
48026
  }
48010
48027
  static abaplintVersion() {
48011
48028
  // magic, see build script "version.sh"
48012
- return "2.101.3";
48029
+ return "2.101.5";
48013
48030
  }
48014
48031
  getDDICReferences() {
48015
48032
  return this.ddicReferences;
@@ -60442,14 +60459,18 @@ class ModifyOnlyOwnDBTables {
60442
60459
  }
60443
60460
  const concat = databaseTable.concatTokens().toUpperCase();
60444
60461
  if (regExp.test(concat) === false) {
60445
- // must contain a ReferenceType.TableVoidReference
60462
+ // must contain a ReferenceType.TableVoidReference or a ReferenceType.TableReference if its a dependency
60446
60463
  if (spaghetti === undefined) {
60447
60464
  spaghetti = new syntax_1.SyntaxLogic(this.reg, obj).run().spaghetti;
60448
60465
  }
60449
60466
  const start = databaseTable.getFirstToken().getStart();
60450
60467
  const scope = spaghetti.lookupPosition(start, file.getFilename());
60451
- const found = scope === null || scope === void 0 ? void 0 : scope.findTableVoidReference(start);
60452
- if (found) {
60468
+ const found1 = scope === null || scope === void 0 ? void 0 : scope.findTableVoidReference(start);
60469
+ if (found1) {
60470
+ output.push(issue_1.Issue.atStatement(file, s, this.getMetadata().title, this.getMetadata().key, this.getConfig().severity));
60471
+ }
60472
+ const found2 = scope === null || scope === void 0 ? void 0 : scope.findTableReference(start);
60473
+ if (found2) {
60453
60474
  output.push(issue_1.Issue.atStatement(file, s, this.getMetadata().title, this.getMetadata().key, this.getConfig().severity));
60454
60475
  }
60455
60476
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/cli",
3
- "version": "2.101.3",
3
+ "version": "2.101.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.101.3",
41
+ "@abaplint/core": "^2.101.5",
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
  },