@abaplint/core 2.91.22 → 2.91.25
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 +5 -0
- package/build/src/abap/2_statements/expressions/index.js +1 -0
- package/build/src/abap/2_statements/expressions/sql_field.js +22 -0
- package/build/src/abap/2_statements/expressions/sql_field_list.js +1 -10
- package/build/src/abap/2_statements/expressions/sql_field_list_loop.js +1 -2
- package/build/src/abap/5_syntax/statements/append.js +9 -0
- package/build/src/registry.js +1 -1
- package/build/src/rules/downport.js +5 -4
- package/build/src/rules/select_add_order_by.js +2 -2
- package/package.json +1 -1
package/build/abaplint.d.ts
CHANGED
|
@@ -1933,6 +1933,7 @@ declare namespace Expressions {
|
|
|
1933
1933
|
SQLCompareOperator,
|
|
1934
1934
|
SQLCompare,
|
|
1935
1935
|
SQLCond,
|
|
1936
|
+
SQLField,
|
|
1936
1937
|
SQLFieldListLoop,
|
|
1937
1938
|
SQLFieldList,
|
|
1938
1939
|
SQLFieldName,
|
|
@@ -4938,6 +4939,10 @@ declare class SQLCond extends Expression {
|
|
|
4938
4939
|
getRunnable(): IStatementRunnable;
|
|
4939
4940
|
}
|
|
4940
4941
|
|
|
4942
|
+
declare class SQLField extends Expression {
|
|
4943
|
+
getRunnable(): IStatementRunnable;
|
|
4944
|
+
}
|
|
4945
|
+
|
|
4941
4946
|
declare class SQLFieldList extends Expression {
|
|
4942
4947
|
getRunnable(): IStatementRunnable;
|
|
4943
4948
|
}
|
|
@@ -163,6 +163,7 @@ __exportStar(require("./sql_client"), exports);
|
|
|
163
163
|
__exportStar(require("./sql_compare_operator"), exports);
|
|
164
164
|
__exportStar(require("./sql_compare"), exports);
|
|
165
165
|
__exportStar(require("./sql_cond"), exports);
|
|
166
|
+
__exportStar(require("./sql_field"), exports);
|
|
166
167
|
__exportStar(require("./sql_field_list_loop"), exports);
|
|
167
168
|
__exportStar(require("./sql_field_list"), exports);
|
|
168
169
|
__exportStar(require("./sql_field_name"), exports);
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SQLField = void 0;
|
|
4
|
+
const combi_1 = require("../combi");
|
|
5
|
+
const _1 = require(".");
|
|
6
|
+
const version_1 = require("../../../version");
|
|
7
|
+
const tokens_1 = require("../../1_lexer/tokens");
|
|
8
|
+
const sql_function_1 = require("./sql_function");
|
|
9
|
+
const simple_field_chain_1 = require("./simple_field_chain");
|
|
10
|
+
const sql_path_1 = require("./sql_path");
|
|
11
|
+
class SQLField extends combi_1.Expression {
|
|
12
|
+
getRunnable() {
|
|
13
|
+
const abap = (0, combi_1.ver)(version_1.Version.v740sp05, (0, combi_1.seq)((0, combi_1.tok)(tokens_1.WAt), simple_field_chain_1.SimpleFieldChain));
|
|
14
|
+
const as = (0, combi_1.seq)("AS", _1.SQLAsName);
|
|
15
|
+
const field = (0, combi_1.altPrio)(_1.SQLAggregation, _1.SQLCase, sql_function_1.SQLFunction, sql_path_1.SQLPath, _1.SQLFieldName, abap, _1.Constant);
|
|
16
|
+
const sub = (0, combi_1.plusPrio)((0, combi_1.seq)((0, combi_1.altPrio)("+", "-", "*", "/", "&&"), (0, combi_1.optPrio)((0, combi_1.tok)(tokens_1.WParenLeftW)), field, (0, combi_1.optPrio)((0, combi_1.tok)(tokens_1.WParenRightW))));
|
|
17
|
+
const arith = (0, combi_1.ver)(version_1.Version.v740sp05, sub);
|
|
18
|
+
return (0, combi_1.seq)(field, (0, combi_1.optPrio)(arith), (0, combi_1.optPrio)(as));
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
exports.SQLField = SQLField;
|
|
22
|
+
//# sourceMappingURL=sql_field.js.map
|
|
@@ -4,19 +4,10 @@ exports.SQLFieldList = void 0;
|
|
|
4
4
|
const combi_1 = require("../combi");
|
|
5
5
|
const _1 = require(".");
|
|
6
6
|
const version_1 = require("../../../version");
|
|
7
|
-
const tokens_1 = require("../../1_lexer/tokens");
|
|
8
|
-
const sql_function_1 = require("./sql_function");
|
|
9
|
-
const simple_field_chain_1 = require("./simple_field_chain");
|
|
10
|
-
const sql_path_1 = require("./sql_path");
|
|
11
7
|
class SQLFieldList extends combi_1.Expression {
|
|
12
8
|
getRunnable() {
|
|
13
9
|
const comma = (0, combi_1.optPrio)((0, combi_1.ver)(version_1.Version.v740sp05, ","));
|
|
14
|
-
|
|
15
|
-
const as = (0, combi_1.seq)("AS", _1.SQLAsName);
|
|
16
|
-
const field = (0, combi_1.altPrio)(_1.SQLAggregation, _1.SQLCase, sql_function_1.SQLFunction, sql_path_1.SQLPath, _1.SQLFieldName, abap, _1.Constant);
|
|
17
|
-
const sub = (0, combi_1.plusPrio)((0, combi_1.seq)((0, combi_1.altPrio)("+", "-", "*", "/", "&&"), (0, combi_1.optPrio)((0, combi_1.tok)(tokens_1.WParenLeftW)), field, (0, combi_1.optPrio)((0, combi_1.tok)(tokens_1.WParenRightW))));
|
|
18
|
-
const arith = (0, combi_1.ver)(version_1.Version.v740sp05, sub);
|
|
19
|
-
return (0, combi_1.altPrio)("*", _1.Dynamic, (0, combi_1.plusPrio)((0, combi_1.seq)(field, (0, combi_1.optPrio)(arith), (0, combi_1.optPrio)(as), comma)));
|
|
10
|
+
return (0, combi_1.altPrio)("*", _1.Dynamic, (0, combi_1.plusPrio)((0, combi_1.seq)(_1.SQLField, comma)));
|
|
20
11
|
}
|
|
21
12
|
}
|
|
22
13
|
exports.SQLFieldList = SQLFieldList;
|
|
@@ -4,14 +4,13 @@ exports.SQLFieldListLoop = void 0;
|
|
|
4
4
|
const combi_1 = require("../combi");
|
|
5
5
|
const _1 = require(".");
|
|
6
6
|
const version_1 = require("../../../version");
|
|
7
|
-
const sql_function_1 = require("./sql_function");
|
|
8
7
|
const sql_path_1 = require("./sql_path");
|
|
9
8
|
// loop must include one field from the database table
|
|
10
9
|
class SQLFieldListLoop extends combi_1.Expression {
|
|
11
10
|
getRunnable() {
|
|
12
11
|
const comma = (0, combi_1.opt)((0, combi_1.ver)(version_1.Version.v740sp05, ","));
|
|
13
12
|
const as = (0, combi_1.seq)("AS", _1.SQLAsName);
|
|
14
|
-
const someField = (0, combi_1.seq)(
|
|
13
|
+
const someField = (0, combi_1.seq)(_1.SQLField, comma);
|
|
15
14
|
const fieldList = (0, combi_1.seq)((0, combi_1.star)(someField), (0, combi_1.alt)(_1.SQLFieldName, sql_path_1.SQLPath), (0, combi_1.optPrio)(as), comma, (0, combi_1.star)(someField));
|
|
16
15
|
const fields = (0, combi_1.alt)("*", _1.Dynamic, fieldList);
|
|
17
16
|
return fields;
|
|
@@ -6,6 +6,7 @@ const source_1 = require("../expressions/source");
|
|
|
6
6
|
const target_1 = require("../expressions/target");
|
|
7
7
|
const basic_1 = require("../../types/basic");
|
|
8
8
|
const fstarget_1 = require("../expressions/fstarget");
|
|
9
|
+
const inline_data_1 = require("../expressions/inline_data");
|
|
9
10
|
class Append {
|
|
10
11
|
runSyntax(node, scope, filename) {
|
|
11
12
|
let targetType = undefined;
|
|
@@ -21,6 +22,14 @@ class Append {
|
|
|
21
22
|
const rowType = targetType instanceof basic_1.TableType ? targetType.getRowType() : targetType;
|
|
22
23
|
new fstarget_1.FSTarget().runSyntax(fsTarget, scope, filename, rowType);
|
|
23
24
|
}
|
|
25
|
+
const dataTarget = node.findExpressionAfterToken("INTO");
|
|
26
|
+
if (dataTarget && node.concatTokens().toUpperCase().includes(" REFERENCE INTO DATA(")) {
|
|
27
|
+
if (!(targetType instanceof basic_1.TableType) && !(targetType instanceof basic_1.VoidType)) {
|
|
28
|
+
throw new Error("APPEND to non table type");
|
|
29
|
+
}
|
|
30
|
+
const rowType = targetType instanceof basic_1.TableType ? targetType.getRowType() : targetType;
|
|
31
|
+
new inline_data_1.InlineData().runSyntax(dataTarget, scope, filename, new basic_1.DataReference(rowType));
|
|
32
|
+
}
|
|
24
33
|
let source = node.findDirectExpression(Expressions.Source);
|
|
25
34
|
if (source === undefined) {
|
|
26
35
|
source = node.findDirectExpression(Expressions.SimpleSource4);
|
package/build/src/registry.js
CHANGED
|
@@ -340,8 +340,9 @@ Only one transformation is applied to a statement at a time, so multiple steps m
|
|
|
340
340
|
const candidates = [high.findAllExpressionsRecursive(Expressions.SQLTarget),
|
|
341
341
|
high.findAllExpressionsRecursive(Expressions.SQLSource),
|
|
342
342
|
high.findAllExpressionsRecursive(Expressions.SQLSourceSimple)].flat();
|
|
343
|
-
for (const c of candidates) {
|
|
344
|
-
if (c.getFirstToken() instanceof tokens_1.WAt
|
|
343
|
+
for (const c of candidates.reverse()) {
|
|
344
|
+
if (c.getFirstToken() instanceof tokens_1.WAt
|
|
345
|
+
|| c.getFirstToken() instanceof tokens_1.At) {
|
|
345
346
|
addFix(c.getFirstToken());
|
|
346
347
|
}
|
|
347
348
|
}
|
|
@@ -420,7 +421,7 @@ Only one transformation is applied to a statement at a time, so multiple steps m
|
|
|
420
421
|
return undefined;
|
|
421
422
|
}
|
|
422
423
|
let fieldDefinition = "";
|
|
423
|
-
const fields = fieldList.
|
|
424
|
+
const fields = fieldList.findAllExpressions(Expressions.SQLFieldName);
|
|
424
425
|
const name = ((_c = inlineData.findFirstExpression(Expressions.TargetField)) === null || _c === void 0 ? void 0 : _c.concatTokens()) || "error";
|
|
425
426
|
if (fields.length === 1) {
|
|
426
427
|
fieldDefinition = `DATA ${name} TYPE ${tableName}-${fields[0].concatTokens()}.`;
|
|
@@ -476,7 +477,7 @@ ${indentation}`);
|
|
|
476
477
|
return undefined;
|
|
477
478
|
}
|
|
478
479
|
let fieldDefinitions = "";
|
|
479
|
-
for (const f of fieldList.
|
|
480
|
+
for (const f of fieldList.findAllExpressions(Expressions.SQLFieldName)) {
|
|
480
481
|
let fieldName = f.concatTokens();
|
|
481
482
|
if (fieldName.includes("~")) {
|
|
482
483
|
const split = fieldName.split("~");
|
|
@@ -60,8 +60,8 @@ If the target is a sorted/hashed table, no issue is reported`,
|
|
|
60
60
|
continue;
|
|
61
61
|
}
|
|
62
62
|
// skip COUNT(*)
|
|
63
|
-
const list = s.
|
|
64
|
-
if (
|
|
63
|
+
const list = s.findAllExpressions(Expressions.SQLField);
|
|
64
|
+
if (list.length === 1 && ((_a = list[0].getFirstChild()) === null || _a === void 0 ? void 0 : _a.get()) instanceof Expressions.SQLAggregation) {
|
|
65
65
|
continue;
|
|
66
66
|
}
|
|
67
67
|
else if (s.findFirstExpression(Expressions.SQLOrderBy)) {
|