@abaplint/transpiler-cli 2.7.9 → 2.7.10

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/bundle.js +58 -31
  2. package/package.json +4 -4
package/build/bundle.js CHANGED
@@ -24977,7 +24977,6 @@ const source_1 = __webpack_require__(/*! ./source */ "./node_modules/@abaplint/c
24977
24977
  const _type_utils_1 = __webpack_require__(/*! ../_type_utils */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_type_utils.js");
24978
24978
  class StringTemplate {
24979
24979
  runSyntax(node, scope, filename) {
24980
- var _a;
24981
24980
  const typeUtils = new _type_utils_1.TypeUtils(scope);
24982
24981
  for (const templateSource of node.findAllExpressions(Expressions.StringTemplateSource)) {
24983
24982
  const s = templateSource.findDirectExpression(Expressions.Source);
@@ -24988,9 +24987,22 @@ class StringTemplate {
24988
24987
  else if (typeUtils.isCharLike(type) === false && typeUtils.isHexLike(type) === false) {
24989
24988
  throw new Error("Not character like, " + type.constructor.name);
24990
24989
  }
24991
- for (const formatSource of ((_a = templateSource.findDirectExpression(Expressions.StringTemplateFormatting)) === null || _a === void 0 ? void 0 : _a.findAllExpressions(Expressions.Source)) || []) {
24990
+ const format = templateSource.findDirectExpression(Expressions.StringTemplateFormatting);
24991
+ const formatConcat = format === null || format === void 0 ? void 0 : format.concatTokens();
24992
+ for (const formatSource of (format === null || format === void 0 ? void 0 : format.findAllExpressions(Expressions.Source)) || []) {
24992
24993
  new source_1.Source().runSyntax(formatSource, scope, filename);
24993
24994
  }
24995
+ if ((formatConcat === null || formatConcat === void 0 ? void 0 : formatConcat.includes("ALPHA = "))
24996
+ && !(type instanceof basic_1.UnknownType)
24997
+ && !(type instanceof basic_1.VoidType)
24998
+ && !(type instanceof basic_1.StringType)
24999
+ && !(type instanceof basic_1.CLikeType)
25000
+ && !(type instanceof basic_1.CharacterType)
25001
+ && !(type instanceof basic_1.NumericGenericType)
25002
+ && !(type instanceof basic_1.NumericType)
25003
+ && !(type instanceof basic_1.AnyType)) {
25004
+ throw new Error("Cannot apply ALPHA to this type");
25005
+ }
24994
25006
  }
24995
25007
  return new basic_1.StringType({ qualifiedName: "STRING" });
24996
25008
  }
@@ -28863,45 +28875,56 @@ const _reference_1 = __webpack_require__(/*! ../_reference */ "./node_modules/@a
28863
28875
  const basic_1 = __webpack_require__(/*! ../../types/basic */ "./node_modules/@abaplint/core/build/src/abap/types/basic/index.js");
28864
28876
  const message_source_1 = __webpack_require__(/*! ../expressions/message_source */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/message_source.js");
28865
28877
  const raise_with_1 = __webpack_require__(/*! ../expressions/raise_with */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/raise_with.js");
28878
+ const _object_oriented_1 = __webpack_require__(/*! ../_object_oriented */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_object_oriented.js");
28879
+ const method_parameters_1 = __webpack_require__(/*! ../expressions/method_parameters */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/method_parameters.js");
28866
28880
  class Raise {
28867
28881
  runSyntax(node, scope, filename) {
28868
28882
  // todo
28869
- var _a, _b, _c;
28883
+ var _a, _b, _c, _d, _e;
28884
+ const helper = new _object_oriented_1.ObjectOriented(scope);
28885
+ let method;
28870
28886
  const classTok = (_a = node.findDirectExpression(Expressions.ClassName)) === null || _a === void 0 ? void 0 : _a.getFirstToken();
28871
- const classNam = classTok === null || classTok === void 0 ? void 0 : classTok.getStr();
28872
- if (classNam) {
28873
- const found = scope.existsObject(classNam);
28887
+ const className = classTok === null || classTok === void 0 ? void 0 : classTok.getStr();
28888
+ if (className) {
28889
+ const found = scope.existsObject(className);
28874
28890
  if (found.found === true && found.id) {
28875
28891
  scope.addReference(classTok, found.id, found.type, filename);
28892
+ const def = scope.findObjectDefinition(className);
28893
+ method = (_b = helper.searchMethodName(def, "CONSTRUCTOR")) === null || _b === void 0 ? void 0 : _b.method;
28876
28894
  }
28877
- else if (scope.getDDIC().inErrorNamespace(classNam) === false) {
28878
- const extra = { ooName: classNam, ooType: "Void" };
28895
+ else if (scope.getDDIC().inErrorNamespace(className) === false) {
28896
+ const extra = { ooName: className, ooType: "Void" };
28879
28897
  scope.addReference(classTok, undefined, _reference_1.ReferenceType.ObjectOrientedVoidReference, filename, extra);
28898
+ method = new basic_1.VoidType(className);
28880
28899
  }
28881
28900
  else {
28882
- throw new Error("RAISE, unknown class " + classNam);
28901
+ throw new Error("RAISE, unknown class " + className);
28902
+ }
28903
+ if (method === undefined) {
28904
+ method = new basic_1.VoidType(className);
28883
28905
  }
28884
28906
  }
28885
- let prev = "";
28886
- for (const c of node.getChildren()) {
28887
- if (c instanceof nodes_1.ExpressionNode
28888
- && (c.get() instanceof Expressions.SimpleSource2 || c.get() instanceof Expressions.Source)) {
28889
- const type = new source_1.Source().runSyntax(c, scope, filename);
28890
- if (prev === "EXCEPTION"
28891
- && type
28892
- && !(type instanceof basic_1.VoidType)
28893
- && !(type instanceof basic_1.ObjectReferenceType)) {
28894
- throw new Error("RAISE EXCEPTION, must be object reference, got " + type.constructor.name);
28895
- }
28907
+ const c = node.findExpressionAfterToken("EXCEPTION");
28908
+ if (c instanceof nodes_1.ExpressionNode && (c.get() instanceof Expressions.SimpleSource2 || c.get() instanceof Expressions.Source)) {
28909
+ const type = new source_1.Source().runSyntax(c, scope, filename);
28910
+ if (type instanceof basic_1.VoidType) {
28911
+ method = type;
28912
+ }
28913
+ else if (type instanceof basic_1.ObjectReferenceType) {
28914
+ const def = scope.findObjectDefinition(type.getIdentifierName());
28915
+ method = (_c = helper.searchMethodName(def, "CONSTRUCTOR")) === null || _c === void 0 ? void 0 : _c.method;
28916
+ }
28917
+ else if (type !== undefined) {
28918
+ throw new Error("RAISE EXCEPTION, must be object reference, got " + type.constructor.name);
28896
28919
  }
28897
- prev = c.concatTokens().toUpperCase();
28898
28920
  }
28899
- // todo, check parameters vs constructor
28921
+ if (method === undefined) {
28922
+ method = new basic_1.VoidType("Exception");
28923
+ }
28924
+ // check parameters vs constructor
28900
28925
  const param = node.findDirectExpression(Expressions.ParameterListS);
28901
28926
  if (param) {
28902
- for (const s of param.findAllExpressions(Expressions.Source)) {
28903
- new source_1.Source().runSyntax(s, scope, filename);
28904
- }
28927
+ new method_parameters_1.MethodParameters().checkExporting(param, scope, method, filename, true);
28905
28928
  }
28906
28929
  for (const s of node.findDirectExpressions(Expressions.RaiseWith)) {
28907
28930
  new raise_with_1.RaiseWith().runSyntax(s, scope, filename);
@@ -28915,8 +28938,8 @@ class Raise {
28915
28938
  for (const s of node.findDirectExpressions(Expressions.MessageSource)) {
28916
28939
  new message_source_1.MessageSource().runSyntax(s, scope, filename);
28917
28940
  }
28918
- const id = (_b = node.findExpressionAfterToken("ID")) === null || _b === void 0 ? void 0 : _b.concatTokens();
28919
- const number = (_c = node.findDirectExpression(Expressions.MessageNumber)) === null || _c === void 0 ? void 0 : _c.concatTokens();
28941
+ const id = (_d = node.findExpressionAfterToken("ID")) === null || _d === void 0 ? void 0 : _d.concatTokens();
28942
+ const number = (_e = node.findDirectExpression(Expressions.MessageNumber)) === null || _e === void 0 ? void 0 : _e.concatTokens();
28920
28943
  if ((id === null || id === void 0 ? void 0 : id.startsWith("'")) && number) {
28921
28944
  const messageClass = id.substring(1, id.length - 1).toUpperCase();
28922
28945
  scope.getMSAGReferences().addUsing(filename, node.getFirstToken(), messageClass, number);
@@ -47063,7 +47086,7 @@ class Registry {
47063
47086
  }
47064
47087
  static abaplintVersion() {
47065
47088
  // magic, see build script "version.sh"
47066
- return "2.101.3";
47089
+ return "2.101.6";
47067
47090
  }
47068
47091
  getDDICReferences() {
47069
47092
  return this.ddicReferences;
@@ -59496,14 +59519,18 @@ class ModifyOnlyOwnDBTables {
59496
59519
  }
59497
59520
  const concat = databaseTable.concatTokens().toUpperCase();
59498
59521
  if (regExp.test(concat) === false) {
59499
- // must contain a ReferenceType.TableVoidReference
59522
+ // must contain a ReferenceType.TableVoidReference or a ReferenceType.TableReference if its a dependency
59500
59523
  if (spaghetti === undefined) {
59501
59524
  spaghetti = new syntax_1.SyntaxLogic(this.reg, obj).run().spaghetti;
59502
59525
  }
59503
59526
  const start = databaseTable.getFirstToken().getStart();
59504
59527
  const scope = spaghetti.lookupPosition(start, file.getFilename());
59505
- const found = scope === null || scope === void 0 ? void 0 : scope.findTableVoidReference(start);
59506
- if (found) {
59528
+ const found1 = scope === null || scope === void 0 ? void 0 : scope.findTableVoidReference(start);
59529
+ if (found1) {
59530
+ output.push(issue_1.Issue.atStatement(file, s, this.getMetadata().title, this.getMetadata().key, this.getConfig().severity));
59531
+ }
59532
+ const found2 = scope === null || scope === void 0 ? void 0 : scope.findTableReference(start);
59533
+ if (found2) {
59507
59534
  output.push(issue_1.Issue.atStatement(file, s, this.getMetadata().title, this.getMetadata().key, this.getConfig().severity));
59508
59535
  }
59509
59536
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/transpiler-cli",
3
- "version": "2.7.9",
3
+ "version": "2.7.10",
4
4
  "description": "Transpiler - Command Line Interface",
5
5
  "funding": "https://github.com/sponsors/larshp",
6
6
  "bin": {
@@ -26,14 +26,14 @@
26
26
  "author": "abaplint",
27
27
  "license": "MIT",
28
28
  "devDependencies": {
29
- "@abaplint/transpiler": "^2.7.9",
29
+ "@abaplint/transpiler": "^2.7.10",
30
30
  "@types/glob": "^7.2.0",
31
31
  "glob": "=7.2.0",
32
32
  "@types/progress": "^2.0.5",
33
33
  "@types/node": "^20.2.3",
34
- "@abaplint/core": "^2.101.3",
34
+ "@abaplint/core": "^2.101.6",
35
35
  "progress": "^2.0.3",
36
- "webpack": "^5.83.1",
36
+ "webpack": "^5.84.0",
37
37
  "webpack-cli": "^5.1.1",
38
38
  "typescript": "^5.0.4"
39
39
  }