@abaplint/transpiler-cli 2.5.28 → 2.5.30

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 +31 -30
  2. package/package.json +4 -4
package/build/bundle.js CHANGED
@@ -21642,6 +21642,9 @@ const _reference_1 = __webpack_require__(/*! ../_reference */ "./node_modules/@a
21642
21642
  const _object_oriented_1 = __webpack_require__(/*! ../_object_oriented */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_object_oriented.js");
21643
21643
  class ComponentChain {
21644
21644
  runSyntax(context, node, scope, filename) {
21645
+ if (context === undefined) {
21646
+ return undefined;
21647
+ }
21645
21648
  const children = node.getChildren();
21646
21649
  for (let i = 0; i < children.length; i++) {
21647
21650
  if (context instanceof void_type_1.VoidType || context instanceof basic_1.UnknownType) {
@@ -21704,7 +21707,7 @@ class ComponentChain {
21704
21707
  }
21705
21708
  }
21706
21709
  else {
21707
- throw new Error("ComponentChain, not a structure");
21710
+ throw new Error("ComponentChain, not a structure, " + (context === null || context === void 0 ? void 0 : context.constructor.name));
21708
21711
  }
21709
21712
  }
21710
21713
  }
@@ -21727,7 +21730,7 @@ exports.ComponentChain = ComponentChain;
21727
21730
  Object.defineProperty(exports, "__esModule", ({ value: true }));
21728
21731
  exports.ComponentCompare = void 0;
21729
21732
  const Expressions = __webpack_require__(/*! ../../2_statements/expressions */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js");
21730
- const basic_1 = __webpack_require__(/*! ../../types/basic */ "./node_modules/@abaplint/core/build/src/abap/types/basic/index.js");
21733
+ const component_chain_1 = __webpack_require__(/*! ./component_chain */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/component_chain.js");
21731
21734
  const source_1 = __webpack_require__(/*! ./source */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/source.js");
21732
21735
  class ComponentCompare {
21733
21736
  runSyntax(node, scope, filename, type) {
@@ -21735,23 +21738,7 @@ class ComponentCompare {
21735
21738
  if (chain === undefined) {
21736
21739
  throw new Error("ComponentCompare, chain not found");
21737
21740
  }
21738
- // todo, handle deep chain
21739
- if (chain.getChildren().length === 1
21740
- && type !== undefined
21741
- && !(type instanceof basic_1.VoidType)
21742
- && !(type instanceof basic_1.UnknownType)
21743
- && !(type instanceof basic_1.AnyType)) {
21744
- const fieldName = chain.concatTokens();
21745
- if (fieldName.toLowerCase() !== "table_line") {
21746
- if (!(type instanceof basic_1.StructureType)) {
21747
- throw new Error("ComponentCompare, source not structured");
21748
- }
21749
- if (type.getComponentByName(fieldName) === undefined) {
21750
- throw new Error("Component \"" + fieldName + "\" not part of structure");
21751
- }
21752
- // todo, check type compatibility
21753
- }
21754
- }
21741
+ new component_chain_1.ComponentChain().runSyntax(type, chain, scope, filename);
21755
21742
  for (const s of node.findDirectExpressions(Expressions.Source)) {
21756
21743
  new source_1.Source().runSyntax(s, scope, filename);
21757
21744
  }
@@ -26571,12 +26558,14 @@ const target_1 = __webpack_require__(/*! ../expressions/target */ "./node_module
26571
26558
  const source_1 = __webpack_require__(/*! ../expressions/source */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/source.js");
26572
26559
  const component_compare_1 = __webpack_require__(/*! ../expressions/component_compare */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/component_compare.js");
26573
26560
  const component_cond_1 = __webpack_require__(/*! ../expressions/component_cond */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/component_cond.js");
26561
+ const basic_1 = __webpack_require__(/*! ../../types/basic */ "./node_modules/@abaplint/core/build/src/abap/types/basic/index.js");
26574
26562
  class DeleteInternal {
26575
26563
  runSyntax(node, scope, filename) {
26576
26564
  var _a;
26577
26565
  for (const s of node.findDirectExpressions(Expressions.Source)) {
26578
26566
  new source_1.Source().runSyntax(s, scope, filename);
26579
26567
  }
26568
+ let targetType = undefined;
26580
26569
  const target = node.findDirectExpression(Expressions.Target);
26581
26570
  if (target) {
26582
26571
  let tabl = undefined;
@@ -26588,14 +26577,17 @@ class DeleteInternal {
26588
26577
  }
26589
26578
  }
26590
26579
  if (tabl === undefined) {
26591
- new target_1.Target().runSyntax(target, scope, filename);
26580
+ targetType = new target_1.Target().runSyntax(target, scope, filename);
26581
+ if (targetType instanceof basic_1.TableType) {
26582
+ targetType = targetType.getRowType();
26583
+ }
26592
26584
  }
26593
26585
  }
26594
26586
  for (const t of node.findDirectExpressions(Expressions.ComponentCompare)) {
26595
- new component_compare_1.ComponentCompare().runSyntax(t, scope, filename);
26587
+ new component_compare_1.ComponentCompare().runSyntax(t, scope, filename, targetType);
26596
26588
  }
26597
26589
  for (const t of node.findDirectExpressions(Expressions.ComponentCond)) {
26598
- new component_cond_1.ComponentCond().runSyntax(t, scope, filename);
26590
+ new component_cond_1.ComponentCond().runSyntax(t, scope, filename, targetType);
26599
26591
  }
26600
26592
  }
26601
26593
  }
@@ -46210,7 +46202,7 @@ class Registry {
46210
46202
  }
46211
46203
  static abaplintVersion() {
46212
46204
  // magic, see build script "version.sh"
46213
- return "2.95.38";
46205
+ return "2.95.39";
46214
46206
  }
46215
46207
  getDDICReferences() {
46216
46208
  return this.references;
@@ -73994,7 +73986,7 @@ class PerformTranspiler {
73994
73986
  return new chunk_1.Chunk(`throw new Error("PerformTranspiler FormName not found");`);
73995
73987
  }
73996
73988
  // todo, parameters
73997
- if (node.concatTokens().includes(" IN PROGRAM ")) {
73989
+ if (node.concatTokens().toUpperCase().includes(" IN PROGRAM ")) {
73998
73990
  return new chunk_1.Chunk(`throw new Error("PerformTranspiler IN PROGRAM, transpiler todo");`);
73999
73991
  }
74000
73992
  return new chunk_1.Chunk("await " + formName.concatTokens() + "();");
@@ -75892,7 +75884,7 @@ class ClassImplementationTranspiler {
75892
75884
  return false;
75893
75885
  }
75894
75886
  /** Finds static attributes + constants including those from interfaces (from superclass is ingored) */
75895
- findStaticAttributes(cdef, scope) {
75887
+ findStaticAttributes(cdef, scope, traversal) {
75896
75888
  const ret = [];
75897
75889
  ret.push(...cdef.getAttributes().getStatic().map(a => { return { identifier: a, prefix: "" }; }));
75898
75890
  ret.push(...cdef.getAttributes().getConstants().map(a => { return { identifier: a, prefix: "" }; }));
@@ -75902,14 +75894,17 @@ class ClassImplementationTranspiler {
75902
75894
  if (i === undefined) {
75903
75895
  break;
75904
75896
  }
75905
- const intf = scope.findInterfaceDefinition(i.name);
75897
+ const intf = traversal.findInterfaceDefinition(i.name, scope);
75906
75898
  if (intf === undefined) {
75907
75899
  continue;
75908
75900
  }
75909
- // todo, constants from interface?
75910
75901
  implementing.push(...intf.getImplementing());
75911
- ret.push(...intf.getAttributes().getStatic().map(a => { return { identifier: a, prefix: intf.getName().toLowerCase() + "$" }; }));
75912
- ret.push(...intf.getAttributes().getConstants().map(a => { return { identifier: a, prefix: intf.getName().toLowerCase() + "$" }; }));
75902
+ ret.push(...intf.getAttributes().getStatic().map(a => {
75903
+ return { identifier: a, prefix: intf.getName().toLowerCase() + "$" };
75904
+ }));
75905
+ ret.push(...intf.getAttributes().getConstants().map(a => {
75906
+ return { identifier: a, prefix: intf.getName().toLowerCase() + "$" };
75907
+ }));
75913
75908
  }
75914
75909
  return ret;
75915
75910
  }
@@ -75943,7 +75938,7 @@ class ClassImplementationTranspiler {
75943
75938
  }
75944
75939
  let ret = "";
75945
75940
  const clasName = node.getFirstToken().getStr().toLowerCase();
75946
- const staticAttributes = this.findStaticAttributes(cdef, scope);
75941
+ const staticAttributes = this.findStaticAttributes(cdef, scope, traversal);
75947
75942
  for (const attr of staticAttributes) {
75948
75943
  const name = traversal_1.Traversal.escapeNamespace(clasName) + "." + traversal_1.Traversal.escapeNamespace(attr.prefix) + traversal_1.Traversal.escapeNamespace(attr.identifier.getName().toLowerCase());
75949
75944
  ret += name + " = " + new transpile_types_1.TranspileTypes().toType(attr.identifier.getType()) + ";\n";
@@ -76745,6 +76740,12 @@ class TranspileTypes {
76745
76740
  if (type.getQualifiedName() !== undefined) {
76746
76741
  extra += ", \"" + type.getQualifiedName() + "\"";
76747
76742
  }
76743
+ else {
76744
+ extra += ", undefined";
76745
+ }
76746
+ if (type.getDDICName() !== undefined) {
76747
+ extra += ", \"" + type.getQualifiedName() + "\"";
76748
+ }
76748
76749
  }
76749
76750
  else if (type instanceof abaplint.BasicTypes.CLikeType
76750
76751
  || type instanceof abaplint.BasicTypes.CSequenceType) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/transpiler-cli",
3
- "version": "2.5.28",
3
+ "version": "2.5.30",
4
4
  "description": "Transpiler - Command Line Interface",
5
5
  "bin": {
6
6
  "abap_transpile": "./abap_transpile"
@@ -25,13 +25,13 @@
25
25
  "author": "abaplint",
26
26
  "license": "MIT",
27
27
  "devDependencies": {
28
- "@abaplint/transpiler": "^2.5.28",
28
+ "@abaplint/transpiler": "^2.5.30",
29
29
  "@types/glob": "^7.2.0",
30
30
  "glob": "=7.2.0",
31
31
  "@types/progress": "^2.0.5",
32
- "@abaplint/core": "^2.95.38",
32
+ "@abaplint/core": "^2.95.39",
33
33
  "progress": "^2.0.3",
34
- "webpack": "^5.76.0",
34
+ "webpack": "^5.76.1",
35
35
  "webpack-cli": "^5.0.1",
36
36
  "typescript": "=4.8.4"
37
37
  }