@abaplint/cli 2.102.43 → 2.102.45

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/cli.js +83 -33
  2. package/package.json +4 -4
package/build/cli.js CHANGED
@@ -21792,7 +21792,8 @@ class TypeUtils {
21792
21792
  }
21793
21793
  }
21794
21794
  else if (source instanceof basic_1.IntegerType) {
21795
- if (target instanceof basic_1.StringType) {
21795
+ if (target instanceof basic_1.StringType
21796
+ || target instanceof basic_1.PackedType) {
21796
21797
  return false;
21797
21798
  }
21798
21799
  else if (target instanceof basic_1.Integer8Type) {
@@ -26827,6 +26828,15 @@ class SpaghettiScopeNode extends ScopeData {
26827
26828
  }
26828
26829
  return ret;
26829
26830
  }
26831
+ listInterfaceDefinitions() {
26832
+ let search = this;
26833
+ const ret = [];
26834
+ while (search !== undefined) {
26835
+ ret.push(...Object.values(search.getData().idefs));
26836
+ search = search.getParent();
26837
+ }
26838
+ return ret;
26839
+ }
26830
26840
  findFormDefinition(name) {
26831
26841
  let search = this;
26832
26842
  const upper = name.toUpperCase();
@@ -28164,6 +28174,9 @@ const target_1 = __webpack_require__(/*! ../expressions/target */ "./node_module
28164
28174
  const source_1 = __webpack_require__(/*! ../expressions/source */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/source.js");
28165
28175
  const dynamic_1 = __webpack_require__(/*! ../expressions/dynamic */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/dynamic.js");
28166
28176
  const basic_types_1 = __webpack_require__(/*! ../basic_types */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/basic_types.js");
28177
+ const basic_1 = __webpack_require__(/*! ../../types/basic */ "./node_modules/@abaplint/core/build/src/abap/types/basic/index.js");
28178
+ const _typed_identifier_1 = __webpack_require__(/*! ../../types/_typed_identifier */ "./node_modules/@abaplint/core/build/src/abap/types/_typed_identifier.js");
28179
+ const _reference_1 = __webpack_require__(/*! ../_reference */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_reference.js");
28167
28180
  class CreateData {
28168
28181
  runSyntax(node, scope, filename) {
28169
28182
  for (const s of node.findDirectExpressions(Expressions.Source)) {
@@ -28177,7 +28190,23 @@ class CreateData {
28177
28190
  }
28178
28191
  const type = node.findDirectExpression(Expressions.TypeName);
28179
28192
  if (type) {
28180
- new basic_types_1.BasicTypes(filename, scope).resolveTypeName(type);
28193
+ const found = new basic_types_1.BasicTypes(filename, scope).resolveTypeName(type);
28194
+ if (found instanceof basic_1.UnknownType) {
28195
+ if (node.concatTokens().toUpperCase().includes(" REF TO ")) {
28196
+ const def = scope.findObjectDefinition(type.concatTokens());
28197
+ if (def) {
28198
+ scope.addReference(type.getFirstToken(), def, _reference_1.ReferenceType.TypeReference, filename);
28199
+ }
28200
+ else {
28201
+ const identifier = new _typed_identifier_1.TypedIdentifier(type.getFirstToken(), filename, found);
28202
+ scope.addReference(type.getFirstToken(), identifier, _reference_1.ReferenceType.TypeReference, filename);
28203
+ }
28204
+ }
28205
+ else {
28206
+ const identifier = new _typed_identifier_1.TypedIdentifier(type.getFirstToken(), filename, found);
28207
+ scope.addReference(type.getFirstToken(), identifier, _reference_1.ReferenceType.TypeReference, filename);
28208
+ }
28209
+ }
28181
28210
  }
28182
28211
  }
28183
28212
  }
@@ -40065,6 +40094,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
40065
40094
 
40066
40095
  Object.defineProperty(exports, "__esModule", ({ value: true }));
40067
40096
  exports.LSPLookup = void 0;
40097
+ /* eslint-disable max-len */
40068
40098
  const LServer = __webpack_require__(/*! vscode-languageserver-types */ "./node_modules/vscode-languageserver-types/lib/esm/main.js");
40069
40099
  const Statements = __webpack_require__(/*! ../abap/2_statements/statements */ "./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js");
40070
40100
  const Expressions = __webpack_require__(/*! ../abap/2_statements/expressions */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js");
@@ -40147,13 +40177,14 @@ class LSPLookup {
40147
40177
  }
40148
40178
  return { hover: hoverValue, definition: location, implementation: location, definitionId: variable, scope: bottomScope };
40149
40179
  }
40150
- for (const c of bottomScope.listClassDefinitions()) {
40180
+ // TODO: this can be optimized, no need to loop through all the defintions, the scope knows the name of the object?
40181
+ for (const c of [...bottomScope.listClassDefinitions(), ...bottomScope.listInterfaceDefinitions()]) {
40151
40182
  for (const m of ((_a = c.getMethodDefinitions()) === null || _a === void 0 ? void 0 : _a.getAll()) || []) {
40152
40183
  for (const p of ((_b = m.getParameters()) === null || _b === void 0 ? void 0 : _b.getAll()) || []) {
40153
40184
  if (p.getStart().equals(cursor.token.getStart())) {
40154
40185
  const found = _lsp_utils_1.LSPUtils.identiferToLocation(p);
40155
40186
  return {
40156
- hover: "Method Parameter, " + cursor.token.getStr(),
40187
+ hover: "Method Parameter: " + cursor.token.getStr().replace("!", ""),
40157
40188
  definition: found,
40158
40189
  definitionId: p,
40159
40190
  implementation: undefined,
@@ -40335,11 +40366,12 @@ class LSPLookup {
40335
40366
  };
40336
40367
  }
40337
40368
  static findMethodDefinition(found, scope) {
40338
- var _a, _b, _c, _d;
40369
+ var _a, _b, _c, _d, _e, _f, _g;
40339
40370
  if (scope === undefined) {
40340
40371
  return undefined;
40341
40372
  }
40342
- if (scope.getIdentifier().stype !== _scope_type_1.ScopeType.ClassDefinition
40373
+ if ((scope.getIdentifier().stype !== _scope_type_1.ScopeType.ClassDefinition
40374
+ && scope.getIdentifier().stype !== _scope_type_1.ScopeType.Interface)
40343
40375
  || !(found.snode.get() instanceof Statements.MethodDef)) {
40344
40376
  return undefined;
40345
40377
  }
@@ -40355,8 +40387,14 @@ class LSPLookup {
40355
40387
  || nameToken.getStart().getRow() !== found.token.getStart().getRow()) {
40356
40388
  return undefined;
40357
40389
  }
40358
- const def = (_d = (_c = (_b = scope.getParent()) === null || _b === void 0 ? void 0 : _b.findClassDefinition(scope.getIdentifier().sname)) === null || _c === void 0 ? void 0 : _c.getMethodDefinitions()) === null || _d === void 0 ? void 0 : _d.getByName(nameToken.getStr());
40359
- return def;
40390
+ if (scope.getIdentifier().stype === _scope_type_1.ScopeType.ClassDefinition) {
40391
+ const def = (_d = (_c = (_b = scope.getParent()) === null || _b === void 0 ? void 0 : _b.findClassDefinition(scope.getIdentifier().sname)) === null || _c === void 0 ? void 0 : _c.getMethodDefinitions()) === null || _d === void 0 ? void 0 : _d.getByName(nameToken.getStr());
40392
+ return def;
40393
+ }
40394
+ else {
40395
+ const def = (_g = (_f = (_e = scope.getParent()) === null || _e === void 0 ? void 0 : _e.findInterfaceDefinition(scope.getIdentifier().sname)) === null || _f === void 0 ? void 0 : _f.getMethodDefinitions()) === null || _g === void 0 ? void 0 : _g.getByName(nameToken.getStr());
40396
+ return def;
40397
+ }
40360
40398
  }
40361
40399
  static findFunctionModule(found) {
40362
40400
  if (!(found.snode.get() instanceof Statements.CallFunction)) {
@@ -48896,7 +48934,7 @@ class Registry {
48896
48934
  }
48897
48935
  static abaplintVersion() {
48898
48936
  // magic, see build script "version.sh"
48899
- return "2.102.43";
48937
+ return "2.102.45";
48900
48938
  }
48901
48939
  getDDICReferences() {
48902
48940
  return this.ddicReferences;
@@ -52100,7 +52138,12 @@ class CloudTypes {
52100
52138
  }
52101
52139
  run(obj) {
52102
52140
  if (this.reg.getConfig().getVersion() !== version_1.Version.Cloud
52141
+ || obj instanceof Objects.ApplicationJobCatalogEntry
52142
+ || obj instanceof Objects.ApplicationJobTemplate
52103
52143
  || obj instanceof Objects.AssignmentServiceToAuthorizationGroup
52144
+ || obj instanceof Objects.ATCCheckCategory
52145
+ || obj instanceof Objects.ATCCheckObject
52146
+ || obj instanceof Objects.ATCCheckVariant
52104
52147
  || obj instanceof Objects.AuthorizationCheckField
52105
52148
  || obj instanceof Objects.AuthorizationObject
52106
52149
  || obj instanceof Objects.AuthorizationObjectExtension
@@ -52108,11 +52151,7 @@ class CloudTypes {
52108
52151
  || obj instanceof Objects.BusinessCatalog
52109
52152
  || obj instanceof Objects.BusinessCatalogAppAssignment
52110
52153
  || obj instanceof Objects.CDSMetadataExtension
52111
- || obj instanceof Objects.RestrictionField
52112
52154
  || obj instanceof Objects.Class
52113
- || obj instanceof Objects.OutboundService
52114
- || obj instanceof Objects.ApplicationJobCatalogEntry
52115
- || obj instanceof Objects.ApplicationJobTemplate
52116
52155
  || obj instanceof Objects.CommunicationScenario
52117
52156
  || obj instanceof Objects.DataControl
52118
52157
  || obj instanceof Objects.DataDefinition
@@ -52124,11 +52163,11 @@ class CloudTypes {
52124
52163
  || obj instanceof Objects.InboundService
52125
52164
  || obj instanceof Objects.Interface
52126
52165
  || obj instanceof Objects.LockObject
52127
- || obj instanceof Objects.ATCCheckCategory
52128
- || obj instanceof Objects.ATCCheckObject
52129
- || obj instanceof Objects.ATCCheckVariant
52130
52166
  || obj instanceof Objects.MessageClass
52167
+ || obj instanceof Objects.NumberRange
52168
+ || obj instanceof Objects.OutboundService
52131
52169
  || obj instanceof Objects.Package
52170
+ || obj instanceof Objects.RestrictionField
52132
52171
  || obj instanceof Objects.RestrictionType
52133
52172
  || obj instanceof Objects.ServiceBinding
52134
52173
  || obj instanceof Objects.ServiceDefinition
@@ -53072,14 +53111,12 @@ exports.DefinitionsTop = exports.DefinitionsTopConf = void 0;
53072
53111
  const issue_1 = __webpack_require__(/*! ../issue */ "./node_modules/@abaplint/core/build/src/issue.js");
53073
53112
  const _statement_1 = __webpack_require__(/*! ../abap/2_statements/statements/_statement */ "./node_modules/@abaplint/core/build/src/abap/2_statements/statements/_statement.js");
53074
53113
  const Statements = __webpack_require__(/*! ../abap/2_statements/statements */ "./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js");
53075
- const Expressions = __webpack_require__(/*! ../abap/2_statements/expressions */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js");
53076
53114
  const Structures = __webpack_require__(/*! ../abap/3_structures/structures */ "./node_modules/@abaplint/core/build/src/abap/3_structures/structures/index.js");
53077
53115
  const _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ "./node_modules/@abaplint/core/build/src/rules/_abap_rule.js");
53078
53116
  const _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ "./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js");
53079
53117
  const _irule_1 = __webpack_require__(/*! ./_irule */ "./node_modules/@abaplint/core/build/src/rules/_irule.js");
53080
53118
  const edit_helper_1 = __webpack_require__(/*! ../edit_helper */ "./node_modules/@abaplint/core/build/src/edit_helper.js");
53081
53119
  const nodes_1 = __webpack_require__(/*! ../abap/nodes */ "./node_modules/@abaplint/core/build/src/abap/nodes/index.js");
53082
- const version_1 = __webpack_require__(/*! ../version */ "./node_modules/@abaplint/core/build/src/version.js");
53083
53120
  class DefinitionsTopConf extends _basic_rule_config_1.BasicRuleConfig {
53084
53121
  }
53085
53122
  exports.DefinitionsTopConf = DefinitionsTopConf;
@@ -53098,10 +53135,16 @@ class DefinitionsTop extends _abap_rule_1.ABAPRule {
53098
53135
  key: "definitions_top",
53099
53136
  title: "Place definitions in top of routine",
53100
53137
  shortDescription: `Checks that definitions are placed at the beginning of METHODs, FORMs and FUNCTIONs.`,
53101
- extendedInformation: `If the routine has inline definitions then no issues are reported
53102
-
53103
- https://docs.abapopenchecks.org/checks/17/`,
53138
+ extendedInformation: `https://docs.abapopenchecks.org/checks/17/`,
53104
53139
  tags: [_irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Quickfix],
53140
+ badExample: `FROM foo.
53141
+ WRITE 'hello'.
53142
+ DATA int TYPE i.
53143
+ ENDFORM.`,
53144
+ goodExample: `FROM foo.
53145
+ DATA int TYPE i.
53146
+ WRITE 'hello'.
53147
+ ENDFORM.`,
53105
53148
  };
53106
53149
  }
53107
53150
  getMessage() {
@@ -53130,10 +53173,6 @@ https://docs.abapopenchecks.org/checks/17/`,
53130
53173
  this.fixed = false;
53131
53174
  this.mode = DEFINITION;
53132
53175
  this.moveTo = (_a = r.getFirstStatement()) === null || _a === void 0 ? void 0 : _a.getLastToken().getEnd();
53133
- if (this.reg.getConfig().getVersion() !== version_1.Version.v702
53134
- && r.findFirstExpression(Expressions.InlineData)) {
53135
- continue;
53136
- }
53137
53176
  const found = this.walk(r, file);
53138
53177
  if (found) {
53139
53178
  issues.push(found);
@@ -53194,16 +53233,19 @@ https://docs.abapopenchecks.org/checks/17/`,
53194
53233
  && (get instanceof Statements.Data
53195
53234
  || get instanceof Statements.Type
53196
53235
  || get instanceof Statements.Constant
53236
+ || (get instanceof Statements.Move && c.concatTokens().toUpperCase().startsWith("DATA("))
53197
53237
  || get instanceof Statements.Static
53198
53238
  || get instanceof Statements.FieldSymbol)) {
53199
53239
  if (this.mode === AFTER) {
53200
53240
  // only one fix per routine, as it reorders a lot
53201
- let fix = undefined;
53202
- if (this.fixed === false && this.moveTo) {
53203
- fix = this.buildFix(file, c, this.moveTo);
53204
- this.fixed = true;
53241
+ if (!(get instanceof Statements.Move && c.concatTokens().toUpperCase().startsWith("DATA("))) {
53242
+ let fix = undefined;
53243
+ if (this.fixed === false && this.moveTo) {
53244
+ fix = this.buildFix(file, c, this.moveTo);
53245
+ this.fixed = true;
53246
+ }
53247
+ return issue_1.Issue.atStatement(file, c, this.getMessage(), this.getMetadata().key, this.conf.severity, fix);
53205
53248
  }
53206
- return issue_1.Issue.atStatement(file, c, this.getMessage(), this.getMetadata().key, this.conf.severity, fix);
53207
53249
  }
53208
53250
  else {
53209
53251
  this.moveTo = c.getLastToken().getEnd();
@@ -71477,6 +71519,7 @@ Builder.prototype.j2x = function(jObj, level) {
71477
71519
  let attrStr = '';
71478
71520
  let val = '';
71479
71521
  for (let key in jObj) {
71522
+ if(!jObj.hasOwnProperty(key)) continue;
71480
71523
  if (typeof jObj[key] === 'undefined') {
71481
71524
  // supress undefined node only if it is not an attribute
71482
71525
  if (this.isAttribute(key)) {
@@ -71698,6 +71741,8 @@ function arrToStr(arr, options, jPath, indentation) {
71698
71741
  for (let i = 0; i < arr.length; i++) {
71699
71742
  const tagObj = arr[i];
71700
71743
  const tagName = propName(tagObj);
71744
+ if(tagName === undefined) continue;
71745
+
71701
71746
  let newJPath = "";
71702
71747
  if (jPath.length === 0) newJPath = tagName
71703
71748
  else newJPath = `${jPath}.${tagName}`;
@@ -71767,6 +71812,7 @@ function propName(obj) {
71767
71812
  const keys = Object.keys(obj);
71768
71813
  for (let i = 0; i < keys.length; i++) {
71769
71814
  const key = keys[i];
71815
+ if(!obj.hasOwnProperty(key)) continue;
71770
71816
  if (key !== ":@") return key;
71771
71817
  }
71772
71818
  }
@@ -71775,6 +71821,7 @@ function attr_to_str(attrMap, options) {
71775
71821
  let attrStr = "";
71776
71822
  if (attrMap && !options.ignoreAttributes) {
71777
71823
  for (let attr in attrMap) {
71824
+ if(!attrMap.hasOwnProperty(attr)) continue;
71778
71825
  let attrVal = options.attributeValueProcessor(attr, attrMap[attr]);
71779
71826
  attrVal = replaceEntitiesValue(attrVal, options);
71780
71827
  if (attrVal === true && options.suppressBooleanAttributes) {
@@ -72318,6 +72365,7 @@ const parseXml = function(xmlData) {
72318
72365
  }else {//Opening tag
72319
72366
  let result = readTagExp(xmlData,i, this.options.removeNSPrefix);
72320
72367
  let tagName= result.tagName;
72368
+ const rawTagName = result.rawTagName;
72321
72369
  let tagExp = result.tagExp;
72322
72370
  let attrExpPresent = result.attrExpPresent;
72323
72371
  let closeIndex = result.closeIndex;
@@ -72343,7 +72391,7 @@ const parseXml = function(xmlData) {
72343
72391
  if(tagName !== xmlObj.tagname){
72344
72392
  jPath += jPath ? "." + tagName : tagName;
72345
72393
  }
72346
- if (this.isItStopNode(this.options.stopNodes, jPath, tagName)) { //TODO: namespace
72394
+ if (this.isItStopNode(this.options.stopNodes, jPath, tagName)) {
72347
72395
  let tagContent = "";
72348
72396
  //self-closing tag
72349
72397
  if(tagExp.length > 0 && tagExp.lastIndexOf("/") === tagExp.length - 1){
@@ -72356,8 +72404,8 @@ const parseXml = function(xmlData) {
72356
72404
  //normal tag
72357
72405
  else{
72358
72406
  //read until closing tag is found
72359
- const result = this.readStopNodeData(xmlData, tagName, closeIndex + 1);
72360
- if(!result) throw new Error(`Unexpected end of ${tagName}`);
72407
+ const result = this.readStopNodeData(xmlData, rawTagName, closeIndex + 1);
72408
+ if(!result) throw new Error(`Unexpected end of ${rawTagName}`);
72361
72409
  i = result.i;
72362
72410
  tagContent = result.tagContent;
72363
72411
  }
@@ -72542,6 +72590,7 @@ function readTagExp(xmlData,i, removeNSPrefix, closingChar = ">"){
72542
72590
  tagExp = tagExp.substr(separatorIndex + 1);
72543
72591
  }
72544
72592
 
72593
+ const rawTagName = tagName;
72545
72594
  if(removeNSPrefix){
72546
72595
  const colonIndex = tagName.indexOf(":");
72547
72596
  if(colonIndex !== -1){
@@ -72555,6 +72604,7 @@ function readTagExp(xmlData,i, removeNSPrefix, closingChar = ">"){
72555
72604
  tagExp: tagExp,
72556
72605
  closeIndex: closeIndex,
72557
72606
  attrExpPresent: attrExpPresent,
72607
+ rawTagName: rawTagName,
72558
72608
  }
72559
72609
  }
72560
72610
  /**
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@abaplint/cli",
3
- "version": "2.102.43",
3
+ "version": "2.102.45",
4
4
  "description": "abaplint - Command Line Interface",
5
5
  "funding": "https://github.com/sponsors/larshp",
6
6
  "bin": {
7
- "abaplint": "./abaplint"
7
+ "abaplint": "abaplint"
8
8
  },
9
9
  "scripts": {
10
10
  "lint": "eslint src/**/*.ts test/**/*.ts --format unix",
@@ -38,12 +38,12 @@
38
38
  },
39
39
  "homepage": "https://abaplint.org",
40
40
  "devDependencies": {
41
- "@abaplint/core": "^2.102.43",
41
+ "@abaplint/core": "^2.102.45",
42
42
  "@types/chai": "^4.3.6",
43
43
  "@types/glob": "^7.2.0",
44
44
  "@types/minimist": "^1.2.2",
45
45
  "@types/mocha": "^10.0.1",
46
- "@types/node": "^20.6.2",
46
+ "@types/node": "^20.6.3",
47
47
  "@types/progress": "^2.0.5",
48
48
  "chai": "^4.3.8",
49
49
  "chalk": "^5.3.0",