@abaplint/core 2.105.23 → 2.105.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/src/abap/5_syntax/_type_utils.js +8 -1
- package/build/src/abap/5_syntax/expressions/conv_body.js +6 -3
- package/build/src/abap/5_syntax/expressions/source.js +5 -1
- package/build/src/abap/5_syntax/statements/append.js +12 -1
- package/build/src/abap/5_syntax/statements/read_table.js +2 -2
- package/build/src/registry.js +1 -1
- package/package.json +3 -3
|
@@ -278,7 +278,8 @@ class TypeUtils {
|
|
|
278
278
|
}
|
|
279
279
|
return false;
|
|
280
280
|
}
|
|
281
|
-
else if (target instanceof cgeneric_type_1.CGenericType
|
|
281
|
+
else if (target instanceof cgeneric_type_1.CGenericType
|
|
282
|
+
|| target instanceof basic_1.GenericObjectReferenceType) {
|
|
282
283
|
return false;
|
|
283
284
|
}
|
|
284
285
|
else if (target instanceof basic_1.XSequenceType || target instanceof basic_1.XStringType) {
|
|
@@ -468,8 +469,14 @@ class TypeUtils {
|
|
|
468
469
|
if (source instanceof basic_1.TableType && source.isWithHeader() === false) {
|
|
469
470
|
return false;
|
|
470
471
|
}
|
|
472
|
+
else if (target instanceof basic_1.StringType
|
|
473
|
+
&& source instanceof basic_1.StructureType
|
|
474
|
+
&& this.isCharLike(source)) {
|
|
475
|
+
return true;
|
|
476
|
+
}
|
|
471
477
|
else if (source instanceof basic_1.DataReference
|
|
472
478
|
|| source instanceof basic_1.ObjectReferenceType
|
|
479
|
+
|| source instanceof basic_1.StructureType
|
|
473
480
|
|| source instanceof basic_1.GenericObjectReferenceType) {
|
|
474
481
|
return false;
|
|
475
482
|
}
|
|
@@ -7,19 +7,22 @@ const let_1 = require("./let");
|
|
|
7
7
|
class ConvBody {
|
|
8
8
|
runSyntax(node, scope, filename) {
|
|
9
9
|
if (node === undefined) {
|
|
10
|
-
|
|
10
|
+
throw new Error("ConvBody, node undefined");
|
|
11
11
|
}
|
|
12
12
|
let scoped = false;
|
|
13
13
|
const l = node.findDirectExpression(Expressions.Let);
|
|
14
14
|
if (l) {
|
|
15
15
|
scoped = new let_1.Let().runSyntax(l, scope, filename);
|
|
16
16
|
}
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
const s = node.findDirectExpression(Expressions.Source);
|
|
18
|
+
if (s === undefined) {
|
|
19
|
+
throw new Error("ConvBody, no source found");
|
|
19
20
|
}
|
|
21
|
+
const sourceType = new source_1.Source().runSyntax(s, scope, filename);
|
|
20
22
|
if (scoped === true) {
|
|
21
23
|
scope.pop(node.getLastToken().getEnd());
|
|
22
24
|
}
|
|
25
|
+
return sourceType;
|
|
23
26
|
}
|
|
24
27
|
}
|
|
25
28
|
exports.ConvBody = ConvBody;
|
|
@@ -24,6 +24,7 @@ const _builtin_1 = require("../_builtin");
|
|
|
24
24
|
const attribute_chain_1 = require("./attribute_chain");
|
|
25
25
|
const dereference_1 = require("./dereference");
|
|
26
26
|
const _typed_identifier_1 = require("../../types/_typed_identifier");
|
|
27
|
+
const _type_utils_1 = require("../_type_utils");
|
|
27
28
|
/*
|
|
28
29
|
* Type interference, valid scenarios:
|
|
29
30
|
* typed = VALUE #( ... ). right hand side must follow left hand type
|
|
@@ -107,7 +108,10 @@ class Source {
|
|
|
107
108
|
case "CONV":
|
|
108
109
|
{
|
|
109
110
|
const foundType = this.determineType(node, scope, filename, targetType);
|
|
110
|
-
new conv_body_1.ConvBody().runSyntax(node.findDirectExpression(Expressions.ConvBody), scope, filename);
|
|
111
|
+
const bodyType = new conv_body_1.ConvBody().runSyntax(node.findDirectExpression(Expressions.ConvBody), scope, filename);
|
|
112
|
+
if (new _type_utils_1.TypeUtils(scope).isAssignable(foundType, bodyType) === false) {
|
|
113
|
+
throw new Error("CONV: Types not compatible");
|
|
114
|
+
}
|
|
111
115
|
this.addIfInferred(node, scope, filename, foundType);
|
|
112
116
|
return foundType;
|
|
113
117
|
}
|
|
@@ -7,6 +7,7 @@ const target_1 = require("../expressions/target");
|
|
|
7
7
|
const basic_1 = require("../../types/basic");
|
|
8
8
|
const fstarget_1 = require("../expressions/fstarget");
|
|
9
9
|
const inline_data_1 = require("../expressions/inline_data");
|
|
10
|
+
const _type_utils_1 = require("../_type_utils");
|
|
10
11
|
// todo: issue error for short APPEND if the source is without header line
|
|
11
12
|
class Append {
|
|
12
13
|
runSyntax(node, scope, filename) {
|
|
@@ -49,7 +50,17 @@ class Append {
|
|
|
49
50
|
else if (targetType instanceof basic_1.VoidType) {
|
|
50
51
|
rowType = targetType;
|
|
51
52
|
}
|
|
52
|
-
new source_1.Source().runSyntax(source, scope, filename, rowType);
|
|
53
|
+
const sourceType = new source_1.Source().runSyntax(source, scope, filename, rowType);
|
|
54
|
+
if (node.findDirectTokenByText("LINES")) {
|
|
55
|
+
if (new _type_utils_1.TypeUtils(scope).isAssignable(sourceType, targetType) === false) {
|
|
56
|
+
throw new Error("Incompatible types");
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
if (new _type_utils_1.TypeUtils(scope).isAssignable(sourceType, rowType) === false) {
|
|
61
|
+
throw new Error("Incompatible types");
|
|
62
|
+
}
|
|
63
|
+
}
|
|
53
64
|
}
|
|
54
65
|
const from = node.findExpressionAfterToken("FROM");
|
|
55
66
|
if (from && from.get() instanceof Expressions.Source) {
|
|
@@ -42,8 +42,8 @@ class ReadTable {
|
|
|
42
42
|
const fromSource = node.findExpressionAfterToken("FROM");
|
|
43
43
|
if (fromSource) {
|
|
44
44
|
const fromType = new source_1.Source().runSyntax(fromSource, scope, filename);
|
|
45
|
-
if (new _type_utils_1.TypeUtils(scope).isAssignable(fromType,
|
|
46
|
-
throw new Error("READ TABLE, FROM must be
|
|
45
|
+
if (new _type_utils_1.TypeUtils(scope).isAssignable(fromType, rowType) === false) {
|
|
46
|
+
throw new Error("READ TABLE, FROM must be compatible");
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
49
|
for (const s of sources) {
|
package/build/src/registry.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abaplint/core",
|
|
3
|
-
"version": "2.105.
|
|
3
|
+
"version": "2.105.25",
|
|
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.41.
|
|
53
|
+
"@microsoft/api-extractor": "^7.41.1",
|
|
54
54
|
"@types/chai": "^4.3.12",
|
|
55
55
|
"@types/mocha": "^10.0.6",
|
|
56
|
-
"@types/node": "^20.11.
|
|
56
|
+
"@types/node": "^20.11.22",
|
|
57
57
|
"chai": "^4.4.1",
|
|
58
58
|
"eslint": "^8.57.0",
|
|
59
59
|
"mocha": "^10.3.0",
|