@abaplint/core 2.119.8 → 2.119.10
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/5_syntax/expressions/select.js +5 -1
- package/build/src/abap/5_syntax/expressions/source.js +3 -1
- package/build/src/abap/5_syntax/statements/parameter.js +10 -5
- package/build/src/abap/5_syntax/statements/selectoption.js +12 -7
- package/build/src/registry.js +1 -1
- package/build/src/rules/parser_missing_space.js +13 -0
- package/package.json +1 -1
|
@@ -354,6 +354,9 @@ class Select {
|
|
|
354
354
|
const ret = [];
|
|
355
355
|
if (node.get() instanceof Expressions.SelectLoop) {
|
|
356
356
|
expr = node.findFirstExpression(Expressions.SQLFieldListLoop);
|
|
357
|
+
if (expr === undefined) {
|
|
358
|
+
expr = node;
|
|
359
|
+
}
|
|
357
360
|
}
|
|
358
361
|
else {
|
|
359
362
|
expr = node.findFirstExpression(Expressions.SQLFieldList);
|
|
@@ -361,7 +364,8 @@ class Select {
|
|
|
361
364
|
if (((_a = expr === null || expr === void 0 ? void 0 : expr.getFirstChild()) === null || _a === void 0 ? void 0 : _a.get()) instanceof Expressions.Dynamic) {
|
|
362
365
|
dynamic_1.Dynamic.runSyntax(expr.getFirstChild(), input);
|
|
363
366
|
}
|
|
364
|
-
|
|
367
|
+
// eslint-disable-next-line max-len
|
|
368
|
+
for (const field of (expr === null || expr === void 0 ? void 0 : expr.findDirectExpressionsMulti([Expressions.SQLField, Expressions.SQLFieldName, Expressions.SQLAggregation])) || []) {
|
|
365
369
|
let code = field.concatTokens().toUpperCase();
|
|
366
370
|
const as = ((_b = field.findDirectExpression(Expressions.SQLAsName)) === null || _b === void 0 ? void 0 : _b.concatTokens()) || "";
|
|
367
371
|
if (as !== "") {
|
|
@@ -39,6 +39,7 @@ const assert_error_1 = require("../assert_error");
|
|
|
39
39
|
// TODO: refactor all these method parameters to objects, this is getting messy
|
|
40
40
|
class Source {
|
|
41
41
|
static runSyntax(node, input, targetType, writeReference = false, allowGenericDeference = false) {
|
|
42
|
+
var _a;
|
|
42
43
|
if (node === undefined) {
|
|
43
44
|
return undefined;
|
|
44
45
|
}
|
|
@@ -116,12 +117,13 @@ class Source {
|
|
|
116
117
|
{
|
|
117
118
|
const foundType = this.determineType(node, input, targetType);
|
|
118
119
|
const bodyType = conv_body_1.ConvBody.runSyntax(node.findDirectExpression(Expressions.ConvBody), input);
|
|
120
|
+
const inferred = (_a = node.findDirectExpression(Expressions.TypeNameOrInfer)) === null || _a === void 0 ? void 0 : _a.concatTokens();
|
|
119
121
|
if (new _type_utils_1.TypeUtils(input.scope).isConvable(foundType, bodyType) === false) {
|
|
120
122
|
const message = `CONV: Types not compatible, ${foundType === null || foundType === void 0 ? void 0 : foundType.constructor.name}, ${bodyType === null || bodyType === void 0 ? void 0 : bodyType.constructor.name}`;
|
|
121
123
|
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
|
|
122
124
|
return basic_1.VoidType.get(_syntax_input_1.CheckSyntaxKey);
|
|
123
125
|
}
|
|
124
|
-
else if (foundType === null || foundType === void 0 ? void 0 : foundType.isGeneric()) {
|
|
126
|
+
else if ((foundType === null || foundType === void 0 ? void 0 : foundType.isGeneric()) && inferred !== "#") {
|
|
125
127
|
const message = "Cannot CONV to generic type";
|
|
126
128
|
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
|
|
127
129
|
return basic_1.VoidType.get(_syntax_input_1.CheckSyntaxKey);
|
|
@@ -9,16 +9,21 @@ const _syntax_input_1 = require("../_syntax_input");
|
|
|
9
9
|
const tokens_1 = require("../../1_lexer/tokens");
|
|
10
10
|
class Parameter {
|
|
11
11
|
runSyntax(node, input) {
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
const nameExpression = node.findFirstExpression(Expressions.FieldSub);
|
|
13
|
+
if (nameExpression === undefined) {
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
let nameToken = nameExpression.getFirstToken();
|
|
17
|
+
// FieldSub can include dashes and optional length, eg p-tcode or p_table(4).
|
|
18
|
+
if (nameExpression.getChildren().length > 1) {
|
|
19
|
+
const fullName = nameExpression.concatTokens().replace(/\(.+$/, "").replace(/\[\]$/, "");
|
|
20
|
+
nameToken = new tokens_1.Identifier(nameToken.getStart(), fullName);
|
|
21
|
+
}
|
|
14
22
|
if (nameToken && nameToken.getStr().length > 8) {
|
|
15
23
|
const message = "Parameter name too long, " + nameToken.getStr();
|
|
16
24
|
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
|
|
17
25
|
return;
|
|
18
26
|
}
|
|
19
|
-
else if (nameToken === undefined) {
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
27
|
if (node.findDirectTokenByText("RADIOBUTTON") && node.findDirectTokenByText("LENGTH")) {
|
|
23
28
|
const message = "RADIOBUTTON and LENGTH not possible together";
|
|
24
29
|
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
|
|
@@ -10,23 +10,28 @@ const _syntax_input_1 = require("../_syntax_input");
|
|
|
10
10
|
const tokens_1 = require("../../1_lexer/tokens");
|
|
11
11
|
class SelectOption {
|
|
12
12
|
runSyntax(node, input) {
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
const nameExpression = node.findFirstExpression(Expressions.FieldSub);
|
|
14
|
+
if (nameExpression === undefined) {
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
let nameToken = nameExpression.getFirstToken();
|
|
18
|
+
// FieldSub can include dashes and optional length, eg s-matnr or s_name(10).
|
|
19
|
+
if (nameExpression.getChildren().length > 1) {
|
|
20
|
+
const fullName = nameExpression.concatTokens().replace(/\(.+$/, "").replace(/\[\]$/, "");
|
|
21
|
+
nameToken = new tokens_1.Identifier(nameToken.getStart(), fullName);
|
|
22
|
+
}
|
|
15
23
|
if (nameToken && nameToken.getStr().length > 8) {
|
|
16
24
|
const message = "Select-option name too long, " + nameToken.getStr();
|
|
17
25
|
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, nameToken, message));
|
|
18
26
|
return;
|
|
19
27
|
}
|
|
20
|
-
else if (nameToken === undefined) {
|
|
21
|
-
return;
|
|
22
|
-
}
|
|
23
28
|
for (const d of node.findDirectExpressions(Expressions.Dynamic)) {
|
|
24
29
|
dynamic_1.Dynamic.runSyntax(d, input);
|
|
25
30
|
input.scope.addIdentifier(new _typed_identifier_1.TypedIdentifier(nameToken, input.filename, basic_1.VoidType.get("DYNAMIC_SELECT_OPTION")));
|
|
26
31
|
return;
|
|
27
32
|
}
|
|
28
|
-
const
|
|
29
|
-
let found = new basic_types_1.BasicTypes(input).resolveLikeName(
|
|
33
|
+
const nameChain = node.findFirstExpression(Expressions.FieldChain);
|
|
34
|
+
let found = new basic_types_1.BasicTypes(input).resolveLikeName(nameChain);
|
|
30
35
|
if (found) {
|
|
31
36
|
if (found instanceof basic_1.StructureType) {
|
|
32
37
|
let length = 0;
|
package/build/src/registry.js
CHANGED
|
@@ -49,6 +49,19 @@ This rule makes sure the spaces are consistently required across the language.`,
|
|
|
49
49
|
return issues;
|
|
50
50
|
}
|
|
51
51
|
missingSpace(statement) {
|
|
52
|
+
{
|
|
53
|
+
const tokens = statement.getTokens();
|
|
54
|
+
for (let i = 1; i < tokens.length; i++) {
|
|
55
|
+
const prev = tokens[i - 1];
|
|
56
|
+
const current = tokens[i];
|
|
57
|
+
if (prev.getStr() === ")"
|
|
58
|
+
&& current.getStr() === "="
|
|
59
|
+
&& prev.getRow() === current.getRow()
|
|
60
|
+
&& prev.getEnd().getCol() === current.getStart().getCol()) {
|
|
61
|
+
return current.getStart();
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
52
65
|
const found = statement.findAllExpressionsMulti([
|
|
53
66
|
Expressions.CondSub, Expressions.SQLCond, Expressions.ValueBodyLine,
|
|
54
67
|
Expressions.NewObject, Expressions.Cond, Expressions.ComponentCond,
|