@abaplint/transpiler-cli 2.12.23 → 2.12.24

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.
package/abap_transpile CHANGED
@@ -1,2 +1,2 @@
1
- #!/usr/bin/env node
1
+ #!/usr/bin/env node
2
2
  require("./build/bundle");
package/build/bundle.js CHANGED
@@ -7157,7 +7157,7 @@ class SQLCompare extends combi_1.Expression {
7157
7157
  const nul = (0, combi_1.seq)("IS", (0, combi_1.optPrio)("NOT"), (0, combi_1.altPrio)("NULL", (0, combi_1.ver)(version_1.Version.v753, "INITIAL")));
7158
7158
  const source = new _1.SQLSource();
7159
7159
  const sub = (0, combi_1.seq)((0, combi_1.optPrio)((0, combi_1.altPrio)("ALL", "ANY", "SOME")), (0, combi_1.altPrio)(subSelect, subSelectDouble));
7160
- const arith = (0, combi_1.ver)(version_1.Version.v750, (0, combi_1.plusPrio)((0, combi_1.seq)((0, combi_1.altPrio)("+", "-", "*", "/"), _1.SQLFieldName)));
7160
+ const arith = (0, combi_1.ver)(version_1.Version.v750, (0, combi_1.plusPrio)((0, combi_1.seq)((0, combi_1.altPrio)("+", "-", "*", "/"), _1.SQLFieldName)), version_1.Version.OpenABAP);
7161
7161
  const paren = (0, combi_1.seq)((0, combi_1.tok)(tokens_1.ParenLeftW), _1.Source, (0, combi_1.tok)(tokens_1.WParenRightW));
7162
7162
  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)), version_1.Version.OpenABAP);
7163
7163
  const rett = (0, combi_1.seq)((0, combi_1.altPrio)(_1.SQLFunction, _1.ConstantString, (0, combi_1.seq)((0, combi_1.altPrio)(_1.SQLPath, _1.SQLFieldName), (0, combi_1.optPrio)(arith)), at), (0, combi_1.altPrio)((0, combi_1.seq)(_1.SQLCompareOperator, (0, combi_1.altPrio)(sub, source)), (0, combi_1.seq)((0, combi_1.optPrio)("NOT"), (0, combi_1.altPrio)(_1.SQLIn, like, between)), nul));
@@ -8913,13 +8913,14 @@ class StatementParser {
8913
8913
  lazyUnknown(wa) {
8914
8914
  const result = [];
8915
8915
  for (let statement of wa.statements) {
8916
- // dont use CALL METHOD, when executing lazy, it easily gives a Move for the last statment if lazy logic is evaluated
8916
+ // dont use CALL METHOD, when executing lazy, it easily gives a Move for the last statement if lazy logic is evaluated
8917
8917
  if (statement.get() instanceof _statement_1.Unknown) {
8918
8918
  const concat = statement.concatTokens().toUpperCase();
8919
8919
  if (concat.startsWith("CALL METHOD ") === false
8920
8920
  && concat.startsWith("RAISE EXCEPTION TYPE ") === false
8921
8921
  && concat.startsWith("READ TABLE ") === false
8922
8922
  && concat.startsWith("LOOP AT ") === false
8923
+ && concat.startsWith("SELECT SINGLE ") === false
8923
8924
  && concat.startsWith("CALL FUNCTION ") === false) {
8924
8925
  for (const { first, second } of this.buildSplits(statement.getTokens())) {
8925
8926
  if (second.length === 1) {
@@ -27626,6 +27627,9 @@ class Source {
27626
27627
  if (context instanceof basic_1.FloatType && found instanceof basic_1.IntegerType) {
27627
27628
  return context;
27628
27629
  }
27630
+ else if (context instanceof basic_1.IntegerType && (found === null || found === void 0 ? void 0 : found.isGeneric())) {
27631
+ return context;
27632
+ }
27629
27633
  else {
27630
27634
  return found;
27631
27635
  }
@@ -30404,8 +30408,9 @@ class CreateObject {
30404
30408
  target_1.Target.runSyntax(t, input);
30405
30409
  }
30406
30410
  const t = node.findDirectExpression(Expressions.Target);
30411
+ let found = undefined;
30407
30412
  if (t) {
30408
- const found = target_1.Target.runSyntax(t, input);
30413
+ found = target_1.Target.runSyntax(t, input);
30409
30414
  if (found instanceof basic_1.VoidType) {
30410
30415
  // do nothing
30411
30416
  }
@@ -30457,7 +30462,11 @@ class CreateObject {
30457
30462
  for (const t of node.findDirectExpressions(Expressions.Dynamic)) {
30458
30463
  dynamic_1.Dynamic.runSyntax(t, input);
30459
30464
  }
30460
- input.scope.addReference(t === null || t === void 0 ? void 0 : t.getFirstToken(), cdef, _reference_1.ReferenceType.ConstructorReference, input.filename, { ooName: cdef === null || cdef === void 0 ? void 0 : cdef.getName() });
30465
+ let ooName = cdef === null || cdef === void 0 ? void 0 : cdef.getName();
30466
+ if (ooName === undefined && found instanceof basic_1.VoidType) {
30467
+ ooName = found.getVoided();
30468
+ }
30469
+ input.scope.addReference(t === null || t === void 0 ? void 0 : t.getFirstToken(), cdef, _reference_1.ReferenceType.ConstructorReference, input.filename, { ooName: ooName });
30461
30470
  this.validateParameters(cdef, node, input);
30462
30471
  }
30463
30472
  validateParameters(cdef, node, input) {
@@ -39091,7 +39100,7 @@ exports.FormDefinition = FormDefinition;
39091
39100
  "use strict";
39092
39101
 
39093
39102
  Object.defineProperty(exports, "__esModule", ({ value: true }));
39094
- exports.FunctionModuleDefinition = exports.FunctionModuleParameterDirection = void 0;
39103
+ exports.FunctionModuleDefinition = exports.FunctionModuleType = exports.FunctionModuleParameterDirection = void 0;
39095
39104
  const xml_utils_1 = __webpack_require__(/*! ../../xml_utils */ "./node_modules/@abaplint/core/build/src/xml_utils.js");
39096
39105
  var FunctionModuleParameterDirection;
39097
39106
  (function (FunctionModuleParameterDirection) {
@@ -39100,6 +39109,12 @@ var FunctionModuleParameterDirection;
39100
39109
  FunctionModuleParameterDirection["changing"] = "changing";
39101
39110
  FunctionModuleParameterDirection["tables"] = "tables";
39102
39111
  })(FunctionModuleParameterDirection || (exports.FunctionModuleParameterDirection = FunctionModuleParameterDirection = {}));
39112
+ var FunctionModuleType;
39113
+ (function (FunctionModuleType) {
39114
+ FunctionModuleType["regular"] = "regular";
39115
+ FunctionModuleType["remote"] = "remoteEnabled";
39116
+ FunctionModuleType["update"] = "update";
39117
+ })(FunctionModuleType || (exports.FunctionModuleType = FunctionModuleType = {}));
39103
39118
  class FunctionModuleDefinition {
39104
39119
  constructor(data) {
39105
39120
  this.parse(data);
@@ -39107,6 +39122,9 @@ class FunctionModuleDefinition {
39107
39122
  getParameters() {
39108
39123
  return this.parameters;
39109
39124
  }
39125
+ getModuleType() {
39126
+ return this.moduleType;
39127
+ }
39110
39128
  getDescription() {
39111
39129
  return this.description;
39112
39130
  }
@@ -39121,6 +39139,13 @@ class FunctionModuleDefinition {
39121
39139
  this.name = data.FUNCNAME;
39122
39140
  this.description = data.SHORT_TEXT;
39123
39141
  this.parameters = [];
39142
+ this.moduleType = FunctionModuleType.regular;
39143
+ if (data.REMOTE_CALL === "R") {
39144
+ this.moduleType = FunctionModuleType.remote;
39145
+ }
39146
+ else if (data.UPDATE_TASK !== undefined) {
39147
+ this.moduleType = FunctionModuleType.update;
39148
+ }
39124
39149
  if (data.IMPORT) {
39125
39150
  for (const param of (0, xml_utils_1.xmlToArray)(data.IMPORT.RSIMP)) {
39126
39151
  if (param.PARAMETER === undefined) {
@@ -54211,7 +54236,7 @@ class Registry {
54211
54236
  }
54212
54237
  static abaplintVersion() {
54213
54238
  // magic, see build script "version.sh"
54214
- return "2.115.10";
54239
+ return "2.115.14";
54215
54240
  }
54216
54241
  getDDICReferences() {
54217
54242
  return this.ddicReferences;
@@ -81316,6 +81341,7 @@ const abaplint = __webpack_require__(/*! @abaplint/core */ "./node_modules/@abap
81316
81341
  const chunk_1 = __webpack_require__(/*! ../chunk */ "./node_modules/@abaplint/transpiler/build/src/chunk.js");
81317
81342
  const type_name_or_infer_1 = __webpack_require__(/*! ./type_name_or_infer */ "./node_modules/@abaplint/transpiler/build/src/expressions/type_name_or_infer.js");
81318
81343
  const transpile_types_1 = __webpack_require__(/*! ../transpile_types */ "./node_modules/@abaplint/transpiler/build/src/transpile_types.js");
81344
+ const types_1 = __webpack_require__(/*! ../types */ "./node_modules/@abaplint/transpiler/build/src/types.js");
81319
81345
  class NewObjectTranspiler {
81320
81346
  transpile(node, traversal) {
81321
81347
  const ret = new chunk_1.Chunk();
@@ -81328,8 +81354,26 @@ class NewObjectTranspiler {
81328
81354
  if (parameters) {
81329
81355
  para = traversal.traverse(parameters).getCode();
81330
81356
  }
81331
- const type = new type_name_or_infer_1.TypeNameOrInfer().findType(typeNameOrInfer, traversal);
81332
- if (type instanceof abaplint.BasicTypes.ObjectReferenceType) {
81357
+ let type = new type_name_or_infer_1.TypeNameOrInfer().findTypeOrUndefined(typeNameOrInfer, traversal);
81358
+ if (type === undefined) {
81359
+ const scope = traversal.findCurrentScopeByToken(node.getFirstToken());
81360
+ try {
81361
+ type = traversal.lookupType(typeNameOrInfer, scope);
81362
+ }
81363
+ catch {
81364
+ // ignore
81365
+ }
81366
+ }
81367
+ if (type === undefined) {
81368
+ if (traversal.options?.unknownTypes === types_1.UnknownTypesEnum.runtimeError) {
81369
+ ret.appendString(`(function() { throw new Error("Void type: ${typeNameOrInfer.concatTokens().toUpperCase()}") })()`);
81370
+ return ret;
81371
+ }
81372
+ else {
81373
+ throw new Error("NewObjectTranspiler, type not found: " + node.concatTokens() + ", " + traversal.getCurrentObject().getName() + " line " + node.getFirstToken().getStart().getRow());
81374
+ }
81375
+ }
81376
+ else if (type instanceof abaplint.BasicTypes.ObjectReferenceType) {
81333
81377
  if (node.getChildren()[3].get() instanceof abaplint.Expressions.Source) {
81334
81378
  // single default parameter
81335
81379
  const scope = traversal.findCurrentScopeByToken(typeNameOrInfer.getFirstToken());
@@ -81342,7 +81386,13 @@ class NewObjectTranspiler {
81342
81386
  ret.appendString(transpile_types_1.TranspileTypes.toType(type) + ".set(await (new " + clas + "()).constructor_(" + para + "))");
81343
81387
  }
81344
81388
  else {
81345
- throw new Error("NewObjectTranspiler: only ObjectReferenceType currently handled, todo");
81389
+ const source = node.findFirstExpression(abaplint.Expressions.Source);
81390
+ if (source === undefined) {
81391
+ throw new Error("NewObjectTranspiler: DataReference source not found");
81392
+ }
81393
+ const typeCode = transpile_types_1.TranspileTypes.toType(type);
81394
+ const sourceCode = traversal.traverse(source).getCode();
81395
+ ret.appendString("((() => {const r = new abap.types.DataReference(" + typeCode + "); r.assign(" + sourceCode + "); return r; })())");
81346
81396
  }
81347
81397
  return ret;
81348
81398
  }
@@ -83159,6 +83209,11 @@ class TypeNameOrInfer {
83159
83209
  }
83160
83210
  return type;
83161
83211
  }
83212
+ findTypeOrUndefined(node, traversal) {
83213
+ const scope = traversal.findCurrentScopeByToken(node.getFirstToken());
83214
+ const type = traversal.lookupInferred(node, scope);
83215
+ return type;
83216
+ }
83162
83217
  transpile(node, traversal) {
83163
83218
  const type = this.findType(node, traversal);
83164
83219
  const ret = new chunk_1.Chunk();
@@ -93073,7 +93128,8 @@ this.INTERNAL_ID = abap.internalIdCounter++;\n`;
93073
93128
  if (scope === undefined) {
93074
93129
  return undefined;
93075
93130
  }
93076
- else if (!(node.get() instanceof abaplint.Expressions.TypeName)) {
93131
+ else if (!(node.get() instanceof abaplint.Expressions.TypeName)
93132
+ && !(node.get() instanceof abaplint.Expressions.TypeNameOrInfer)) {
93077
93133
  throw new Error("lookupType, node is not a TypeName, " + node.get());
93078
93134
  }
93079
93135
  const name = node.concatTokens().toLowerCase();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/transpiler-cli",
3
- "version": "2.12.23",
3
+ "version": "2.12.24",
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.115.10",
31
- "@abaplint/transpiler": "^2.12.23",
30
+ "@abaplint/core": "^2.115.14",
31
+ "@abaplint/transpiler": "^2.12.24",
32
32
  "@types/glob": "^8.1.0",
33
- "@types/node": "^24.10.4",
33
+ "@types/node": "^24.10.7",
34
34
  "@types/progress": "^2.0.7",
35
35
  "glob": "=7.2.0",
36
36
  "progress": "^2.0.3",