@abaplint/transpiler-cli 2.10.56 → 2.10.58

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 +57 -31
  2. package/package.json +4 -4
package/build/bundle.js CHANGED
@@ -3291,6 +3291,8 @@ class Compare extends combi_1.Expression {
3291
3291
  const inn = (0, combi_1.seq)((0, combi_1.optPrio)("NOT"), "IN", (0, combi_1.altPrio)(_1.Source, list));
3292
3292
  const sopt = (0, combi_1.seq)("IS", (0, combi_1.optPrio)("NOT"), (0, combi_1.altPrio)("SUPPLIED", "BOUND", (0, combi_1.ver)(version_1.Version.v750, (0, combi_1.seq)("INSTANCE OF", _1.ClassName), version_1.Version.OpenABAP), "REQUESTED", "INITIAL"));
3293
3293
  const between = (0, combi_1.seq)((0, combi_1.optPrio)("NOT"), "BETWEEN", _1.Source, "AND", _1.Source);
3294
+ // https://help.sap.com/doc/abapdocu_752_index_htm/7.52/en-us/abennews-740_sp08-expressions.htm
3295
+ // but also seems to work in v740sp05, blah
3294
3296
  const predicate = (0, combi_1.ver)(version_1.Version.v740sp08, _1.MethodCallChain);
3295
3297
  const rett = (0, combi_1.seq)(_1.Source, (0, combi_1.altPrio)((0, combi_1.seq)(_1.CompareOperator, _1.Source), inn, between, sopt));
3296
3298
  const fsassign = (0, combi_1.seq)(_1.SourceFieldSymbolChain, "IS", (0, combi_1.optPrio)("NOT"), "ASSIGNED");
@@ -6842,10 +6844,11 @@ exports.SQLAggregation = SQLAggregation;
6842
6844
 
6843
6845
  Object.defineProperty(exports, "__esModule", ({ value: true }));
6844
6846
  exports.SQLAliasField = void 0;
6847
+ const tokens_1 = __webpack_require__(/*! ../../1_lexer/tokens */ "./node_modules/@abaplint/core/build/src/abap/1_lexer/tokens/index.js");
6845
6848
  const combi_1 = __webpack_require__(/*! ../combi */ "./node_modules/@abaplint/core/build/src/abap/2_statements/combi.js");
6846
6849
  class SQLAliasField extends combi_1.Expression {
6847
6850
  getRunnable() {
6848
- return (0, combi_1.regex)(/^(\/\w+\/)?\w+~(\/\w+\/)?\w+$/);
6851
+ return (0, combi_1.seq)((0, combi_1.regex)(/^(\/\w+\/)?\w+~(\/\w+\/)?\w+$/), (0, combi_1.starPrio)((0, combi_1.seq)((0, combi_1.tok)(tokens_1.Dash), (0, combi_1.regex)(/^\w+$/))));
6849
6852
  }
6850
6853
  }
6851
6854
  exports.SQLAliasField = SQLAliasField;
@@ -7703,7 +7706,7 @@ class SQLSource extends combi_1.Expression {
7703
7706
  getRunnable() {
7704
7707
  const paren = (0, combi_1.seq)((0, combi_1.tok)(tokens_1.ParenLeftW), _1.Source, (0, combi_1.tok)(tokens_1.WParenRightW));
7705
7708
  const at = (0, combi_1.ver)(version_1.Version.v740sp05, (0, combi_1.seq)((0, combi_1.tok)(tokens_1.WAt), (0, combi_1.altPrio)(_1.SimpleSource3, paren)));
7706
- return (0, combi_1.alt)(_1.SQLAliasField, _1.SimpleSource3, at);
7709
+ return (0, combi_1.altPrio)(_1.SQLAliasField, _1.SimpleSource3, at);
7707
7710
  }
7708
7711
  }
7709
7712
  exports.SQLSource = SQLSource;
@@ -18245,9 +18248,10 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
18245
18248
  exports.DynproLoop = void 0;
18246
18249
  const Statements = __webpack_require__(/*! ../../2_statements/statements */ "./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js");
18247
18250
  const _combi_1 = __webpack_require__(/*! ./_combi */ "./node_modules/@abaplint/core/build/src/abap/3_structures/structures/_combi.js");
18251
+ const chain_1 = __webpack_require__(/*! ./chain */ "./node_modules/@abaplint/core/build/src/abap/3_structures/structures/chain.js");
18248
18252
  class DynproLoop {
18249
18253
  getMatcher() {
18250
- return (0, _combi_1.beginEnd)((0, _combi_1.sta)(Statements.DynproLoop), (0, _combi_1.star)((0, _combi_1.sta)(Statements.Module)), (0, _combi_1.sta)(Statements.EndLoop));
18254
+ return (0, _combi_1.beginEnd)((0, _combi_1.sta)(Statements.DynproLoop), (0, _combi_1.star)((0, _combi_1.alt)((0, _combi_1.sta)(Statements.Module), (0, _combi_1.sub)(chain_1.Chain))), (0, _combi_1.sta)(Statements.EndLoop));
18251
18255
  }
18252
18256
  }
18253
18257
  exports.DynproLoop = DynproLoop;
@@ -18760,9 +18764,10 @@ const Statements = __webpack_require__(/*! ../../2_statements/statements */ "./n
18760
18764
  const _combi_1 = __webpack_require__(/*! ./_combi */ "./node_modules/@abaplint/core/build/src/abap/3_structures/structures/_combi.js");
18761
18765
  const chain_1 = __webpack_require__(/*! ./chain */ "./node_modules/@abaplint/core/build/src/abap/3_structures/structures/chain.js");
18762
18766
  const loop_1 = __webpack_require__(/*! ./loop */ "./node_modules/@abaplint/core/build/src/abap/3_structures/structures/loop.js");
18767
+ const dynpro_loop_1 = __webpack_require__(/*! ./dynpro_loop */ "./node_modules/@abaplint/core/build/src/abap/3_structures/structures/dynpro_loop.js");
18763
18768
  class ProcessAfterInput {
18764
18769
  getMatcher() {
18765
- const pai = (0, _combi_1.star)((0, _combi_1.alt)((0, _combi_1.sta)(Statements.Module), (0, _combi_1.sta)(Statements.Field), (0, _combi_1.sta)(Statements.CallSubscreen), (0, _combi_1.sub)(chain_1.Chain), (0, _combi_1.sub)(loop_1.Loop)));
18770
+ const pai = (0, _combi_1.star)((0, _combi_1.alt)((0, _combi_1.sta)(Statements.Module), (0, _combi_1.sta)(Statements.Field), (0, _combi_1.sta)(Statements.CallSubscreen), (0, _combi_1.sub)(chain_1.Chain), (0, _combi_1.sub)(dynpro_loop_1.DynproLoop), (0, _combi_1.sub)(loop_1.Loop)));
18766
18771
  return (0, _combi_1.seq)((0, _combi_1.sta)(Statements.ProcessAfterInput), pai);
18767
18772
  }
18768
18773
  }
@@ -22069,6 +22074,7 @@ exports.TypeUtils = void 0;
22069
22074
  const types_1 = __webpack_require__(/*! ../types */ "./node_modules/@abaplint/core/build/src/abap/types/index.js");
22070
22075
  const basic_1 = __webpack_require__(/*! ../types/basic */ "./node_modules/@abaplint/core/build/src/abap/types/basic/index.js");
22071
22076
  const cgeneric_type_1 = __webpack_require__(/*! ../types/basic/cgeneric_type */ "./node_modules/@abaplint/core/build/src/abap/types/basic/cgeneric_type.js");
22077
+ const Expressions = __webpack_require__(/*! ../2_statements/expressions */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js");
22072
22078
  // todo: refactor to static? for performance
22073
22079
  class TypeUtils {
22074
22080
  constructor(scope) {
@@ -22287,8 +22293,22 @@ class TypeUtils {
22287
22293
  }
22288
22294
  return false;
22289
22295
  }
22290
- isAssignableStrict(source, target, calculated = false) {
22296
+ isCalculated(node) {
22297
+ /*
22298
+ if (node.getChildren().length === 1
22299
+ && node.get() instanceof Expressions.Source
22300
+ && node.getFirstChild()?.get() instanceof Expressions.MethodCallChain) {
22301
+ return false;
22302
+ }
22303
+ */
22304
+ const calculated = node.findFirstExpression(Expressions.MethodCallChain) !== undefined
22305
+ || node.findFirstExpression(Expressions.StringTemplate) !== undefined
22306
+ || node.findFirstExpression(Expressions.ArithOperator) !== undefined;
22307
+ return calculated;
22308
+ }
22309
+ isAssignableStrict(source, target, node) {
22291
22310
  var _a, _b, _c, _d, _e, _f, _g, _h;
22311
+ const calculated = node ? this.isCalculated(node) : false;
22292
22312
  /*
22293
22313
  console.dir(source);
22294
22314
  console.dir(target);
@@ -22340,6 +22360,13 @@ class TypeUtils {
22340
22360
  else if (source instanceof basic_1.StringType) {
22341
22361
  if (target instanceof basic_1.StructureType && this.structureContainsString(target)) {
22342
22362
  return false;
22363
+ /*
22364
+ } else if (target instanceof CharacterType) {
22365
+ if (source.getAbstractTypeData()?.derivedFromConstant === true) {
22366
+ return true;
22367
+ }
22368
+ return false;
22369
+ */
22343
22370
  }
22344
22371
  else if (target instanceof basic_1.IntegerType) {
22345
22372
  if (((_f = source.getAbstractTypeData()) === null || _f === void 0 ? void 0 : _f.derivedFromConstant) === true) {
@@ -25568,15 +25595,12 @@ class MethodCallParam {
25568
25595
  if (child.get() instanceof Expressions.Source) {
25569
25596
  sourceType = new source_1.Source().runSyntax(child, input, targetType);
25570
25597
  }
25571
- const calculated = child.findFirstExpression(Expressions.MethodCallChain) !== undefined
25572
- || child.findFirstExpression(Expressions.StringTemplate) !== undefined
25573
- || child.findFirstExpression(Expressions.ArithOperator) !== undefined;
25574
25598
  if (sourceType === undefined) {
25575
25599
  const message = "No source type determined, method source";
25576
25600
  input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
25577
25601
  return;
25578
25602
  }
25579
- else if (new _type_utils_1.TypeUtils(input.scope).isAssignableStrict(sourceType, targetType, calculated) === false) {
25603
+ else if (new _type_utils_1.TypeUtils(input.scope).isAssignableStrict(sourceType, targetType, child) === false) {
25580
25604
  const message = "Method parameter type not compatible";
25581
25605
  input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
25582
25606
  return;
@@ -25867,15 +25891,12 @@ class MethodParameters {
25867
25891
  }
25868
25892
  for (const item of items) {
25869
25893
  const parameter = allImporting.find(p => p.getName().toUpperCase() === item.name);
25870
- const calculated = item.source.findFirstExpression(Expressions.MethodCallChain) !== undefined
25871
- || item.source.findFirstExpression(Expressions.StringTemplate) !== undefined
25872
- || item.source.findFirstExpression(Expressions.ArithOperator) !== undefined;
25873
25894
  if (parameter === undefined) {
25874
25895
  const message = "Method importing parameter \"" + item.name + "\" does not exist";
25875
25896
  input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
25876
25897
  continue;
25877
25898
  }
25878
- else if (new _type_utils_1.TypeUtils(input.scope).isAssignableStrict(item.sourceType, parameter.getType(), calculated) === false) {
25899
+ else if (new _type_utils_1.TypeUtils(input.scope).isAssignableStrict(item.sourceType, parameter.getType(), item.source) === false) {
25879
25900
  const message = "Method parameter type not compatible, " + item.name;
25880
25901
  input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
25881
25902
  return;
@@ -29787,16 +29808,13 @@ class CreateObject {
29787
29808
  }
29788
29809
  const source = p.findDirectExpression(Expressions.Source);
29789
29810
  const sourceType = new source_1.Source().runSyntax(source, input);
29790
- const calculated = (source === null || source === void 0 ? void 0 : source.findFirstExpression(Expressions.MethodCallChain)) !== undefined
29791
- || (source === null || source === void 0 ? void 0 : source.findFirstExpression(Expressions.StringTemplate)) !== undefined
29792
- || (source === null || source === void 0 ? void 0 : source.findFirstExpression(Expressions.ArithOperator)) !== undefined;
29793
29811
  const found = allImporting === null || allImporting === void 0 ? void 0 : allImporting.find(p => p.getName().toUpperCase() === name);
29794
29812
  if (found === undefined) {
29795
29813
  const message = `constructor parameter "${name}" does not exist`;
29796
29814
  input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
29797
29815
  return;
29798
29816
  }
29799
- else if (new _type_utils_1.TypeUtils(input.scope).isAssignableStrict(sourceType, found.getType(), calculated) === false) {
29817
+ else if (new _type_utils_1.TypeUtils(input.scope).isAssignableStrict(sourceType, found.getType(), source) === false) {
29800
29818
  const message = `constructor parameter "${name}" type not compatible`;
29801
29819
  input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
29802
29820
  return;
@@ -53098,7 +53116,7 @@ class Registry {
53098
53116
  }
53099
53117
  static abaplintVersion() {
53100
53118
  // magic, see build script "version.sh"
53101
- return "2.113.121";
53119
+ return "2.113.125";
53102
53120
  }
53103
53121
  getDDICReferences() {
53104
53122
  return this.ddicReferences;
@@ -61840,6 +61858,7 @@ https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#check-vs-re
61840
61858
  else if (this.conf.allowCheck === false && get instanceof Statements.Check && stack.length === 0) {
61841
61859
  const message = "CHECK is not allowed outside of loops";
61842
61860
  let tokensString = statement.concatTokens();
61861
+ tokensString = tokensString.replace(/^check /i, "CHECK ");
61843
61862
  tokensString = tokensString.split("CHECK")[1].trim();
61844
61863
  const replacement = "IF NOT " + tokensString + "\n RETURN.\nENDIF.";
61845
61864
  const fix = edit_helper_1.EditHelper.replaceRange(file, statement.getFirstToken().getStart(), statement.getLastToken().getEnd(), replacement);
@@ -75368,8 +75387,9 @@ ENDINTERFACE.`,
75368
75387
  var _a;
75369
75388
  const issues = [];
75370
75389
  for (const s of ((_a = file.getStructure()) === null || _a === void 0 ? void 0 : _a.findAllStatements(Statements.MethodDef)) || []) {
75371
- if (s.findDirectExpression(Expressions.MethodDefExceptions)) {
75372
- issues.push(issue_1.Issue.atStatement(file, s, this.getMessage(), this.getMetadata().key));
75390
+ const expr = s.findDirectExpression(Expressions.MethodDefExceptions);
75391
+ if (expr) {
75392
+ issues.push(issue_1.Issue.atToken(file, expr.getFirstToken(), this.getMessage(), this.getMetadata().key));
75373
75393
  }
75374
75394
  }
75375
75395
  return issues;
@@ -76769,14 +76789,6 @@ class Chunk {
76769
76789
  this.appendString(str);
76770
76790
  }
76771
76791
  }
76772
- /*
76773
- public copy(): Chunk {
76774
- const ret = new Chunk();
76775
- ret.raw = this.raw;
76776
- ret.mappings = [...this.mappings];
76777
- return ret;
76778
- }
76779
- */
76780
76792
  join(chunks, str = ", ") {
76781
76793
  for (let i = 0; i < chunks.length; i++) {
76782
76794
  this.appendChunk(chunks[i]);
@@ -82398,8 +82410,16 @@ class ClearTranspiler {
82398
82410
  transpile(node, traversal) {
82399
82411
  const target = traversal.traverse(node.findDirectExpression(abaplint.Expressions.Target));
82400
82412
  const ret = new chunk_1.Chunk();
82413
+ /*
82401
82414
  ret.appendChunk(target);
82402
- ret.append(".clear();", node.getLastToken(), traversal);
82415
+ ret.append(".clear();", node.getLastToken().getEnd(), traversal);
82416
+ */
82417
+ ret.append(target.getCode() + ".clear();", node.getLastToken().getEnd(), traversal);
82418
+ // ret.append(target.getCode() + ".clear();", node, traversal);
82419
+ /*
82420
+ ret.append(target.getCode(), node.getFirstToken().getStart(), traversal);
82421
+ ret.append(".clear();", node.getLastToken().getEnd(), traversal);
82422
+ */
82403
82423
  return ret;
82404
82424
  }
82405
82425
  }
@@ -84877,9 +84897,15 @@ class MessageTranspiler {
84877
84897
  }
84878
84898
  }
84879
84899
  else {
84880
- // exception based
84900
+ // exception or constant based
84881
84901
  const exception = node.findDirectExpression(abaplint.Expressions.SimpleSource3);
84882
- options.push("exception: " + traversal.traverse(exception).getCode());
84902
+ const str = exception?.findFirstExpression(abaplint.Expressions.Constant);
84903
+ if (str) {
84904
+ options.push("text: " + traversal.traverse(str).getCode());
84905
+ }
84906
+ else {
84907
+ options.push("exception: " + traversal.traverse(exception).getCode());
84908
+ }
84883
84909
  const type = node.findExpressionAfterToken("TYPE");
84884
84910
  if (type) {
84885
84911
  options.push("type: " + traversal.traverse(type).getCode());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/transpiler-cli",
3
- "version": "2.10.56",
3
+ "version": "2.10.58",
4
4
  "description": "Transpiler - Command Line Interface",
5
5
  "funding": "https://github.com/sponsors/larshp",
6
6
  "bin": {
@@ -27,10 +27,10 @@
27
27
  "author": "abaplint",
28
28
  "license": "MIT",
29
29
  "devDependencies": {
30
- "@abaplint/core": "^2.113.121",
31
- "@abaplint/transpiler": "^2.10.56",
30
+ "@abaplint/core": "^2.113.125",
31
+ "@abaplint/transpiler": "^2.10.58",
32
32
  "@types/glob": "^8.1.0",
33
- "@types/node": "^22.15.21",
33
+ "@types/node": "^22.15.29",
34
34
  "@types/progress": "^2.0.7",
35
35
  "glob": "=7.2.0",
36
36
  "progress": "^2.0.3",