@abaplint/core 2.120.87 → 2.120.88
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
CHANGED
|
@@ -42,6 +42,18 @@ export declare abstract class ABAPObject extends AbstractObject {
|
|
|
42
42
|
private findTextsTranslations;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
+
export declare class ABAPParser {
|
|
46
|
+
private readonly release;
|
|
47
|
+
private readonly languageVersion;
|
|
48
|
+
private readonly globalMacros;
|
|
49
|
+
private readonly reg?;
|
|
50
|
+
/** @deprecated Use `new ABAPParser(options)` instead */
|
|
51
|
+
constructor(release: ABAPRelease, globalMacros?: readonly string[], reg?: IRegistry);
|
|
52
|
+
constructor(options?: IABAPParserOptions);
|
|
53
|
+
private static isRelease;
|
|
54
|
+
parse(files: readonly IFile[]): IABAPParserResult;
|
|
55
|
+
}
|
|
56
|
+
|
|
45
57
|
declare class ABAPQueryFunctionalArea extends AbstractObject {
|
|
46
58
|
getType(): string;
|
|
47
59
|
getAllowedNaming(): {
|
|
@@ -3304,6 +3316,25 @@ declare interface IAbaplintAppSettings {
|
|
|
3304
3316
|
observations?: boolean;
|
|
3305
3317
|
}
|
|
3306
3318
|
|
|
3319
|
+
export declare interface IABAPParserOptions {
|
|
3320
|
+
release?: ABAPRelease;
|
|
3321
|
+
languageVersion?: LanguageVersion;
|
|
3322
|
+
globalMacros?: readonly string[];
|
|
3323
|
+
reg?: IRegistry;
|
|
3324
|
+
}
|
|
3325
|
+
|
|
3326
|
+
export declare interface IABAPParserResult {
|
|
3327
|
+
issues: readonly Issue[];
|
|
3328
|
+
output: readonly ABAPFile[];
|
|
3329
|
+
/** runtime in milliseconds */
|
|
3330
|
+
runtime: number;
|
|
3331
|
+
runtimeExtra: {
|
|
3332
|
+
lexing: number;
|
|
3333
|
+
statements: number;
|
|
3334
|
+
structure: number;
|
|
3335
|
+
};
|
|
3336
|
+
}
|
|
3337
|
+
|
|
3307
3338
|
declare class IACBinaryData extends AbstractObject {
|
|
3308
3339
|
getType(): string;
|
|
3309
3340
|
getAllowedNaming(): {
|
|
@@ -8,10 +8,15 @@ class FormParamType extends combi_1.Expression {
|
|
|
8
8
|
getRunnable() {
|
|
9
9
|
const def = (0, combi_1.seq)("DEFAULT", (0, combi_1.alt)(_1.Constant, _1.FieldChain));
|
|
10
10
|
const table = (0, combi_1.seq)((0, combi_1.alt)("STANDARD", "HASHED", "INDEX", "SORTED", "ANY"), "TABLE");
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
const
|
|
14
|
-
|
|
11
|
+
// the following are not valid FORM typings, fail instead of reading the
|
|
12
|
+
// remaining words as additional parameters
|
|
13
|
+
const inline = (0, combi_1.seq)((0, combi_1.alt)("TABLE", "RANGE"), "OF", (0, combi_1.failCombinator)());
|
|
14
|
+
const tableKey = (0, combi_1.seq)("WITH", (0, combi_1.failCombinator)());
|
|
15
|
+
const lengthDecimals = (0, combi_1.seq)((0, combi_1.alt)("LENGTH", "DECIMALS"), _1.Integer, (0, combi_1.failCombinator)());
|
|
16
|
+
const tabseq = (0, combi_1.seq)(table, (0, combi_1.optPrio)((0, combi_1.seq)("OF", (0, combi_1.altPrio)((0, combi_1.seq)("REF TO", (0, combi_1.failCombinator)()), _1.TypeName))), (0, combi_1.optPrio)(tableKey));
|
|
17
|
+
const ret = (0, combi_1.seq)((0, combi_1.optPrio)((0, combi_1.alt)("REF TO", "LINE OF")), _1.TypeName, (0, combi_1.optPrio)(lengthDecimals), (0, combi_1.opt)(def));
|
|
18
|
+
const like = (0, combi_1.seq)("LIKE", (0, combi_1.altPrio)(inline, (0, combi_1.seq)(table, (0, combi_1.failCombinator)()), (0, combi_1.seq)((0, combi_1.optPrio)((0, combi_1.alt)("REF TO", "LINE OF")), _1.FieldChain)));
|
|
19
|
+
return (0, combi_1.alt)((0, combi_1.seq)("TYPE", (0, combi_1.altPrio)(tabseq, (0, combi_1.ver)(version_1.Release.v916, (0, combi_1.seq)("ANY", "STRUCTURE")), inline, ret)), like);
|
|
15
20
|
}
|
|
16
21
|
}
|
|
17
22
|
exports.FormParamType = FormParamType;
|
package/build/src/index.js
CHANGED
|
@@ -33,8 +33,8 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.
|
|
37
|
-
exports.LSPEdit = exports.RuleTag = exports.Severity = exports.Visibility = exports.Info = exports.Diagnostics = exports.Rename = exports.PrettyPrinter = exports.Position = exports.CurrentScope = exports.RulesRunner = exports.SpaghettiScope = exports.SyntaxLogic = void 0;
|
|
36
|
+
exports.Tokens = exports.ABAPParser = exports.ExpressionsCDS = exports.CDSParser = exports.LanguageServerTypes = exports.DDLKind = exports.DDLParser = exports.AbstractFile = exports.ABAPFile = exports.MemoryFile = exports.Edits = exports.ReferenceType = exports.NativeSQL = exports.MacroContent = exports.MacroCall = exports.SpaghettiScopeNode = exports.Token = exports.ScopeType = exports.BasicTypes = exports.TypedIdentifier = exports.AbstractType = exports.VirtualPosition = exports.Comment = exports.Unknown = exports.Empty = exports.Identifier = exports.Nodes = exports.Types = exports.Expressions = exports.Statements = exports.Structures = exports.SkipLogic = exports.Objects = exports.ArtifactsRules = exports.ArtifactsObjects = exports.ArtifactsABAP = exports.BuiltIn = exports.FormLengthStats = exports.FunctionLengthStats = exports.MethodLengthStats = exports.LanguageServer = exports.Registry = exports.CyclomaticComplexityStats = exports.versionToABAPRelease = exports.releaseAtLeast = exports.Release = exports.LanguageVersion = exports.Version = exports.Config = exports.Issue = void 0;
|
|
37
|
+
exports.LSPEdit = exports.RuleTag = exports.Severity = exports.Visibility = exports.Info = exports.Diagnostics = exports.Rename = exports.PrettyPrinter = exports.Position = exports.CurrentScope = exports.RulesRunner = exports.SpaghettiScope = exports.SyntaxLogic = exports.ABAPObject = void 0;
|
|
38
38
|
const issue_1 = require("./issue");
|
|
39
39
|
Object.defineProperty(exports, "Issue", { enumerable: true, get: function () { return issue_1.Issue; } });
|
|
40
40
|
const config_1 = require("./config");
|
|
@@ -131,6 +131,8 @@ Object.defineProperty(exports, "DDLParser", { enumerable: true, get: function ()
|
|
|
131
131
|
Object.defineProperty(exports, "DDLKind", { enumerable: true, get: function () { return ddl_parser_1.DDLKind; } });
|
|
132
132
|
const cds_parser_1 = require("./cds/cds_parser");
|
|
133
133
|
Object.defineProperty(exports, "CDSParser", { enumerable: true, get: function () { return cds_parser_1.CDSParser; } });
|
|
134
|
+
const abap_parser_1 = require("./abap/abap_parser");
|
|
135
|
+
Object.defineProperty(exports, "ABAPParser", { enumerable: true, get: function () { return abap_parser_1.ABAPParser; } });
|
|
134
136
|
const rules_runner_1 = require("./rules_runner");
|
|
135
137
|
Object.defineProperty(exports, "RulesRunner", { enumerable: true, get: function () { return rules_runner_1.RulesRunner; } });
|
|
136
138
|
const _irule_1 = require("./rules/_irule");
|
package/build/src/registry.js
CHANGED
|
@@ -331,6 +331,18 @@ Make sure to test the downported code, it might not always be completely correct
|
|
|
331
331
|
}
|
|
332
332
|
}
|
|
333
333
|
}
|
|
334
|
+
// a chained call with EXPORTING/IMPORTING/CHANGING/RECEIVING/EXCEPTIONS parses in the low
|
|
335
|
+
// version, but 702 reads the last call of a chain as a functional call,
|
|
336
|
+
// "Unexpected word CHANGING in functional method call"
|
|
337
|
+
if (ret.length === 0) {
|
|
338
|
+
for (let i = 0; i < lowStatements.length; i++) {
|
|
339
|
+
const issue = this.outlineChainedCallParameters(lowStatements[i], highStatements[i], lowFile, highSyntax);
|
|
340
|
+
if (issue) {
|
|
341
|
+
ret.push(issue);
|
|
342
|
+
break;
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
}
|
|
334
346
|
// INSERT with a 702 built-in function as the operand parses in the low version, but 702
|
|
335
347
|
// reads the function as a method call, "Method SUBSTRING does not exist"
|
|
336
348
|
if (ret.length === 0) {
|
|
@@ -2912,6 +2924,67 @@ ${indentation} output = ${uniqueName}.\n`;
|
|
|
2912
2924
|
}
|
|
2913
2925
|
return undefined;
|
|
2914
2926
|
}
|
|
2927
|
+
/** a( )->b( CHANGING c = d ), the object the last method is called on is outlined into a
|
|
2928
|
+
* variable typed via the RETURNING parameter of the method before it */
|
|
2929
|
+
outlineChainedCallParameters(low, high, lowFile, highSyntax) {
|
|
2930
|
+
var _a, _b, _c, _d;
|
|
2931
|
+
if (!(high.get() instanceof Statements.Call)) {
|
|
2932
|
+
return undefined;
|
|
2933
|
+
}
|
|
2934
|
+
else if (this.lowReg.getConfig().isOpenABAP()) {
|
|
2935
|
+
return undefined;
|
|
2936
|
+
}
|
|
2937
|
+
else if (low.getFirstToken().getStart() instanceof virtual_position_1.VirtualPosition) {
|
|
2938
|
+
return undefined;
|
|
2939
|
+
}
|
|
2940
|
+
const chain = high.findDirectExpression(Expressions.MethodCallChain);
|
|
2941
|
+
const children = (chain === null || chain === void 0 ? void 0 : chain.getChildren()) || [];
|
|
2942
|
+
const last = children[children.length - 1];
|
|
2943
|
+
const arrow = children[children.length - 2];
|
|
2944
|
+
const previous = children[children.length - 3];
|
|
2945
|
+
if (chain === undefined
|
|
2946
|
+
|| !(last instanceof nodes_1.ExpressionNode)
|
|
2947
|
+
|| !(last.get() instanceof Expressions.MethodCall)
|
|
2948
|
+
|| (arrow === null || arrow === void 0 ? void 0 : arrow.getFirstToken().getStr()) !== "->"
|
|
2949
|
+
|| !(previous instanceof nodes_1.ExpressionNode)
|
|
2950
|
+
|| !(previous.get() instanceof Expressions.MethodCall)) {
|
|
2951
|
+
return undefined;
|
|
2952
|
+
}
|
|
2953
|
+
const parameters = (_a = last.findDirectExpression(Expressions.MethodCallParam)) === null || _a === void 0 ? void 0 : _a.findDirectExpression(Expressions.MethodParameters);
|
|
2954
|
+
if (parameters === undefined) {
|
|
2955
|
+
return undefined;
|
|
2956
|
+
}
|
|
2957
|
+
// the type of the object, from the method that returns it
|
|
2958
|
+
const methodToken = (_b = previous.findDirectExpression(Expressions.MethodName)) === null || _b === void 0 ? void 0 : _b.getFirstToken();
|
|
2959
|
+
if (methodToken === undefined) {
|
|
2960
|
+
return undefined;
|
|
2961
|
+
}
|
|
2962
|
+
const spag = highSyntax.spaghetti.lookupPosition(methodToken.getStart(), lowFile.getFilename());
|
|
2963
|
+
let type = undefined;
|
|
2964
|
+
for (const r of (spag === null || spag === void 0 ? void 0 : spag.getData().references) || []) {
|
|
2965
|
+
if (r.referenceType === _reference_1.ReferenceType.MethodReference
|
|
2966
|
+
&& r.position.getStart().equals(methodToken.getStart())) {
|
|
2967
|
+
const returning = (_d = (_c = r.resolved) === null || _c === void 0 ? void 0 : _c.getParameters().getReturning()) === null || _d === void 0 ? void 0 : _d.getType();
|
|
2968
|
+
if (returning instanceof basic_1.ObjectReferenceType) {
|
|
2969
|
+
type = returning.toABAP();
|
|
2970
|
+
}
|
|
2971
|
+
break;
|
|
2972
|
+
}
|
|
2973
|
+
}
|
|
2974
|
+
if (type === undefined) {
|
|
2975
|
+
return undefined;
|
|
2976
|
+
}
|
|
2977
|
+
const object = children.slice(0, children.length - 2).map(c => c.concatTokens()).join("");
|
|
2978
|
+
const uniqueName = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
|
|
2979
|
+
const indentation = " ".repeat(high.getFirstToken().getStart().getCol() - 1);
|
|
2980
|
+
const code = `DATA ${uniqueName} TYPE ${type}.\n` +
|
|
2981
|
+
indentation + `${uniqueName} = ${object}.\n` +
|
|
2982
|
+
indentation;
|
|
2983
|
+
const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getFirstToken().getStart(), code);
|
|
2984
|
+
const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, chain.getFirstToken().getStart(), previous.getLastToken().getEnd(), uniqueName);
|
|
2985
|
+
const fix = edit_helper_1.EditHelper.merge(fix2, fix1);
|
|
2986
|
+
return issue_1.Issue.atToken(lowFile, chain.getFirstToken(), "Outline object of chained call with parameter keywords", this.getMetadata().key, this.conf.severity, fix);
|
|
2987
|
+
}
|
|
2915
2988
|
/** if the source expression is the complete source of an INSERT or APPEND statement, then the
|
|
2916
2989
|
* outlined variable must be typed via the row type of the table, returns the table name */
|
|
2917
2990
|
findRowTypeOf(high, source) {
|