@abaplint/transpiler-cli 2.7.162 → 2.7.163

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 -13
  2. package/package.json +4 -4
package/build/bundle.js CHANGED
@@ -21519,7 +21519,8 @@ class TypeUtils {
21519
21519
  }
21520
21520
  return false;
21521
21521
  }
21522
- else if (target instanceof cgeneric_type_1.CGenericType) {
21522
+ else if (target instanceof cgeneric_type_1.CGenericType
21523
+ || target instanceof basic_1.GenericObjectReferenceType) {
21523
21524
  return false;
21524
21525
  }
21525
21526
  else if (target instanceof basic_1.XSequenceType || target instanceof basic_1.XStringType) {
@@ -21709,8 +21710,14 @@ class TypeUtils {
21709
21710
  if (source instanceof basic_1.TableType && source.isWithHeader() === false) {
21710
21711
  return false;
21711
21712
  }
21713
+ else if ((target instanceof basic_1.StringType || target instanceof basic_1.CharacterType)
21714
+ && source instanceof basic_1.StructureType
21715
+ && this.isCharLike(source)) {
21716
+ return true;
21717
+ }
21712
21718
  else if (source instanceof basic_1.DataReference
21713
21719
  || source instanceof basic_1.ObjectReferenceType
21720
+ || source instanceof basic_1.StructureType
21714
21721
  || source instanceof basic_1.GenericObjectReferenceType) {
21715
21722
  return false;
21716
21723
  }
@@ -23289,19 +23296,22 @@ const let_1 = __webpack_require__(/*! ./let */ "./node_modules/@abaplint/core/bu
23289
23296
  class ConvBody {
23290
23297
  runSyntax(node, scope, filename) {
23291
23298
  if (node === undefined) {
23292
- return;
23299
+ throw new Error("ConvBody, node undefined");
23293
23300
  }
23294
23301
  let scoped = false;
23295
23302
  const l = node.findDirectExpression(Expressions.Let);
23296
23303
  if (l) {
23297
23304
  scoped = new let_1.Let().runSyntax(l, scope, filename);
23298
23305
  }
23299
- for (const s of node.findDirectExpressions(Expressions.Source)) {
23300
- new source_1.Source().runSyntax(s, scope, filename);
23306
+ const s = node.findDirectExpression(Expressions.Source);
23307
+ if (s === undefined) {
23308
+ throw new Error("ConvBody, no source found");
23301
23309
  }
23310
+ const sourceType = new source_1.Source().runSyntax(s, scope, filename);
23302
23311
  if (scoped === true) {
23303
23312
  scope.pop(node.getLastToken().getEnd());
23304
23313
  }
23314
+ return sourceType;
23305
23315
  }
23306
23316
  }
23307
23317
  exports.ConvBody = ConvBody;
@@ -25647,6 +25657,7 @@ const _builtin_1 = __webpack_require__(/*! ../_builtin */ "./node_modules/@abapl
25647
25657
  const attribute_chain_1 = __webpack_require__(/*! ./attribute_chain */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/attribute_chain.js");
25648
25658
  const dereference_1 = __webpack_require__(/*! ./dereference */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/dereference.js");
25649
25659
  const _typed_identifier_1 = __webpack_require__(/*! ../../types/_typed_identifier */ "./node_modules/@abaplint/core/build/src/abap/types/_typed_identifier.js");
25660
+ const _type_utils_1 = __webpack_require__(/*! ../_type_utils */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_type_utils.js");
25650
25661
  /*
25651
25662
  * Type interference, valid scenarios:
25652
25663
  * typed = VALUE #( ... ). right hand side must follow left hand type
@@ -25730,7 +25741,10 @@ class Source {
25730
25741
  case "CONV":
25731
25742
  {
25732
25743
  const foundType = this.determineType(node, scope, filename, targetType);
25733
- new conv_body_1.ConvBody().runSyntax(node.findDirectExpression(Expressions.ConvBody), scope, filename);
25744
+ const bodyType = new conv_body_1.ConvBody().runSyntax(node.findDirectExpression(Expressions.ConvBody), scope, filename);
25745
+ if (new _type_utils_1.TypeUtils(scope).isAssignable(foundType, bodyType) === false) {
25746
+ throw new Error("CONV: Types not compatible");
25747
+ }
25734
25748
  this.addIfInferred(node, scope, filename, foundType);
25735
25749
  return foundType;
25736
25750
  }
@@ -27176,6 +27190,7 @@ const target_1 = __webpack_require__(/*! ../expressions/target */ "./node_module
27176
27190
  const basic_1 = __webpack_require__(/*! ../../types/basic */ "./node_modules/@abaplint/core/build/src/abap/types/basic/index.js");
27177
27191
  const fstarget_1 = __webpack_require__(/*! ../expressions/fstarget */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/fstarget.js");
27178
27192
  const inline_data_1 = __webpack_require__(/*! ../expressions/inline_data */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/inline_data.js");
27193
+ const _type_utils_1 = __webpack_require__(/*! ../_type_utils */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_type_utils.js");
27179
27194
  // todo: issue error for short APPEND if the source is without header line
27180
27195
  class Append {
27181
27196
  runSyntax(node, scope, filename) {
@@ -27218,7 +27233,17 @@ class Append {
27218
27233
  else if (targetType instanceof basic_1.VoidType) {
27219
27234
  rowType = targetType;
27220
27235
  }
27221
- new source_1.Source().runSyntax(source, scope, filename, rowType);
27236
+ const sourceType = new source_1.Source().runSyntax(source, scope, filename, rowType);
27237
+ if (node.findDirectTokenByText("LINES")) {
27238
+ if (new _type_utils_1.TypeUtils(scope).isAssignable(sourceType, targetType) === false) {
27239
+ throw new Error("Incompatible types");
27240
+ }
27241
+ }
27242
+ else {
27243
+ if (new _type_utils_1.TypeUtils(scope).isAssignable(sourceType, rowType) === false) {
27244
+ throw new Error("Incompatible types");
27245
+ }
27246
+ }
27222
27247
  }
27223
27248
  const from = node.findExpressionAfterToken("FROM");
27224
27249
  if (from && from.get() instanceof Expressions.Source) {
@@ -29146,7 +29171,11 @@ class GetReference {
29146
29171
  const type = new source_1.Source().runSyntax(s, scope, filename);
29147
29172
  const target = node.findDirectExpression(Expressions.Target);
29148
29173
  const inline = target === null || target === void 0 ? void 0 : target.findDirectExpression(Expressions.InlineData);
29174
+ // todo: error if inline field symbol
29149
29175
  if (inline) {
29176
+ if (type instanceof basic_1.AnyType) {
29177
+ throw new Error("GET REFERENCE generic and inline declaration not possible");
29178
+ }
29150
29179
  new inline_data_1.InlineData().runSyntax(inline, scope, filename, type ? new basic_1.DataReference(type) : undefined);
29151
29180
  }
29152
29181
  else if (target) {
@@ -30586,8 +30615,8 @@ class ReadTable {
30586
30615
  const fromSource = node.findExpressionAfterToken("FROM");
30587
30616
  if (fromSource) {
30588
30617
  const fromType = new source_1.Source().runSyntax(fromSource, scope, filename);
30589
- if (new _type_utils_1.TypeUtils(scope).isAssignable(fromType, basic_1.IntegerType.get()) === false) {
30590
- throw new Error("READ TABLE, FROM must be simple");
30618
+ if (new _type_utils_1.TypeUtils(scope).isAssignable(fromType, rowType) === false) {
30619
+ throw new Error("READ TABLE, FROM must be compatible");
30591
30620
  }
30592
30621
  }
30593
30622
  for (const s of sources) {
@@ -31929,7 +31958,10 @@ const _reference_1 = __webpack_require__(/*! ../_reference */ "./node_modules/@a
31929
31958
  class Write {
31930
31959
  runSyntax(node, scope, filename) {
31931
31960
  // todo, more
31932
- const second = node.getChildren()[1];
31961
+ let second = node.getChildren()[1];
31962
+ if (second.get() instanceof Expressions.WriteOffsetLength) {
31963
+ second = node.getChildren()[2];
31964
+ }
31933
31965
  for (const s of node.findAllExpressions(Expressions.Source)) {
31934
31966
  const type = new source_1.Source().runSyntax(s, scope, filename);
31935
31967
  if (s === second
@@ -50246,7 +50278,7 @@ class Registry {
50246
50278
  }
50247
50279
  static abaplintVersion() {
50248
50280
  // magic, see build script "version.sh"
50249
- return "2.105.21";
50281
+ return "2.105.26";
50250
50282
  }
50251
50283
  getDDICReferences() {
50252
50284
  return this.ddicReferences;
@@ -56164,7 +56196,7 @@ ${indentation}CREATE OBJECT ${uniqueName2} EXPORTING textid = ${uniqueName1}.\n`
56164
56196
  return undefined;
56165
56197
  }
56166
56198
  downportRefSimple(high, lowFile, highSyntax) {
56167
- var _a;
56199
+ var _a, _b;
56168
56200
  if (!(high.get() instanceof Statements.Move)
56169
56201
  || high.getChildren().length !== 4
56170
56202
  || high.getChildren()[2].getFirstToken().getStr().toUpperCase() !== "REF") {
@@ -56189,7 +56221,20 @@ ENDIF.
56189
56221
  GET REFERENCE OF <${uniqueName}> INTO ${target.concatTokens()}`;
56190
56222
  }
56191
56223
  else {
56192
- code = `GET REFERENCE OF ${sourceRef.concatTokens()} INTO ${target.concatTokens()}`;
56224
+ const concat = target.concatTokens();
56225
+ code = `GET REFERENCE OF ${sourceRef.concatTokens()} INTO ${concat}`;
56226
+ // workaround for handling generic ANY type,
56227
+ if (concat.toUpperCase().startsWith("DATA(")) {
56228
+ const spag = highSyntax.spaghetti.lookupPosition(high.getFirstToken().getStart(), lowFile.getFilename());
56229
+ if (spag !== undefined) {
56230
+ const found = spag.findVariable(sourceRef.concatTokens());
56231
+ const tt = found === null || found === void 0 ? void 0 : found.getType();
56232
+ if (tt instanceof basic_1.AnyType) {
56233
+ const tname = (_b = target.findFirstExpression(Expressions.TargetField)) === null || _b === void 0 ? void 0 : _b.concatTokens();
56234
+ code = `DATA ${tname} TYPE REF TO data.\nGET REFERENCE OF ${sourceRef.concatTokens()} INTO ${tname}`;
56235
+ }
56236
+ }
56237
+ }
56193
56238
  }
56194
56239
  const start = high.getFirstToken().getStart();
56195
56240
  const end = high.getLastToken().getStart();
@@ -78438,7 +78483,7 @@ class DataTranspiler {
78438
78483
  }
78439
78484
  const found = scope.findVariable(token.getStr());
78440
78485
  if (found === undefined) {
78441
- throw new Error("DataTranspiler, var not found, \"" + token.getStr() + "\"");
78486
+ throw new Error("DataTranspiler, var not found, \"" + token.getStr() + "\", " + traversal.getFilename() + ", line: " + token.getRow());
78442
78487
  }
78443
78488
  let value = "";
78444
78489
  if (found.getValue() !== undefined && node.concatTokens().includes(" & ")) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/transpiler-cli",
3
- "version": "2.7.162",
3
+ "version": "2.7.163",
4
4
  "description": "Transpiler - Command Line Interface",
5
5
  "funding": "https://github.com/sponsors/larshp",
6
6
  "bin": {
@@ -26,12 +26,12 @@
26
26
  "author": "abaplint",
27
27
  "license": "MIT",
28
28
  "devDependencies": {
29
- "@abaplint/transpiler": "^2.7.162",
29
+ "@abaplint/transpiler": "^2.7.163",
30
30
  "@types/glob": "^8.1.0",
31
31
  "glob": "=7.2.0",
32
32
  "@types/progress": "^2.0.7",
33
- "@types/node": "^20.11.20",
34
- "@abaplint/core": "^2.105.21",
33
+ "@types/node": "^20.11.22",
34
+ "@abaplint/core": "^2.105.26",
35
35
  "progress": "^2.0.3",
36
36
  "webpack": "^5.90.3",
37
37
  "webpack-cli": "^5.1.4",