@abaplint/core 2.85.8 → 2.85.12
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/README.md +1 -1
- package/build/src/abap/2_statements/combi.js +20 -4
- package/build/src/abap/2_statements/expressions/simple_source3.js +1 -1
- package/build/src/abap/2_statements/expressions/sql_cds_parameters.js +1 -1
- package/build/src/abap/2_statements/expressions/sql_compare.js +7 -7
- package/build/src/abap/2_statements/expressions/sql_from_source.js +1 -1
- package/build/src/abap/2_statements/expressions/sql_source.js +2 -3
- package/build/src/abap/2_statements/expressions/sql_source_simple.js +3 -3
- package/build/src/abap/2_statements/expressions/type_table_key.js +1 -1
- package/build/src/abap/5_syntax/_type_utils.js +16 -4
- package/build/src/abap/5_syntax/expressions/attribute_chain.js +1 -1
- package/build/src/abap/5_syntax/expressions/constant.js +3 -0
- package/build/src/abap/5_syntax/expressions/select.js +3 -0
- package/build/src/abap/5_syntax/expressions/sql_for_all_entries.js +4 -1
- package/build/src/abap/5_syntax/statements/create_data.js +5 -0
- package/build/src/abap/5_syntax/statements/delete_database.js +3 -0
- package/build/src/abap/5_syntax/statements/insert_database.js +3 -0
- package/build/src/abap/5_syntax/statements/modify_database.js +7 -0
- package/build/src/abap/5_syntax/statements/update_database.js +3 -0
- package/build/src/abap/5_syntax/statements/write.js +8 -1
- package/build/src/abap/types/basic/structure_type.js +1 -1
- package/build/src/registry.js +1 -1
- package/build/src/rules/identical_contents.js +2 -2
- package/build/src/rules/local_testclass_location.js +5 -0
- package/build/src/rules/sql_escape_host_variables.js +2 -1
- package/build/src/rules/unused_variables.js +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
[abaplint](https://abaplint.org/) core library
|
|
4
4
|
|
|
5
|
-
Exposes
|
|
5
|
+
Exposes functionality like the parser and rules, which can be used in other projects.
|
|
6
6
|
|
|
7
7
|
For more information see https://github.com/abaplint/abaplint
|
|
@@ -313,13 +313,19 @@ class StarPrioroity {
|
|
|
313
313
|
res = this.sta.run(res);
|
|
314
314
|
if (res.length === 0) {
|
|
315
315
|
if (prev !== undefined) {
|
|
316
|
-
|
|
316
|
+
// console.log("star length: " + prev.length);
|
|
317
|
+
let best = Number.MAX_SAFE_INTEGER;
|
|
318
|
+
for (const p of prev) {
|
|
319
|
+
if (p.remainingLength() < best) {
|
|
320
|
+
result = [p];
|
|
321
|
+
best = p.remainingLength();
|
|
322
|
+
}
|
|
323
|
+
}
|
|
317
324
|
}
|
|
318
325
|
break;
|
|
319
326
|
}
|
|
320
327
|
prev = res;
|
|
321
328
|
}
|
|
322
|
-
// console.dir(result);
|
|
323
329
|
return result;
|
|
324
330
|
}
|
|
325
331
|
railroad() {
|
|
@@ -401,13 +407,17 @@ class Sequence {
|
|
|
401
407
|
const result = [];
|
|
402
408
|
for (const input of r) {
|
|
403
409
|
let temp = [input];
|
|
410
|
+
let match = true;
|
|
404
411
|
for (const sequence of this.list) {
|
|
405
412
|
temp = sequence.run(temp);
|
|
406
413
|
if (temp.length === 0) {
|
|
414
|
+
match = false;
|
|
407
415
|
break;
|
|
408
416
|
}
|
|
409
417
|
}
|
|
410
|
-
|
|
418
|
+
if (match === true) {
|
|
419
|
+
result.push(...temp);
|
|
420
|
+
}
|
|
411
421
|
}
|
|
412
422
|
return result;
|
|
413
423
|
}
|
|
@@ -702,7 +712,13 @@ class Combi {
|
|
|
702
712
|
this.ver = version;
|
|
703
713
|
const input = new result_1.Result(tokens, 0);
|
|
704
714
|
const result = runnable.run([input]);
|
|
705
|
-
|
|
715
|
+
/*
|
|
716
|
+
console.log("res: " + result.length);
|
|
717
|
+
for (const res of result) {
|
|
718
|
+
console.dir(res.getNodes().map(n => n.get().constructor.name));
|
|
719
|
+
console.dir(res.getNodes().map(n => n.concatTokens()));
|
|
720
|
+
}
|
|
721
|
+
*/
|
|
706
722
|
for (const res of result) {
|
|
707
723
|
if (res.remainingLength() === 0) {
|
|
708
724
|
return res.getNodes();
|
|
@@ -5,7 +5,7 @@ const combi_1 = require("../combi");
|
|
|
5
5
|
const _1 = require(".");
|
|
6
6
|
class SimpleSource3 extends combi_1.Expression {
|
|
7
7
|
getRunnable() {
|
|
8
|
-
return (0, combi_1.
|
|
8
|
+
return (0, combi_1.altPrio)(_1.Constant, _1.TextElement, _1.FieldChain);
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
11
|
exports.SimpleSource3 = SimpleSource3;
|
|
@@ -8,7 +8,7 @@ const field_chain_1 = require("./field_chain");
|
|
|
8
8
|
class SQLCDSParameters extends combi_1.Expression {
|
|
9
9
|
getRunnable() {
|
|
10
10
|
const param = (0, combi_1.seq)(_1.Field, "=", (0, combi_1.alt)((0, combi_1.seq)((0, combi_1.tok)(tokens_1.WAt), field_chain_1.FieldChain), _1.Constant));
|
|
11
|
-
return (0, combi_1.seq)("(", param, (0, combi_1.
|
|
11
|
+
return (0, combi_1.seq)("(", param, (0, combi_1.starPrio)((0, combi_1.seq)(",", param)), ")");
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
14
|
exports.SQLCDSParameters = SQLCDSParameters;
|
|
@@ -10,15 +10,15 @@ class SQLCompare extends combi_1.Expression {
|
|
|
10
10
|
const val = new _1.SQLSource();
|
|
11
11
|
const list = (0, combi_1.seq)((0, combi_1.altPrio)((0, combi_1.tok)(tokens_1.WParenLeft), (0, combi_1.tok)(tokens_1.WParenLeftW)), val, (0, combi_1.starPrio)((0, combi_1.seq)(",", val)), ")");
|
|
12
12
|
const subSelect = (0, combi_1.seq)("(", _1.Select, ")");
|
|
13
|
-
const inn = (0, combi_1.seq)(
|
|
14
|
-
const between = (0, combi_1.seq)(
|
|
15
|
-
const like = (0, combi_1.seq)(
|
|
16
|
-
const nul = (0, combi_1.seq)("IS", (0, combi_1.optPrio)("NOT"), (0, combi_1.
|
|
13
|
+
const inn = (0, combi_1.seq)("IN", (0, combi_1.altPrio)(_1.SQLSource, list, subSelect));
|
|
14
|
+
const between = (0, combi_1.seq)("BETWEEN", _1.SQLSource, "AND", _1.SQLSource);
|
|
15
|
+
const like = (0, combi_1.seq)("LIKE", _1.SQLSource, (0, combi_1.optPrio)((0, combi_1.seq)("ESCAPE", _1.SQLSource)));
|
|
16
|
+
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")));
|
|
17
17
|
const source = new _1.SQLSource();
|
|
18
18
|
const sub = (0, combi_1.seq)((0, combi_1.optPrio)((0, combi_1.altPrio)("ALL", "ANY", "SOME")), subSelect);
|
|
19
|
-
const builtin = (0, combi_1.ver)(version_1.Version.v751, (0, combi_1.seq)((0, combi_1.
|
|
20
|
-
const arith = (0, combi_1.ver)(version_1.Version.v750, (0, combi_1.
|
|
21
|
-
const rett = (0, combi_1.seq)((0, combi_1.altPrio)(builtin,
|
|
19
|
+
const builtin = (0, combi_1.ver)(version_1.Version.v751, (0, combi_1.seq)((0, combi_1.altPrio)("lower", "upper"), (0, combi_1.tok)(tokens_1.ParenLeftW), _1.SQLFieldName, (0, combi_1.tok)(tokens_1.WParenRightW)));
|
|
20
|
+
const arith = (0, combi_1.ver)(version_1.Version.v750, (0, combi_1.plusPrio)((0, combi_1.seq)((0, combi_1.altPrio)("+", "-", "*", "/"), _1.SQLFieldName)));
|
|
21
|
+
const rett = (0, combi_1.seq)((0, combi_1.altPrio)(builtin, (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));
|
|
22
22
|
const exists = (0, combi_1.seq)("EXISTS", subSelect);
|
|
23
23
|
return (0, combi_1.altPrio)(exists, _1.Dynamic, rett);
|
|
24
24
|
}
|
|
@@ -11,7 +11,7 @@ class SQLFromSource extends combi_1.Expression {
|
|
|
11
11
|
// https://help.sap.com/doc/abapdocu_752_index_htm/7.52/en-US/abennews-752-open_sql.htm#!ABAP_MODIFICATION_1@1@
|
|
12
12
|
const tab = (0, combi_1.ver)(version_1.Version.v752, (0, combi_1.seq)((0, combi_1.tok)(tokens_1.WAt), _1.FieldChain));
|
|
13
13
|
const aas = (0, combi_1.seq)("AS", _1.SQLAsName);
|
|
14
|
-
return (0, combi_1.seq)((0, combi_1.altPrio)(
|
|
14
|
+
return (0, combi_1.seq)((0, combi_1.altPrio)(with_name_1.WithName, (0, combi_1.seq)(_1.DatabaseTable, (0, combi_1.optPrio)(_1.SQLCDSParameters)), tab), (0, combi_1.optPrio)((0, combi_1.ver)(version_1.Version.v752, "WITH PRIVILEGED ACCESS")), (0, combi_1.optPrio)(aas));
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
17
|
exports.SQLFromSource = SQLFromSource;
|
|
@@ -8,9 +8,8 @@ const _1 = require(".");
|
|
|
8
8
|
class SQLSource extends combi_1.Expression {
|
|
9
9
|
getRunnable() {
|
|
10
10
|
const paren = (0, combi_1.seq)((0, combi_1.tok)(tokens_1.ParenLeftW), _1.Source, (0, combi_1.tok)(tokens_1.WParenRightW));
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
return (0, combi_1.alt)(_1.SQLAliasField, _1.Source, at);
|
|
11
|
+
const at = (0, combi_1.ver)(version_1.Version.v740sp05, (0, combi_1.seq)((0, combi_1.tok)(tokens_1.WAt), (0, combi_1.altPrio)(_1.SimpleSource3, paren)));
|
|
12
|
+
return (0, combi_1.alt)(_1.SQLAliasField, _1.SimpleSource3, at);
|
|
14
13
|
}
|
|
15
14
|
}
|
|
16
15
|
exports.SQLSource = SQLSource;
|
|
@@ -5,12 +5,12 @@ const combi_1 = require("../combi");
|
|
|
5
5
|
const version_1 = require("../../../version");
|
|
6
6
|
const tokens_1 = require("../../1_lexer/tokens");
|
|
7
7
|
const _1 = require(".");
|
|
8
|
-
|
|
8
|
+
// todo, delete this expression, its the same as SQLSource?
|
|
9
9
|
class SQLSourceSimple extends combi_1.Expression {
|
|
10
10
|
getRunnable() {
|
|
11
11
|
const paren = (0, combi_1.seq)((0, combi_1.tok)(tokens_1.ParenLeftW), _1.Source, (0, combi_1.tok)(tokens_1.WParenRightW));
|
|
12
|
-
const at = (0, combi_1.ver)(version_1.Version.v740sp05, (0, combi_1.seq)((0, combi_1.tok)(tokens_1.WAt), (0, combi_1.alt)(_1.
|
|
13
|
-
return (0, combi_1.alt)(_1.
|
|
12
|
+
const at = (0, combi_1.ver)(version_1.Version.v740sp05, (0, combi_1.seq)((0, combi_1.tok)(tokens_1.WAt), (0, combi_1.alt)(_1.SimpleSource3, paren)));
|
|
13
|
+
return (0, combi_1.alt)(_1.SimpleSource3, at);
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
16
|
exports.SQLSourceSimple = SQLSourceSimple;
|
|
@@ -9,7 +9,7 @@ class TypeTableKey extends combi_1.Expression {
|
|
|
9
9
|
const uniqueness = (0, combi_1.alt)("NON-UNIQUE", "UNIQUE");
|
|
10
10
|
const defaultKey = "DEFAULT KEY";
|
|
11
11
|
const emptyKey = (0, combi_1.ver)(version_1.Version.v740sp02, "EMPTY KEY");
|
|
12
|
-
const key = (0, combi_1.seq)("WITH", (0, combi_1.opt)(uniqueness), (0, combi_1.altPrio)(defaultKey, emptyKey, (0, combi_1.seq)((0, combi_1.opt)((0, combi_1.alt)("SORTED", "HASHED")), "KEY", (0, combi_1.alt)((0, combi_1.seq)(_1.Field, "COMPONENTS", (0, combi_1.plus)(_1.FieldSub)), (0, combi_1.plus)(_1.FieldSub)))));
|
|
12
|
+
const key = (0, combi_1.seq)("WITH", (0, combi_1.opt)(uniqueness), (0, combi_1.altPrio)(defaultKey, emptyKey, (0, combi_1.seq)((0, combi_1.opt)((0, combi_1.alt)("SORTED", "HASHED")), "KEY", (0, combi_1.alt)((0, combi_1.seq)(_1.Field, "COMPONENTS", (0, combi_1.plus)(_1.FieldSub)), (0, combi_1.plus)(_1.FieldSub)))), (0, combi_1.optPrio)("READ-ONLY"));
|
|
13
13
|
return key;
|
|
14
14
|
}
|
|
15
15
|
}
|
|
@@ -20,6 +20,13 @@ class TypeUtils {
|
|
|
20
20
|
|| type instanceof basic_1.AnyType
|
|
21
21
|
|| type instanceof basic_1.UnknownType
|
|
22
22
|
|| type instanceof basic_1.NumericType
|
|
23
|
+
|| type instanceof basic_1.IntegerType
|
|
24
|
+
|| type instanceof basic_1.FloatType
|
|
25
|
+
|| type instanceof basic_1.FloatingPointType
|
|
26
|
+
|| type instanceof basic_1.DecFloatType
|
|
27
|
+
|| type instanceof basic_1.DecFloat16Type
|
|
28
|
+
|| type instanceof basic_1.DecFloat34Type
|
|
29
|
+
|| type instanceof basic_1.NumericGenericType
|
|
23
30
|
|| type instanceof basic_1.CSequenceType
|
|
24
31
|
|| type instanceof basic_1.DateType
|
|
25
32
|
|| type instanceof basic_1.CLikeType
|
|
@@ -53,8 +60,8 @@ class TypeUtils {
|
|
|
53
60
|
}
|
|
54
61
|
static isAssignable(source, target) {
|
|
55
62
|
/*
|
|
56
|
-
|
|
57
|
-
|
|
63
|
+
console.dir(source);
|
|
64
|
+
console.dir(target);
|
|
58
65
|
*/
|
|
59
66
|
if (target instanceof basic_1.TableType) {
|
|
60
67
|
if (target.isWithHeader()) {
|
|
@@ -97,8 +104,13 @@ class TypeUtils {
|
|
|
97
104
|
|| source instanceof basic_1.UnknownType) {
|
|
98
105
|
return true;
|
|
99
106
|
}
|
|
100
|
-
else if (
|
|
101
|
-
|
|
107
|
+
else if (target.containsVoid() === true) {
|
|
108
|
+
return true;
|
|
109
|
+
}
|
|
110
|
+
else if (source instanceof basic_1.IntegerType) {
|
|
111
|
+
return false;
|
|
112
|
+
}
|
|
113
|
+
else if (this.isCharLike(target) && this.isCharLike(source)) {
|
|
102
114
|
return true;
|
|
103
115
|
}
|
|
104
116
|
return false;
|
|
@@ -18,7 +18,7 @@ class AttributeChain {
|
|
|
18
18
|
if (!(first.get() instanceof expressions_1.AttributeName)) {
|
|
19
19
|
throw new Error("AttributeChain, unexpected first child");
|
|
20
20
|
}
|
|
21
|
-
const def = scope.
|
|
21
|
+
const def = scope.findObjectDefinition(inputContext.getIdentifierName());
|
|
22
22
|
if (def === undefined) {
|
|
23
23
|
throw new Error("Definition for \"" + inputContext.getIdentifierName() + "\" not found in scope(AttributeChain)");
|
|
24
24
|
}
|
|
@@ -8,6 +8,9 @@ class Constant {
|
|
|
8
8
|
if (node.findDirectExpression(expressions_1.Integer)) {
|
|
9
9
|
return new basic_1.IntegerType("I");
|
|
10
10
|
}
|
|
11
|
+
else if (node.getFirstToken().getStr().startsWith("'")) {
|
|
12
|
+
return new basic_1.CharacterType(10);
|
|
13
|
+
}
|
|
11
14
|
else {
|
|
12
15
|
return new basic_1.StringType("STRING");
|
|
13
16
|
}
|
|
@@ -45,6 +45,9 @@ class Select {
|
|
|
45
45
|
for (const s of node.findAllExpressions(Expressions.Source)) {
|
|
46
46
|
new source_1.Source().runSyntax(s, scope, filename);
|
|
47
47
|
}
|
|
48
|
+
for (const s of node.findAllExpressions(Expressions.SimpleSource3)) {
|
|
49
|
+
new source_1.Source().runSyntax(s, scope, filename);
|
|
50
|
+
}
|
|
48
51
|
if (scope.getType() === _scope_type_1.ScopeType.OpenSQL) {
|
|
49
52
|
scope.pop(node.getLastToken().getEnd());
|
|
50
53
|
}
|
|
@@ -6,7 +6,10 @@ const source_1 = require("./source");
|
|
|
6
6
|
const basic_1 = require("../../types/basic");
|
|
7
7
|
class SQLForAllEntries {
|
|
8
8
|
runSyntax(node, scope, filename) {
|
|
9
|
-
|
|
9
|
+
let s = node.findFirstExpression(Expressions.Source);
|
|
10
|
+
if (s === undefined) {
|
|
11
|
+
s = node.findFirstExpression(Expressions.SimpleSource3);
|
|
12
|
+
}
|
|
10
13
|
if (s) {
|
|
11
14
|
const type = new source_1.Source().runSyntax(s, scope, filename);
|
|
12
15
|
if (type instanceof basic_1.VoidType) {
|
|
@@ -5,6 +5,7 @@ const Expressions = require("../../2_statements/expressions");
|
|
|
5
5
|
const target_1 = require("../expressions/target");
|
|
6
6
|
const source_1 = require("../expressions/source");
|
|
7
7
|
const dynamic_1 = require("../expressions/dynamic");
|
|
8
|
+
const basic_types_1 = require("../basic_types");
|
|
8
9
|
class CreateData {
|
|
9
10
|
runSyntax(node, scope, filename) {
|
|
10
11
|
for (const s of node.findDirectExpressions(Expressions.Source)) {
|
|
@@ -16,6 +17,10 @@ class CreateData {
|
|
|
16
17
|
for (const t of node.findDirectExpressions(Expressions.Dynamic)) {
|
|
17
18
|
new dynamic_1.Dynamic().runSyntax(t, scope, filename);
|
|
18
19
|
}
|
|
20
|
+
const type = node.findDirectExpression(Expressions.TypeName);
|
|
21
|
+
if (type) {
|
|
22
|
+
new basic_types_1.BasicTypes(filename, scope).resolveTypeName(type);
|
|
23
|
+
}
|
|
19
24
|
}
|
|
20
25
|
}
|
|
21
26
|
exports.CreateData = CreateData;
|
|
@@ -10,6 +10,9 @@ class DeleteDatabase {
|
|
|
10
10
|
for (const s of node.findAllExpressions(Expressions.Source)) {
|
|
11
11
|
new source_1.Source().runSyntax(s, scope, filename);
|
|
12
12
|
}
|
|
13
|
+
for (const s of node.findAllExpressions(Expressions.SimpleSource3)) {
|
|
14
|
+
new source_1.Source().runSyntax(s, scope, filename);
|
|
15
|
+
}
|
|
13
16
|
for (const d of node.findAllExpressions(Expressions.Dynamic)) {
|
|
14
17
|
new dynamic_1.Dynamic().runSyntax(d, scope, filename);
|
|
15
18
|
}
|
|
@@ -10,6 +10,9 @@ class InsertDatabase {
|
|
|
10
10
|
for (const s of node.findAllExpressions(Expressions.Source)) {
|
|
11
11
|
new source_1.Source().runSyntax(s, scope, filename);
|
|
12
12
|
}
|
|
13
|
+
for (const s of node.findAllExpressions(Expressions.SimpleSource3)) {
|
|
14
|
+
new source_1.Source().runSyntax(s, scope, filename);
|
|
15
|
+
}
|
|
13
16
|
for (const d of node.findAllExpressions(Expressions.Dynamic)) {
|
|
14
17
|
new dynamic_1.Dynamic().runSyntax(d, scope, filename);
|
|
15
18
|
}
|
|
@@ -4,6 +4,7 @@ exports.ModifyDatabase = void 0;
|
|
|
4
4
|
const Expressions = require("../../2_statements/expressions");
|
|
5
5
|
const dynamic_1 = require("../expressions/dynamic");
|
|
6
6
|
const database_table_1 = require("../expressions/database_table");
|
|
7
|
+
const source_1 = require("../expressions/source");
|
|
7
8
|
class ModifyDatabase {
|
|
8
9
|
runSyntax(node, scope, filename) {
|
|
9
10
|
for (const d of node.findAllExpressions(Expressions.Dynamic)) {
|
|
@@ -13,6 +14,12 @@ class ModifyDatabase {
|
|
|
13
14
|
if (dbtab !== undefined) {
|
|
14
15
|
new database_table_1.DatabaseTable().runSyntax(dbtab, scope, filename);
|
|
15
16
|
}
|
|
17
|
+
for (const s of node.findAllExpressions(Expressions.Source)) {
|
|
18
|
+
new source_1.Source().runSyntax(s, scope, filename);
|
|
19
|
+
}
|
|
20
|
+
for (const s of node.findAllExpressions(Expressions.SimpleSource3)) {
|
|
21
|
+
new source_1.Source().runSyntax(s, scope, filename);
|
|
22
|
+
}
|
|
16
23
|
}
|
|
17
24
|
}
|
|
18
25
|
exports.ModifyDatabase = ModifyDatabase;
|
|
@@ -32,6 +32,9 @@ class UpdateDatabase {
|
|
|
32
32
|
for (const s of node.findAllExpressions(Expressions.Source)) {
|
|
33
33
|
new source_1.Source().runSyntax(s, scope, filename);
|
|
34
34
|
}
|
|
35
|
+
for (const s of node.findAllExpressions(Expressions.SimpleSource3)) {
|
|
36
|
+
new source_1.Source().runSyntax(s, scope, filename);
|
|
37
|
+
}
|
|
35
38
|
for (const d of node.findAllExpressions(Expressions.Dynamic)) {
|
|
36
39
|
new dynamic_1.Dynamic().runSyntax(d, scope, filename);
|
|
37
40
|
}
|
|
@@ -5,11 +5,18 @@ const Expressions = require("../../2_statements/expressions");
|
|
|
5
5
|
const source_1 = require("../expressions/source");
|
|
6
6
|
const target_1 = require("../expressions/target");
|
|
7
7
|
const dynamic_1 = require("../expressions/dynamic");
|
|
8
|
+
const _type_utils_1 = require("../_type_utils");
|
|
8
9
|
class Write {
|
|
9
10
|
runSyntax(node, scope, filename) {
|
|
10
11
|
// todo, more
|
|
12
|
+
const second = node.getChildren()[1];
|
|
11
13
|
for (const s of node.findAllExpressions(Expressions.Source)) {
|
|
12
|
-
new source_1.Source().runSyntax(s, scope, filename);
|
|
14
|
+
const type = new source_1.Source().runSyntax(s, scope, filename);
|
|
15
|
+
if (s === second
|
|
16
|
+
&& _type_utils_1.TypeUtils.isCharLike(type) === false
|
|
17
|
+
&& _type_utils_1.TypeUtils.isHexLike(type) === false) {
|
|
18
|
+
throw new Error("Source not character like");
|
|
19
|
+
}
|
|
13
20
|
}
|
|
14
21
|
for (const s of node.findAllExpressions(Expressions.Dynamic)) {
|
|
15
22
|
new dynamic_1.Dynamic().runSyntax(s, scope, filename);
|
|
@@ -43,7 +43,7 @@ class StructureType extends _abstract_type_1.AbstractType {
|
|
|
43
43
|
return "StructureTypetoABAPtodo";
|
|
44
44
|
}
|
|
45
45
|
containsVoid() {
|
|
46
|
-
return this.getComponents().some(c => { c.type.containsVoid(); });
|
|
46
|
+
return this.getComponents().some(c => { return c.type.containsVoid(); });
|
|
47
47
|
}
|
|
48
48
|
toCDS() {
|
|
49
49
|
return "abap.TODO_STRUCTURE";
|
package/build/src/registry.js
CHANGED
|
@@ -19,8 +19,8 @@ class IdenticalContents extends _abap_rule_1.ABAPRule {
|
|
|
19
19
|
return {
|
|
20
20
|
key: "identical_contents",
|
|
21
21
|
title: "Identical contents",
|
|
22
|
-
shortDescription: `Find identical contents in blocks inside IFs, both in the beginning and in the end
|
|
23
|
-
|
|
22
|
+
shortDescription: `Find identical contents in blocks inside IFs, both in the beginning and in the end.`,
|
|
23
|
+
extendedInformation: `
|
|
24
24
|
Prerequsites: code is pretty printed with identical cAsE
|
|
25
25
|
|
|
26
26
|
Chained statments are ignored`,
|
|
@@ -6,6 +6,7 @@ const _abap_rule_1 = require("./_abap_rule");
|
|
|
6
6
|
const _basic_rule_config_1 = require("./_basic_rule_config");
|
|
7
7
|
const objects_1 = require("../objects");
|
|
8
8
|
const _irule_1 = require("./_irule");
|
|
9
|
+
const version_1 = require("../version");
|
|
9
10
|
class LocalTestclassLocationConf extends _basic_rule_config_1.BasicRuleConfig {
|
|
10
11
|
}
|
|
11
12
|
exports.LocalTestclassLocationConf = LocalTestclassLocationConf;
|
|
@@ -33,6 +34,10 @@ class LocalTestclassLocation extends _abap_rule_1.ABAPRule {
|
|
|
33
34
|
}
|
|
34
35
|
runParsed(file, obj) {
|
|
35
36
|
const issues = [];
|
|
37
|
+
if (this.reg.getConfig().getVersion() === version_1.Version.v700) {
|
|
38
|
+
// 700 does not have testclass includes
|
|
39
|
+
return [];
|
|
40
|
+
}
|
|
36
41
|
if (!(obj instanceof objects_1.Class)) {
|
|
37
42
|
return [];
|
|
38
43
|
}
|
|
@@ -73,7 +73,8 @@ class SQLEscapeHostVariables extends _abap_rule_1.ABAPRule {
|
|
|
73
73
|
}
|
|
74
74
|
for (const o of s.findAllExpressions(Expressions.SQLSource)) {
|
|
75
75
|
const first = o.getFirstChild();
|
|
76
|
-
if ((first === null || first === void 0 ? void 0 : first.get()) instanceof Expressions.Source && first.getChildren()[0].get() instanceof Expressions.FieldChain)
|
|
76
|
+
if (((first === null || first === void 0 ? void 0 : first.get()) instanceof Expressions.Source && first.getChildren()[0].get() instanceof Expressions.FieldChain)
|
|
77
|
+
|| ((first === null || first === void 0 ? void 0 : first.get()) instanceof Expressions.SimpleSource3 && first.getChildren()[0].get() instanceof Expressions.FieldChain)) {
|
|
77
78
|
const message = "Escape SQL host variables";
|
|
78
79
|
const issue = issue_1.Issue.atToken(file, first.getFirstToken(), message, this.getMetadata().key, this.conf.severity);
|
|
79
80
|
issues.push(issue);
|
|
@@ -66,7 +66,7 @@ class UnusedVariables {
|
|
|
66
66
|
shortDescription: `Checks for unused variables and constants`,
|
|
67
67
|
extendedInformation: `WARNING: slow
|
|
68
68
|
|
|
69
|
-
|
|
69
|
+
Skips event parameters.
|
|
70
70
|
|
|
71
71
|
Note that this currently does not work if the source code uses macros.
|
|
72
72
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abaplint/core",
|
|
3
|
-
"version": "2.85.
|
|
3
|
+
"version": "2.85.12",
|
|
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.19.4",
|
|
49
49
|
"@types/chai": "^4.3.0",
|
|
50
50
|
"@types/mocha": "^9.1.0",
|
|
51
|
-
"@types/node": "^17.0.
|
|
51
|
+
"@types/node": "^17.0.15",
|
|
52
52
|
"chai": "^4.3.6",
|
|
53
53
|
"eslint": "^8.8.0",
|
|
54
54
|
"mocha": "^9.2.0",
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"typescript": "^4.5.5"
|
|
59
59
|
},
|
|
60
60
|
"dependencies": {
|
|
61
|
-
"fast-xml-parser": "^4.0.
|
|
61
|
+
"fast-xml-parser": "^4.0.2",
|
|
62
62
|
"json5": "^2.2.0",
|
|
63
63
|
"vscode-languageserver-protocol": "^3.16.0",
|
|
64
64
|
"vscode-languageserver-types": "^3.16.0"
|