@abaplint/core 2.84.0 → 2.84.4
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/README.md +6 -6
- package/build/abaplint.d.ts +11 -4
- package/build/src/abap/2_statements/expressions/call_transformation_parameters.js +2 -2
- package/build/src/abap/2_statements/expressions/index.js +2 -1
- package/build/src/abap/2_statements/expressions/message_number.js +11 -0
- package/build/src/abap/2_statements/expressions/message_source.js +1 -1
- package/build/src/abap/2_statements/statements/call_transformation.js +1 -1
- package/build/src/abap/2_statements/statements/raise.js +1 -1
- package/build/src/abap/5_syntax/_current_scope.js +9 -4
- package/build/src/abap/5_syntax/_scope_type.js +1 -0
- package/build/src/abap/5_syntax/basic_types.js +5 -5
- package/build/src/abap/5_syntax/statements/call_transformation.js +1 -1
- package/build/src/abap/5_syntax/structures/data.js +9 -3
- package/build/src/abap/5_syntax/syntax.js +6 -0
- package/build/src/abap/flow/flow_graph.js +7 -7
- package/build/src/abap/types/basic/data_reference_type.js +2 -2
- package/build/src/abap/types/basic/structure_type.js +3 -3
- package/build/src/ddic.js +22 -22
- package/build/src/lsp/help.js +7 -7
- package/build/src/registry.js +1 -1
- package/build/src/rules/7bit_ascii.js +2 -2
- package/build/src/rules/abapdoc.js +1 -1
- package/build/src/rules/align_parameters.js +33 -33
- package/build/src/rules/ambiguous_statement.js +5 -5
- package/build/src/rules/avoid_use.js +6 -6
- package/build/src/rules/begin_end_names.js +4 -4
- package/build/src/rules/begin_single_include.js +12 -12
- package/build/src/rules/call_transaction_authority_check.js +3 -3
- package/build/src/rules/chain_mainly_declarations.js +4 -4
- package/build/src/rules/check_abstract.js +2 -2
- package/build/src/rules/check_comments.js +4 -4
- package/build/src/rules/check_include.js +3 -3
- package/build/src/rules/check_no_handler_pragma.js +8 -8
- package/build/src/rules/check_subrc.js +8 -8
- package/build/src/rules/commented_code.js +1 -1
- package/build/src/rules/constructor_visibility_public.js +4 -4
- package/build/src/rules/contains_tab.js +2 -2
- package/build/src/rules/dangerous_statement.js +1 -1
- package/build/src/rules/downport.js +53 -46
- package/build/src/rules/exit_or_check.js +3 -3
- package/build/src/rules/exporting.js +1 -1
- package/build/src/rules/forbidden_identifier.js +1 -1
- package/build/src/rules/forbidden_void_type.js +2 -2
- package/build/src/rules/functional_writing.js +17 -17
- package/build/src/rules/global_class.js +10 -10
- package/build/src/rules/identical_conditions.js +2 -2
- package/build/src/rules/identical_contents.js +15 -15
- package/build/src/rules/identical_descriptions.js +4 -4
- package/build/src/rules/if_in_if.js +7 -7
- package/build/src/rules/implement_methods.js +3 -3
- package/build/src/rules/in_statement_indentation.js +11 -11
- package/build/src/rules/intf_referencing_clas.js +3 -3
- package/build/src/rules/line_break_style.js +2 -2
- package/build/src/rules/line_length.js +1 -1
- package/build/src/rules/line_only_punc.js +1 -1
- package/build/src/rules/local_variable_names.js +2 -2
- package/build/src/rules/many_parentheses.js +10 -10
- package/build/src/rules/max_one_method_parameter_per_line.js +7 -7
- package/build/src/rules/max_one_statement.js +3 -3
- package/build/src/rules/nesting.js +1 -1
- package/build/src/rules/no_chained_assignment.js +1 -1
- package/build/src/rules/no_public_attributes.js +1 -1
- package/build/src/rules/no_yoda_conditions.js +4 -4
- package/build/src/rules/obsolete_statement.js +40 -40
- package/build/src/rules/omit_parameter_name.js +3 -3
- package/build/src/rules/omit_preceding_zeros.js +2 -0
- package/build/src/rules/omit_receiving.js +13 -13
- package/build/src/rules/parser_702_chaining.js +2 -2
- package/build/src/rules/parser_error.js +2 -2
- package/build/src/rules/parser_missing_space.js +1 -1
- package/build/src/rules/prefer_inline.js +16 -16
- package/build/src/rules/prefer_is_not.js +7 -7
- package/build/src/rules/prefer_raise_exception_new.js +3 -3
- package/build/src/rules/prefer_returning_to_exporting.js +1 -1
- package/build/src/rules/prefer_xsdbool.js +2 -2
- package/build/src/rules/remove_descriptions.js +4 -4
- package/build/src/rules/rfc_error_handling.js +9 -9
- package/build/src/rules/select_add_order_by.js +5 -5
- package/build/src/rules/select_performance.js +2 -2
- package/build/src/rules/sicf_consistency.js +4 -4
- package/build/src/rules/space_before_dot.js +2 -2
- package/build/src/rules/start_at_tab.js +1 -1
- package/build/src/rules/sy_modification.js +2 -2
- package/build/src/rules/tabl_enhancement_category.js +2 -2
- package/build/src/rules/unused_methods.js +9 -9
- package/build/src/rules/unused_variables.js +6 -6
- package/build/src/rules/use_bool_expression.js +8 -8
- package/build/src/rules/use_line_exists.js +6 -6
- package/build/src/rules/use_new.js +2 -2
- package/build/src/rules/when_others_last.js +6 -6
- package/package.json +66 -66
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
# @abaplint/core
|
|
2
|
-
|
|
3
|
-
[abaplint](https://abaplint.org/) core library
|
|
4
|
-
|
|
5
|
-
Exposes functionallity like the parser and rules, which can be used in other projects.
|
|
6
|
-
|
|
1
|
+
# @abaplint/core
|
|
2
|
+
|
|
3
|
+
[abaplint](https://abaplint.org/) core library
|
|
4
|
+
|
|
5
|
+
Exposes functionallity like the parser and rules, which can be used in other projects.
|
|
6
|
+
|
|
7
7
|
For more information see https://github.com/abaplint/abaplint
|
package/build/abaplint.d.ts
CHANGED
|
@@ -1155,6 +1155,7 @@ export declare class CurrentScope {
|
|
|
1155
1155
|
getType(): ScopeType;
|
|
1156
1156
|
push(stype: ScopeType, sname: string, start: Position, filename: string): void;
|
|
1157
1157
|
isOO(): boolean;
|
|
1158
|
+
isTypePool(): boolean;
|
|
1158
1159
|
setAllowHeaderUse(name: string): void;
|
|
1159
1160
|
isAllowHeaderUse(name: string): boolean;
|
|
1160
1161
|
pop(end: Position): SpaghettiScope;
|
|
@@ -1286,7 +1287,7 @@ declare class DataEnd implements IStatement {
|
|
|
1286
1287
|
|
|
1287
1288
|
declare class DataReference extends AbstractType {
|
|
1288
1289
|
private readonly type;
|
|
1289
|
-
constructor(type: AbstractType,
|
|
1290
|
+
constructor(type: AbstractType, qualifiedName?: string);
|
|
1290
1291
|
toText(level: number): string;
|
|
1291
1292
|
getType(): AbstractType;
|
|
1292
1293
|
toABAP(): string;
|
|
@@ -1307,7 +1308,7 @@ declare class DDIC {
|
|
|
1307
1308
|
private readonly reg;
|
|
1308
1309
|
constructor(reg: IRegistry);
|
|
1309
1310
|
isException(def: InfoClassDefinition | undefined, _obj: ABAPObject): boolean;
|
|
1310
|
-
lookupBuiltinType(name: string, length?: number, decimals?: number): AbstractType | undefined;
|
|
1311
|
+
lookupBuiltinType(name: string, length?: number, decimals?: number, qualifiedName?: string): AbstractType | undefined;
|
|
1311
1312
|
inErrorNamespace(name: string | undefined): boolean;
|
|
1312
1313
|
lookupObject(name: string): ILookupResult;
|
|
1313
1314
|
lookupNoVoid(name: string): ILookupResult | undefined;
|
|
@@ -1846,6 +1847,7 @@ declare namespace Expressions {
|
|
|
1846
1847
|
LoopGroupBy,
|
|
1847
1848
|
MacroName,
|
|
1848
1849
|
MessageClass_2 as MessageClass,
|
|
1850
|
+
MessageNumber,
|
|
1849
1851
|
MessageSource,
|
|
1850
1852
|
MessageTypeAndNumber,
|
|
1851
1853
|
MethodCallBody,
|
|
@@ -1853,11 +1855,11 @@ declare namespace Expressions {
|
|
|
1853
1855
|
MethodCallParam,
|
|
1854
1856
|
MethodCall,
|
|
1855
1857
|
MethodDefChanging,
|
|
1858
|
+
MethodDefExceptions,
|
|
1856
1859
|
MethodDefExporting,
|
|
1857
1860
|
MethodDefImporting,
|
|
1858
1861
|
MethodDefRaising,
|
|
1859
1862
|
MethodDefReturning,
|
|
1860
|
-
MethodDefExceptions,
|
|
1861
1863
|
MethodName,
|
|
1862
1864
|
MethodParamName,
|
|
1863
1865
|
MethodParamOptional,
|
|
@@ -3553,6 +3555,10 @@ declare class MessageClass_2 extends Expression {
|
|
|
3553
3555
|
getRunnable(): IStatementRunnable;
|
|
3554
3556
|
}
|
|
3555
3557
|
|
|
3558
|
+
declare class MessageNumber extends Expression {
|
|
3559
|
+
getRunnable(): IStatementRunnable;
|
|
3560
|
+
}
|
|
3561
|
+
|
|
3556
3562
|
declare class MessageSource extends Expression {
|
|
3557
3563
|
getRunnable(): IStatementRunnable;
|
|
3558
3564
|
}
|
|
@@ -4526,6 +4532,7 @@ export declare enum ScopeType {
|
|
|
4526
4532
|
Dummy = "_dummy",
|
|
4527
4533
|
Global = "_global",
|
|
4528
4534
|
Program = "_program",
|
|
4535
|
+
TypePool = "_type_pool",
|
|
4529
4536
|
FunctionGroup = "_function_group",
|
|
4530
4537
|
ClassDefinition = "class_definition",
|
|
4531
4538
|
Interface = "interface",
|
|
@@ -5426,7 +5433,7 @@ export { Structures }
|
|
|
5426
5433
|
declare class StructureType extends AbstractType {
|
|
5427
5434
|
private readonly indexed;
|
|
5428
5435
|
private readonly components;
|
|
5429
|
-
constructor(components: IStructureComponent[],
|
|
5436
|
+
constructor(components: IStructureComponent[], qualifiedName?: string);
|
|
5430
5437
|
getComponents(): IStructureComponent[];
|
|
5431
5438
|
getComponentByName(name: string): AbstractType | undefined;
|
|
5432
5439
|
toText(level: number): string;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.CallTransformationParameters = void 0;
|
|
4
|
+
const _1 = require(".");
|
|
4
5
|
const combi_1 = require("../combi");
|
|
5
6
|
const dynamic_1 = require("./dynamic");
|
|
6
7
|
const field_1 = require("./field");
|
|
7
8
|
const integer_1 = require("./integer");
|
|
8
|
-
const source_1 = require("./source");
|
|
9
9
|
class CallTransformationParameters extends combi_1.Expression {
|
|
10
10
|
getRunnable() {
|
|
11
|
-
const field = (0, combi_1.seq)((0, combi_1.alt)(field_1.Field, integer_1.Integer), "=",
|
|
11
|
+
const field = (0, combi_1.seq)((0, combi_1.alt)(field_1.Field, integer_1.Integer), "=", _1.SimpleSource3);
|
|
12
12
|
return (0, combi_1.alt)((0, combi_1.plus)(field), dynamic_1.Dynamic);
|
|
13
13
|
}
|
|
14
14
|
}
|
|
@@ -94,6 +94,7 @@ __exportStar(require("./let"), exports);
|
|
|
94
94
|
__exportStar(require("./loop_group_by"), exports);
|
|
95
95
|
__exportStar(require("./macro_name"), exports);
|
|
96
96
|
__exportStar(require("./message_class"), exports);
|
|
97
|
+
__exportStar(require("./message_number"), exports);
|
|
97
98
|
__exportStar(require("./message_source"), exports);
|
|
98
99
|
__exportStar(require("./message_type_and_number"), exports);
|
|
99
100
|
__exportStar(require("./method_call_body"), exports);
|
|
@@ -101,11 +102,11 @@ __exportStar(require("./method_call_chain"), exports);
|
|
|
101
102
|
__exportStar(require("./method_call_param"), exports);
|
|
102
103
|
__exportStar(require("./method_call"), exports);
|
|
103
104
|
__exportStar(require("./method_def_changing"), exports);
|
|
105
|
+
__exportStar(require("./method_def_exceptions"), exports);
|
|
104
106
|
__exportStar(require("./method_def_exporting"), exports);
|
|
105
107
|
__exportStar(require("./method_def_importing"), exports);
|
|
106
108
|
__exportStar(require("./method_def_raising"), exports);
|
|
107
109
|
__exportStar(require("./method_def_returning"), exports);
|
|
108
|
-
__exportStar(require("./method_def_exceptions"), exports);
|
|
109
110
|
__exportStar(require("./method_name"), exports);
|
|
110
111
|
__exportStar(require("./method_param_name"), exports);
|
|
111
112
|
__exportStar(require("./method_param_optional"), exports);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MessageNumber = void 0;
|
|
4
|
+
const combi_1 = require("../combi");
|
|
5
|
+
class MessageNumber extends combi_1.Expression {
|
|
6
|
+
getRunnable() {
|
|
7
|
+
return (0, combi_1.regex)(/^\d\d\d$/i);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
exports.MessageNumber = MessageNumber;
|
|
11
|
+
//# sourceMappingURL=message_number.js.map
|
|
@@ -8,7 +8,7 @@ class MessageSource extends combi_1.Expression {
|
|
|
8
8
|
getRunnable() {
|
|
9
9
|
const msgid = (0, combi_1.seq)((0, combi_1.tok)(tokens_1.ParenLeft), _1.MessageClass, (0, combi_1.tok)(tokens_1.ParenRightW));
|
|
10
10
|
const simple = (0, combi_1.seq)(_1.MessageTypeAndNumber, (0, combi_1.opt)(msgid));
|
|
11
|
-
const mess1 = (0, combi_1.seq)("ID", _1.Source, "TYPE", _1.Source, "NUMBER", _1.Source);
|
|
11
|
+
const mess1 = (0, combi_1.seq)("ID", _1.Source, "TYPE", _1.Source, "NUMBER", (0, combi_1.altPrio)(_1.MessageNumber, _1.Source));
|
|
12
12
|
return (0, combi_1.altPrio)(simple, mess1);
|
|
13
13
|
}
|
|
14
14
|
}
|
|
@@ -8,7 +8,7 @@ class CallTransformation {
|
|
|
8
8
|
const options = (0, combi_1.seq)("OPTIONS", expressions_1.CallTransformationOptions);
|
|
9
9
|
const parameters = (0, combi_1.seq)("PARAMETERS", expressions_1.CallTransformationParameters);
|
|
10
10
|
const objects = (0, combi_1.seq)("OBJECTS", expressions_1.CallTransformationParameters);
|
|
11
|
-
const source2 = (0, combi_1.seq)("XML", expressions_1.
|
|
11
|
+
const source2 = (0, combi_1.seq)("XML", expressions_1.SimpleSource3);
|
|
12
12
|
const source = (0, combi_1.seq)("SOURCE", (0, combi_1.alt)(expressions_1.CallTransformationParameters, source2));
|
|
13
13
|
const result2 = (0, combi_1.seq)("XML", expressions_1.Target);
|
|
14
14
|
const result = (0, combi_1.seq)("RESULT", (0, combi_1.alt)(expressions_1.CallTransformationParameters, result2));
|
|
@@ -7,7 +7,7 @@ const expressions_1 = require("../expressions");
|
|
|
7
7
|
class Raise {
|
|
8
8
|
getMatcher() {
|
|
9
9
|
const mess = (0, combi_1.seq)("MESSAGE", expressions_1.MessageSource, (0, combi_1.opt)(expressions_1.RaiseWith));
|
|
10
|
-
const messid = (0, combi_1.seq)("MESSAGE ID", expressions_1.Source, "NUMBER", expressions_1.Source, (0, combi_1.optPrio)(expressions_1.RaiseWith));
|
|
10
|
+
const messid = (0, combi_1.seq)("MESSAGE ID", expressions_1.Source, "NUMBER", (0, combi_1.altPrio)(expressions_1.MessageNumber, expressions_1.Source), (0, combi_1.optPrio)(expressions_1.RaiseWith));
|
|
11
11
|
const exporting = (0, combi_1.seq)("EXPORTING", expressions_1.ParameterListS);
|
|
12
12
|
const from = (0, combi_1.seq)("TYPE", expressions_1.ClassName, (0, combi_1.opt)((0, combi_1.alt)((0, combi_1.ver)(version_1.Version.v750, (0, combi_1.alt)(mess, messid)), (0, combi_1.ver)(version_1.Version.v752, "USING MESSAGE"))), (0, combi_1.optPrio)(exporting));
|
|
13
13
|
const clas = (0, combi_1.seq)((0, combi_1.optPrio)("RESUMABLE"), "EXCEPTION", (0, combi_1.altPrio)(from, (0, combi_1.ver)(version_1.Version.v752, expressions_1.Source), expressions_1.SimpleSource2));
|
|
@@ -206,6 +206,7 @@ class CurrentScope {
|
|
|
206
206
|
return undefined;
|
|
207
207
|
}
|
|
208
208
|
findTypePoolConstant(name) {
|
|
209
|
+
var _a;
|
|
209
210
|
if (name === undefined || name.includes("_") === undefined) {
|
|
210
211
|
return undefined;
|
|
211
212
|
}
|
|
@@ -214,12 +215,12 @@ class CurrentScope {
|
|
|
214
215
|
if (typePool === undefined) {
|
|
215
216
|
return undefined;
|
|
216
217
|
}
|
|
217
|
-
const spag = new syntax_1.SyntaxLogic(this.reg, typePool).run().spaghetti.getFirstChild();
|
|
218
|
+
const spag = (_a = new syntax_1.SyntaxLogic(this.reg, typePool).run().spaghetti.getFirstChild()) === null || _a === void 0 ? void 0 : _a.getFirstChild();
|
|
218
219
|
const found = spag === null || spag === void 0 ? void 0 : spag.findVariable(name);
|
|
219
220
|
return found;
|
|
220
221
|
}
|
|
221
222
|
findTypePoolType(name) {
|
|
222
|
-
var _a;
|
|
223
|
+
var _a, _b;
|
|
223
224
|
if (name.includes("_") === undefined) {
|
|
224
225
|
return undefined;
|
|
225
226
|
}
|
|
@@ -228,8 +229,8 @@ class CurrentScope {
|
|
|
228
229
|
if (typePool === undefined) {
|
|
229
230
|
return undefined;
|
|
230
231
|
}
|
|
231
|
-
const spag = new syntax_1.SyntaxLogic(this.reg, typePool).run().spaghetti.getFirstChild();
|
|
232
|
-
const found = (
|
|
232
|
+
const spag = (_a = new syntax_1.SyntaxLogic(this.reg, typePool).run().spaghetti.getFirstChild()) === null || _a === void 0 ? void 0 : _a.getFirstChild();
|
|
233
|
+
const found = (_b = spag === null || spag === void 0 ? void 0 : spag.findType(name)) === null || _b === void 0 ? void 0 : _b.getType();
|
|
233
234
|
return found;
|
|
234
235
|
}
|
|
235
236
|
/** Lookup interface in local and global scope */
|
|
@@ -321,6 +322,10 @@ class CurrentScope {
|
|
|
321
322
|
}
|
|
322
323
|
return false;
|
|
323
324
|
}
|
|
325
|
+
isTypePool() {
|
|
326
|
+
var _a;
|
|
327
|
+
return ((_a = this.current) === null || _a === void 0 ? void 0 : _a.getIdentifier().filename.endsWith(".type.abap")) === true || false;
|
|
328
|
+
}
|
|
324
329
|
setAllowHeaderUse(name) {
|
|
325
330
|
// workaround for SELECT FOR ALL ENTRIES
|
|
326
331
|
this.allowHeaderUse = name;
|
|
@@ -7,6 +7,7 @@ var ScopeType;
|
|
|
7
7
|
ScopeType["Dummy"] = "_dummy";
|
|
8
8
|
ScopeType["Global"] = "_global";
|
|
9
9
|
ScopeType["Program"] = "_program";
|
|
10
|
+
ScopeType["TypePool"] = "_type_pool";
|
|
10
11
|
ScopeType["FunctionGroup"] = "_function_group";
|
|
11
12
|
ScopeType["ClassDefinition"] = "class_definition";
|
|
12
13
|
ScopeType["Interface"] = "interface";
|
|
@@ -140,7 +140,7 @@ class BasicTypes {
|
|
|
140
140
|
}
|
|
141
141
|
return type;
|
|
142
142
|
}
|
|
143
|
-
resolveTypeName(typeName, length, decimals) {
|
|
143
|
+
resolveTypeName(typeName, length, decimals, name) {
|
|
144
144
|
if (typeName === undefined) {
|
|
145
145
|
return undefined;
|
|
146
146
|
}
|
|
@@ -149,7 +149,7 @@ class BasicTypes {
|
|
|
149
149
|
return chain;
|
|
150
150
|
}
|
|
151
151
|
const chainText = typeName.concatTokens().toUpperCase();
|
|
152
|
-
const f = this.scope.getDDIC().lookupBuiltinType(chainText, length, decimals);
|
|
152
|
+
const f = this.scope.getDDIC().lookupBuiltinType(chainText, length, decimals, name);
|
|
153
153
|
if (f !== undefined) {
|
|
154
154
|
return f;
|
|
155
155
|
}
|
|
@@ -196,7 +196,7 @@ class BasicTypes {
|
|
|
196
196
|
if (nameExpr.countTokens() > 1) { // workaround for names with dashes
|
|
197
197
|
name = new identifier_1.Identifier(name.getStart(), nameExpr.concatTokens());
|
|
198
198
|
}
|
|
199
|
-
const found = this.parseType(node);
|
|
199
|
+
const found = this.parseType(node, this.scope.isTypePool() ? name.getStr() : undefined);
|
|
200
200
|
if (found) {
|
|
201
201
|
return new _typed_identifier_1.TypedIdentifier(name, this.filename, found);
|
|
202
202
|
}
|
|
@@ -344,7 +344,7 @@ class BasicTypes {
|
|
|
344
344
|
if (type === undefined) {
|
|
345
345
|
return new Types.UnknownType("Type error, could not resolve \"" + name + "\", parseType");
|
|
346
346
|
}
|
|
347
|
-
return new Types.DataReference(type);
|
|
347
|
+
return new Types.DataReference(type, name);
|
|
348
348
|
}
|
|
349
349
|
else if (text === "TYPE STANDARD TABLE"
|
|
350
350
|
|| text === "TYPE SORTED TABLE"
|
|
@@ -392,7 +392,7 @@ class BasicTypes {
|
|
|
392
392
|
found = this.resolveTypeRef(typename);
|
|
393
393
|
}
|
|
394
394
|
else if (text.startsWith("TYPE")) {
|
|
395
|
-
found = this.resolveTypeName(typename, this.findLength(node), this.findDecimals(node));
|
|
395
|
+
found = this.resolveTypeName(typename, this.findLength(node), this.findDecimals(node), name);
|
|
396
396
|
const concat = node.concatTokens().toUpperCase();
|
|
397
397
|
if (found && concat.includes(" OCCURS ")) {
|
|
398
398
|
found = new Types.TableType(found, { withHeader: concat.includes("WITH HEADER LINE") }, name);
|
|
@@ -9,7 +9,7 @@ const inline_data_1 = require("../expressions/inline_data");
|
|
|
9
9
|
const dynamic_1 = require("../expressions/dynamic");
|
|
10
10
|
class CallTransformation {
|
|
11
11
|
runSyntax(node, scope, filename) {
|
|
12
|
-
for (const s of node.findAllExpressions(Expressions.
|
|
12
|
+
for (const s of node.findAllExpressions(Expressions.SimpleSource3)) {
|
|
13
13
|
new source_1.Source().runSyntax(s, scope, filename);
|
|
14
14
|
}
|
|
15
15
|
for (const d of node.findAllExpressions(Expressions.Dynamic)) {
|
|
@@ -8,9 +8,10 @@ const nodes_1 = require("../../nodes");
|
|
|
8
8
|
const _typed_identifier_1 = require("../../types/_typed_identifier");
|
|
9
9
|
const Basic = require("../../types/basic");
|
|
10
10
|
const data_1 = require("../statements/data");
|
|
11
|
+
const _reference_1 = require("../_reference");
|
|
11
12
|
class Data {
|
|
12
13
|
runSyntax(node, scope, filename) {
|
|
13
|
-
var _a
|
|
14
|
+
var _a;
|
|
14
15
|
const name = node.findFirstExpression(Expressions.DefinitionName).getFirstToken();
|
|
15
16
|
let table = false;
|
|
16
17
|
const components = [];
|
|
@@ -35,8 +36,10 @@ class Data {
|
|
|
35
36
|
}
|
|
36
37
|
else if (c instanceof nodes_1.StatementNode && ctyp instanceof Statements.IncludeType) {
|
|
37
38
|
// INCLUDES
|
|
38
|
-
const
|
|
39
|
-
|
|
39
|
+
const typeToken = (_a = c.findFirstExpression(Expressions.TypeName)) === null || _a === void 0 ? void 0 : _a.getFirstToken();
|
|
40
|
+
const typeName = typeToken === null || typeToken === void 0 ? void 0 : typeToken.getStr();
|
|
41
|
+
const foundId = scope.findType(typeName);
|
|
42
|
+
let found = foundId === null || foundId === void 0 ? void 0 : foundId.getType();
|
|
40
43
|
if (found === undefined) {
|
|
41
44
|
const f = scope.getDDIC().lookupTableOrView(typeName).type;
|
|
42
45
|
if (f instanceof _typed_identifier_1.TypedIdentifier) {
|
|
@@ -46,6 +49,9 @@ class Data {
|
|
|
46
49
|
found = f;
|
|
47
50
|
}
|
|
48
51
|
}
|
|
52
|
+
else {
|
|
53
|
+
scope.addReference(typeToken, foundId, _reference_1.ReferenceType.TypeReference, filename);
|
|
54
|
+
}
|
|
49
55
|
if (found instanceof Basic.VoidType) {
|
|
50
56
|
if (table === true) {
|
|
51
57
|
return new _typed_identifier_1.TypedIdentifier(name, filename, new Basic.TableType(found, { withHeader: true }));
|
|
@@ -297,6 +297,12 @@ class SyntaxLogic {
|
|
|
297
297
|
this.scope.push(stype, this.object.getName(), new position_1.Position(1, 1), main.getFilename());
|
|
298
298
|
}
|
|
299
299
|
}
|
|
300
|
+
else if (this.object instanceof objects_1.TypePool) {
|
|
301
|
+
const main = this.object.getMainABAPFile();
|
|
302
|
+
if (main !== undefined) {
|
|
303
|
+
this.scope.push(_scope_type_1.ScopeType.TypePool, this.object.getName(), new position_1.Position(1, 1), main.getFilename());
|
|
304
|
+
}
|
|
305
|
+
}
|
|
300
306
|
for (const file of traversal) {
|
|
301
307
|
this.currentFile = file;
|
|
302
308
|
const structure = this.currentFile.getStructure();
|
|
@@ -72,13 +72,13 @@ class FlowGraph {
|
|
|
72
72
|
this.label = label;
|
|
73
73
|
}
|
|
74
74
|
toDigraph() {
|
|
75
|
-
return `digraph G {
|
|
76
|
-
labelloc="t";
|
|
77
|
-
label="${this.label}";
|
|
78
|
-
graph [fontname = "helvetica"];
|
|
79
|
-
node [fontname = "helvetica", shape="box"];
|
|
80
|
-
edge [fontname = "helvetica"];
|
|
81
|
-
${this.toTextEdges()}
|
|
75
|
+
return `digraph G {
|
|
76
|
+
labelloc="t";
|
|
77
|
+
label="${this.label}";
|
|
78
|
+
graph [fontname = "helvetica"];
|
|
79
|
+
node [fontname = "helvetica", shape="box"];
|
|
80
|
+
edge [fontname = "helvetica"];
|
|
81
|
+
${this.toTextEdges()}
|
|
82
82
|
}`;
|
|
83
83
|
}
|
|
84
84
|
listSources(node) {
|
|
@@ -3,8 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.DataReference = void 0;
|
|
4
4
|
const _abstract_type_1 = require("./_abstract_type");
|
|
5
5
|
class DataReference extends _abstract_type_1.AbstractType {
|
|
6
|
-
constructor(type,
|
|
7
|
-
super(
|
|
6
|
+
constructor(type, qualifiedName) {
|
|
7
|
+
super(qualifiedName);
|
|
8
8
|
this.type = type;
|
|
9
9
|
}
|
|
10
10
|
toText(level) {
|
|
@@ -3,8 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.StructureType = void 0;
|
|
4
4
|
const _abstract_type_1 = require("./_abstract_type");
|
|
5
5
|
class StructureType extends _abstract_type_1.AbstractType {
|
|
6
|
-
constructor(components,
|
|
7
|
-
super(
|
|
6
|
+
constructor(components, qualifiedName) {
|
|
7
|
+
super(qualifiedName);
|
|
8
8
|
if (components.length === 0) {
|
|
9
9
|
throw new Error("Structure does not contain any components");
|
|
10
10
|
}
|
|
@@ -12,7 +12,7 @@ class StructureType extends _abstract_type_1.AbstractType {
|
|
|
12
12
|
for (const c of components) {
|
|
13
13
|
const upper = c.name.toUpperCase();
|
|
14
14
|
if (this.indexed[upper] !== undefined) {
|
|
15
|
-
throw new Error("Structure, duplicate field name \"" + upper + "\", " +
|
|
15
|
+
throw new Error("Structure, duplicate field name \"" + upper + "\", " + qualifiedName);
|
|
16
16
|
}
|
|
17
17
|
this.indexed[upper] = c.type;
|
|
18
18
|
}
|
package/build/src/ddic.js
CHANGED
|
@@ -43,7 +43,7 @@ class DDIC {
|
|
|
43
43
|
const isException = ((superClassName === null || superClassName === void 0 ? void 0 : superClassName.match(/^.?cx_.*$/i)) || (superClassName === null || superClassName === void 0 ? void 0 : superClassName.match(/^\/.+\/cx_.*$/i))) ? true : false;
|
|
44
44
|
return isException;
|
|
45
45
|
}
|
|
46
|
-
lookupBuiltinType(name, length, decimals) {
|
|
46
|
+
lookupBuiltinType(name, length, decimals, qualifiedName) {
|
|
47
47
|
switch (name) {
|
|
48
48
|
case "STRING":
|
|
49
49
|
return new Types.StringType(name);
|
|
@@ -54,31 +54,31 @@ class DDIC {
|
|
|
54
54
|
case "T":
|
|
55
55
|
return new Types.TimeType(name);
|
|
56
56
|
case "XSEQUENCE":
|
|
57
|
-
return new Types.XSequenceType();
|
|
57
|
+
return new Types.XSequenceType(qualifiedName);
|
|
58
58
|
case "CLIKE":
|
|
59
|
-
return new Types.CLikeType();
|
|
59
|
+
return new Types.CLikeType(qualifiedName);
|
|
60
60
|
case "DECFLOAT":
|
|
61
|
-
return new Types.DecFloatType();
|
|
61
|
+
return new Types.DecFloatType(qualifiedName);
|
|
62
62
|
case "ANY":
|
|
63
|
-
return new Types.AnyType();
|
|
63
|
+
return new Types.AnyType(qualifiedName);
|
|
64
64
|
case "SIMPLE":
|
|
65
|
-
return new Types.SimpleType();
|
|
65
|
+
return new Types.SimpleType(qualifiedName);
|
|
66
66
|
case "%_C_POINTER":
|
|
67
|
-
return new Types.HexType(8);
|
|
67
|
+
return new Types.HexType(8, qualifiedName);
|
|
68
68
|
case "TABLE":
|
|
69
69
|
return new Types.TableType(new Types.AnyType(), { withHeader: false });
|
|
70
70
|
case "DATA":
|
|
71
|
-
return new Types.AnyType();
|
|
71
|
+
return new Types.AnyType(qualifiedName);
|
|
72
72
|
case "NUMERIC":
|
|
73
|
-
return new Types.NumericGenericType();
|
|
73
|
+
return new Types.NumericGenericType(qualifiedName);
|
|
74
74
|
case "UTCLONG": // todo, take version into account
|
|
75
|
-
return new Types.UTCLongType();
|
|
75
|
+
return new Types.UTCLongType(qualifiedName);
|
|
76
76
|
case "DECFLOAT16":
|
|
77
|
-
return new Types.DecFloat16Type();
|
|
77
|
+
return new Types.DecFloat16Type(qualifiedName);
|
|
78
78
|
case "DECFLOAT34":
|
|
79
|
-
return new Types.DecFloat34Type();
|
|
79
|
+
return new Types.DecFloat34Type(qualifiedName);
|
|
80
80
|
case "CSEQUENCE":
|
|
81
|
-
return new Types.CSequenceType();
|
|
81
|
+
return new Types.CSequenceType(qualifiedName);
|
|
82
82
|
case "I":
|
|
83
83
|
case "INT8": // todo, take version into account
|
|
84
84
|
return new Types.IntegerType(name);
|
|
@@ -86,34 +86,34 @@ class DDIC {
|
|
|
86
86
|
return new Types.FloatType(name);
|
|
87
87
|
case "P":
|
|
88
88
|
if (length && decimals) {
|
|
89
|
-
return new Types.PackedType(length, decimals);
|
|
89
|
+
return new Types.PackedType(length, decimals, qualifiedName);
|
|
90
90
|
}
|
|
91
91
|
else if (length) {
|
|
92
|
-
return new Types.PackedType(length, 0);
|
|
92
|
+
return new Types.PackedType(length, 0, qualifiedName);
|
|
93
93
|
}
|
|
94
94
|
else {
|
|
95
|
-
return new Types.PackedType(1, 0);
|
|
95
|
+
return new Types.PackedType(1, 0, qualifiedName);
|
|
96
96
|
}
|
|
97
97
|
case "C":
|
|
98
98
|
if (length) {
|
|
99
|
-
return new Types.CharacterType(length);
|
|
99
|
+
return new Types.CharacterType(length, qualifiedName);
|
|
100
100
|
}
|
|
101
101
|
else {
|
|
102
|
-
return new Types.CharacterType(1);
|
|
102
|
+
return new Types.CharacterType(1, qualifiedName);
|
|
103
103
|
}
|
|
104
104
|
case "X":
|
|
105
105
|
if (length) {
|
|
106
|
-
return new Types.HexType(length);
|
|
106
|
+
return new Types.HexType(length, qualifiedName);
|
|
107
107
|
}
|
|
108
108
|
else {
|
|
109
|
-
return new Types.HexType(1);
|
|
109
|
+
return new Types.HexType(1, qualifiedName);
|
|
110
110
|
}
|
|
111
111
|
case "N":
|
|
112
112
|
if (length) {
|
|
113
|
-
return new Types.NumericType(length);
|
|
113
|
+
return new Types.NumericType(length, qualifiedName);
|
|
114
114
|
}
|
|
115
115
|
else {
|
|
116
|
-
return new Types.NumericType(1);
|
|
116
|
+
return new Types.NumericType(1, qualifiedName);
|
|
117
117
|
}
|
|
118
118
|
}
|
|
119
119
|
return undefined;
|
package/build/src/lsp/help.js
CHANGED
|
@@ -19,13 +19,13 @@ class Help {
|
|
|
19
19
|
/////////////////////////////////////////////////
|
|
20
20
|
static dumpABAP(file, reg, textDocument, position) {
|
|
21
21
|
let content = "";
|
|
22
|
-
content = `
|
|
23
|
-
<a href="#_tokens" rel="no-refresh">Tokens</a> |
|
|
24
|
-
<a href="#_statements" rel="no-refresh">Statements</a> |
|
|
25
|
-
<a href="#_structure" rel="no-refresh">Structure</a> |
|
|
26
|
-
<a href="#_files" rel="no-refresh">Files</a> |
|
|
27
|
-
<a href="#_info" rel="no-refresh">Info Dump</a>
|
|
28
|
-
<hr>
|
|
22
|
+
content = `
|
|
23
|
+
<a href="#_tokens" rel="no-refresh">Tokens</a> |
|
|
24
|
+
<a href="#_statements" rel="no-refresh">Statements</a> |
|
|
25
|
+
<a href="#_structure" rel="no-refresh">Structure</a> |
|
|
26
|
+
<a href="#_files" rel="no-refresh">Files</a> |
|
|
27
|
+
<a href="#_info" rel="no-refresh">Info Dump</a>
|
|
28
|
+
<hr>
|
|
29
29
|
` +
|
|
30
30
|
"<tt>" + textDocument.uri + " (" +
|
|
31
31
|
(position.line + 1) + ", " +
|
package/build/src/registry.js
CHANGED
|
@@ -17,8 +17,8 @@ class SevenBitAscii {
|
|
|
17
17
|
key: "7bit_ascii",
|
|
18
18
|
title: "Check for 7bit ascii",
|
|
19
19
|
shortDescription: `Only allow characters from the 7bit ASCII set.`,
|
|
20
|
-
extendedInformation: `https://docs.abapopenchecks.org/checks/05/
|
|
21
|
-
|
|
20
|
+
extendedInformation: `https://docs.abapopenchecks.org/checks/05/
|
|
21
|
+
|
|
22
22
|
Checkes files with extension ".abap" and ".asddls"`,
|
|
23
23
|
tags: [_irule_1.RuleTag.SingleFile],
|
|
24
24
|
};
|
|
@@ -23,7 +23,7 @@ class Abapdoc extends _abap_rule_1.ABAPRule {
|
|
|
23
23
|
return {
|
|
24
24
|
key: "abapdoc",
|
|
25
25
|
title: "Check abapdoc",
|
|
26
|
-
shortDescription: `Various checks regarding abapdoc.
|
|
26
|
+
shortDescription: `Various checks regarding abapdoc.
|
|
27
27
|
Base rule checks for existence of abapdoc for public class methods and all interface methods.`,
|
|
28
28
|
tags: [_irule_1.RuleTag.SingleFile],
|
|
29
29
|
};
|
|
@@ -20,42 +20,42 @@ class AlignParameters extends _abap_rule_1.ABAPRule {
|
|
|
20
20
|
key: "align_parameters",
|
|
21
21
|
title: "Align Parameters",
|
|
22
22
|
shortDescription: `Checks for vertially aligned parameters`,
|
|
23
|
-
extendedInformation: `Checks:
|
|
24
|
-
* function module calls
|
|
25
|
-
* method calls
|
|
26
|
-
* VALUE constructors
|
|
27
|
-
* NEW constructors
|
|
28
|
-
* RAISE EXCEPTION statements
|
|
29
|
-
* CREATE OBJECT statements
|
|
30
|
-
* RAISE EVENT statements
|
|
31
|
-
|
|
32
|
-
https://github.com/SAP/styleguides/blob/master/clean-abap/CleanABAP.md#align-parameters
|
|
33
|
-
|
|
34
|
-
Does not take effect on non functional method calls, use https://rules.abaplint.org/functional_writing/
|
|
35
|
-
|
|
23
|
+
extendedInformation: `Checks:
|
|
24
|
+
* function module calls
|
|
25
|
+
* method calls
|
|
26
|
+
* VALUE constructors
|
|
27
|
+
* NEW constructors
|
|
28
|
+
* RAISE EXCEPTION statements
|
|
29
|
+
* CREATE OBJECT statements
|
|
30
|
+
* RAISE EVENT statements
|
|
31
|
+
|
|
32
|
+
https://github.com/SAP/styleguides/blob/master/clean-abap/CleanABAP.md#align-parameters
|
|
33
|
+
|
|
34
|
+
Does not take effect on non functional method calls, use https://rules.abaplint.org/functional_writing/
|
|
35
|
+
|
|
36
36
|
Also https://rules.abaplint.org/max_one_method_parameter_per_line/ can help aligning parameter syntax`,
|
|
37
37
|
tags: [_irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Whitespace, _irule_1.RuleTag.Styleguide],
|
|
38
|
-
badExample: `CALL FUNCTION 'FOOBAR'
|
|
39
|
-
EXPORTING
|
|
40
|
-
foo = 2
|
|
41
|
-
parameter = 3.
|
|
42
|
-
|
|
43
|
-
foobar( moo = 1
|
|
44
|
-
param = 1 ).
|
|
45
|
-
|
|
46
|
-
foo = VALUE #(
|
|
47
|
-
foo = bar
|
|
38
|
+
badExample: `CALL FUNCTION 'FOOBAR'
|
|
39
|
+
EXPORTING
|
|
40
|
+
foo = 2
|
|
41
|
+
parameter = 3.
|
|
42
|
+
|
|
43
|
+
foobar( moo = 1
|
|
44
|
+
param = 1 ).
|
|
45
|
+
|
|
46
|
+
foo = VALUE #(
|
|
47
|
+
foo = bar
|
|
48
48
|
moo = 2 ).`,
|
|
49
|
-
goodExample: `CALL FUNCTION 'FOOBAR'
|
|
50
|
-
EXPORTING
|
|
51
|
-
foo = 2
|
|
52
|
-
parameter = 3.
|
|
53
|
-
|
|
54
|
-
foobar( moo = 1
|
|
55
|
-
param = 1 ).
|
|
56
|
-
|
|
57
|
-
foo = VALUE #(
|
|
58
|
-
foo = bar
|
|
49
|
+
goodExample: `CALL FUNCTION 'FOOBAR'
|
|
50
|
+
EXPORTING
|
|
51
|
+
foo = 2
|
|
52
|
+
parameter = 3.
|
|
53
|
+
|
|
54
|
+
foobar( moo = 1
|
|
55
|
+
param = 1 ).
|
|
56
|
+
|
|
57
|
+
foo = VALUE #(
|
|
58
|
+
foo = bar
|
|
59
59
|
moo = 2 ).`,
|
|
60
60
|
};
|
|
61
61
|
}
|
|
@@ -20,14 +20,14 @@ class AmbiguousStatement extends _abap_rule_1.ABAPRule {
|
|
|
20
20
|
return {
|
|
21
21
|
key: "ambiguous_statement",
|
|
22
22
|
title: "Check for ambigious statements",
|
|
23
|
-
shortDescription: `Checks for ambiguity between deleting or modifying from internal and database table
|
|
24
|
-
Add "TABLE" keyword or "@" for escaping SQL variables
|
|
25
|
-
|
|
23
|
+
shortDescription: `Checks for ambiguity between deleting or modifying from internal and database table
|
|
24
|
+
Add "TABLE" keyword or "@" for escaping SQL variables
|
|
25
|
+
|
|
26
26
|
Only works if the target version is 740sp05 or above`,
|
|
27
27
|
tags: [_irule_1.RuleTag.SingleFile],
|
|
28
|
-
badExample: `DELETE foo FROM bar.
|
|
28
|
+
badExample: `DELETE foo FROM bar.
|
|
29
29
|
MODIFY foo FROM bar.`,
|
|
30
|
-
goodExample: `DELETE foo FROM @bar.
|
|
30
|
+
goodExample: `DELETE foo FROM @bar.
|
|
31
31
|
MODIFY TABLE foo FROM bar.`,
|
|
32
32
|
};
|
|
33
33
|
}
|