@abaplint/core 2.91.13 → 2.91.16
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.
- package/build/abaplint.d.ts +9 -4
- package/build/src/abap/2_statements/expressions/index.js +5 -4
- package/build/src/abap/2_statements/expressions/sql_compare.js +1 -7
- package/build/src/abap/2_statements/expressions/sql_in.js +20 -0
- package/build/src/registry.js +1 -1
- package/build/src/rules/definitions_top.js +30 -2
- package/build/src/rules/downport.js +22 -5
- package/package.json +2 -2
package/build/abaplint.d.ts
CHANGED
|
@@ -1780,10 +1780,10 @@ declare namespace Expressions {
|
|
|
1780
1780
|
ArithOperator,
|
|
1781
1781
|
ArrowOrDash,
|
|
1782
1782
|
Arrow,
|
|
1783
|
+
AssociationName,
|
|
1783
1784
|
AttributeChain,
|
|
1784
1785
|
AttributeName,
|
|
1785
1786
|
BlockName,
|
|
1786
|
-
AssociationName,
|
|
1787
1787
|
CallTransformationOptions,
|
|
1788
1788
|
CallTransformationParameters,
|
|
1789
1789
|
Cast,
|
|
@@ -1794,7 +1794,6 @@ declare namespace Expressions {
|
|
|
1794
1794
|
Color,
|
|
1795
1795
|
CompareOperator,
|
|
1796
1796
|
Compare,
|
|
1797
|
-
TestSeamName,
|
|
1798
1797
|
ComponentChainSimple,
|
|
1799
1798
|
ComponentChain,
|
|
1800
1799
|
ComponentCompareSimple,
|
|
@@ -1934,6 +1933,7 @@ declare namespace Expressions {
|
|
|
1934
1933
|
SQLGroupBy,
|
|
1935
1934
|
SQLHaving,
|
|
1936
1935
|
SQLHints,
|
|
1936
|
+
SQLIn,
|
|
1937
1937
|
SQLIntoStructure,
|
|
1938
1938
|
SQLIntoTable,
|
|
1939
1939
|
SQLJoin,
|
|
@@ -1942,6 +1942,7 @@ declare namespace Expressions {
|
|
|
1942
1942
|
SQLSourceSimple,
|
|
1943
1943
|
SQLSource,
|
|
1944
1944
|
SQLTarget,
|
|
1945
|
+
SQLUpTo,
|
|
1945
1946
|
StringTemplateFormatting,
|
|
1946
1947
|
StringTemplateSource,
|
|
1947
1948
|
StringTemplate,
|
|
@@ -1952,6 +1953,7 @@ declare namespace Expressions {
|
|
|
1952
1953
|
TargetFieldSymbol,
|
|
1953
1954
|
TargetField,
|
|
1954
1955
|
Target,
|
|
1956
|
+
TestSeamName,
|
|
1955
1957
|
TextElementKey,
|
|
1956
1958
|
TextElementString,
|
|
1957
1959
|
TextElement,
|
|
@@ -1962,9 +1964,8 @@ declare namespace Expressions {
|
|
|
1962
1964
|
TypeTableKey,
|
|
1963
1965
|
TypeTable,
|
|
1964
1966
|
Type_2 as Type,
|
|
1965
|
-
SQLUpTo,
|
|
1966
|
-
ValueBody,
|
|
1967
1967
|
ValueBodyLines,
|
|
1968
|
+
ValueBody,
|
|
1968
1969
|
Value,
|
|
1969
1970
|
WithName,
|
|
1970
1971
|
WriteOffsetLength
|
|
@@ -4966,6 +4967,10 @@ declare class SQLHints extends Expression {
|
|
|
4966
4967
|
getRunnable(): IStatementRunnable;
|
|
4967
4968
|
}
|
|
4968
4969
|
|
|
4970
|
+
declare class SQLIn extends Expression {
|
|
4971
|
+
getRunnable(): IStatementRunnable;
|
|
4972
|
+
}
|
|
4973
|
+
|
|
4969
4974
|
declare class SQLIntoStructure extends Expression {
|
|
4970
4975
|
getRunnable(): IStatementRunnable;
|
|
4971
4976
|
}
|
|
@@ -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)(
|
|
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
|
package/build/src/registry.js
CHANGED
|
@@ -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: `
|
|
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
|
}
|
|
@@ -63,6 +67,13 @@ class DefinitionsTop extends _abap_rule_1.ABAPRule {
|
|
|
63
67
|
}
|
|
64
68
|
//////////////////
|
|
65
69
|
walk(r, file) {
|
|
70
|
+
var _a, _b, _c, _d, _e, _f;
|
|
71
|
+
if (this.reg.getConfig().getVersion() !== version_1.Version.v702) {
|
|
72
|
+
if (r.findFirstExpression(Expressions.InlineData)) {
|
|
73
|
+
return undefined;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
let previous = undefined;
|
|
66
77
|
for (const c of r.getChildren()) {
|
|
67
78
|
if (c instanceof nodes_1.StatementNode && c.get() instanceof _statement_1.Comment) {
|
|
68
79
|
continue;
|
|
@@ -79,8 +90,24 @@ class DefinitionsTop extends _abap_rule_1.ABAPRule {
|
|
|
79
90
|
|| c.get() instanceof Structures.Constants
|
|
80
91
|
|| c.get() instanceof Structures.Statics)) {
|
|
81
92
|
if (this.mode === AFTER) {
|
|
93
|
+
// These are chained structured statements
|
|
94
|
+
let fix = undefined;
|
|
95
|
+
if (((_b = (_a = c.getLastChild()) === null || _a === void 0 ? void 0 : _a.getLastChild()) === null || _b === void 0 ? void 0 : _b.getFirstToken().getStr()) === "."
|
|
96
|
+
&& !(previous instanceof nodes_1.StructureNode)
|
|
97
|
+
&& this.moveTo) {
|
|
98
|
+
// this is not perfect, but will work for now
|
|
99
|
+
const start = (_d = (_c = c.getFirstChild()) === null || _c === void 0 ? void 0 : _c.getFirstChild()) === null || _d === void 0 ? void 0 : _d.getFirstToken().getStart();
|
|
100
|
+
const end = (_f = (_e = c.getLastChild()) === null || _e === void 0 ? void 0 : _e.getLastChild()) === null || _f === void 0 ? void 0 : _f.getLastToken().getEnd();
|
|
101
|
+
if (start && end) {
|
|
102
|
+
let concat = c.concatTokens();
|
|
103
|
+
concat = concat.replace(/,/g, ".\n");
|
|
104
|
+
const fix1 = edit_helper_1.EditHelper.deleteRange(file, start, end);
|
|
105
|
+
const fix2 = edit_helper_1.EditHelper.insertAt(file, this.moveTo, "\n" + concat);
|
|
106
|
+
fix = edit_helper_1.EditHelper.merge(fix1, fix2);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
82
109
|
// no quick fixes for these, its difficult?
|
|
83
|
-
return issue_1.Issue.atStatement(file, c.getFirstStatement(), this.getMessage(), this.getMetadata().key, this.conf.severity);
|
|
110
|
+
return issue_1.Issue.atStatement(file, c.getFirstStatement(), this.getMessage(), this.getMetadata().key, this.conf.severity, fix);
|
|
84
111
|
}
|
|
85
112
|
else {
|
|
86
113
|
this.moveTo = c.getLastToken().getEnd();
|
|
@@ -122,6 +149,7 @@ class DefinitionsTop extends _abap_rule_1.ABAPRule {
|
|
|
122
149
|
return found;
|
|
123
150
|
}
|
|
124
151
|
}
|
|
152
|
+
previous = c;
|
|
125
153
|
}
|
|
126
154
|
return undefined;
|
|
127
155
|
}
|
|
@@ -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
|
|
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)) {
|
|
@@ -846,7 +862,8 @@ ${indentation}RAISE EXCEPTION ${uniqueName2}.`;
|
|
|
846
862
|
downportRef(high, lowFile, highSyntax) {
|
|
847
863
|
let found = undefined;
|
|
848
864
|
for (const s of high.findAllExpressionsRecursive(Expressions.Source)) {
|
|
849
|
-
if (s.getFirstToken().getStr().toUpperCase() === "REF"
|
|
865
|
+
if (s.getFirstToken().getStr().toUpperCase() === "REF"
|
|
866
|
+
&& s.findDirectExpression(Expressions.TypeNameOrInfer)) {
|
|
850
867
|
found = s;
|
|
851
868
|
}
|
|
852
869
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abaplint/core",
|
|
3
|
-
"version": "2.91.
|
|
3
|
+
"version": "2.91.16",
|
|
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.
|
|
51
|
+
"@types/node": "^18.6.1",
|
|
52
52
|
"chai": "^4.3.6",
|
|
53
53
|
"eslint": "^8.20.0",
|
|
54
54
|
"mocha": "^10.0.0",
|