@abaplint/core 2.95.12 → 2.95.14
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.
|
@@ -3,13 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.WriteOffsetLength = void 0;
|
|
4
4
|
const combi_1 = require("../combi");
|
|
5
5
|
const tokens_1 = require("../../1_lexer/tokens");
|
|
6
|
-
const
|
|
6
|
+
const simple_field_chain2_1 = require("./simple_field_chain2");
|
|
7
7
|
class WriteOffsetLength extends combi_1.Expression {
|
|
8
8
|
getRunnable() {
|
|
9
|
-
const post = (0, combi_1.seq)((0, combi_1.alt)(
|
|
9
|
+
const post = (0, combi_1.seq)((0, combi_1.alt)(simple_field_chain2_1.SimpleFieldChain2, (0, combi_1.regex)(/^[\d]+$/), (0, combi_1.regex)(/^\*$/)), (0, combi_1.alt)((0, combi_1.tok)(tokens_1.ParenRightW), (0, combi_1.tok)(tokens_1.ParenRight)));
|
|
10
10
|
const wlength = (0, combi_1.seq)((0, combi_1.tok)(tokens_1.WParenLeft), post);
|
|
11
11
|
const length = (0, combi_1.seq)((0, combi_1.tok)(tokens_1.ParenLeft), post);
|
|
12
|
-
const complex = (0, combi_1.alt)(wlength, (0, combi_1.seq)((0, combi_1.alt)(
|
|
12
|
+
const complex = (0, combi_1.alt)(wlength, (0, combi_1.seq)((0, combi_1.alt)(simple_field_chain2_1.SimpleFieldChain2, (0, combi_1.regex)(/^\/?[\w\d]+$/), "/"), (0, combi_1.opt)(length)));
|
|
13
13
|
const at = (0, combi_1.seq)((0, combi_1.opt)("AT"), complex);
|
|
14
14
|
return at;
|
|
15
15
|
}
|
|
@@ -5,16 +5,17 @@ const basic_1 = require("../../types/basic");
|
|
|
5
5
|
const Expressions = require("../../2_statements/expressions");
|
|
6
6
|
const source_1 = require("./source");
|
|
7
7
|
const _type_utils_1 = require("../_type_utils");
|
|
8
|
+
const basic_types_1 = require("../basic_types");
|
|
8
9
|
class Cast {
|
|
9
10
|
runSyntax(node, scope, targetType, filename) {
|
|
10
|
-
var _a;
|
|
11
11
|
const sourceNode = node.findDirectExpression(Expressions.Source);
|
|
12
12
|
if (sourceNode === undefined) {
|
|
13
13
|
throw new Error("Cast, source node not found");
|
|
14
14
|
}
|
|
15
15
|
const sourceType = new source_1.Source().runSyntax(sourceNode, scope, filename);
|
|
16
16
|
let tt = undefined;
|
|
17
|
-
const
|
|
17
|
+
const typeExpression = node.findDirectExpression(Expressions.TypeNameOrInfer);
|
|
18
|
+
const typeName = typeExpression === null || typeExpression === void 0 ? void 0 : typeExpression.concatTokens();
|
|
18
19
|
if (typeName === undefined) {
|
|
19
20
|
throw new Error("Cast, child TypeNameOrInfer not found");
|
|
20
21
|
}
|
|
@@ -24,21 +25,28 @@ class Cast {
|
|
|
24
25
|
else if (typeName === "#") {
|
|
25
26
|
throw new Error("Cast, todo, infer type");
|
|
26
27
|
}
|
|
27
|
-
if (tt === undefined) {
|
|
28
|
-
const
|
|
29
|
-
|
|
28
|
+
if (tt === undefined && typeExpression) {
|
|
29
|
+
const basic = new basic_types_1.BasicTypes(filename, scope);
|
|
30
|
+
tt = basic.parseType(typeExpression);
|
|
31
|
+
if (tt === undefined || tt instanceof basic_1.VoidType || tt instanceof basic_1.UnknownType) {
|
|
32
|
+
const found = scope.findObjectDefinition(typeName);
|
|
33
|
+
if (found) {
|
|
34
|
+
tt = new basic_1.ObjectReferenceType(found, typeName);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
tt = new basic_1.DataReference(tt, typeName);
|
|
39
|
+
}
|
|
40
|
+
if (tt === undefined && scope.getDDIC().inErrorNamespace(typeName) === false) {
|
|
30
41
|
tt = new basic_1.VoidType(typeName);
|
|
31
42
|
}
|
|
32
43
|
else if (typeName.toUpperCase() === "OBJECT") {
|
|
33
44
|
return new basic_1.GenericObjectReferenceType();
|
|
34
45
|
}
|
|
35
|
-
else if (
|
|
46
|
+
else if (tt === undefined) {
|
|
36
47
|
// todo, this should be an UnknownType instead?
|
|
37
48
|
throw new Error("Type \"" + typeName + "\" not found in scope, Cast");
|
|
38
49
|
}
|
|
39
|
-
else {
|
|
40
|
-
tt = new basic_1.ObjectReferenceType(found, typeName);
|
|
41
|
-
}
|
|
42
50
|
}
|
|
43
51
|
new source_1.Source().addIfInferred(node, scope, filename, tt);
|
|
44
52
|
if (new _type_utils_1.TypeUtils(scope).isCastable(sourceType, tt) === false) {
|
|
@@ -6,6 +6,8 @@ const source_1 = require("../expressions/source");
|
|
|
6
6
|
const target_1 = require("../expressions/target");
|
|
7
7
|
const dynamic_1 = require("../expressions/dynamic");
|
|
8
8
|
const _type_utils_1 = require("../_type_utils");
|
|
9
|
+
const field_chain_1 = require("../expressions/field_chain");
|
|
10
|
+
const _reference_1 = require("../_reference");
|
|
9
11
|
class Write {
|
|
10
12
|
runSyntax(node, scope, filename) {
|
|
11
13
|
// todo, more
|
|
@@ -18,6 +20,9 @@ class Write {
|
|
|
18
20
|
throw new Error("Source not character like");
|
|
19
21
|
}
|
|
20
22
|
}
|
|
23
|
+
for (const s of node.findAllExpressions(Expressions.SimpleFieldChain2)) {
|
|
24
|
+
new field_chain_1.FieldChain().runSyntax(s, scope, filename, _reference_1.ReferenceType.DataReadReference);
|
|
25
|
+
}
|
|
21
26
|
for (const s of node.findAllExpressions(Expressions.Dynamic)) {
|
|
22
27
|
new dynamic_1.Dynamic().runSyntax(s, scope, filename);
|
|
23
28
|
}
|
package/build/src/registry.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abaplint/core",
|
|
3
|
-
"version": "2.95.
|
|
3
|
+
"version": "2.95.14",
|
|
4
4
|
"description": "abaplint - Core API",
|
|
5
5
|
"main": "build/src/index.js",
|
|
6
6
|
"typings": "build/abaplint.d.ts",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"@microsoft/api-extractor": "^7.34.3",
|
|
51
51
|
"@types/chai": "^4.3.4",
|
|
52
52
|
"@types/mocha": "^10.0.1",
|
|
53
|
-
"@types/node": "^18.
|
|
53
|
+
"@types/node": "^18.13.0",
|
|
54
54
|
"chai": "^4.3.7",
|
|
55
55
|
"eslint": "^8.33.0",
|
|
56
56
|
"mocha": "^10.2.0",
|