@abaplint/core 2.99.1 → 2.99.2
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/abaplint.d.ts +5 -1
- package/build/src/abap/5_syntax/_type_utils.js +15 -1
- package/build/src/abap/5_syntax/basic_types.js +1 -1
- package/build/src/abap/5_syntax/expressions/field_chain.js +18 -2
- package/build/src/abap/5_syntax/expressions/field_length.js +9 -0
- package/build/src/abap/5_syntax/expressions/field_offset.js +4 -0
- package/build/src/abap/types/basic/character_type.js +8 -5
- package/build/src/registry.js +1 -1
- package/package.json +4 -4
package/build/abaplint.d.ts
CHANGED
|
@@ -817,7 +817,11 @@ declare class ChapterOfBookStructure extends AbstractObject {
|
|
|
817
817
|
declare class CharacterType extends AbstractType {
|
|
818
818
|
private readonly length;
|
|
819
819
|
constructor(length: number, extra?: AbstractTypeData);
|
|
820
|
-
cloneType(
|
|
820
|
+
cloneType(input: {
|
|
821
|
+
qualifiedName?: string;
|
|
822
|
+
ddicName?: string;
|
|
823
|
+
derivedFromConstant?: boolean;
|
|
824
|
+
}): CharacterType;
|
|
821
825
|
getLength(): number;
|
|
822
826
|
toText(): string;
|
|
823
827
|
toABAP(): string;
|
|
@@ -208,7 +208,7 @@ class TypeUtils {
|
|
|
208
208
|
return false;
|
|
209
209
|
}
|
|
210
210
|
isAssignableStrict(source, target) {
|
|
211
|
-
var _a, _b;
|
|
211
|
+
var _a, _b, _c, _d;
|
|
212
212
|
/*
|
|
213
213
|
console.dir(source);
|
|
214
214
|
console.dir(target);
|
|
@@ -227,6 +227,20 @@ class TypeUtils {
|
|
|
227
227
|
return false;
|
|
228
228
|
}
|
|
229
229
|
}
|
|
230
|
+
else if (source instanceof basic_1.HexType) {
|
|
231
|
+
if (target instanceof basic_1.HexType) {
|
|
232
|
+
if (((_c = source.getAbstractTypeData()) === null || _c === void 0 ? void 0 : _c.derivedFromConstant) === true) {
|
|
233
|
+
return source.getLength() <= target.getLength();
|
|
234
|
+
}
|
|
235
|
+
return source.getLength() === target.getLength();
|
|
236
|
+
}
|
|
237
|
+
else if (target instanceof basic_1.IntegerType) {
|
|
238
|
+
if (((_d = source.getAbstractTypeData()) === null || _d === void 0 ? void 0 : _d.derivedFromConstant) === true) {
|
|
239
|
+
return true;
|
|
240
|
+
}
|
|
241
|
+
return false;
|
|
242
|
+
}
|
|
243
|
+
}
|
|
230
244
|
else if (source instanceof basic_1.StringType && target instanceof basic_1.StructureType) {
|
|
231
245
|
if (this.structureContainsString(target)) {
|
|
232
246
|
return false;
|
|
@@ -94,10 +94,26 @@ class FieldChain {
|
|
|
94
94
|
context = new attribute_name_1.AttributeName().runSyntax(context, current, scope, filename, refType);
|
|
95
95
|
}
|
|
96
96
|
else if (current.get() instanceof Expressions.FieldOffset && current instanceof nodes_1.ExpressionNode) {
|
|
97
|
-
new field_offset_1.FieldOffset().runSyntax(current, scope, filename);
|
|
97
|
+
const offset = new field_offset_1.FieldOffset().runSyntax(current, scope, filename);
|
|
98
|
+
if (offset) {
|
|
99
|
+
if (context instanceof basic_1.CharacterType) {
|
|
100
|
+
context = new basic_1.CharacterType(context.getLength() - offset);
|
|
101
|
+
}
|
|
102
|
+
else if (context instanceof basic_1.HexType) {
|
|
103
|
+
context = new basic_1.HexType(context.getLength() - offset);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
98
106
|
}
|
|
99
107
|
else if (current.get() instanceof Expressions.FieldLength && current instanceof nodes_1.ExpressionNode) {
|
|
100
|
-
new field_length_1.FieldLength().runSyntax(current, scope, filename);
|
|
108
|
+
const length = new field_length_1.FieldLength().runSyntax(current, scope, filename);
|
|
109
|
+
if (length) {
|
|
110
|
+
if (context instanceof basic_1.CharacterType) {
|
|
111
|
+
context = new basic_1.CharacterType(length);
|
|
112
|
+
}
|
|
113
|
+
else if (context instanceof basic_1.HexType) {
|
|
114
|
+
context = new basic_1.HexType(length);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
101
117
|
}
|
|
102
118
|
}
|
|
103
119
|
return context;
|
|
@@ -9,6 +9,15 @@ class FieldLength {
|
|
|
9
9
|
const field = node.findDirectExpression(Expressions.SimpleFieldChain2);
|
|
10
10
|
if (field) {
|
|
11
11
|
new field_chain_1.FieldChain().runSyntax(field, scope, filename, _reference_1.ReferenceType.DataReadReference);
|
|
12
|
+
return undefined;
|
|
13
|
+
}
|
|
14
|
+
else {
|
|
15
|
+
const children = node.getChildren();
|
|
16
|
+
const num = children[children.length - 2];
|
|
17
|
+
if (num.getLastToken().getStr() === "*") {
|
|
18
|
+
return undefined;
|
|
19
|
+
}
|
|
20
|
+
return parseInt(num.getLastToken().getStr(), 10);
|
|
12
21
|
}
|
|
13
22
|
}
|
|
14
23
|
}
|
|
@@ -9,6 +9,10 @@ class FieldOffset {
|
|
|
9
9
|
const field = node.findDirectExpression(Expressions.SimpleFieldChain2);
|
|
10
10
|
if (field) {
|
|
11
11
|
new field_chain_1.FieldChain().runSyntax(field, scope, filename, _reference_1.ReferenceType.DataReadReference);
|
|
12
|
+
return undefined;
|
|
13
|
+
}
|
|
14
|
+
else {
|
|
15
|
+
return parseInt(node.getLastToken().getStr(), 10);
|
|
12
16
|
}
|
|
13
17
|
}
|
|
14
18
|
}
|
|
@@ -10,13 +10,16 @@ class CharacterType extends _abstract_type_1.AbstractType {
|
|
|
10
10
|
}
|
|
11
11
|
this.length = length;
|
|
12
12
|
}
|
|
13
|
-
cloneType(
|
|
13
|
+
cloneType(input) {
|
|
14
14
|
const clone = Object.assign({}, this.getAbstractTypeData()) || {};
|
|
15
|
-
if (qualifiedName) {
|
|
16
|
-
clone.qualifiedName = qualifiedName;
|
|
15
|
+
if (input.qualifiedName) {
|
|
16
|
+
clone.qualifiedName = input.qualifiedName;
|
|
17
17
|
}
|
|
18
|
-
if (ddicName) {
|
|
19
|
-
clone.ddicName = ddicName;
|
|
18
|
+
if (input.ddicName) {
|
|
19
|
+
clone.ddicName = input.ddicName;
|
|
20
|
+
}
|
|
21
|
+
if (input.derivedFromConstant) {
|
|
22
|
+
clone.derivedFromConstant = input.derivedFromConstant;
|
|
20
23
|
}
|
|
21
24
|
return new CharacterType(this.length, clone);
|
|
22
25
|
}
|
package/build/src/registry.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abaplint/core",
|
|
3
|
-
"version": "2.99.
|
|
3
|
+
"version": "2.99.2",
|
|
4
4
|
"description": "abaplint - Core API",
|
|
5
5
|
"main": "build/src/index.js",
|
|
6
6
|
"typings": "build/abaplint.d.ts",
|
|
@@ -47,10 +47,10 @@
|
|
|
47
47
|
},
|
|
48
48
|
"homepage": "https://abaplint.org",
|
|
49
49
|
"devDependencies": {
|
|
50
|
-
"@microsoft/api-extractor": "^7.34.
|
|
51
|
-
"@types/chai": "^4.3.
|
|
50
|
+
"@microsoft/api-extractor": "^7.34.7",
|
|
51
|
+
"@types/chai": "^4.3.5",
|
|
52
52
|
"@types/mocha": "^10.0.1",
|
|
53
|
-
"@types/node": "^18.16.
|
|
53
|
+
"@types/node": "^18.16.3",
|
|
54
54
|
"chai": "^4.3.7",
|
|
55
55
|
"eslint": "^8.39.0",
|
|
56
56
|
"mocha": "^10.2.0",
|