@abaplint/transpiler-cli 2.13.78 → 2.13.79

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 +157 -21
  2. package/package.json +3 -3
package/build/bundle.js CHANGED
@@ -24813,6 +24813,7 @@ exports.ABAPFileInformationParser = void 0;
24813
24813
  const Structures = __importStar(__webpack_require__(/*! ../3_structures/structures */ "./node_modules/@abaplint/core/build/src/abap/3_structures/structures/index.js"));
24814
24814
  const Expressions = __importStar(__webpack_require__(/*! ../2_statements/expressions */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js"));
24815
24815
  const Statements = __importStar(__webpack_require__(/*! ../2_statements/statements */ "./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js"));
24816
+ const nodes_1 = __webpack_require__(/*! ../nodes */ "./node_modules/@abaplint/core/build/src/abap/nodes/index.js");
24816
24817
  const _identifier_1 = __webpack_require__(/*! ./_identifier */ "./node_modules/@abaplint/core/build/src/abap/4_file_information/_identifier.js");
24817
24818
  const Tokens = __importStar(__webpack_require__(/*! ../1_lexer/tokens */ "./node_modules/@abaplint/core/build/src/abap/1_lexer/tokens/index.js"));
24818
24819
  const visibility_1 = __webpack_require__(/*! ./visibility */ "./node_modules/@abaplint/core/build/src/abap/4_file_information/visibility.js");
@@ -24952,6 +24953,7 @@ class ABAPFileInformationParser {
24952
24953
  riskLevel,
24953
24954
  isAbstract: (cdef === null || cdef === void 0 ? void 0 : cdef.findDirectTokenByText("ABSTRACT")) !== undefined,
24954
24955
  isSharedMemory: concat.includes(" SHARED MEMORY ENABLED"),
24956
+ behaviorDefinitionName: this.findBehaviorDefinitionName(cdef),
24955
24957
  isFinal: found.findFirstExpression(Expressions.ClassFinal) !== undefined,
24956
24958
  aliases,
24957
24959
  attributes,
@@ -24961,6 +24963,20 @@ class ABAPFileInformationParser {
24961
24963
  return classes;
24962
24964
  }
24963
24965
  ///////////////////
24966
+ /** "FOR BEHAVIOR OF" and "FOR EVENTS OF" both use the BehaviorDefinitionName expression,
24967
+ * so look at the token two positions before the expression to tell them apart */
24968
+ findBehaviorDefinitionName(cdef) {
24969
+ const children = (cdef === null || cdef === void 0 ? void 0 : cdef.getChildren()) || [];
24970
+ for (let i = 2; i < children.length; i++) {
24971
+ const child = children[i];
24972
+ if (child instanceof nodes_1.ExpressionNode
24973
+ && child.get() instanceof Expressions.BehaviorDefinitionName
24974
+ && children[i - 2].concatTokens().toUpperCase() === "BEHAVIOR") {
24975
+ return child.concatTokens();
24976
+ }
24977
+ }
24978
+ return undefined;
24979
+ }
24964
24980
  getImplementing(input) {
24965
24981
  const ret = [];
24966
24982
  for (const node of input.findAllStatements(Statements.InterfaceDef)) {
@@ -26656,6 +26672,18 @@ class CurrentScope {
26656
26672
  }
26657
26673
  return undefined;
26658
26674
  }
26675
+ /** the BDEF from "FOR BEHAVIOR OF" of the enclosing global class, undefined if not a behavior pool */
26676
+ findBehaviorDefinition() {
26677
+ var _a;
26678
+ if (this.parentObj.getType() !== "CLAS") {
26679
+ return undefined;
26680
+ }
26681
+ const name = (_a = this.parentObj.getClassDefinition()) === null || _a === void 0 ? void 0 : _a.behaviorDefinitionName;
26682
+ if (name === undefined) {
26683
+ return undefined;
26684
+ }
26685
+ return this.reg.getObject("BDEF", name);
26686
+ }
26659
26687
  isBadiDef(name) {
26660
26688
  const upper = name.toUpperCase();
26661
26689
  for (const enhs of this.reg.getObjectsByType("ENHS")) {
@@ -28965,7 +28993,7 @@ class BasicTypes {
28965
28993
  return undefined;
28966
28994
  }
28967
28995
  parseTable(node, name) {
28968
- var _a, _b, _c, _d;
28996
+ var _a, _b, _c;
28969
28997
  const typename = node.findFirstExpression(Expressions.TypeName) || node.findFirstExpression(Expressions.EntityAssociation);
28970
28998
  const text = (_a = node.findFirstExpression(Expressions.TypeTable)) === null || _a === void 0 ? void 0 : _a.concatTokens().toUpperCase();
28971
28999
  if (text === undefined) {
@@ -29102,25 +29130,31 @@ class BasicTypes {
29102
29130
  return new Types.TableType(structure, options);
29103
29131
  }
29104
29132
  else if (typename && this.isRAPTableFor(text)) {
29105
- const name = typename.concatTokens();
29106
- const ddlsName = this.getRAPBaseEntityName(name);
29107
- const type = (_d = this.input.scope.getDDIC().lookupDDLS(ddlsName)) === null || _d === void 0 ? void 0 : _d.type;
29108
- if (type) {
29109
- return new Types.TableType(basic_1.VoidType.get("RAP-TODO"), options);
29110
- }
29111
- else if (this.isRAPDerivedEntityName(name)) {
29112
- return Types.VoidType.get(name);
29113
- }
29114
- else if (this.input.scope.getDDIC().inErrorNamespace(ddlsName)) {
29115
- return new Types.UnknownType(`DDLS ${ddlsName} not found`);
29116
- }
29117
- else {
29118
- return Types.VoidType.get(name);
29119
- }
29133
+ return this.rapTableFor(typename.concatTokens(), options);
29120
29134
  }
29121
29135
  // fallback to old style syntax, OCCURS etc
29122
29136
  return this.parseType(node, name);
29123
29137
  }
29138
+ /** type of a RAP derived table type, ie the "TABLE FOR LOCK zentity" part of a type */
29139
+ rapTableFor(entityName, options) {
29140
+ var _a;
29141
+ const ddlsName = this.resolveRAPAlias(this.getRAPBaseEntityName(entityName));
29142
+ if ((_a = this.input.scope.getDDIC().lookupDDLS(ddlsName)) === null || _a === void 0 ? void 0 : _a.type) {
29143
+ return new Types.TableType(basic_1.VoidType.get("RAP-TODO"), options !== null && options !== void 0 ? options : {
29144
+ withHeader: false,
29145
+ keyType: Types.TableKeyType.user,
29146
+ primaryKey: { name: "primary_key", type: basic_1.TableAccessType.standard, isUnique: false, keyFields: [] },
29147
+ secondary: [],
29148
+ });
29149
+ }
29150
+ else if (this.isRAPDerivedEntityName(entityName)) {
29151
+ return Types.VoidType.get(entityName);
29152
+ }
29153
+ else if (this.input.scope.getDDIC().inErrorNamespace(ddlsName)) {
29154
+ return new Types.UnknownType(`DDLS ${ddlsName} not found`);
29155
+ }
29156
+ return Types.VoidType.get(entityName);
29157
+ }
29124
29158
  parseType(node, qualifiedName) {
29125
29159
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
29126
29160
  const typeName = node.findFirstExpression(Expressions.TypeName);
@@ -29314,6 +29348,12 @@ class BasicTypes {
29314
29348
  const splitAt = Math.min(...candidates);
29315
29349
  return name.substring(0, splitAt);
29316
29350
  }
29351
+ /** inside a behavior pool the entities are referenced via the aliases defined in the BDEF */
29352
+ resolveRAPAlias(name) {
29353
+ var _a;
29354
+ var _b;
29355
+ return (_b = (_a = this.input.scope.findBehaviorDefinition()) === null || _a === void 0 ? void 0 : _a.findEntityNameByAlias(name)) !== null && _b !== void 0 ? _b : name;
29356
+ }
29317
29357
  isRAPDerivedEntityName(name) {
29318
29358
  return name.includes("\\") || name.includes("~");
29319
29359
  }
@@ -53884,6 +53924,7 @@ const _typed_identifier_1 = __webpack_require__(/*! ./_typed_identifier */ "./no
53884
53924
  const basic_1 = __webpack_require__(/*! ./basic */ "./node_modules/@abaplint/core/build/src/abap/types/basic/index.js");
53885
53925
  const method_def_returning_1 = __webpack_require__(/*! ../5_syntax/expressions/method_def_returning */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/method_def_returning.js");
53886
53926
  const method_param_1 = __webpack_require__(/*! ../5_syntax/expressions/method_param */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/method_param.js");
53927
+ const basic_types_1 = __webpack_require__(/*! ../5_syntax/basic_types */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/basic_types.js");
53887
53928
  const _object_oriented_1 = __webpack_require__(/*! ../5_syntax/_object_oriented */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_object_oriented.js");
53888
53929
  const _reference_1 = __webpack_require__(/*! ../5_syntax/_reference */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_reference.js");
53889
53930
  const identifier_1 = __webpack_require__(/*! ../1_lexer/tokens/identifier */ "./node_modules/@abaplint/core/build/src/abap/1_lexer/tokens/identifier.js");
@@ -54071,24 +54112,37 @@ class MethodParameters {
54071
54112
  }
54072
54113
  }
54073
54114
  workaroundRAP(node, input, parentName) {
54115
+ var _a;
54074
54116
  const resultName = node.findExpressionAfterToken("RESULT");
54075
54117
  const concat = node.concatTokens().toUpperCase();
54076
54118
  const isRap = node.findExpressionAfterToken("IMPORTING")
54077
54119
  || (concat.includes(" IMPORTING REQUEST ") ? node.findExpressionAfterToken("REQUEST") : undefined);
54078
54120
  if (isRap) {
54121
+ // "FOR LOCK" handlers have a well defined signature, so the types can be derived
54122
+ const lockEntity = concat.includes(" FOR LOCK ")
54123
+ ? (_a = node.findExpressionAfterToken("LOCK")) === null || _a === void 0 ? void 0 : _a.concatTokens()
54124
+ : undefined;
54079
54125
  for (const foo of node.findDirectExpressions(Expressions.MethodParamName)) {
54080
54126
  if (foo === resultName) {
54081
54127
  continue;
54082
54128
  }
54083
- this.importing.push(new _typed_identifier_1.TypedIdentifier(foo.getFirstToken(), input.filename, basic_1.VoidType.get("RapMethodParameter"), ["importing" /* IdentifierMeta.MethodImporting */]));
54129
+ const type = lockEntity === undefined
54130
+ ? basic_1.VoidType.get("RapMethodParameter")
54131
+ : new basic_types_1.BasicTypes(input).rapTableFor(lockEntity);
54132
+ this.importing.push(new _typed_identifier_1.TypedIdentifier(foo.getFirstToken(), input.filename, type, ["importing" /* IdentifierMeta.MethodImporting */]));
54133
+ }
54134
+ if (lockEntity !== undefined) {
54135
+ // note: "mapped" is not part of the signature for "FOR LOCK"
54136
+ const token = isRap.getFirstToken();
54137
+ this.exporting.push(new _typed_identifier_1.TypedIdentifier(new identifier_1.Identifier(token.getStart(), "failed"), input.filename, basic_1.VoidType.get(`RESPONSE FOR FAILED EARLY ${lockEntity}`), ["exporting" /* IdentifierMeta.MethodExporting */]));
54138
+ this.exporting.push(new _typed_identifier_1.TypedIdentifier(new identifier_1.Identifier(token.getStart(), "reported"), input.filename, basic_1.VoidType.get(`RESPONSE FOR REPORTED EARLY ${lockEntity}`), ["exporting" /* IdentifierMeta.MethodExporting */]));
54084
54139
  }
54085
- if (concat.includes(" FOR VALIDATE ")
54140
+ else if (concat.includes(" FOR VALIDATE ")
54086
54141
  || concat.includes(" FOR BEHAVIOR ")
54087
54142
  || concat.includes(" FOR DETERMINE ")
54088
54143
  || concat.includes(" FOR FEATURES ")
54089
54144
  || concat.includes(" FOR INSTANCE FEATURES ")
54090
54145
  || concat.includes(" FOR GLOBAL AUTHORIZATION ")
54091
- || concat.includes(" FOR LOCK ")
54092
54146
  || concat.includes(" FOR PRECHECK ")
54093
54147
  || concat.includes(" FOR NUMBERING ")
54094
54148
  || concat.includes(" FOR READ ")
@@ -62047,6 +62101,10 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
62047
62101
  exports.BehaviorDefinition = void 0;
62048
62102
  const _abstract_object_1 = __webpack_require__(/*! ./_abstract_object */ "./node_modules/@abaplint/core/build/src/objects/_abstract_object.js");
62049
62103
  class BehaviorDefinition extends _abstract_object_1.AbstractObject {
62104
+ constructor() {
62105
+ super(...arguments);
62106
+ this.parsedData = undefined;
62107
+ }
62050
62108
  getType() {
62051
62109
  return "BDEF";
62052
62110
  }
@@ -62060,6 +62118,49 @@ class BehaviorDefinition extends _abstract_object_1.AbstractObject {
62060
62118
  // todo
62061
62119
  return undefined;
62062
62120
  }
62121
+ setDirty() {
62122
+ this.parsedData = undefined;
62123
+ super.setDirty();
62124
+ }
62125
+ findSourceFile() {
62126
+ return this.getFiles().find(f => f.getFilename().endsWith(".asbdef"));
62127
+ }
62128
+ listEntities() {
62129
+ return this.parseSource().entities;
62130
+ }
62131
+ /** finds the entity name for a given alias, undefined if the alias is not defined */
62132
+ findEntityNameByAlias(alias) {
62133
+ var _a;
62134
+ const upper = alias.toUpperCase();
62135
+ for (const entity of this.listEntities()) {
62136
+ if (((_a = entity.alias) === null || _a === void 0 ? void 0 : _a.toUpperCase()) === upper) {
62137
+ return entity.name;
62138
+ }
62139
+ }
62140
+ return undefined;
62141
+ }
62142
+ /////////////////////////
62143
+ parseSource() {
62144
+ var _a;
62145
+ if (this.parsedData !== undefined) {
62146
+ return this.parsedData;
62147
+ }
62148
+ this.parsedData = { entities: [] };
62149
+ const raw = (_a = this.findSourceFile()) === null || _a === void 0 ? void 0 : _a.getRaw();
62150
+ if (raw === undefined) {
62151
+ return this.parsedData;
62152
+ }
62153
+ // BDEF uses "//" for line comments
62154
+ const stripped = raw.replace(/\/\/.*$/gm, "");
62155
+ // eg. "define behavior for ZI_Booking alias Booking", also "define abstract behavior for ..."
62156
+ const regex = /\bdefine\s+(?:\w+\s+)*?behavior\s+for\s+([\w/]+)(?:\s+alias\s+(\w+))?/gi;
62157
+ let match = regex.exec(stripped);
62158
+ while (match !== null) {
62159
+ this.parsedData.entities.push({ name: match[1], alias: match[2] });
62160
+ match = regex.exec(stripped);
62161
+ }
62162
+ return this.parsedData;
62163
+ }
62063
62164
  }
62064
62165
  exports.BehaviorDefinition = BehaviorDefinition;
62065
62166
  //# sourceMappingURL=behavior_definition.js.map
@@ -65564,6 +65665,7 @@ exports.LockObject = void 0;
65564
65665
  const basic_1 = __webpack_require__(/*! ../abap/types/basic */ "./node_modules/@abaplint/core/build/src/abap/types/basic/index.js");
65565
65666
  const ddic_1 = __webpack_require__(/*! ../ddic */ "./node_modules/@abaplint/core/build/src/ddic.js");
65566
65667
  const _abstract_object_1 = __webpack_require__(/*! ./_abstract_object */ "./node_modules/@abaplint/core/build/src/objects/_abstract_object.js");
65668
+ const xml_utils_1 = __webpack_require__(/*! ../xml_utils */ "./node_modules/@abaplint/core/build/src/xml_utils.js");
65567
65669
  class LockObject extends _abstract_object_1.AbstractObject {
65568
65670
  getType() {
65569
65671
  return "ENQU";
@@ -65584,6 +65686,11 @@ class LockObject extends _abstract_object_1.AbstractObject {
65584
65686
  this.parse();
65585
65687
  return (_a = this.parsedXML) === null || _a === void 0 ? void 0 : _a.primaryTable;
65586
65688
  }
65689
+ getParameters() {
65690
+ var _a;
65691
+ this.parse();
65692
+ return (_a = this.parsedXML) === null || _a === void 0 ? void 0 : _a.parameters;
65693
+ }
65587
65694
  parseType(reg) {
65588
65695
  var _a;
65589
65696
  this.parse();
@@ -65608,7 +65715,7 @@ class LockObject extends _abstract_object_1.AbstractObject {
65608
65715
  }
65609
65716
  }
65610
65717
  parse() {
65611
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
65718
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
65612
65719
  if (this.parsedXML) {
65613
65720
  return { updated: false, runtime: 0 };
65614
65721
  }
@@ -65622,6 +65729,18 @@ class LockObject extends _abstract_object_1.AbstractObject {
65622
65729
  }
65623
65730
  this.parsedXML.primaryTable = (_f = (_e = (_d = (_c = parsed.abapGit) === null || _c === void 0 ? void 0 : _c["asx:abap"]) === null || _d === void 0 ? void 0 : _d["asx:values"]) === null || _e === void 0 ? void 0 : _e.DD25V) === null || _f === void 0 ? void 0 : _f.ROOTTAB;
65624
65731
  this.parsedXML.description = (_k = (_j = (_h = (_g = parsed.abapGit) === null || _g === void 0 ? void 0 : _g["asx:abap"]) === null || _h === void 0 ? void 0 : _h["asx:values"]) === null || _j === void 0 ? void 0 : _j.DD25V) === null || _k === void 0 ? void 0 : _k.DDTEXT;
65732
+ this.parsedXML.parameters = [];
65733
+ const parameters = (_o = (_m = (_l = parsed.abapGit) === null || _l === void 0 ? void 0 : _l["asx:abap"]) === null || _m === void 0 ? void 0 : _m["asx:values"]) === null || _o === void 0 ? void 0 : _o.DD27P_TABLE;
65734
+ for (const parameter of (0, xml_utils_1.xmlToArray)(parameters === null || parameters === void 0 ? void 0 : parameters.DD27P)) {
65735
+ if (typeof (parameter === null || parameter === void 0 ? void 0 : parameter.VIEWFIELD) !== "string") {
65736
+ continue;
65737
+ }
65738
+ this.parsedXML.parameters.push({
65739
+ VIEWFIELD: parameter.VIEWFIELD,
65740
+ TABNAME: parameter.TABNAME,
65741
+ FIELDNAME: parameter.FIELDNAME,
65742
+ });
65743
+ }
65625
65744
  const end = Date.now();
65626
65745
  return { updated: true, runtime: end - start };
65627
65746
  }
@@ -70628,7 +70747,7 @@ class Registry {
70628
70747
  }
70629
70748
  static abaplintVersion() {
70630
70749
  // magic, see build script "version.js"
70631
- return "2.120.43";
70750
+ return "2.120.44";
70632
70751
  }
70633
70752
  getDDICReferences() {
70634
70753
  return this.ddicReferences;
@@ -100556,6 +100675,7 @@ class XMLConsistency {
100556
100675
  * XML is well-formed and parseable
100557
100676
  * Naming for CLAS and INTF objects
100558
100677
  * QUAN fields in TABL objects have reference table and field values
100678
+ * Lock parameter names in ENQU objects are max 16 characters
100559
100679
  * Texts and translations do not exceed maximum allowed length.`,
100560
100680
  tags: [_irule_1.RuleTag.Naming, _irule_1.RuleTag.Syntax],
100561
100681
  };
@@ -100613,6 +100733,9 @@ class XMLConsistency {
100613
100733
  else if (obj instanceof Objects.Table) {
100614
100734
  issues.push(...this.runTable(obj, file));
100615
100735
  }
100736
+ else if (obj instanceof Objects.LockObject) {
100737
+ issues.push(...this.runLockObject(obj, file));
100738
+ }
100616
100739
  if (obj instanceof _abap_object_1.ABAPObject) {
100617
100740
  issues.push(...this.runTextPool(obj, file));
100618
100741
  }
@@ -100796,6 +100919,19 @@ class XMLConsistency {
100796
100919
  }
100797
100920
  return issues;
100798
100921
  }
100922
+ runLockObject(obj, file) {
100923
+ var _a;
100924
+ const maxParameterLength = 16;
100925
+ const issues = [];
100926
+ for (const parameter of (_a = obj.getParameters()) !== null && _a !== void 0 ? _a : []) {
100927
+ if (parameter.VIEWFIELD.length > maxParameterLength) {
100928
+ const message = `Lock parameter ${parameter.VIEWFIELD} exceeds maximum length of ` +
100929
+ `${maxParameterLength} characters (actual: ${parameter.VIEWFIELD.length})`;
100930
+ issues.push(issue_1.Issue.atRow(file, 1, message, this.getMetadata().key, this.conf.severity));
100931
+ }
100932
+ }
100933
+ return issues;
100934
+ }
100799
100935
  runTable(obj, file) {
100800
100936
  var _a, _b;
100801
100937
  var _c;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/transpiler-cli",
3
- "version": "2.13.78",
3
+ "version": "2.13.79",
4
4
  "description": "Transpiler - Command Line Interface",
5
5
  "funding": "https://github.com/sponsors/larshp",
6
6
  "bin": {
@@ -27,8 +27,8 @@
27
27
  "author": "abaplint",
28
28
  "license": "MIT",
29
29
  "devDependencies": {
30
- "@abaplint/core": "^2.120.43",
31
- "@abaplint/transpiler": "^2.13.78",
30
+ "@abaplint/core": "^2.120.44",
31
+ "@abaplint/transpiler": "^2.13.79",
32
32
  "@types/glob": "^9.0.0",
33
33
  "@types/node": "^26.4.1",
34
34
  "@types/progress": "^2.0.7",