@abaplint/transpiler-cli 2.7.8 → 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 +80 -36
  2. package/package.json +4 -4
package/build/bundle.js CHANGED
@@ -17971,7 +17971,7 @@ class ABAPFileInformation {
17971
17971
  }
17972
17972
  }
17973
17973
  parseClasses(structure) {
17974
- var _a, _b, _c;
17974
+ var _a;
17975
17975
  for (const found of structure.findAllStructures(Structures.ClassDefinition)) {
17976
17976
  const className = found.findFirstStatement(Statements.ClassDefinition).findFirstExpression(Expressions.ClassName).getFirstToken();
17977
17977
  const methods = this.parseMethodDefinition(found.findFirstStructure(Structures.PublicSection), visibility_1.Visibility.Public);
@@ -17990,8 +17990,26 @@ class ABAPFileInformation {
17990
17990
  const containsGlobal = found.findFirstExpression(Expressions.ClassGlobal);
17991
17991
  const cdef = found.findFirstStatement(Statements.ClassDefinition);
17992
17992
  const concat = (cdef === null || cdef === void 0 ? void 0 : cdef.concatTokens().toUpperCase()) || "";
17993
- const duration = (_b = cdef === null || cdef === void 0 ? void 0 : cdef.findExpressionAfterToken("DURATION")) === null || _b === void 0 ? void 0 : _b.concatTokens().toUpperCase();
17994
- const riskLevel = (_c = cdef === null || cdef === void 0 ? void 0 : cdef.findExpressionAfterToken("LEVEL")) === null || _c === void 0 ? void 0 : _c.concatTokens().toUpperCase();
17993
+ let riskLevel;
17994
+ if (concat.includes("RISK LEVEL CRITICAL")) {
17995
+ riskLevel = _abap_file_information_1.RiskLevel.critical;
17996
+ }
17997
+ else if (concat.includes("RISK LEVEL DANGEROUS")) {
17998
+ riskLevel = _abap_file_information_1.RiskLevel.dangerous;
17999
+ }
18000
+ else if (concat.includes("RISK LEVEL HARMLESS")) {
18001
+ riskLevel = _abap_file_information_1.RiskLevel.harmless;
18002
+ }
18003
+ let duration;
18004
+ if (concat.includes("DURATION SHORT")) {
18005
+ duration = _abap_file_information_1.Duration.short;
18006
+ }
18007
+ else if (concat.includes("DURATION LONG")) {
18008
+ duration = _abap_file_information_1.Duration.long;
18009
+ }
18010
+ else if (concat.includes("DURATION MEDIUM")) {
18011
+ duration = _abap_file_information_1.Duration.medium;
18012
+ }
17995
18013
  this.classes.push({
17996
18014
  name: className.getStr(),
17997
18015
  identifier: new _identifier_1.Identifier(className, this.filename),
@@ -24959,7 +24977,6 @@ const source_1 = __webpack_require__(/*! ./source */ "./node_modules/@abaplint/c
24959
24977
  const _type_utils_1 = __webpack_require__(/*! ../_type_utils */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_type_utils.js");
24960
24978
  class StringTemplate {
24961
24979
  runSyntax(node, scope, filename) {
24962
- var _a;
24963
24980
  const typeUtils = new _type_utils_1.TypeUtils(scope);
24964
24981
  for (const templateSource of node.findAllExpressions(Expressions.StringTemplateSource)) {
24965
24982
  const s = templateSource.findDirectExpression(Expressions.Source);
@@ -24970,9 +24987,22 @@ class StringTemplate {
24970
24987
  else if (typeUtils.isCharLike(type) === false && typeUtils.isHexLike(type) === false) {
24971
24988
  throw new Error("Not character like, " + type.constructor.name);
24972
24989
  }
24973
- 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)) || []) {
24974
24993
  new source_1.Source().runSyntax(formatSource, scope, filename);
24975
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
+ }
24976
25006
  }
24977
25007
  return new basic_1.StringType({ qualifiedName: "STRING" });
24978
25008
  }
@@ -28845,45 +28875,56 @@ const _reference_1 = __webpack_require__(/*! ../_reference */ "./node_modules/@a
28845
28875
  const basic_1 = __webpack_require__(/*! ../../types/basic */ "./node_modules/@abaplint/core/build/src/abap/types/basic/index.js");
28846
28876
  const message_source_1 = __webpack_require__(/*! ../expressions/message_source */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/message_source.js");
28847
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");
28848
28880
  class Raise {
28849
28881
  runSyntax(node, scope, filename) {
28850
28882
  // todo
28851
- var _a, _b, _c;
28883
+ var _a, _b, _c, _d, _e;
28884
+ const helper = new _object_oriented_1.ObjectOriented(scope);
28885
+ let method;
28852
28886
  const classTok = (_a = node.findDirectExpression(Expressions.ClassName)) === null || _a === void 0 ? void 0 : _a.getFirstToken();
28853
- const classNam = classTok === null || classTok === void 0 ? void 0 : classTok.getStr();
28854
- if (classNam) {
28855
- 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);
28856
28890
  if (found.found === true && found.id) {
28857
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;
28858
28894
  }
28859
- else if (scope.getDDIC().inErrorNamespace(classNam) === false) {
28860
- const extra = { ooName: classNam, ooType: "Void" };
28895
+ else if (scope.getDDIC().inErrorNamespace(className) === false) {
28896
+ const extra = { ooName: className, ooType: "Void" };
28861
28897
  scope.addReference(classTok, undefined, _reference_1.ReferenceType.ObjectOrientedVoidReference, filename, extra);
28898
+ method = new basic_1.VoidType(className);
28862
28899
  }
28863
28900
  else {
28864
- 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);
28865
28905
  }
28866
28906
  }
28867
- let prev = "";
28868
- for (const c of node.getChildren()) {
28869
- if (c instanceof nodes_1.ExpressionNode
28870
- && (c.get() instanceof Expressions.SimpleSource2 || c.get() instanceof Expressions.Source)) {
28871
- const type = new source_1.Source().runSyntax(c, scope, filename);
28872
- if (prev === "EXCEPTION"
28873
- && type
28874
- && !(type instanceof basic_1.VoidType)
28875
- && !(type instanceof basic_1.ObjectReferenceType)) {
28876
- throw new Error("RAISE EXCEPTION, must be object reference, got " + type.constructor.name);
28877
- }
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;
28878
28912
  }
28879
- prev = c.concatTokens().toUpperCase();
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);
28919
+ }
28920
+ }
28921
+ if (method === undefined) {
28922
+ method = new basic_1.VoidType("Exception");
28880
28923
  }
28881
- // todo, check parameters vs constructor
28924
+ // check parameters vs constructor
28882
28925
  const param = node.findDirectExpression(Expressions.ParameterListS);
28883
28926
  if (param) {
28884
- for (const s of param.findAllExpressions(Expressions.Source)) {
28885
- new source_1.Source().runSyntax(s, scope, filename);
28886
- }
28927
+ new method_parameters_1.MethodParameters().checkExporting(param, scope, method, filename, true);
28887
28928
  }
28888
28929
  for (const s of node.findDirectExpressions(Expressions.RaiseWith)) {
28889
28930
  new raise_with_1.RaiseWith().runSyntax(s, scope, filename);
@@ -28897,8 +28938,8 @@ class Raise {
28897
28938
  for (const s of node.findDirectExpressions(Expressions.MessageSource)) {
28898
28939
  new message_source_1.MessageSource().runSyntax(s, scope, filename);
28899
28940
  }
28900
- const id = (_b = node.findExpressionAfterToken("ID")) === null || _b === void 0 ? void 0 : _b.concatTokens();
28901
- 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();
28902
28943
  if ((id === null || id === void 0 ? void 0 : id.startsWith("'")) && number) {
28903
28944
  const messageClass = id.substring(1, id.length - 1).toUpperCase();
28904
28945
  scope.getMSAGReferences().addUsing(filename, node.getFirstToken(), messageClass, number);
@@ -47045,7 +47086,7 @@ class Registry {
47045
47086
  }
47046
47087
  static abaplintVersion() {
47047
47088
  // magic, see build script "version.sh"
47048
- return "2.101.2";
47089
+ return "2.101.6";
47049
47090
  }
47050
47091
  getDDICReferences() {
47051
47092
  return this.ddicReferences;
@@ -59478,14 +59519,18 @@ class ModifyOnlyOwnDBTables {
59478
59519
  }
59479
59520
  const concat = databaseTable.concatTokens().toUpperCase();
59480
59521
  if (regExp.test(concat) === false) {
59481
- // must contain a ReferenceType.TableVoidReference
59522
+ // must contain a ReferenceType.TableVoidReference or a ReferenceType.TableReference if its a dependency
59482
59523
  if (spaghetti === undefined) {
59483
59524
  spaghetti = new syntax_1.SyntaxLogic(this.reg, obj).run().spaghetti;
59484
59525
  }
59485
59526
  const start = databaseTable.getFirstToken().getStart();
59486
59527
  const scope = spaghetti.lookupPosition(start, file.getFilename());
59487
- const found = scope === null || scope === void 0 ? void 0 : scope.findTableVoidReference(start);
59488
- 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) {
59489
59534
  output.push(issue_1.Issue.atStatement(file, s, this.getMetadata().title, this.getMetadata().key, this.getConfig().severity));
59490
59535
  }
59491
59536
  }
@@ -79751,10 +79796,9 @@ run().then(() => {
79751
79796
  if (a.obj.getName() < b.obj.getName()) {
79752
79797
  ret = -1;
79753
79798
  }
79754
- if (a.obj.getName() > b.obj.getName()) {
79799
+ else if (a.obj.getName() > b.obj.getName()) {
79755
79800
  ret = 1;
79756
79801
  }
79757
- ret = 0;
79758
79802
  }
79759
79803
  return ret;
79760
79804
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/transpiler-cli",
3
- "version": "2.7.8",
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.8",
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.2",
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
  }