@abaplint/cli 2.102.44 → 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 +49 -19
  2. package/package.json +2 -2
package/build/cli.js CHANGED
@@ -28174,6 +28174,9 @@ const target_1 = __webpack_require__(/*! ../expressions/target */ "./node_module
28174
28174
  const source_1 = __webpack_require__(/*! ../expressions/source */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/source.js");
28175
28175
  const dynamic_1 = __webpack_require__(/*! ../expressions/dynamic */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/dynamic.js");
28176
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");
28177
28180
  class CreateData {
28178
28181
  runSyntax(node, scope, filename) {
28179
28182
  for (const s of node.findDirectExpressions(Expressions.Source)) {
@@ -28187,7 +28190,23 @@ class CreateData {
28187
28190
  }
28188
28191
  const type = node.findDirectExpression(Expressions.TypeName);
28189
28192
  if (type) {
28190
- 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
+ }
28191
28210
  }
28192
28211
  }
28193
28212
  }
@@ -48915,7 +48934,7 @@ class Registry {
48915
48934
  }
48916
48935
  static abaplintVersion() {
48917
48936
  // magic, see build script "version.sh"
48918
- return "2.102.44";
48937
+ return "2.102.45";
48919
48938
  }
48920
48939
  getDDICReferences() {
48921
48940
  return this.ddicReferences;
@@ -53092,14 +53111,12 @@ exports.DefinitionsTop = exports.DefinitionsTopConf = void 0;
53092
53111
  const issue_1 = __webpack_require__(/*! ../issue */ "./node_modules/@abaplint/core/build/src/issue.js");
53093
53112
  const _statement_1 = __webpack_require__(/*! ../abap/2_statements/statements/_statement */ "./node_modules/@abaplint/core/build/src/abap/2_statements/statements/_statement.js");
53094
53113
  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
53114
  const Structures = __webpack_require__(/*! ../abap/3_structures/structures */ "./node_modules/@abaplint/core/build/src/abap/3_structures/structures/index.js");
53097
53115
  const _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ "./node_modules/@abaplint/core/build/src/rules/_abap_rule.js");
53098
53116
  const _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ "./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js");
53099
53117
  const _irule_1 = __webpack_require__(/*! ./_irule */ "./node_modules/@abaplint/core/build/src/rules/_irule.js");
53100
53118
  const edit_helper_1 = __webpack_require__(/*! ../edit_helper */ "./node_modules/@abaplint/core/build/src/edit_helper.js");
53101
53119
  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
53120
  class DefinitionsTopConf extends _basic_rule_config_1.BasicRuleConfig {
53104
53121
  }
53105
53122
  exports.DefinitionsTopConf = DefinitionsTopConf;
@@ -53118,10 +53135,16 @@ class DefinitionsTop extends _abap_rule_1.ABAPRule {
53118
53135
  key: "definitions_top",
53119
53136
  title: "Place definitions in top of routine",
53120
53137
  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/`,
53138
+ extendedInformation: `https://docs.abapopenchecks.org/checks/17/`,
53124
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.`,
53125
53148
  };
53126
53149
  }
53127
53150
  getMessage() {
@@ -53150,10 +53173,6 @@ https://docs.abapopenchecks.org/checks/17/`,
53150
53173
  this.fixed = false;
53151
53174
  this.mode = DEFINITION;
53152
53175
  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
53176
  const found = this.walk(r, file);
53158
53177
  if (found) {
53159
53178
  issues.push(found);
@@ -53214,16 +53233,19 @@ https://docs.abapopenchecks.org/checks/17/`,
53214
53233
  && (get instanceof Statements.Data
53215
53234
  || get instanceof Statements.Type
53216
53235
  || get instanceof Statements.Constant
53236
+ || (get instanceof Statements.Move && c.concatTokens().toUpperCase().startsWith("DATA("))
53217
53237
  || get instanceof Statements.Static
53218
53238
  || get instanceof Statements.FieldSymbol)) {
53219
53239
  if (this.mode === AFTER) {
53220
53240
  // 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;
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);
53225
53248
  }
53226
- return issue_1.Issue.atStatement(file, c, this.getMessage(), this.getMetadata().key, this.conf.severity, fix);
53227
53249
  }
53228
53250
  else {
53229
53251
  this.moveTo = c.getLastToken().getEnd();
@@ -71497,6 +71519,7 @@ Builder.prototype.j2x = function(jObj, level) {
71497
71519
  let attrStr = '';
71498
71520
  let val = '';
71499
71521
  for (let key in jObj) {
71522
+ if(!jObj.hasOwnProperty(key)) continue;
71500
71523
  if (typeof jObj[key] === 'undefined') {
71501
71524
  // supress undefined node only if it is not an attribute
71502
71525
  if (this.isAttribute(key)) {
@@ -71718,6 +71741,8 @@ function arrToStr(arr, options, jPath, indentation) {
71718
71741
  for (let i = 0; i < arr.length; i++) {
71719
71742
  const tagObj = arr[i];
71720
71743
  const tagName = propName(tagObj);
71744
+ if(tagName === undefined) continue;
71745
+
71721
71746
  let newJPath = "";
71722
71747
  if (jPath.length === 0) newJPath = tagName
71723
71748
  else newJPath = `${jPath}.${tagName}`;
@@ -71787,6 +71812,7 @@ function propName(obj) {
71787
71812
  const keys = Object.keys(obj);
71788
71813
  for (let i = 0; i < keys.length; i++) {
71789
71814
  const key = keys[i];
71815
+ if(!obj.hasOwnProperty(key)) continue;
71790
71816
  if (key !== ":@") return key;
71791
71817
  }
71792
71818
  }
@@ -71795,6 +71821,7 @@ function attr_to_str(attrMap, options) {
71795
71821
  let attrStr = "";
71796
71822
  if (attrMap && !options.ignoreAttributes) {
71797
71823
  for (let attr in attrMap) {
71824
+ if(!attrMap.hasOwnProperty(attr)) continue;
71798
71825
  let attrVal = options.attributeValueProcessor(attr, attrMap[attr]);
71799
71826
  attrVal = replaceEntitiesValue(attrVal, options);
71800
71827
  if (attrVal === true && options.suppressBooleanAttributes) {
@@ -72338,6 +72365,7 @@ const parseXml = function(xmlData) {
72338
72365
  }else {//Opening tag
72339
72366
  let result = readTagExp(xmlData,i, this.options.removeNSPrefix);
72340
72367
  let tagName= result.tagName;
72368
+ const rawTagName = result.rawTagName;
72341
72369
  let tagExp = result.tagExp;
72342
72370
  let attrExpPresent = result.attrExpPresent;
72343
72371
  let closeIndex = result.closeIndex;
@@ -72363,7 +72391,7 @@ const parseXml = function(xmlData) {
72363
72391
  if(tagName !== xmlObj.tagname){
72364
72392
  jPath += jPath ? "." + tagName : tagName;
72365
72393
  }
72366
- if (this.isItStopNode(this.options.stopNodes, jPath, tagName)) { //TODO: namespace
72394
+ if (this.isItStopNode(this.options.stopNodes, jPath, tagName)) {
72367
72395
  let tagContent = "";
72368
72396
  //self-closing tag
72369
72397
  if(tagExp.length > 0 && tagExp.lastIndexOf("/") === tagExp.length - 1){
@@ -72376,8 +72404,8 @@ const parseXml = function(xmlData) {
72376
72404
  //normal tag
72377
72405
  else{
72378
72406
  //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}`);
72407
+ const result = this.readStopNodeData(xmlData, rawTagName, closeIndex + 1);
72408
+ if(!result) throw new Error(`Unexpected end of ${rawTagName}`);
72381
72409
  i = result.i;
72382
72410
  tagContent = result.tagContent;
72383
72411
  }
@@ -72562,6 +72590,7 @@ function readTagExp(xmlData,i, removeNSPrefix, closingChar = ">"){
72562
72590
  tagExp = tagExp.substr(separatorIndex + 1);
72563
72591
  }
72564
72592
 
72593
+ const rawTagName = tagName;
72565
72594
  if(removeNSPrefix){
72566
72595
  const colonIndex = tagName.indexOf(":");
72567
72596
  if(colonIndex !== -1){
@@ -72575,6 +72604,7 @@ function readTagExp(xmlData,i, removeNSPrefix, closingChar = ">"){
72575
72604
  tagExp: tagExp,
72576
72605
  closeIndex: closeIndex,
72577
72606
  attrExpPresent: attrExpPresent,
72607
+ rawTagName: rawTagName,
72578
72608
  }
72579
72609
  }
72580
72610
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/cli",
3
- "version": "2.102.44",
3
+ "version": "2.102.45",
4
4
  "description": "abaplint - Command Line Interface",
5
5
  "funding": "https://github.com/sponsors/larshp",
6
6
  "bin": {
@@ -38,7 +38,7 @@
38
38
  },
39
39
  "homepage": "https://abaplint.org",
40
40
  "devDependencies": {
41
- "@abaplint/core": "^2.102.44",
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",