@abaplint/core 2.91.14 → 2.91.17

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.
@@ -1475,6 +1475,7 @@ declare class Domain extends AbstractObject {
1475
1475
  private parsedType;
1476
1476
  getType(): string;
1477
1477
  getDescription(): string | undefined;
1478
+ getConversionExit(): string | undefined;
1478
1479
  getAllowedNaming(): {
1479
1480
  maxLength: number;
1480
1481
  allowNamespace: boolean;
@@ -1780,10 +1781,10 @@ declare namespace Expressions {
1780
1781
  ArithOperator,
1781
1782
  ArrowOrDash,
1782
1783
  Arrow,
1784
+ AssociationName,
1783
1785
  AttributeChain,
1784
1786
  AttributeName,
1785
1787
  BlockName,
1786
- AssociationName,
1787
1788
  CallTransformationOptions,
1788
1789
  CallTransformationParameters,
1789
1790
  Cast,
@@ -1794,7 +1795,6 @@ declare namespace Expressions {
1794
1795
  Color,
1795
1796
  CompareOperator,
1796
1797
  Compare,
1797
- TestSeamName,
1798
1798
  ComponentChainSimple,
1799
1799
  ComponentChain,
1800
1800
  ComponentCompareSimple,
@@ -1934,6 +1934,7 @@ declare namespace Expressions {
1934
1934
  SQLGroupBy,
1935
1935
  SQLHaving,
1936
1936
  SQLHints,
1937
+ SQLIn,
1937
1938
  SQLIntoStructure,
1938
1939
  SQLIntoTable,
1939
1940
  SQLJoin,
@@ -1942,6 +1943,7 @@ declare namespace Expressions {
1942
1943
  SQLSourceSimple,
1943
1944
  SQLSource,
1944
1945
  SQLTarget,
1946
+ SQLUpTo,
1945
1947
  StringTemplateFormatting,
1946
1948
  StringTemplateSource,
1947
1949
  StringTemplate,
@@ -1952,6 +1954,7 @@ declare namespace Expressions {
1952
1954
  TargetFieldSymbol,
1953
1955
  TargetField,
1954
1956
  Target,
1957
+ TestSeamName,
1955
1958
  TextElementKey,
1956
1959
  TextElementString,
1957
1960
  TextElement,
@@ -1962,9 +1965,8 @@ declare namespace Expressions {
1962
1965
  TypeTableKey,
1963
1966
  TypeTable,
1964
1967
  Type_2 as Type,
1965
- SQLUpTo,
1966
- ValueBody,
1967
1968
  ValueBodyLines,
1969
+ ValueBody,
1968
1970
  Value,
1969
1971
  WithName,
1970
1972
  WriteOffsetLength
@@ -4966,6 +4968,10 @@ declare class SQLHints extends Expression {
4966
4968
  getRunnable(): IStatementRunnable;
4967
4969
  }
4968
4970
 
4971
+ declare class SQLIn extends Expression {
4972
+ getRunnable(): IStatementRunnable;
4973
+ }
4974
+
4969
4975
  declare class SQLIntoStructure extends Expression {
4970
4976
  getRunnable(): IStatementRunnable;
4971
4977
  }
@@ -20,10 +20,10 @@ __exportStar(require("./and_return"), exports);
20
20
  __exportStar(require("./arith_operator"), exports);
21
21
  __exportStar(require("./arrow_or_dash"), exports);
22
22
  __exportStar(require("./arrow"), exports);
23
+ __exportStar(require("./association_name"), exports);
23
24
  __exportStar(require("./attribute_chain"), exports);
24
25
  __exportStar(require("./attribute_name"), exports);
25
26
  __exportStar(require("./block_name"), exports);
26
- __exportStar(require("./association_name"), exports);
27
27
  __exportStar(require("./call_transformation_options"), exports);
28
28
  __exportStar(require("./call_transformation_parameters"), exports);
29
29
  __exportStar(require("./cast"), exports);
@@ -34,7 +34,6 @@ __exportStar(require("./class_name"), exports);
34
34
  __exportStar(require("./color"), exports);
35
35
  __exportStar(require("./compare_operator"), exports);
36
36
  __exportStar(require("./compare"), exports);
37
- __exportStar(require("./test_seam_name"), exports);
38
37
  __exportStar(require("./component_chain_simple"), exports);
39
38
  __exportStar(require("./component_chain"), exports);
40
39
  __exportStar(require("./component_compare_simple"), exports);
@@ -174,6 +173,7 @@ __exportStar(require("./sql_function"), exports);
174
173
  __exportStar(require("./sql_group_by"), exports);
175
174
  __exportStar(require("./sql_having"), exports);
176
175
  __exportStar(require("./sql_hints"), exports);
176
+ __exportStar(require("./sql_in"), exports);
177
177
  __exportStar(require("./sql_into_structure"), exports);
178
178
  __exportStar(require("./sql_into_table"), exports);
179
179
  __exportStar(require("./sql_join"), exports);
@@ -182,6 +182,7 @@ __exportStar(require("./sql_path"), exports);
182
182
  __exportStar(require("./sql_source_simple"), exports);
183
183
  __exportStar(require("./sql_source"), exports);
184
184
  __exportStar(require("./sql_target"), exports);
185
+ __exportStar(require("./sql_up_to"), exports);
185
186
  __exportStar(require("./string_template_formatting"), exports);
186
187
  __exportStar(require("./string_template_source"), exports);
187
188
  __exportStar(require("./string_template"), exports);
@@ -192,6 +193,7 @@ __exportStar(require("./table_expression"), exports);
192
193
  __exportStar(require("./target_field_symbol"), exports);
193
194
  __exportStar(require("./target_field"), exports);
194
195
  __exportStar(require("./target"), exports);
196
+ __exportStar(require("./test_seam_name"), exports);
195
197
  __exportStar(require("./text_element_key"), exports);
196
198
  __exportStar(require("./text_element_string"), exports);
197
199
  __exportStar(require("./text_element"), exports);
@@ -202,9 +204,8 @@ __exportStar(require("./type_param"), exports);
202
204
  __exportStar(require("./type_table_key"), exports);
203
205
  __exportStar(require("./type_table"), exports);
204
206
  __exportStar(require("./type"), exports);
205
- __exportStar(require("./sql_up_to"), exports);
206
- __exportStar(require("./value_body"), exports);
207
207
  __exportStar(require("./value_body_lines"), exports);
208
+ __exportStar(require("./value_body"), exports);
208
209
  __exportStar(require("./value"), exports);
209
210
  __exportStar(require("./with_name"), exports);
210
211
  __exportStar(require("./write_offset_length"), exports);
@@ -3,23 +3,17 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SQLCompare = void 0;
4
4
  const combi_1 = require("../combi");
5
5
  const _1 = require(".");
6
- const tokens_1 = require("../../1_lexer/tokens");
7
6
  const version_1 = require("../../../version");
8
7
  class SQLCompare extends combi_1.Expression {
9
8
  getRunnable() {
10
- const val = new _1.SQLSource();
11
- const listOld = (0, combi_1.seq)((0, combi_1.tok)(tokens_1.WParenLeft), val, (0, combi_1.starPrio)((0, combi_1.seq)(",", val)), (0, combi_1.altPrio)((0, combi_1.tok)(tokens_1.ParenRight), (0, combi_1.tok)(tokens_1.ParenRightW), (0, combi_1.tok)(tokens_1.WParenRightW)));
12
- const listNew = (0, combi_1.seq)((0, combi_1.tok)(tokens_1.WParenLeftW), val, (0, combi_1.starPrio)((0, combi_1.seq)(",", val)), (0, combi_1.altPrio)((0, combi_1.tok)(tokens_1.WParenRight), (0, combi_1.tok)(tokens_1.WParenRightW)));
13
- const list = (0, combi_1.alt)(listOld, (0, combi_1.ver)(version_1.Version.v740sp02, listNew)); // version is a guess, https://github.com/abaplint/abaplint/issues/2530
14
9
  const subSelect = (0, combi_1.seq)("(", _1.Select, ")");
15
- const inn = (0, combi_1.seq)("IN", (0, combi_1.altPrio)(_1.SQLSource, list, subSelect));
16
10
  const between = (0, combi_1.seq)("BETWEEN", _1.SQLSource, "AND", _1.SQLSource);
17
11
  const like = (0, combi_1.seq)("LIKE", _1.SQLSource, (0, combi_1.optPrio)((0, combi_1.seq)("ESCAPE", _1.SQLSource)));
18
12
  const nul = (0, combi_1.seq)("IS", (0, combi_1.optPrio)("NOT"), (0, combi_1.altPrio)("NULL", (0, combi_1.ver)(version_1.Version.v753, "INITIAL")));
19
13
  const source = new _1.SQLSource();
20
14
  const sub = (0, combi_1.seq)((0, combi_1.optPrio)((0, combi_1.altPrio)("ALL", "ANY", "SOME")), subSelect);
21
15
  const arith = (0, combi_1.ver)(version_1.Version.v750, (0, combi_1.plusPrio)((0, combi_1.seq)((0, combi_1.altPrio)("+", "-", "*", "/"), _1.SQLFieldName)));
22
- const rett = (0, combi_1.seq)((0, combi_1.altPrio)(_1.SQLFunction, (0, combi_1.seq)(_1.SQLFieldName, (0, combi_1.optPrio)(arith))), (0, combi_1.altPrio)((0, combi_1.seq)(_1.SQLCompareOperator, (0, combi_1.altPrio)(sub, source)), (0, combi_1.seq)((0, combi_1.optPrio)("NOT"), (0, combi_1.altPrio)(inn, like, between)), nul));
16
+ const rett = (0, combi_1.seq)((0, combi_1.altPrio)(_1.SQLFunction, (0, combi_1.seq)(_1.SQLFieldName, (0, combi_1.optPrio)(arith))), (0, combi_1.altPrio)((0, combi_1.seq)(_1.SQLCompareOperator, (0, combi_1.altPrio)(sub, source)), (0, combi_1.seq)((0, combi_1.optPrio)("NOT"), (0, combi_1.altPrio)(_1.SQLIn, like, between)), nul));
23
17
  const exists = (0, combi_1.seq)("EXISTS", subSelect);
24
18
  return (0, combi_1.altPrio)(exists, _1.Dynamic, rett);
25
19
  }
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SQLIn = void 0;
4
+ const combi_1 = require("../combi");
5
+ const _1 = require(".");
6
+ const tokens_1 = require("../../1_lexer/tokens");
7
+ const version_1 = require("../../../version");
8
+ class SQLIn extends combi_1.Expression {
9
+ getRunnable() {
10
+ const val = new _1.SQLSource();
11
+ const listOld = (0, combi_1.seq)((0, combi_1.tok)(tokens_1.WParenLeft), val, (0, combi_1.starPrio)((0, combi_1.seq)(",", val)), (0, combi_1.altPrio)((0, combi_1.tok)(tokens_1.ParenRight), (0, combi_1.tok)(tokens_1.ParenRightW), (0, combi_1.tok)(tokens_1.WParenRightW)));
12
+ const listNew = (0, combi_1.seq)((0, combi_1.tok)(tokens_1.WParenLeftW), val, (0, combi_1.starPrio)((0, combi_1.seq)(",", val)), (0, combi_1.altPrio)((0, combi_1.tok)(tokens_1.WParenRight), (0, combi_1.tok)(tokens_1.WParenRightW)));
13
+ const list = (0, combi_1.alt)(listOld, (0, combi_1.ver)(version_1.Version.v740sp02, listNew)); // version is a guess, https://github.com/abaplint/abaplint/issues/2530
14
+ const subSelect = (0, combi_1.seq)("(", _1.Select, ")");
15
+ const inn = (0, combi_1.seq)("IN", (0, combi_1.altPrio)(_1.SQLSource, list, subSelect));
16
+ return inn;
17
+ }
18
+ }
19
+ exports.SQLIn = SQLIn;
20
+ //# sourceMappingURL=sql_in.js.map
@@ -13,6 +13,10 @@ class Domain extends _abstract_object_1.AbstractObject {
13
13
  var _a;
14
14
  return (_a = this.parsedXML) === null || _a === void 0 ? void 0 : _a.description;
15
15
  }
16
+ getConversionExit() {
17
+ var _a;
18
+ return (_a = this.parsedXML) === null || _a === void 0 ? void 0 : _a.conversionExit;
19
+ }
16
20
  getAllowedNaming() {
17
21
  return {
18
22
  maxLength: 30,
@@ -62,6 +66,7 @@ class Domain extends _abstract_object_1.AbstractObject {
62
66
  description: dd01v === null || dd01v === void 0 ? void 0 : dd01v.DDTEXT,
63
67
  datatype: dd01v === null || dd01v === void 0 ? void 0 : dd01v.DATATYPE,
64
68
  length: dd01v === null || dd01v === void 0 ? void 0 : dd01v.LENG,
69
+ conversionExit: dd01v === null || dd01v === void 0 ? void 0 : dd01v.CONVEXIT,
65
70
  decimals: dd01v === null || dd01v === void 0 ? void 0 : dd01v.DECIMALS,
66
71
  values: values,
67
72
  };
@@ -68,7 +68,7 @@ class Registry {
68
68
  }
69
69
  static abaplintVersion() {
70
70
  // magic, see build script "version.sh"
71
- return "2.91.14";
71
+ return "2.91.17";
72
72
  }
73
73
  getDDICReferences() {
74
74
  return this.references;
@@ -4,12 +4,14 @@ exports.DefinitionsTop = exports.DefinitionsTopConf = void 0;
4
4
  const issue_1 = require("../issue");
5
5
  const _statement_1 = require("../abap/2_statements/statements/_statement");
6
6
  const Statements = require("../abap/2_statements/statements");
7
+ const Expressions = require("../abap/2_statements/expressions");
7
8
  const Structures = require("../abap/3_structures/structures");
8
9
  const _abap_rule_1 = require("./_abap_rule");
9
10
  const _basic_rule_config_1 = require("./_basic_rule_config");
10
11
  const _irule_1 = require("./_irule");
11
12
  const edit_helper_1 = require("../edit_helper");
12
13
  const nodes_1 = require("../abap/nodes");
14
+ const version_1 = require("../version");
13
15
  class DefinitionsTopConf extends _basic_rule_config_1.BasicRuleConfig {
14
16
  }
15
17
  exports.DefinitionsTopConf = DefinitionsTopConf;
@@ -28,7 +30,9 @@ class DefinitionsTop extends _abap_rule_1.ABAPRule {
28
30
  key: "definitions_top",
29
31
  title: "Place definitions in top of routine",
30
32
  shortDescription: `Checks that definitions are placed at the beginning of METHODs and FORMs.`,
31
- extendedInformation: `https://docs.abapopenchecks.org/checks/17/`,
33
+ extendedInformation: `If the routine has inline definitions then no issues are reported
34
+
35
+ https://docs.abapopenchecks.org/checks/17/`,
32
36
  tags: [_irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Quickfix],
33
37
  };
34
38
  }
@@ -48,12 +52,21 @@ class DefinitionsTop extends _abap_rule_1.ABAPRule {
48
52
  if (structure === undefined) {
49
53
  return [];
50
54
  }
55
+ const containsUnknown = file.getStatements().some(s => s.get() instanceof _statement_1.Unknown);
56
+ if (containsUnknown === true) {
57
+ return [];
58
+ }
51
59
  const routines = structure.findAllStructures(Structures.Form).concat(structure.findAllStructures(Structures.Method));
52
60
  for (const r of routines) {
53
61
  // one fix per routine
54
62
  this.fixed = false;
55
63
  this.mode = DEFINITION;
56
64
  this.moveTo = (_a = r.getFirstStatement()) === null || _a === void 0 ? void 0 : _a.getLastToken().getEnd();
65
+ if (this.reg.getConfig().getVersion() !== version_1.Version.v702) {
66
+ if (r.findFirstExpression(Expressions.InlineData)) {
67
+ continue;
68
+ }
69
+ }
57
70
  const found = this.walk(r, file);
58
71
  if (found) {
59
72
  issues.push(found);
@@ -63,6 +76,8 @@ class DefinitionsTop extends _abap_rule_1.ABAPRule {
63
76
  }
64
77
  //////////////////
65
78
  walk(r, file) {
79
+ var _a, _b, _c, _d, _e, _f;
80
+ let previous = undefined;
66
81
  for (const c of r.getChildren()) {
67
82
  if (c instanceof nodes_1.StatementNode && c.get() instanceof _statement_1.Comment) {
68
83
  continue;
@@ -79,8 +94,24 @@ class DefinitionsTop extends _abap_rule_1.ABAPRule {
79
94
  || c.get() instanceof Structures.Constants
80
95
  || c.get() instanceof Structures.Statics)) {
81
96
  if (this.mode === AFTER) {
97
+ // These are chained structured statements
98
+ let fix = undefined;
99
+ if (((_b = (_a = c.getLastChild()) === null || _a === void 0 ? void 0 : _a.getLastChild()) === null || _b === void 0 ? void 0 : _b.getFirstToken().getStr()) === "."
100
+ && !(previous instanceof nodes_1.StructureNode)
101
+ && this.moveTo) {
102
+ // this is not perfect, but will work for now
103
+ const start = (_d = (_c = c.getFirstChild()) === null || _c === void 0 ? void 0 : _c.getFirstChild()) === null || _d === void 0 ? void 0 : _d.getFirstToken().getStart();
104
+ const end = (_f = (_e = c.getLastChild()) === null || _e === void 0 ? void 0 : _e.getLastChild()) === null || _f === void 0 ? void 0 : _f.getLastToken().getEnd();
105
+ if (start && end) {
106
+ let concat = c.concatTokens();
107
+ concat = concat.replace(/,/g, ".\n");
108
+ const fix1 = edit_helper_1.EditHelper.deleteRange(file, start, end);
109
+ const fix2 = edit_helper_1.EditHelper.insertAt(file, this.moveTo, "\n" + concat);
110
+ fix = edit_helper_1.EditHelper.merge(fix1, fix2);
111
+ }
112
+ }
82
113
  // no quick fixes for these, its difficult?
83
- return issue_1.Issue.atStatement(file, c.getFirstStatement(), this.getMessage(), this.getMetadata().key, this.conf.severity);
114
+ return issue_1.Issue.atStatement(file, c.getFirstStatement(), this.getMessage(), this.getMetadata().key, this.conf.severity, fix);
84
115
  }
85
116
  else {
86
117
  this.moveTo = c.getLastToken().getEnd();
@@ -122,6 +153,7 @@ class DefinitionsTop extends _abap_rule_1.ABAPRule {
122
153
  return found;
123
154
  }
124
155
  }
156
+ previous = c;
125
157
  }
126
158
  return undefined;
127
159
  }
@@ -352,12 +352,28 @@ Only one transformation is applied to a statement at a time, so multiple steps m
352
352
  }
353
353
  }
354
354
  }
355
- if (fix === undefined) {
356
- return undefined;
357
- }
358
- else {
355
+ if (fix !== undefined) {
359
356
  return issue_1.Issue.atToken(lowFile, low.getFirstToken(), "SQL, remove \" and ,", this.getMetadata().key, this.conf.severity, fix);
360
357
  }
358
+ for (const c of high.findAllExpressionsRecursive(Expressions.SQLIn)) {
359
+ const children = c.getChildren();
360
+ const first = children[1];
361
+ if (!(first.get() instanceof tokens_1.WParenLeftW)) {
362
+ continue;
363
+ }
364
+ const last = children[children.length - 1];
365
+ if (last.get() instanceof tokens_1.WParenRightW || last.get() instanceof tokens_1.WParenRight) {
366
+ const firstEnd = first.getFirstToken().getEnd();
367
+ const endDelete = new position_1.Position(firstEnd.getRow(), firstEnd.getCol() + 1);
368
+ const fix1 = edit_helper_1.EditHelper.deleteRange(lowFile, firstEnd, endDelete);
369
+ const lastStart = last.getFirstToken().getStart();
370
+ const startDelete = new position_1.Position(lastStart.getRow(), lastStart.getCol() - 1);
371
+ const fix2 = edit_helper_1.EditHelper.deleteRange(lowFile, startDelete, lastStart);
372
+ fix = edit_helper_1.EditHelper.merge(fix2, fix1);
373
+ return issue_1.Issue.atToken(lowFile, low.getFirstToken(), "SQL, remove spaces", this.getMetadata().key, this.conf.severity, fix);
374
+ }
375
+ }
376
+ return undefined;
361
377
  }
362
378
  downportSelectInline(low, high, lowFile, highSyntax) {
363
379
  if (!(low.get() instanceof _statement_1.Unknown)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/core",
3
- "version": "2.91.14",
3
+ "version": "2.91.17",
4
4
  "description": "abaplint - Core API",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/abaplint.d.ts",
@@ -48,7 +48,7 @@
48
48
  "@microsoft/api-extractor": "^7.28.6",
49
49
  "@types/chai": "^4.3.1",
50
50
  "@types/mocha": "^9.1.1",
51
- "@types/node": "^18.0.6",
51
+ "@types/node": "^18.6.1",
52
52
  "chai": "^4.3.6",
53
53
  "eslint": "^8.20.0",
54
54
  "mocha": "^10.0.0",