@abaplint/core 2.101.11 → 2.101.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/build/src/abap/2_statements/statements/read_table.js +1 -1
- package/build/src/abap/5_syntax/_builtin.js +1 -1
- package/build/src/abap/5_syntax/_type_utils.js +14 -3
- package/build/src/abap/5_syntax/expressions/constant.js +3 -0
- package/build/src/abap/5_syntax/statements/get_bit.js +6 -1
- package/build/src/abap/5_syntax/statements/set_bit.js +5 -1
- package/build/src/registry.js +1 -1
- package/build/src/rules/downport.js +20 -0
- package/package.json +3 -3
|
@@ -14,7 +14,7 @@ class ReadTable {
|
|
|
14
14
|
const from = (0, combi_1.seq)("FROM", expressions_1.Source);
|
|
15
15
|
const fields = (0, combi_1.plus)((0, combi_1.alt)((0, combi_1.seq)("INTO", (0, combi_1.failStar)()), expressions_1.FieldSub));
|
|
16
16
|
const perm = (0, combi_1.per)((0, combi_1.alt)(index, key, from), expressions_1.ReadTableTarget, using, comparing, "CASTING", "TRANSPORTING ALL FIELDS", (0, combi_1.seq)("TRANSPORTING", (0, combi_1.altPrio)(expressions_1.Dynamic, fields)), "BINARY SEARCH");
|
|
17
|
-
return (0, combi_1.seq)("READ TABLE", (0, combi_1.alt)((0, combi_1.ver)(version_1.Version.v740sp02, expressions_1.Source)
|
|
17
|
+
return (0, combi_1.seq)("READ TABLE", (0, combi_1.alt)(expressions_1.SimpleSource2, (0, combi_1.ver)(version_1.Version.v740sp02, expressions_1.Source)), (0, combi_1.opt)(perm));
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
20
|
exports.ReadTable = ReadTable;
|
|
@@ -209,7 +209,7 @@ class TypeUtils {
|
|
|
209
209
|
return false;
|
|
210
210
|
}
|
|
211
211
|
isAssignableStrict(source, target) {
|
|
212
|
-
var _a, _b, _c, _d, _e;
|
|
212
|
+
var _a, _b, _c, _d, _e, _f;
|
|
213
213
|
/*
|
|
214
214
|
console.dir(source);
|
|
215
215
|
console.dir(target);
|
|
@@ -248,8 +248,14 @@ class TypeUtils {
|
|
|
248
248
|
return false;
|
|
249
249
|
}
|
|
250
250
|
}
|
|
251
|
-
else if (source instanceof basic_1.StringType
|
|
252
|
-
if (this.structureContainsString(target)) {
|
|
251
|
+
else if (source instanceof basic_1.StringType) {
|
|
252
|
+
if (target instanceof basic_1.StructureType && this.structureContainsString(target)) {
|
|
253
|
+
return false;
|
|
254
|
+
}
|
|
255
|
+
else if (target instanceof basic_1.XSequenceType) {
|
|
256
|
+
if (((_f = source.getAbstractTypeData()) === null || _f === void 0 ? void 0 : _f.derivedFromConstant) === true) {
|
|
257
|
+
return true;
|
|
258
|
+
}
|
|
253
259
|
return false;
|
|
254
260
|
}
|
|
255
261
|
return true;
|
|
@@ -272,6 +278,11 @@ class TypeUtils {
|
|
|
272
278
|
return false;
|
|
273
279
|
}
|
|
274
280
|
}
|
|
281
|
+
else if (source instanceof basic_1.XStringType) {
|
|
282
|
+
if (target instanceof basic_1.CLikeType) {
|
|
283
|
+
return false;
|
|
284
|
+
}
|
|
285
|
+
}
|
|
275
286
|
return this.isAssignable(source, target);
|
|
276
287
|
}
|
|
277
288
|
isAssignable(source, target) {
|
|
@@ -15,6 +15,9 @@ class Constant {
|
|
|
15
15
|
}
|
|
16
16
|
return new basic_1.CharacterType(len, { derivedFromConstant: true });
|
|
17
17
|
}
|
|
18
|
+
else if (node.getFirstToken().getStr().startsWith("`")) {
|
|
19
|
+
return new basic_1.StringType({ qualifiedName: "STRING", derivedFromConstant: true });
|
|
20
|
+
}
|
|
18
21
|
else {
|
|
19
22
|
return new basic_1.StringType({ qualifiedName: "STRING" });
|
|
20
23
|
}
|
|
@@ -6,10 +6,15 @@ 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 inline_data_1 = require("../expressions/inline_data");
|
|
9
|
+
const _type_utils_1 = require("../_type_utils");
|
|
9
10
|
class GetBit {
|
|
10
11
|
runSyntax(node, scope, filename) {
|
|
12
|
+
let lastType = undefined;
|
|
11
13
|
for (const s of node.findDirectExpressions(Expressions.Source)) {
|
|
12
|
-
new source_1.Source().runSyntax(s, scope, filename);
|
|
14
|
+
lastType = new source_1.Source().runSyntax(s, scope, filename);
|
|
15
|
+
}
|
|
16
|
+
if (lastType && new _type_utils_1.TypeUtils(scope).isHexLike(lastType) === false) {
|
|
17
|
+
throw new Error("Input must be byte-like");
|
|
13
18
|
}
|
|
14
19
|
for (const t of node.findDirectExpressions(Expressions.Target)) {
|
|
15
20
|
const inline = t === null || t === void 0 ? void 0 : t.findDirectExpression(Expressions.InlineData);
|
|
@@ -4,13 +4,17 @@ exports.SetBit = void 0;
|
|
|
4
4
|
const Expressions = require("../../2_statements/expressions");
|
|
5
5
|
const source_1 = require("../expressions/source");
|
|
6
6
|
const target_1 = require("../expressions/target");
|
|
7
|
+
const _type_utils_1 = require("../_type_utils");
|
|
7
8
|
class SetBit {
|
|
8
9
|
runSyntax(node, scope, filename) {
|
|
9
10
|
for (const s of node.findDirectExpressions(Expressions.Source)) {
|
|
10
11
|
new source_1.Source().runSyntax(s, scope, filename);
|
|
11
12
|
}
|
|
12
13
|
for (const t of node.findDirectExpressions(Expressions.Target)) {
|
|
13
|
-
new target_1.Target().runSyntax(t, scope, filename);
|
|
14
|
+
const typ = new target_1.Target().runSyntax(t, scope, filename);
|
|
15
|
+
if (typ && new _type_utils_1.TypeUtils(scope).isHexLike(typ) === false) {
|
|
16
|
+
throw new Error("Input must be byte-like");
|
|
17
|
+
}
|
|
14
18
|
}
|
|
15
19
|
}
|
|
16
20
|
}
|
package/build/src/registry.js
CHANGED
|
@@ -510,6 +510,10 @@ Make sure to test the downported code, it might not always be completely correct
|
|
|
510
510
|
if (found) {
|
|
511
511
|
return found;
|
|
512
512
|
}
|
|
513
|
+
found = this.downportReadTable(high, lowFile, highSyntax);
|
|
514
|
+
if (found) {
|
|
515
|
+
return found;
|
|
516
|
+
}
|
|
513
517
|
return undefined;
|
|
514
518
|
}
|
|
515
519
|
//////////////////////////////////////////
|
|
@@ -805,6 +809,22 @@ ${indentation}${uniqueName} = ${source.concatTokens()}.\n${indentation}`);
|
|
|
805
809
|
}
|
|
806
810
|
return undefined;
|
|
807
811
|
}
|
|
812
|
+
downportReadTable(high, lowFile, highSyntax) {
|
|
813
|
+
if (!(high.get() instanceof Statements.ReadTable)) {
|
|
814
|
+
return undefined;
|
|
815
|
+
}
|
|
816
|
+
const source = high.findExpressionAfterToken("TABLE");
|
|
817
|
+
if ((source === null || source === void 0 ? void 0 : source.get()) instanceof Expressions.Source) {
|
|
818
|
+
const uniqueName = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
|
|
819
|
+
const indentation = " ".repeat(high.getFirstToken().getStart().getCol() - 1);
|
|
820
|
+
const firstToken = high.getFirstToken();
|
|
821
|
+
const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, firstToken.getStart(), `DATA(${uniqueName}) = ${source.concatTokens()}.\n` + indentation);
|
|
822
|
+
const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, source.getFirstToken().getStart(), source.getLastToken().getEnd(), uniqueName);
|
|
823
|
+
const fix = edit_helper_1.EditHelper.merge(fix2, fix1);
|
|
824
|
+
return issue_1.Issue.atToken(lowFile, high.getFirstToken(), "Outline table source", this.getMetadata().key, this.conf.severity, fix);
|
|
825
|
+
}
|
|
826
|
+
return undefined;
|
|
827
|
+
}
|
|
808
828
|
replaceInsertExpression(high, lowFile, highSyntax) {
|
|
809
829
|
if (!(high.get() instanceof Statements.InsertInternal)) {
|
|
810
830
|
return undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abaplint/core",
|
|
3
|
-
"version": "2.101.
|
|
3
|
+
"version": "2.101.12",
|
|
4
4
|
"description": "abaplint - Core API",
|
|
5
5
|
"main": "build/src/index.js",
|
|
6
6
|
"typings": "build/abaplint.d.ts",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"@types/mocha": "^10.0.1",
|
|
54
54
|
"@types/node": "^20.2.5",
|
|
55
55
|
"chai": "^4.3.7",
|
|
56
|
-
"eslint": "^8.
|
|
56
|
+
"eslint": "^8.42.0",
|
|
57
57
|
"mocha": "^10.2.0",
|
|
58
58
|
"c8": "^7.14.0",
|
|
59
59
|
"source-map-support": "^0.5.21",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"typescript": "^5.1.3"
|
|
62
62
|
},
|
|
63
63
|
"dependencies": {
|
|
64
|
-
"fast-xml-parser": "^4.2.
|
|
64
|
+
"fast-xml-parser": "^4.2.3",
|
|
65
65
|
"json5": "^2.2.3",
|
|
66
66
|
"vscode-languageserver-types": "^3.17.3"
|
|
67
67
|
}
|