@abaplint/core 2.120.83 → 2.120.84
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 +19 -5
- package/build/src/abap/1_lexer/tokens/abstract_token.js +36 -12
- package/build/src/abap/5_syntax/_current_scope.js +14 -11
- package/build/src/abap/5_syntax/_eml.js +68 -0
- package/build/src/abap/5_syntax/_object_oriented.js +10 -0
- package/build/src/abap/5_syntax/spaghetti_scope.js +67 -9
- package/build/src/abap/5_syntax/statements/message.js +8 -0
- package/build/src/abap/5_syntax/statements/modify_entities.js +2 -0
- package/build/src/abap/5_syntax/statements/raise.js +6 -0
- package/build/src/abap/5_syntax/statements/read_entities.js +2 -0
- package/build/src/bdef/bdef_parser.js +75 -0
- package/build/src/bdef/expressions/bdef_action.js +15 -0
- package/build/src/bdef/expressions/bdef_alias.js +12 -0
- package/build/src/bdef/expressions/bdef_association.js +15 -0
- package/build/src/bdef/expressions/bdef_association_body.js +18 -0
- package/build/src/bdef/expressions/bdef_authorization_context.js +16 -0
- package/build/src/bdef/expressions/bdef_cardinality.js +13 -0
- package/build/src/bdef/expressions/bdef_default_function.js +14 -0
- package/build/src/bdef/expressions/bdef_define_behavior.js +21 -0
- package/build/src/bdef/expressions/bdef_definition.js +12 -0
- package/build/src/bdef/expressions/bdef_determination.js +15 -0
- package/build/src/bdef/expressions/bdef_determine_action.js +15 -0
- package/build/src/bdef/expressions/bdef_event.js +14 -0
- package/build/src/bdef/expressions/bdef_field.js +13 -0
- package/build/src/bdef/expressions/bdef_field_path.js +13 -0
- package/build/src/bdef/expressions/bdef_header.js +15 -0
- package/build/src/bdef/expressions/bdef_hierarchy.js +16 -0
- package/build/src/bdef/expressions/bdef_implementation_in.js +12 -0
- package/build/src/bdef/expressions/bdef_implementation_type.js +19 -0
- package/build/src/bdef/expressions/bdef_key.js +14 -0
- package/build/src/bdef/expressions/bdef_mapping.js +19 -0
- package/build/src/bdef/expressions/bdef_name.js +13 -0
- package/build/src/bdef/expressions/bdef_operation.js +13 -0
- package/build/src/bdef/expressions/bdef_options.js +15 -0
- package/build/src/bdef/expressions/bdef_parameter.js +13 -0
- package/build/src/bdef/expressions/bdef_reference.js +15 -0
- package/build/src/bdef/expressions/bdef_result.js +13 -0
- package/build/src/bdef/expressions/bdef_side_effects.js +25 -0
- package/build/src/bdef/expressions/bdef_string.js +11 -0
- package/build/src/bdef/expressions/bdef_use.js +18 -0
- package/build/src/bdef/expressions/index.js +46 -0
- package/build/src/objects/behavior_definition.js +46 -8
- package/build/src/registry.js +1 -1
- package/build/src/rules/bdef_check_syntax.js +88 -0
- package/build/src/rules/bdef_parser_error.js +47 -0
- package/build/src/rules/index.js +2 -0
- package/package.json +1 -1
package/build/abaplint.d.ts
CHANGED
|
@@ -549,13 +549,18 @@ declare class BehaviorDefinition extends AbstractObject {
|
|
|
549
549
|
};
|
|
550
550
|
setDirty(): void;
|
|
551
551
|
findSourceFile(): IFile | undefined;
|
|
552
|
+
parse(): IParseResult;
|
|
553
|
+
getTree(): ExpressionNode | undefined;
|
|
554
|
+
hasParserError(): boolean;
|
|
552
555
|
listEntities(): readonly {
|
|
553
556
|
name: string;
|
|
554
557
|
alias: string | undefined;
|
|
555
558
|
}[];
|
|
556
559
|
/** finds the entity name for a given alias, undefined if the alias is not defined */
|
|
557
560
|
findEntityNameByAlias(alias: string): string | undefined;
|
|
558
|
-
private
|
|
561
|
+
private findEntities;
|
|
562
|
+
/** used if the source cannot be parsed */
|
|
563
|
+
private findEntitiesFallback;
|
|
559
564
|
}
|
|
560
565
|
|
|
561
566
|
declare class BehaviorDefinitionName extends Expression {
|
|
@@ -1603,6 +1608,7 @@ export declare class CurrentScope {
|
|
|
1603
1608
|
findObjectDefinition(name: string | undefined): IClassDefinition | IInterfaceDefinition | undefined;
|
|
1604
1609
|
/** the BDEF from "FOR BEHAVIOR OF" of the enclosing global class, undefined if not a behavior pool */
|
|
1605
1610
|
findBehaviorDefinition(): BehaviorDefinition | undefined;
|
|
1611
|
+
findBehaviorDefinitionByName(name: string | undefined): BehaviorDefinition | undefined;
|
|
1606
1612
|
isBadiDef(name: string): boolean;
|
|
1607
1613
|
existsObject(name: string | undefined): {
|
|
1608
1614
|
id: Identifier | undefined;
|
|
@@ -5565,6 +5571,7 @@ declare type ParsedBehaviorDefinition = {
|
|
|
5565
5571
|
name: string;
|
|
5566
5572
|
alias: string | undefined;
|
|
5567
5573
|
}[];
|
|
5574
|
+
tree: ExpressionNode | undefined;
|
|
5568
5575
|
};
|
|
5569
5576
|
|
|
5570
5577
|
declare type ParsedDataDefinition = {
|
|
@@ -6489,6 +6496,15 @@ declare abstract class ScopeData {
|
|
|
6489
6496
|
private readonly data;
|
|
6490
6497
|
constructor();
|
|
6491
6498
|
getData(): IScopeData;
|
|
6499
|
+
setVariable(name: string, identifier: TypedIdentifier): void;
|
|
6500
|
+
setType(name: string, type: TypedIdentifier): void;
|
|
6501
|
+
setExtraLikeType(name: string, type: TypedIdentifier): void;
|
|
6502
|
+
setDeferred(name: string, deferred: DeferredInformation): void;
|
|
6503
|
+
setClassDefinition(name: string, cdef: IClassDefinition): void;
|
|
6504
|
+
setInterfaceDefinition(name: string, idef: IInterfaceDefinition): void;
|
|
6505
|
+
addFormDefinitions(forms: readonly IFormDefinition[]): void;
|
|
6506
|
+
addReference(reference: IReference): void;
|
|
6507
|
+
addSQLConversion(conversion: IScopeData["sqlConversion"][number]): void;
|
|
6492
6508
|
}
|
|
6493
6509
|
|
|
6494
6510
|
export declare enum ScopeType {
|
|
@@ -8003,15 +8019,13 @@ declare class TimeType extends AbstractType {
|
|
|
8003
8019
|
toCDS(): string;
|
|
8004
8020
|
}
|
|
8005
8021
|
|
|
8006
|
-
export declare abstract class Token {
|
|
8007
|
-
private readonly start;
|
|
8022
|
+
export declare abstract class Token extends Position {
|
|
8008
8023
|
private readonly str;
|
|
8009
8024
|
private readonly strUpper;
|
|
8025
|
+
private readonly virtual?;
|
|
8010
8026
|
constructor(start: Position, str: string);
|
|
8011
8027
|
getStr(): string;
|
|
8012
8028
|
getUpperStr(): string;
|
|
8013
|
-
getRow(): number;
|
|
8014
|
-
getCol(): number;
|
|
8015
8029
|
getStart(): Position;
|
|
8016
8030
|
getEnd(): Position;
|
|
8017
8031
|
}
|
|
@@ -2,11 +2,40 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.AbstractToken = void 0;
|
|
4
4
|
const position_1 = require("../../../position");
|
|
5
|
-
|
|
5
|
+
const virtual_position_1 = require("../../../virtual_position");
|
|
6
|
+
// token strings repeat a lot across files (keywords, common names, upper cased copies), share them.
|
|
7
|
+
// Longer strings are typically comments or text literals, not worth sharing
|
|
8
|
+
const INTERN_MAX_LENGTH = 30;
|
|
9
|
+
// bound the table, it lives for the lifetime of the process
|
|
10
|
+
const INTERN_MAX_ENTRIES = 100000;
|
|
11
|
+
// V8 represents substrings of this length or longer as slices that reference the full source,
|
|
12
|
+
// these are flattened before being stored, so the table does not keep removed files alive
|
|
13
|
+
const SLICED_MIN_LENGTH = 13;
|
|
14
|
+
let interned = new Map();
|
|
15
|
+
function intern(str) {
|
|
16
|
+
if (str.length > INTERN_MAX_LENGTH) {
|
|
17
|
+
return str;
|
|
18
|
+
}
|
|
19
|
+
const found = interned.get(str);
|
|
20
|
+
if (found !== undefined) {
|
|
21
|
+
return found;
|
|
22
|
+
}
|
|
23
|
+
if (interned.size >= INTERN_MAX_ENTRIES) {
|
|
24
|
+
interned = new Map();
|
|
25
|
+
}
|
|
26
|
+
const copy = str.length >= SLICED_MIN_LENGTH ? str.split("").join("") : str;
|
|
27
|
+
interned.set(copy, copy);
|
|
28
|
+
return copy;
|
|
29
|
+
}
|
|
30
|
+
// the token is its own start position, saves a separate Position object per token
|
|
31
|
+
class AbstractToken extends position_1.Position {
|
|
6
32
|
constructor(start, str) {
|
|
7
|
-
|
|
8
|
-
this.str = str;
|
|
9
|
-
this.strUpper = str.toUpperCase();
|
|
33
|
+
super(start.getRow(), start.getCol());
|
|
34
|
+
this.str = intern(str);
|
|
35
|
+
this.strUpper = intern(str.toUpperCase());
|
|
36
|
+
if (start instanceof virtual_position_1.VirtualPosition) {
|
|
37
|
+
this.virtual = start;
|
|
38
|
+
}
|
|
10
39
|
}
|
|
11
40
|
// special function, for debugging purposes, see https://github.com/abaplint/abaplint/pull/3137
|
|
12
41
|
[Symbol.for("debug.description")]() {
|
|
@@ -18,17 +47,12 @@ class AbstractToken {
|
|
|
18
47
|
getUpperStr() {
|
|
19
48
|
return this.strUpper;
|
|
20
49
|
}
|
|
21
|
-
getRow() {
|
|
22
|
-
return this.start.getRow();
|
|
23
|
-
}
|
|
24
|
-
getCol() {
|
|
25
|
-
return this.start.getCol();
|
|
26
|
-
}
|
|
27
50
|
getStart() {
|
|
28
|
-
|
|
51
|
+
var _a;
|
|
52
|
+
return (_a = this.virtual) !== null && _a !== void 0 ? _a : this;
|
|
29
53
|
}
|
|
30
54
|
getEnd() {
|
|
31
|
-
return new position_1.Position(this.
|
|
55
|
+
return new position_1.Position(this.getRow(), this.getCol() + this.str.length);
|
|
32
56
|
}
|
|
33
57
|
}
|
|
34
58
|
exports.AbstractToken = AbstractToken;
|
|
@@ -70,7 +70,7 @@ class CurrentScope {
|
|
|
70
70
|
else if (this.isOO() && this.current.getData().vars[upper] !== undefined) {
|
|
71
71
|
throw new Error(`"${name}" already defined`);
|
|
72
72
|
}
|
|
73
|
-
this.current.
|
|
73
|
+
this.current.setType(upper, type);
|
|
74
74
|
}
|
|
75
75
|
addExtraLikeType(type) {
|
|
76
76
|
if (type === undefined) {
|
|
@@ -89,7 +89,7 @@ class CurrentScope {
|
|
|
89
89
|
if (this.current.getData().extraLikeTypes[upper] !== undefined) {
|
|
90
90
|
throw new Error(`Type name "${name}" already defined`);
|
|
91
91
|
}
|
|
92
|
-
this.current.
|
|
92
|
+
this.current.setExtraLikeType(upper, type);
|
|
93
93
|
}
|
|
94
94
|
addClassDefinition(c) {
|
|
95
95
|
if (this.current === undefined) {
|
|
@@ -99,13 +99,13 @@ class CurrentScope {
|
|
|
99
99
|
if (this.current.getData().cdefs[name] !== undefined) {
|
|
100
100
|
throw new Error(`Class "${name}" already defined`);
|
|
101
101
|
}
|
|
102
|
-
this.current.
|
|
102
|
+
this.current.setClassDefinition(name, c);
|
|
103
103
|
}
|
|
104
104
|
addFormDefinitions(f) {
|
|
105
105
|
if (this.current === undefined) {
|
|
106
106
|
return;
|
|
107
107
|
}
|
|
108
|
-
this.current.
|
|
108
|
+
this.current.addFormDefinitions(f);
|
|
109
109
|
}
|
|
110
110
|
/** The FORM definitions are built up front, at that point the program level types are not known.
|
|
111
111
|
* When the FORM statement is traversed it is replaced with one resolved in the scope of the FORM */
|
|
@@ -130,7 +130,7 @@ class CurrentScope {
|
|
|
130
130
|
if (this.current.getData().cdefs[name] !== undefined) {
|
|
131
131
|
throw new Error(`Interface "${name}" already defined`);
|
|
132
132
|
}
|
|
133
|
-
this.current.
|
|
133
|
+
this.current.setInterfaceDefinition(name, i);
|
|
134
134
|
}
|
|
135
135
|
addNamedIdentifier(name, identifier) {
|
|
136
136
|
if (this.current === undefined) {
|
|
@@ -144,7 +144,7 @@ class CurrentScope {
|
|
|
144
144
|
else if (this.isOO() && this.current.getData().types[upper] !== undefined) {
|
|
145
145
|
throw new Error(`"${name}" already defined`);
|
|
146
146
|
}
|
|
147
|
-
this.current.
|
|
147
|
+
this.current.setVariable(upper, identifier);
|
|
148
148
|
}
|
|
149
149
|
addNamedIdentifierToParent(name, identifier) {
|
|
150
150
|
if (this.current === undefined) {
|
|
@@ -162,7 +162,7 @@ class CurrentScope {
|
|
|
162
162
|
else if (this.isOO() && parent.getData().types[upper] !== undefined) {
|
|
163
163
|
throw new Error(`"${name}" already defined`);
|
|
164
164
|
}
|
|
165
|
-
parent.
|
|
165
|
+
parent.setVariable(upper, identifier);
|
|
166
166
|
}
|
|
167
167
|
addIdentifier(identifier) {
|
|
168
168
|
if (identifier === undefined) {
|
|
@@ -174,7 +174,7 @@ class CurrentScope {
|
|
|
174
174
|
if (token === undefined) {
|
|
175
175
|
return;
|
|
176
176
|
}
|
|
177
|
-
this.current.
|
|
177
|
+
this.current.setDeferred(token.getStr().toUpperCase(), { token, ooType: type });
|
|
178
178
|
}
|
|
179
179
|
addListPrefix(identifiers, prefix) {
|
|
180
180
|
for (const id of identifiers) {
|
|
@@ -194,16 +194,16 @@ class CurrentScope {
|
|
|
194
194
|
const position = new _identifier_1.Identifier(usage, filename);
|
|
195
195
|
if (Array.isArray(type)) {
|
|
196
196
|
for (const t of type) {
|
|
197
|
-
(_a = this.current) === null || _a === void 0 ? void 0 : _a.
|
|
197
|
+
(_a = this.current) === null || _a === void 0 ? void 0 : _a.addReference({ position, resolved: referencing, referenceType: t, extra });
|
|
198
198
|
}
|
|
199
199
|
}
|
|
200
200
|
else {
|
|
201
|
-
(_b = this.current) === null || _b === void 0 ? void 0 : _b.
|
|
201
|
+
(_b = this.current) === null || _b === void 0 ? void 0 : _b.addReference({ position, resolved: referencing, referenceType: type, extra });
|
|
202
202
|
}
|
|
203
203
|
}
|
|
204
204
|
addSQLConversion(fieldName, message, token) {
|
|
205
205
|
var _a;
|
|
206
|
-
(_a = this.current) === null || _a === void 0 ? void 0 : _a.
|
|
206
|
+
(_a = this.current) === null || _a === void 0 ? void 0 : _a.addSQLConversion({ fieldName, message, token });
|
|
207
207
|
}
|
|
208
208
|
///////////////////////////
|
|
209
209
|
findFunctionModule(name) {
|
|
@@ -239,6 +239,9 @@ class CurrentScope {
|
|
|
239
239
|
return undefined;
|
|
240
240
|
}
|
|
241
241
|
const name = (_a = this.parentObj.getClassDefinition()) === null || _a === void 0 ? void 0 : _a.behaviorDefinitionName;
|
|
242
|
+
return this.findBehaviorDefinitionByName(name);
|
|
243
|
+
}
|
|
244
|
+
findBehaviorDefinitionByName(name) {
|
|
242
245
|
if (name === undefined) {
|
|
243
246
|
return undefined;
|
|
244
247
|
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.EML = void 0;
|
|
37
|
+
const Expressions = __importStar(require("../2_statements/expressions"));
|
|
38
|
+
const _syntax_input_1 = require("./_syntax_input");
|
|
39
|
+
/** checks the entities referenced in EML statements, eg. READ ENTITIES and MODIFY ENTITIES */
|
|
40
|
+
class EML {
|
|
41
|
+
static checkEntities(node, input) {
|
|
42
|
+
var _a;
|
|
43
|
+
var _b;
|
|
44
|
+
const nameNode = node.findDirectExpression(Expressions.NamespaceSimpleName);
|
|
45
|
+
if (nameNode === undefined) {
|
|
46
|
+
// eg. dynamic "MODIFY ENTITIES OPERATIONS" or "ENTITY zentity\_association"
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
const name = nameNode.concatTokens();
|
|
50
|
+
const scope = input.scope;
|
|
51
|
+
if (node.findDirectTokenByText("ENTITIES") !== undefined) {
|
|
52
|
+
// "ENTITIES OF" refers to the behavior definition
|
|
53
|
+
if (scope.findBehaviorDefinitionByName(name) === undefined && scope.getDDIC().inErrorNamespace(name)) {
|
|
54
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, nameNode.getFirstToken(), `Behavior definition "${name}" not found`));
|
|
55
|
+
}
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
// single "ENTITY", inside a behavior pool the alias defined in the BDEF can be used
|
|
59
|
+
const entity = (_b = (_a = scope.findBehaviorDefinition()) === null || _a === void 0 ? void 0 : _a.findEntityNameByAlias(name)) !== null && _b !== void 0 ? _b : name;
|
|
60
|
+
if (scope.getDDIC().inErrorNamespace(entity)
|
|
61
|
+
&& scope.findBehaviorDefinitionByName(entity) === undefined
|
|
62
|
+
&& scope.getDDIC().lookupDDLS(entity) === undefined) {
|
|
63
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, nameNode.getFirstToken(), `Entity "${name}" not found`));
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
exports.EML = EML;
|
|
68
|
+
//# sourceMappingURL=_eml.js.map
|
|
@@ -225,6 +225,16 @@ class ObjectOriented {
|
|
|
225
225
|
}
|
|
226
226
|
return `The special method "${name}" cannot be called directly`;
|
|
227
227
|
}
|
|
228
|
+
// classic exceptions cannot be raised in a method declaring class based exceptions, returns the message otherwise
|
|
229
|
+
checkClassicException() {
|
|
230
|
+
var _a;
|
|
231
|
+
const methodName = this.scope.getEnclosingMethodName();
|
|
232
|
+
const classDef = this.scope.findClassDefinition(this.scope.getEnclosingClassName());
|
|
233
|
+
if (methodName && classDef && ((_a = this.searchMethodName(classDef, methodName).method) === null || _a === void 0 ? void 0 : _a.getRaising().length)) {
|
|
234
|
+
return "Classic exceptions cannot be raised in methods with class based exceptions";
|
|
235
|
+
}
|
|
236
|
+
return undefined;
|
|
237
|
+
}
|
|
228
238
|
// SUPER-> can only call the previous implementation of the method it is used in, returns the message otherwise
|
|
229
239
|
// both names are resolved in the super class, so an alias and the method it stands for are the same
|
|
230
240
|
checkSuperCall(superDef, methodName) {
|
|
@@ -5,23 +5,81 @@ const _typed_identifier_1 = require("../types/_typed_identifier");
|
|
|
5
5
|
const _identifier_1 = require("../4_file_information/_identifier");
|
|
6
6
|
const _reference_1 = require("./_reference");
|
|
7
7
|
const assert_error_1 = require("./assert_error");
|
|
8
|
+
// most scopes only use a few of the containers, empty ones are shared and replaced on first write
|
|
9
|
+
const EMPTY_OBJECT = Object.freeze({});
|
|
10
|
+
const EMPTY_ARRAY = Object.freeze([]);
|
|
8
11
|
class ScopeData {
|
|
9
12
|
constructor() {
|
|
10
13
|
this.data = {
|
|
11
|
-
vars:
|
|
12
|
-
cdefs:
|
|
13
|
-
idefs:
|
|
14
|
-
forms:
|
|
15
|
-
types:
|
|
16
|
-
extraLikeTypes:
|
|
17
|
-
deferred:
|
|
18
|
-
references:
|
|
19
|
-
sqlConversion:
|
|
14
|
+
vars: EMPTY_OBJECT,
|
|
15
|
+
cdefs: EMPTY_OBJECT,
|
|
16
|
+
idefs: EMPTY_OBJECT,
|
|
17
|
+
forms: EMPTY_ARRAY, // todo, refactor to object
|
|
18
|
+
types: EMPTY_OBJECT,
|
|
19
|
+
extraLikeTypes: EMPTY_OBJECT,
|
|
20
|
+
deferred: EMPTY_OBJECT,
|
|
21
|
+
references: EMPTY_ARRAY,
|
|
22
|
+
sqlConversion: EMPTY_ARRAY,
|
|
20
23
|
};
|
|
21
24
|
}
|
|
22
25
|
getData() {
|
|
23
26
|
return this.data;
|
|
24
27
|
}
|
|
28
|
+
// the shared empty containers are frozen, the methods below replace them on first write
|
|
29
|
+
setVariable(name, identifier) {
|
|
30
|
+
if (this.data.vars === EMPTY_OBJECT) {
|
|
31
|
+
this.data.vars = {};
|
|
32
|
+
}
|
|
33
|
+
this.data.vars[name] = identifier;
|
|
34
|
+
}
|
|
35
|
+
setType(name, type) {
|
|
36
|
+
if (this.data.types === EMPTY_OBJECT) {
|
|
37
|
+
this.data.types = {};
|
|
38
|
+
}
|
|
39
|
+
this.data.types[name] = type;
|
|
40
|
+
}
|
|
41
|
+
setExtraLikeType(name, type) {
|
|
42
|
+
if (this.data.extraLikeTypes === EMPTY_OBJECT) {
|
|
43
|
+
this.data.extraLikeTypes = {};
|
|
44
|
+
}
|
|
45
|
+
this.data.extraLikeTypes[name] = type;
|
|
46
|
+
}
|
|
47
|
+
setDeferred(name, deferred) {
|
|
48
|
+
if (this.data.deferred === EMPTY_OBJECT) {
|
|
49
|
+
this.data.deferred = {};
|
|
50
|
+
}
|
|
51
|
+
this.data.deferred[name] = deferred;
|
|
52
|
+
}
|
|
53
|
+
setClassDefinition(name, cdef) {
|
|
54
|
+
if (this.data.cdefs === EMPTY_OBJECT) {
|
|
55
|
+
this.data.cdefs = {};
|
|
56
|
+
}
|
|
57
|
+
this.data.cdefs[name] = cdef;
|
|
58
|
+
}
|
|
59
|
+
setInterfaceDefinition(name, idef) {
|
|
60
|
+
if (this.data.idefs === EMPTY_OBJECT) {
|
|
61
|
+
this.data.idefs = {};
|
|
62
|
+
}
|
|
63
|
+
this.data.idefs[name] = idef;
|
|
64
|
+
}
|
|
65
|
+
addFormDefinitions(forms) {
|
|
66
|
+
if (this.data.forms === EMPTY_ARRAY) {
|
|
67
|
+
this.data.forms = [];
|
|
68
|
+
}
|
|
69
|
+
this.data.forms.push(...forms);
|
|
70
|
+
}
|
|
71
|
+
addReference(reference) {
|
|
72
|
+
if (this.data.references === EMPTY_ARRAY) {
|
|
73
|
+
this.data.references = [];
|
|
74
|
+
}
|
|
75
|
+
this.data.references.push(reference);
|
|
76
|
+
}
|
|
77
|
+
addSQLConversion(conversion) {
|
|
78
|
+
if (this.data.sqlConversion === EMPTY_ARRAY) {
|
|
79
|
+
this.data.sqlConversion = [];
|
|
80
|
+
}
|
|
81
|
+
this.data.sqlConversion.push(conversion);
|
|
82
|
+
}
|
|
25
83
|
}
|
|
26
84
|
class SpaghettiScopeNode extends ScopeData {
|
|
27
85
|
[Symbol.for("debug.description")]() {
|
|
@@ -40,8 +40,16 @@ const basic_1 = require("../../types/basic");
|
|
|
40
40
|
const source_1 = require("../expressions/source");
|
|
41
41
|
const target_1 = require("../expressions/target");
|
|
42
42
|
const message_source_1 = require("../expressions/message_source");
|
|
43
|
+
const _syntax_input_1 = require("../_syntax_input");
|
|
44
|
+
const _object_oriented_1 = require("../_object_oriented");
|
|
43
45
|
class Message {
|
|
44
46
|
runSyntax(node, input) {
|
|
47
|
+
const exceptionName = node.findDirectExpression(Expressions.ExceptionName);
|
|
48
|
+
const classicMessage = exceptionName ? new _object_oriented_1.ObjectOriented(input.scope).checkClassicException() : undefined;
|
|
49
|
+
if (exceptionName && classicMessage) {
|
|
50
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, exceptionName.getFirstToken(), classicMessage));
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
45
53
|
const found = node.findExpressionAfterToken("INTO");
|
|
46
54
|
const inline = found === null || found === void 0 ? void 0 : found.findDirectExpression(Expressions.InlineData);
|
|
47
55
|
if (inline) {
|
|
@@ -39,8 +39,10 @@ const source_1 = require("../expressions/source");
|
|
|
39
39
|
const target_1 = require("../expressions/target");
|
|
40
40
|
const inline_data_1 = require("../expressions/inline_data");
|
|
41
41
|
const basic_1 = require("../../types/basic");
|
|
42
|
+
const _eml_1 = require("../_eml");
|
|
42
43
|
class ModifyEntities {
|
|
43
44
|
runSyntax(node, input) {
|
|
45
|
+
_eml_1.EML.checkEntities(node, input);
|
|
44
46
|
for (const s of node.findDirectExpressions(Expressions.Source)) {
|
|
45
47
|
source_1.Source.runSyntax(s, input);
|
|
46
48
|
}
|
|
@@ -50,6 +50,12 @@ class Raise {
|
|
|
50
50
|
var _a, _b, _c, _d, _e, _f;
|
|
51
51
|
const helper = new _object_oriented_1.ObjectOriented(input.scope);
|
|
52
52
|
let method;
|
|
53
|
+
const exceptionName = node.findDirectExpression(Expressions.ExceptionName);
|
|
54
|
+
const classicMessage = exceptionName ? helper.checkClassicException() : undefined;
|
|
55
|
+
if (exceptionName && classicMessage) {
|
|
56
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, exceptionName.getFirstToken(), classicMessage));
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
53
59
|
const classTok = (_a = node.findDirectExpression(Expressions.ClassName)) === null || _a === void 0 ? void 0 : _a.getFirstToken();
|
|
54
60
|
const className = classTok === null || classTok === void 0 ? void 0 : classTok.getStr();
|
|
55
61
|
if (classTok && className) {
|
|
@@ -39,8 +39,10 @@ const source_1 = require("../expressions/source");
|
|
|
39
39
|
const target_1 = require("../expressions/target");
|
|
40
40
|
const inline_data_1 = require("../expressions/inline_data");
|
|
41
41
|
const basic_1 = require("../../types/basic");
|
|
42
|
+
const _eml_1 = require("../_eml");
|
|
42
43
|
class ReadEntities {
|
|
43
44
|
runSyntax(node, input) {
|
|
45
|
+
_eml_1.EML.checkEntities(node, input);
|
|
44
46
|
for (const s of node.findDirectExpressions(Expressions.Source)) {
|
|
45
47
|
source_1.Source.runSyntax(s, input);
|
|
46
48
|
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.BDEFParser = void 0;
|
|
37
|
+
const tokens_1 = require("../abap/1_lexer/tokens");
|
|
38
|
+
const combi_1 = require("../abap/2_statements/combi");
|
|
39
|
+
const nodes_1 = require("../abap/nodes");
|
|
40
|
+
const cds_lexer_1 = require("../cds/cds_lexer");
|
|
41
|
+
const version_1 = require("../version");
|
|
42
|
+
const Expressions = __importStar(require("./expressions"));
|
|
43
|
+
class BDEFParser {
|
|
44
|
+
parse(file) {
|
|
45
|
+
if (file === undefined) {
|
|
46
|
+
return undefined;
|
|
47
|
+
}
|
|
48
|
+
// BDEF has the same comments, strings and delimiters as CDS
|
|
49
|
+
const tokens = this.removePragmas(cds_lexer_1.CDSLexer.run(file).filter(t => !(t instanceof tokens_1.Comment)));
|
|
50
|
+
const res = combi_1.Combi.run(new Expressions.BDEFDefinition(), tokens, version_1.defaultRelease);
|
|
51
|
+
if (res === undefined || !(res[0] instanceof nodes_1.ExpressionNode)) {
|
|
52
|
+
return undefined;
|
|
53
|
+
}
|
|
54
|
+
return res[0];
|
|
55
|
+
}
|
|
56
|
+
/** pragmas can occur in many places, eg. "##NOT_ASSIGNED_TO_DETACT" or "##UNMAPPED_FIELD[SingletonID]" */
|
|
57
|
+
removePragmas(tokens) {
|
|
58
|
+
var _a;
|
|
59
|
+
const ret = [];
|
|
60
|
+
for (let i = 0; i < tokens.length; i++) {
|
|
61
|
+
if (tokens[i].getStr().startsWith("##") === false) {
|
|
62
|
+
ret.push(tokens[i]);
|
|
63
|
+
continue;
|
|
64
|
+
}
|
|
65
|
+
if (((_a = tokens[i + 1]) === null || _a === void 0 ? void 0 : _a.getStr()) === "[") {
|
|
66
|
+
while (i < tokens.length - 1 && tokens[i].getStr() !== "]") {
|
|
67
|
+
i++;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
return ret;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
exports.BDEFParser = BDEFParser;
|
|
75
|
+
//# sourceMappingURL=bdef_parser.js.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BDEFAction = void 0;
|
|
4
|
+
const _1 = require(".");
|
|
5
|
+
const combi_1 = require("../../abap/2_statements/combi");
|
|
6
|
+
/** actions and functions, eg. "static factory action ( features : global ) copy parameter ZPARAM result [1] $self;" */
|
|
7
|
+
class BDEFAction extends combi_1.Expression {
|
|
8
|
+
getRunnable() {
|
|
9
|
+
const modifier = (0, combi_1.altPrio)("INTERNAL", "STATIC", "FACTORY", "DEFAULT", "DRAFT", "REPEATABLE", "RECOMMENDATION", (0, combi_1.seq)("SAVE", (0, combi_1.optPrio)(_1.BDEFOptions)), (0, combi_1.seq)("KEY", _1.BDEFOptions));
|
|
10
|
+
const tail = (0, combi_1.altPrio)((0, combi_1.seq)("EXTERNAL", _1.BDEFString), (0, combi_1.seq)("AS", _1.BDEFName), _1.BDEFParameter, _1.BDEFResult, _1.BDEFCardinality, "OPTIMIZED", "EXTENSIBLE", "WITH ADDITIONAL IMPLEMENTATION");
|
|
11
|
+
return (0, combi_1.seq)((0, combi_1.starPrio)(modifier), (0, combi_1.altPrio)("ACTION", "FUNCTION"), (0, combi_1.optPrio)(_1.BDEFOptions), _1.BDEFName, (0, combi_1.starPrio)(tail), (0, combi_1.altPrio)(";", _1.BDEFDefaultFunction));
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
exports.BDEFAction = BDEFAction;
|
|
15
|
+
//# sourceMappingURL=bdef_action.js.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BDEFAlias = void 0;
|
|
4
|
+
const _1 = require(".");
|
|
5
|
+
const combi_1 = require("../../abap/2_statements/combi");
|
|
6
|
+
class BDEFAlias extends combi_1.Expression {
|
|
7
|
+
getRunnable() {
|
|
8
|
+
return (0, combi_1.seq)("ALIAS", _1.BDEFName);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
exports.BDEFAlias = BDEFAlias;
|
|
12
|
+
//# sourceMappingURL=bdef_alias.js.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BDEFAssociation = void 0;
|
|
4
|
+
const _1 = require(".");
|
|
5
|
+
const combi_1 = require("../../abap/2_statements/combi");
|
|
6
|
+
/** eg. "association _Booking { create; with draft; }" */
|
|
7
|
+
class BDEFAssociation extends combi_1.Expression {
|
|
8
|
+
getRunnable() {
|
|
9
|
+
// cross BO association, eg. "using /DMO/R_TRAVELTP_XBO \_Agency"
|
|
10
|
+
const using = (0, combi_1.seq)("USING", _1.BDEFName, (0, combi_1.optPrio)((0, combi_1.regex)(/^\\\w+$/)));
|
|
11
|
+
return (0, combi_1.seq)((0, combi_1.starPrio)((0, combi_1.altPrio)("INTERNAL", "UNMANAGED", "ANCESTOR")), "ASSOCIATION", (0, combi_1.optPrio)(_1.BDEFOptions), _1.BDEFName, (0, combi_1.optPrio)(using), (0, combi_1.optPrio)((0, combi_1.seq)("ABBREVIATION", _1.BDEFName)), (0, combi_1.optPrio)("WITH HIERARCHY"), (0, combi_1.altPrio)(";", _1.BDEFAssociationBody));
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
exports.BDEFAssociation = BDEFAssociation;
|
|
15
|
+
//# sourceMappingURL=bdef_association.js.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BDEFAssociationBody = void 0;
|
|
4
|
+
const _1 = require(".");
|
|
5
|
+
const combi_1 = require("../../abap/2_statements/combi");
|
|
6
|
+
/** eg. "{ create ( features : instance ); with draft; link action linkManager; }" */
|
|
7
|
+
class BDEFAssociationBody extends combi_1.Expression {
|
|
8
|
+
getRunnable() {
|
|
9
|
+
const create = (0, combi_1.seq)((0, combi_1.optPrio)("INTERNAL"), "CREATE", (0, combi_1.optPrio)(_1.BDEFOptions), (0, combi_1.altPrio)(";", _1.BDEFDefaultFunction));
|
|
10
|
+
const withh = (0, combi_1.seq)("WITH", (0, combi_1.altPrio)("DRAFT", "DEPENDENT DRAFT", "CASCADING DELETE"), ";");
|
|
11
|
+
const link = (0, combi_1.seq)((0, combi_1.altPrio)("LINK", "UNLINK"), "ACTION", _1.BDEFName, ";");
|
|
12
|
+
const inverse = (0, combi_1.seq)("INVERSE FUNCTION", _1.BDEFName, ";");
|
|
13
|
+
const item = (0, combi_1.altPrio)(create, withh, link, inverse, ";");
|
|
14
|
+
return (0, combi_1.seq)("{", (0, combi_1.starPrio)(item), "}");
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
exports.BDEFAssociationBody = BDEFAssociationBody;
|
|
18
|
+
//# sourceMappingURL=bdef_association_body.js.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BDEFAuthorizationContext = void 0;
|
|
4
|
+
const _1 = require(".");
|
|
5
|
+
const combi_1 = require("../../abap/2_statements/combi");
|
|
6
|
+
/** eg. "define own authorization context { 'S_TABU_NAM'; }" or "define own authorization context by privileged mode;" */
|
|
7
|
+
class BDEFAuthorizationContext extends combi_1.Expression {
|
|
8
|
+
getRunnable() {
|
|
9
|
+
const item = (0, combi_1.seq)((0, combi_1.altPrio)(_1.BDEFString, _1.BDEFName), ";");
|
|
10
|
+
const body = (0, combi_1.seq)("{", (0, combi_1.starPrio)(item), "}", (0, combi_1.optPrio)(";"));
|
|
11
|
+
const privileged = (0, combi_1.seq)("BY PRIVILEGED MODE", (0, combi_1.optPrio)("AND"));
|
|
12
|
+
return (0, combi_1.seq)("DEFINE", (0, combi_1.optPrio)("OWN"), "AUTHORIZATION CONTEXT", (0, combi_1.optPrio)((0, combi_1.altPrio)(privileged, _1.BDEFName)), (0, combi_1.optPrio)((0, combi_1.seq)("FOR DISABLE", _1.BDEFOptions)), (0, combi_1.altPrio)(";", body));
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
exports.BDEFAuthorizationContext = BDEFAuthorizationContext;
|
|
16
|
+
//# sourceMappingURL=bdef_authorization_context.js.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BDEFCardinality = void 0;
|
|
4
|
+
const combi_1 = require("../../abap/2_statements/combi");
|
|
5
|
+
/** eg. "[1]" or "[0..*]" */
|
|
6
|
+
class BDEFCardinality extends combi_1.Expression {
|
|
7
|
+
getRunnable() {
|
|
8
|
+
const integer = (0, combi_1.regex)(/^\d+$/);
|
|
9
|
+
return (0, combi_1.seq)("[", integer, (0, combi_1.optPrio)((0, combi_1.seq)(".", ".", (0, combi_1.altPrio)(integer, "*"))), "]");
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
exports.BDEFCardinality = BDEFCardinality;
|
|
13
|
+
//# sourceMappingURL=bdef_cardinality.js.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BDEFDefaultFunction = void 0;
|
|
4
|
+
const _1 = require(".");
|
|
5
|
+
const combi_1 = require("../../abap/2_statements/combi");
|
|
6
|
+
/** eg. "{ default function GetDefaultsForCreate; }" */
|
|
7
|
+
class BDEFDefaultFunction extends combi_1.Expression {
|
|
8
|
+
getRunnable() {
|
|
9
|
+
const func = (0, combi_1.seq)("DEFAULT FUNCTION", (0, combi_1.optPrio)((0, combi_1.seq)(_1.BDEFName, (0, combi_1.optPrio)((0, combi_1.seq)("EXTERNAL", _1.BDEFString)))), ";");
|
|
10
|
+
return (0, combi_1.seq)("{", (0, combi_1.plusPrio)(func), "}");
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
exports.BDEFDefaultFunction = BDEFDefaultFunction;
|
|
14
|
+
//# sourceMappingURL=bdef_default_function.js.map
|