@abaplint/transpiler-cli 2.11.10 → 2.11.12

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 -7
  2. package/package.json +4 -4
package/build/bundle.js CHANGED
@@ -27011,6 +27011,10 @@ class Source {
27011
27011
  {
27012
27012
  const foundType = this.determineType(node, input, targetType);
27013
27013
  const bodyType = cond_body_1.CondBody.runSyntax(node.findDirectExpression(Expressions.CondBody), input, foundType);
27014
+ /*
27015
+ console.log("COND BODY type;:");
27016
+ console.dir(bodyType);
27017
+ */
27014
27018
  if (foundType === undefined || foundType.isGeneric()) {
27015
27019
  this.addIfInferred(node, input, bodyType);
27016
27020
  }
@@ -27038,15 +27042,31 @@ class Source {
27038
27042
  }
27039
27043
  case "REF":
27040
27044
  {
27041
- const foundType = this.determineType(node, input, targetType);
27045
+ let foundType = this.determineType(node, input, targetType);
27042
27046
  const s = Source.runSyntax(node.findDirectExpression(Expressions.Source), input);
27043
- if (foundType === undefined && s) {
27044
- return new basic_1.DataReference(s);
27047
+ /*
27048
+ console.dir(node.concatTokens());
27049
+ console.dir(targetType);
27050
+ console.dir(foundType);
27051
+ console.dir(s);
27052
+ */
27053
+ if (foundType && foundType.isGeneric() && s) {
27054
+ foundType = new basic_1.DataReference(s);
27045
27055
  }
27046
- else if (foundType) {
27047
- return new basic_1.DataReference(foundType);
27056
+ else if (foundType === undefined && s) {
27057
+ foundType = new basic_1.DataReference(s);
27048
27058
  }
27049
- return undefined;
27059
+ else if (foundType && targetType === undefined) {
27060
+ foundType = new basic_1.DataReference(foundType);
27061
+ }
27062
+ /*
27063
+ if (targetType && !(targetType instanceof DataReference)) {
27064
+ const message = `REF: Types not compatible, ` + targetType.constructor.name;
27065
+ input.issues.push(syntaxIssue(input, node.getFirstToken(), message));
27066
+ }
27067
+ */
27068
+ this.addIfInferred(node, input, foundType);
27069
+ return foundType;
27050
27070
  }
27051
27071
  case "FILTER":
27052
27072
  {
@@ -27196,11 +27216,20 @@ class Source {
27196
27216
  const typeExpression = node.findDirectExpression(Expressions.TypeNameOrInfer);
27197
27217
  const typeToken = typeExpression === null || typeExpression === void 0 ? void 0 : typeExpression.getFirstToken();
27198
27218
  const typeName = typeToken === null || typeToken === void 0 ? void 0 : typeToken.getStr();
27219
+ /*
27220
+ console.dir(inferredType);
27221
+ console.dir(typeToken);
27222
+ */
27223
+ // hmm, need to align all this
27199
27224
  if (typeName === "#" && inferredType && typeToken) {
27200
27225
  const found = basic.lookupQualifiedName(inferredType.getQualifiedName());
27201
27226
  if (found) {
27202
27227
  input.scope.addReference(typeToken, found, _reference_1.ReferenceType.InferredType, input.filename);
27203
27228
  }
27229
+ else if (inferredType instanceof basic_1.DataReference) {
27230
+ const tid = new _typed_identifier_1.TypedIdentifier(typeToken, input.filename, inferredType);
27231
+ input.scope.addReference(typeToken, tid, _reference_1.ReferenceType.InferredType, input.filename);
27232
+ }
27204
27233
  else if (inferredType instanceof basic_1.ObjectReferenceType) {
27205
27234
  const def = input.scope.findObjectDefinition(inferredType.getQualifiedName());
27206
27235
  if (def) {
@@ -53661,7 +53690,7 @@ class Registry {
53661
53690
  }
53662
53691
  static abaplintVersion() {
53663
53692
  // magic, see build script "version.sh"
53664
- return "2.113.155";
53693
+ return "2.113.159";
53665
53694
  }
53666
53695
  getDDICReferences() {
53667
53696
  return this.ddicReferences;
@@ -79943,6 +79972,7 @@ const core_1 = __webpack_require__(/*! @abaplint/core */ "./node_modules/@abapli
79943
79972
  const _1 = __webpack_require__(/*! . */ "./node_modules/@abaplint/transpiler/build/src/expressions/index.js");
79944
79973
  const constant_1 = __webpack_require__(/*! ./constant */ "./node_modules/@abaplint/transpiler/build/src/expressions/constant.js");
79945
79974
  const chunk_1 = __webpack_require__(/*! ../chunk */ "./node_modules/@abaplint/transpiler/build/src/chunk.js");
79975
+ const transpile_types_1 = __webpack_require__(/*! ../transpile_types */ "./node_modules/@abaplint/transpiler/build/src/transpile_types.js");
79946
79976
  class SourceTranspiler {
79947
79977
  addGet;
79948
79978
  constructor(addGet = false) {
@@ -80007,6 +80037,9 @@ class SourceTranspiler {
80007
80037
  else if (c.get() instanceof core_1.Expressions.TextElement) {
80008
80038
  ret = new chunk_1.Chunk().appendString(`new abap.types.String().set("${c.concatTokens()}")`);
80009
80039
  }
80040
+ else if (c.get() instanceof core_1.Expressions.TypeNameOrInfer) {
80041
+ continue;
80042
+ }
80010
80043
  else if (c.get() instanceof core_1.Expressions.ConvBody) {
80011
80044
  const typ = node.findFirstExpression(core_1.Expressions.TypeNameOrInfer);
80012
80045
  if (typ === undefined) {
@@ -80033,6 +80066,23 @@ class SourceTranspiler {
80033
80066
  ret.append("abap.builtin.boolc(", c, traversal);
80034
80067
  post.append(")", c, traversal);
80035
80068
  }
80069
+ else if (c instanceof core_1.Nodes.TokenNode && c.getFirstToken().getStr().toUpperCase() === "REF") {
80070
+ const infer = node.findDirectExpression(core_1.Expressions.TypeNameOrInfer);
80071
+ if (infer?.concatTokens() !== "#") {
80072
+ throw new Error("transpiler: REF # todo1");
80073
+ }
80074
+ const scope = traversal.findCurrentScopeByToken(infer.getFirstToken());
80075
+ const inferType = traversal.lookupInferred(infer, scope);
80076
+ if (inferType === undefined) {
80077
+ throw new Error("transpiler: REF # todo, lookupInferred, " + node.concatTokens());
80078
+ }
80079
+ const typ = new transpile_types_1.TranspileTypes().toType(inferType);
80080
+ if (typ.startsWith("new abap.types.DataReference(") === false) {
80081
+ throw new Error("transpiler: REF # unexpected type");
80082
+ }
80083
+ ret.append(`${typ}.assign(`, c, traversal);
80084
+ post.append(")", c, traversal);
80085
+ }
80036
80086
  else if (c instanceof core_1.Nodes.TokenNode && c.getFirstToken().getStr().toUpperCase() === "BIT") { // todo, this will not work in the general case
80037
80087
  ret.append("abap.operators.bitnot(", c, traversal);
80038
80088
  post.append(")", c, traversal);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/transpiler-cli",
3
- "version": "2.11.10",
3
+ "version": "2.11.12",
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.155",
31
- "@abaplint/transpiler": "^2.11.10",
30
+ "@abaplint/core": "^2.113.159",
31
+ "@abaplint/transpiler": "^2.11.12",
32
32
  "@types/glob": "^8.1.0",
33
- "@types/node": "^24.2.0",
33
+ "@types/node": "^24.2.1",
34
34
  "@types/progress": "^2.0.7",
35
35
  "glob": "=7.2.0",
36
36
  "progress": "^2.0.3",