@abaplint/core 2.101.17 → 2.101.19
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/_type_utils.js +15 -4
- package/build/src/abap/5_syntax/expressions/method_call_param.js +3 -1
- package/build/src/abap/5_syntax/expressions/source.js +17 -4
- package/build/src/abap/5_syntax/expressions/sql_compare.js +7 -1
- package/build/src/abap/5_syntax/statements/loop.js +11 -2
- package/build/src/registry.js +1 -1
- package/package.json +3 -3
|
@@ -209,13 +209,13 @@ class TypeUtils {
|
|
|
209
209
|
}
|
|
210
210
|
return false;
|
|
211
211
|
}
|
|
212
|
-
isAssignableStrict(source, target,
|
|
213
|
-
var _a, _b, _c, _d, _e, _f;
|
|
212
|
+
isAssignableStrict(source, target, calculated = false) {
|
|
213
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
214
214
|
/*
|
|
215
215
|
console.dir(source);
|
|
216
216
|
console.dir(target);
|
|
217
217
|
*/
|
|
218
|
-
if (
|
|
218
|
+
if (calculated) {
|
|
219
219
|
return this.isAssignable(source, target);
|
|
220
220
|
}
|
|
221
221
|
if (source instanceof basic_1.CharacterType) {
|
|
@@ -256,12 +256,18 @@ class TypeUtils {
|
|
|
256
256
|
if (target instanceof basic_1.StructureType && this.structureContainsString(target)) {
|
|
257
257
|
return false;
|
|
258
258
|
}
|
|
259
|
-
else if (target instanceof basic_1.
|
|
259
|
+
else if (target instanceof basic_1.IntegerType) {
|
|
260
260
|
if (((_f = source.getAbstractTypeData()) === null || _f === void 0 ? void 0 : _f.derivedFromConstant) === true) {
|
|
261
261
|
return true;
|
|
262
262
|
}
|
|
263
263
|
return false;
|
|
264
264
|
}
|
|
265
|
+
else if (target instanceof basic_1.XSequenceType || target instanceof basic_1.XStringType) {
|
|
266
|
+
if (((_g = source.getAbstractTypeData()) === null || _g === void 0 ? void 0 : _g.derivedFromConstant) === true) {
|
|
267
|
+
return true;
|
|
268
|
+
}
|
|
269
|
+
return false;
|
|
270
|
+
}
|
|
265
271
|
return true;
|
|
266
272
|
}
|
|
267
273
|
else if (source instanceof basic_1.StructureType && target instanceof basic_1.StructureType) {
|
|
@@ -282,6 +288,11 @@ class TypeUtils {
|
|
|
282
288
|
return false;
|
|
283
289
|
}
|
|
284
290
|
}
|
|
291
|
+
else if (source instanceof basic_1.FloatType) {
|
|
292
|
+
if (target instanceof basic_1.IntegerType) {
|
|
293
|
+
return false;
|
|
294
|
+
}
|
|
295
|
+
}
|
|
285
296
|
else if (source instanceof basic_1.XStringType) {
|
|
286
297
|
if (target instanceof basic_1.CLikeType) {
|
|
287
298
|
return false;
|
|
@@ -52,10 +52,12 @@ class MethodCallParam {
|
|
|
52
52
|
if (child.get() instanceof Expressions.Source) {
|
|
53
53
|
sourceType = new source_1.Source().runSyntax(child, scope, filename, targetType);
|
|
54
54
|
}
|
|
55
|
+
const calculated = child.findFirstExpression(Expressions.MethodCallChain) !== undefined
|
|
56
|
+
|| child.findFirstExpression(Expressions.ArithOperator) !== undefined;
|
|
55
57
|
if (sourceType === undefined) {
|
|
56
58
|
throw new Error("No source type determined, method source");
|
|
57
59
|
}
|
|
58
|
-
else if (new _type_utils_1.TypeUtils(scope).isAssignableStrict(sourceType, targetType,
|
|
60
|
+
else if (new _type_utils_1.TypeUtils(scope).isAssignableStrict(sourceType, targetType, calculated) === false) {
|
|
59
61
|
throw new Error("Method parameter type not compatible");
|
|
60
62
|
}
|
|
61
63
|
}
|
|
@@ -176,19 +176,24 @@ class Source {
|
|
|
176
176
|
context = new string_template_1.StringTemplate().runSyntax(first, scope, filename);
|
|
177
177
|
}
|
|
178
178
|
else if (first instanceof nodes_1.ExpressionNode && first.get() instanceof Expressions.Source) {
|
|
179
|
-
|
|
179
|
+
const found = new Source().runSyntax(first, scope, filename);
|
|
180
|
+
context = this.infer(context, found);
|
|
180
181
|
}
|
|
181
182
|
else if (first instanceof nodes_1.ExpressionNode && first.get() instanceof Expressions.Constant) {
|
|
182
|
-
|
|
183
|
+
const found = new constant_1.Constant().runSyntax(first);
|
|
184
|
+
context = this.infer(context, found);
|
|
183
185
|
}
|
|
184
186
|
else if (first instanceof nodes_1.ExpressionNode && first.get() instanceof Expressions.Dereference) {
|
|
185
187
|
context = new dereference_1.Dereference().runSyntax(context);
|
|
186
|
-
// } else if (first instanceof ExpressionNode && first.get() instanceof Expressions.ArrowOrDash) {
|
|
187
|
-
// console.dir("dash");
|
|
188
188
|
}
|
|
189
189
|
else if (first instanceof nodes_1.ExpressionNode && first.get() instanceof Expressions.ComponentChain) {
|
|
190
190
|
context = new component_chain_1.ComponentChain().runSyntax(context, first, scope, filename);
|
|
191
191
|
}
|
|
192
|
+
else if (first instanceof nodes_1.ExpressionNode && first.get() instanceof Expressions.ArithOperator) {
|
|
193
|
+
if (first.concatTokens() === "**") {
|
|
194
|
+
context = new basic_1.FloatType();
|
|
195
|
+
}
|
|
196
|
+
}
|
|
192
197
|
else if (first instanceof nodes_1.ExpressionNode && first.get() instanceof Expressions.AttributeChain) {
|
|
193
198
|
context = new attribute_chain_1.AttributeChain().runSyntax(context, first, scope, filename, type);
|
|
194
199
|
}
|
|
@@ -203,6 +208,14 @@ class Source {
|
|
|
203
208
|
return context;
|
|
204
209
|
}
|
|
205
210
|
////////////////////////////////
|
|
211
|
+
infer(context, found) {
|
|
212
|
+
if (context instanceof basic_1.FloatType && found instanceof basic_1.IntegerType) {
|
|
213
|
+
return context;
|
|
214
|
+
}
|
|
215
|
+
else {
|
|
216
|
+
return found;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
206
219
|
addIfInferred(node, scope, filename, inferredType) {
|
|
207
220
|
const basic = new basic_types_1.BasicTypes(filename, scope);
|
|
208
221
|
const typeExpression = node.findFirstExpression(Expressions.TypeNameOrInfer);
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SQLCompare = void 0;
|
|
4
4
|
const Expressions = require("../../2_statements/expressions");
|
|
5
|
+
const nodes_1 = require("../../nodes");
|
|
5
6
|
const basic_1 = require("../../types/basic");
|
|
6
7
|
const sql_source_1 = require("./sql_source");
|
|
7
8
|
class SQLCompare {
|
|
@@ -10,7 +11,12 @@ class SQLCompare {
|
|
|
10
11
|
let sourceType;
|
|
11
12
|
let token;
|
|
12
13
|
for (const s of node.findAllExpressions(Expressions.SQLSource)) {
|
|
13
|
-
|
|
14
|
+
for (const child of s.getChildren()) {
|
|
15
|
+
if (child instanceof nodes_1.ExpressionNode) {
|
|
16
|
+
token = child.getFirstToken();
|
|
17
|
+
break;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
14
20
|
sourceType = new sql_source_1.SQLSource().runSyntax(s, scope, filename);
|
|
15
21
|
}
|
|
16
22
|
const fieldName = (_a = node.findDirectExpression(Expressions.SQLFieldName)) === null || _a === void 0 ? void 0 : _a.concatTokens();
|
|
@@ -13,7 +13,6 @@ const dynamic_1 = require("../expressions/dynamic");
|
|
|
13
13
|
const loop_group_by_1 = require("../expressions/loop_group_by");
|
|
14
14
|
class Loop {
|
|
15
15
|
runSyntax(node, scope, filename) {
|
|
16
|
-
var _a;
|
|
17
16
|
const loopTarget = node.findDirectExpression(Expressions.LoopTarget);
|
|
18
17
|
let target = loopTarget === null || loopTarget === void 0 ? void 0 : loopTarget.findDirectExpression(Expressions.Target);
|
|
19
18
|
const targetType = target ? new target_1.Target().runSyntax(target, scope, filename) : undefined;
|
|
@@ -47,14 +46,24 @@ class Loop {
|
|
|
47
46
|
&& concat.startsWith("LOOP AT GROUP ") === false) {
|
|
48
47
|
throw new Error("Loop, not a table type");
|
|
49
48
|
}
|
|
49
|
+
else if (loopTarget === undefined
|
|
50
|
+
&& sourceType instanceof basic_1.TableType
|
|
51
|
+
&& sourceType.isWithHeader() === false) {
|
|
52
|
+
throw new Error("Loop, no header");
|
|
53
|
+
}
|
|
54
|
+
const targetConcat = loopTarget === null || loopTarget === void 0 ? void 0 : loopTarget.concatTokens().toUpperCase();
|
|
50
55
|
if (sourceType instanceof basic_1.TableType) {
|
|
51
|
-
const targetConcat = (_a = node.findDirectExpression(Expressions.LoopTarget)) === null || _a === void 0 ? void 0 : _a.concatTokens().toUpperCase();
|
|
52
56
|
rowType = sourceType.getRowType();
|
|
53
57
|
sourceType = rowType;
|
|
54
58
|
if (targetConcat === null || targetConcat === void 0 ? void 0 : targetConcat.startsWith("REFERENCE INTO ")) {
|
|
55
59
|
sourceType = new basic_1.DataReference(sourceType);
|
|
56
60
|
}
|
|
57
61
|
}
|
|
62
|
+
if (targetConcat
|
|
63
|
+
&& targetConcat.startsWith("TRANSPORTING ")
|
|
64
|
+
&& node.findDirectTokenByText("WHERE") === undefined) {
|
|
65
|
+
throw new Error("Loop, TRANSPORTING NO FIELDS only with WHERE");
|
|
66
|
+
}
|
|
58
67
|
const inline = target === null || target === void 0 ? void 0 : target.findDirectExpression(Expressions.InlineData);
|
|
59
68
|
if (inline) {
|
|
60
69
|
new inline_data_1.InlineData().runSyntax(inline, scope, filename, sourceType);
|
package/build/src/registry.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abaplint/core",
|
|
3
|
-
"version": "2.101.
|
|
3
|
+
"version": "2.101.19",
|
|
4
4
|
"description": "abaplint - Core API",
|
|
5
5
|
"main": "build/src/index.js",
|
|
6
6
|
"typings": "build/abaplint.d.ts",
|
|
@@ -50,10 +50,10 @@
|
|
|
50
50
|
},
|
|
51
51
|
"homepage": "https://abaplint.org",
|
|
52
52
|
"devDependencies": {
|
|
53
|
-
"@microsoft/api-extractor": "^7.35.
|
|
53
|
+
"@microsoft/api-extractor": "^7.35.3",
|
|
54
54
|
"@types/chai": "^4.3.5",
|
|
55
55
|
"@types/mocha": "^10.0.1",
|
|
56
|
-
"@types/node": "^20.
|
|
56
|
+
"@types/node": "^20.3.1",
|
|
57
57
|
"chai": "^4.3.7",
|
|
58
58
|
"eslint": "^8.42.0",
|
|
59
59
|
"mocha": "^10.2.0",
|