@abaplint/cli 2.102.44 → 2.102.46

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 +51 -22
  2. package/package.json +5 -5
package/build/cli.js CHANGED
@@ -21792,11 +21792,10 @@ class TypeUtils {
21792
21792
  }
21793
21793
  }
21794
21794
  else if (source instanceof basic_1.IntegerType) {
21795
- if (target instanceof basic_1.StringType
21796
- || target instanceof basic_1.PackedType) {
21795
+ if (target instanceof basic_1.StringType) {
21797
21796
  return false;
21798
21797
  }
21799
- else if (target instanceof basic_1.Integer8Type) {
21798
+ else if (target instanceof basic_1.Integer8Type || target instanceof basic_1.PackedType) {
21800
21799
  if (((_h = source.getAbstractTypeData()) === null || _h === void 0 ? void 0 : _h.derivedFromConstant) === true) {
21801
21800
  return true;
21802
21801
  }
@@ -28174,6 +28173,9 @@ const target_1 = __webpack_require__(/*! ../expressions/target */ "./node_module
28174
28173
  const source_1 = __webpack_require__(/*! ../expressions/source */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/source.js");
28175
28174
  const dynamic_1 = __webpack_require__(/*! ../expressions/dynamic */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/dynamic.js");
28176
28175
  const basic_types_1 = __webpack_require__(/*! ../basic_types */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/basic_types.js");
28176
+ const basic_1 = __webpack_require__(/*! ../../types/basic */ "./node_modules/@abaplint/core/build/src/abap/types/basic/index.js");
28177
+ const _typed_identifier_1 = __webpack_require__(/*! ../../types/_typed_identifier */ "./node_modules/@abaplint/core/build/src/abap/types/_typed_identifier.js");
28178
+ const _reference_1 = __webpack_require__(/*! ../_reference */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_reference.js");
28177
28179
  class CreateData {
28178
28180
  runSyntax(node, scope, filename) {
28179
28181
  for (const s of node.findDirectExpressions(Expressions.Source)) {
@@ -28187,7 +28189,23 @@ class CreateData {
28187
28189
  }
28188
28190
  const type = node.findDirectExpression(Expressions.TypeName);
28189
28191
  if (type) {
28190
- new basic_types_1.BasicTypes(filename, scope).resolveTypeName(type);
28192
+ const found = new basic_types_1.BasicTypes(filename, scope).resolveTypeName(type);
28193
+ if (found instanceof basic_1.UnknownType) {
28194
+ if (node.concatTokens().toUpperCase().includes(" REF TO ")) {
28195
+ const def = scope.findObjectDefinition(type.concatTokens());
28196
+ if (def) {
28197
+ scope.addReference(type.getFirstToken(), def, _reference_1.ReferenceType.TypeReference, filename);
28198
+ }
28199
+ else {
28200
+ const identifier = new _typed_identifier_1.TypedIdentifier(type.getFirstToken(), filename, found);
28201
+ scope.addReference(type.getFirstToken(), identifier, _reference_1.ReferenceType.TypeReference, filename);
28202
+ }
28203
+ }
28204
+ else {
28205
+ const identifier = new _typed_identifier_1.TypedIdentifier(type.getFirstToken(), filename, found);
28206
+ scope.addReference(type.getFirstToken(), identifier, _reference_1.ReferenceType.TypeReference, filename);
28207
+ }
28208
+ }
28191
28209
  }
28192
28210
  }
28193
28211
  }
@@ -48915,7 +48933,7 @@ class Registry {
48915
48933
  }
48916
48934
  static abaplintVersion() {
48917
48935
  // magic, see build script "version.sh"
48918
- return "2.102.44";
48936
+ return "2.102.46";
48919
48937
  }
48920
48938
  getDDICReferences() {
48921
48939
  return this.ddicReferences;
@@ -53092,14 +53110,12 @@ exports.DefinitionsTop = exports.DefinitionsTopConf = void 0;
53092
53110
  const issue_1 = __webpack_require__(/*! ../issue */ "./node_modules/@abaplint/core/build/src/issue.js");
53093
53111
  const _statement_1 = __webpack_require__(/*! ../abap/2_statements/statements/_statement */ "./node_modules/@abaplint/core/build/src/abap/2_statements/statements/_statement.js");
53094
53112
  const Statements = __webpack_require__(/*! ../abap/2_statements/statements */ "./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js");
53095
- const Expressions = __webpack_require__(/*! ../abap/2_statements/expressions */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js");
53096
53113
  const Structures = __webpack_require__(/*! ../abap/3_structures/structures */ "./node_modules/@abaplint/core/build/src/abap/3_structures/structures/index.js");
53097
53114
  const _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ "./node_modules/@abaplint/core/build/src/rules/_abap_rule.js");
53098
53115
  const _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ "./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js");
53099
53116
  const _irule_1 = __webpack_require__(/*! ./_irule */ "./node_modules/@abaplint/core/build/src/rules/_irule.js");
53100
53117
  const edit_helper_1 = __webpack_require__(/*! ../edit_helper */ "./node_modules/@abaplint/core/build/src/edit_helper.js");
53101
53118
  const nodes_1 = __webpack_require__(/*! ../abap/nodes */ "./node_modules/@abaplint/core/build/src/abap/nodes/index.js");
53102
- const version_1 = __webpack_require__(/*! ../version */ "./node_modules/@abaplint/core/build/src/version.js");
53103
53119
  class DefinitionsTopConf extends _basic_rule_config_1.BasicRuleConfig {
53104
53120
  }
53105
53121
  exports.DefinitionsTopConf = DefinitionsTopConf;
@@ -53118,10 +53134,16 @@ class DefinitionsTop extends _abap_rule_1.ABAPRule {
53118
53134
  key: "definitions_top",
53119
53135
  title: "Place definitions in top of routine",
53120
53136
  shortDescription: `Checks that definitions are placed at the beginning of METHODs, FORMs and FUNCTIONs.`,
53121
- extendedInformation: `If the routine has inline definitions then no issues are reported
53122
-
53123
- https://docs.abapopenchecks.org/checks/17/`,
53137
+ extendedInformation: `https://docs.abapopenchecks.org/checks/17/`,
53124
53138
  tags: [_irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Quickfix],
53139
+ badExample: `FROM foo.
53140
+ WRITE 'hello'.
53141
+ DATA int TYPE i.
53142
+ ENDFORM.`,
53143
+ goodExample: `FROM foo.
53144
+ DATA int TYPE i.
53145
+ WRITE 'hello'.
53146
+ ENDFORM.`,
53125
53147
  };
53126
53148
  }
53127
53149
  getMessage() {
@@ -53150,10 +53172,6 @@ https://docs.abapopenchecks.org/checks/17/`,
53150
53172
  this.fixed = false;
53151
53173
  this.mode = DEFINITION;
53152
53174
  this.moveTo = (_a = r.getFirstStatement()) === null || _a === void 0 ? void 0 : _a.getLastToken().getEnd();
53153
- if (this.reg.getConfig().getVersion() !== version_1.Version.v702
53154
- && r.findFirstExpression(Expressions.InlineData)) {
53155
- continue;
53156
- }
53157
53175
  const found = this.walk(r, file);
53158
53176
  if (found) {
53159
53177
  issues.push(found);
@@ -53214,16 +53232,19 @@ https://docs.abapopenchecks.org/checks/17/`,
53214
53232
  && (get instanceof Statements.Data
53215
53233
  || get instanceof Statements.Type
53216
53234
  || get instanceof Statements.Constant
53235
+ || (get instanceof Statements.Move && c.concatTokens().toUpperCase().startsWith("DATA("))
53217
53236
  || get instanceof Statements.Static
53218
53237
  || get instanceof Statements.FieldSymbol)) {
53219
53238
  if (this.mode === AFTER) {
53220
53239
  // only one fix per routine, as it reorders a lot
53221
- let fix = undefined;
53222
- if (this.fixed === false && this.moveTo) {
53223
- fix = this.buildFix(file, c, this.moveTo);
53224
- this.fixed = true;
53240
+ if (!(get instanceof Statements.Move && c.concatTokens().toUpperCase().startsWith("DATA("))) {
53241
+ let fix = undefined;
53242
+ if (this.fixed === false && this.moveTo) {
53243
+ fix = this.buildFix(file, c, this.moveTo);
53244
+ this.fixed = true;
53245
+ }
53246
+ return issue_1.Issue.atStatement(file, c, this.getMessage(), this.getMetadata().key, this.conf.severity, fix);
53225
53247
  }
53226
- return issue_1.Issue.atStatement(file, c, this.getMessage(), this.getMetadata().key, this.conf.severity, fix);
53227
53248
  }
53228
53249
  else {
53229
53250
  this.moveTo = c.getLastToken().getEnd();
@@ -71497,6 +71518,7 @@ Builder.prototype.j2x = function(jObj, level) {
71497
71518
  let attrStr = '';
71498
71519
  let val = '';
71499
71520
  for (let key in jObj) {
71521
+ if(!jObj.hasOwnProperty(key)) continue;
71500
71522
  if (typeof jObj[key] === 'undefined') {
71501
71523
  // supress undefined node only if it is not an attribute
71502
71524
  if (this.isAttribute(key)) {
@@ -71718,6 +71740,8 @@ function arrToStr(arr, options, jPath, indentation) {
71718
71740
  for (let i = 0; i < arr.length; i++) {
71719
71741
  const tagObj = arr[i];
71720
71742
  const tagName = propName(tagObj);
71743
+ if(tagName === undefined) continue;
71744
+
71721
71745
  let newJPath = "";
71722
71746
  if (jPath.length === 0) newJPath = tagName
71723
71747
  else newJPath = `${jPath}.${tagName}`;
@@ -71787,6 +71811,7 @@ function propName(obj) {
71787
71811
  const keys = Object.keys(obj);
71788
71812
  for (let i = 0; i < keys.length; i++) {
71789
71813
  const key = keys[i];
71814
+ if(!obj.hasOwnProperty(key)) continue;
71790
71815
  if (key !== ":@") return key;
71791
71816
  }
71792
71817
  }
@@ -71795,6 +71820,7 @@ function attr_to_str(attrMap, options) {
71795
71820
  let attrStr = "";
71796
71821
  if (attrMap && !options.ignoreAttributes) {
71797
71822
  for (let attr in attrMap) {
71823
+ if(!attrMap.hasOwnProperty(attr)) continue;
71798
71824
  let attrVal = options.attributeValueProcessor(attr, attrMap[attr]);
71799
71825
  attrVal = replaceEntitiesValue(attrVal, options);
71800
71826
  if (attrVal === true && options.suppressBooleanAttributes) {
@@ -72338,6 +72364,7 @@ const parseXml = function(xmlData) {
72338
72364
  }else {//Opening tag
72339
72365
  let result = readTagExp(xmlData,i, this.options.removeNSPrefix);
72340
72366
  let tagName= result.tagName;
72367
+ const rawTagName = result.rawTagName;
72341
72368
  let tagExp = result.tagExp;
72342
72369
  let attrExpPresent = result.attrExpPresent;
72343
72370
  let closeIndex = result.closeIndex;
@@ -72363,7 +72390,7 @@ const parseXml = function(xmlData) {
72363
72390
  if(tagName !== xmlObj.tagname){
72364
72391
  jPath += jPath ? "." + tagName : tagName;
72365
72392
  }
72366
- if (this.isItStopNode(this.options.stopNodes, jPath, tagName)) { //TODO: namespace
72393
+ if (this.isItStopNode(this.options.stopNodes, jPath, tagName)) {
72367
72394
  let tagContent = "";
72368
72395
  //self-closing tag
72369
72396
  if(tagExp.length > 0 && tagExp.lastIndexOf("/") === tagExp.length - 1){
@@ -72376,8 +72403,8 @@ const parseXml = function(xmlData) {
72376
72403
  //normal tag
72377
72404
  else{
72378
72405
  //read until closing tag is found
72379
- const result = this.readStopNodeData(xmlData, tagName, closeIndex + 1);
72380
- if(!result) throw new Error(`Unexpected end of ${tagName}`);
72406
+ const result = this.readStopNodeData(xmlData, rawTagName, closeIndex + 1);
72407
+ if(!result) throw new Error(`Unexpected end of ${rawTagName}`);
72381
72408
  i = result.i;
72382
72409
  tagContent = result.tagContent;
72383
72410
  }
@@ -72562,6 +72589,7 @@ function readTagExp(xmlData,i, removeNSPrefix, closingChar = ">"){
72562
72589
  tagExp = tagExp.substr(separatorIndex + 1);
72563
72590
  }
72564
72591
 
72592
+ const rawTagName = tagName;
72565
72593
  if(removeNSPrefix){
72566
72594
  const colonIndex = tagName.indexOf(":");
72567
72595
  if(colonIndex !== -1){
@@ -72575,6 +72603,7 @@ function readTagExp(xmlData,i, removeNSPrefix, closingChar = ">"){
72575
72603
  tagExp: tagExp,
72576
72604
  closeIndex: closeIndex,
72577
72605
  attrExpPresent: attrExpPresent,
72606
+ rawTagName: rawTagName,
72578
72607
  }
72579
72608
  }
72580
72609
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/cli",
3
- "version": "2.102.44",
3
+ "version": "2.102.46",
4
4
  "description": "abaplint - Command Line Interface",
5
5
  "funding": "https://github.com/sponsors/larshp",
6
6
  "bin": {
@@ -38,19 +38,19 @@
38
38
  },
39
39
  "homepage": "https://abaplint.org",
40
40
  "devDependencies": {
41
- "@abaplint/core": "^2.102.44",
41
+ "@abaplint/core": "^2.102.46",
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.3",
46
+ "@types/node": "^20.6.5",
47
47
  "@types/progress": "^2.0.5",
48
48
  "chai": "^4.3.8",
49
49
  "chalk": "^5.3.0",
50
- "eslint": "^8.49.0",
50
+ "eslint": "^8.50.0",
51
51
  "glob": "^7.2.3",
52
52
  "json5": "^2.2.3",
53
- "memfs": "^4.3.0",
53
+ "memfs": "^4.4.0",
54
54
  "minimist": "^1.2.8",
55
55
  "mocha": "^10.2.0",
56
56
  "progress": "^2.0.3",