@abaplint/transpiler-cli 2.14.35 → 2.14.37
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/bundle.js +1566 -349
- package/package.json +3 -3
- package/schema.json +13 -1
- package/tsconfig.tsbuildinfo +0 -1
package/build/bundle.js
CHANGED
|
@@ -4613,19 +4613,18 @@ function buildSelectCore(allowInto = false, allowOrderBy = true) {
|
|
|
4613
4613
|
const fae = (0, combi_1.optPrio)(_1.SQLForAllEntries);
|
|
4614
4614
|
const whereClause = (0, combi_1.optPrio)(where);
|
|
4615
4615
|
const groupHaving = (0, combi_1.seq)((0, combi_1.optPrio)(sql_group_by_1.SQLGroupBy), (0, combi_1.optPrio)(_1.SQLHaving));
|
|
4616
|
-
|
|
4617
|
-
|
|
4618
|
-
: [];
|
|
4616
|
+
// UP TO and OFFSET are not allowed directly after ORDER BY, they go before it or after a trailing INTO
|
|
4617
|
+
const orderBy = allowOrderBy ? [(0, combi_1.optPrio)(_1.SQLOrderBy)] : [];
|
|
4619
4618
|
const trailingOpts = (0, combi_1.seq)(conn, (0, combi_1.optPrio)(_1.SQLHints), (0, combi_1.optPrio)(privileged), (0, combi_1.optPrio)(_1.SQLOptions));
|
|
4620
4619
|
const intoSingle = (0, combi_1.seq)((0, combi_1.altPrio)(sql_into_structure_1.SQLIntoStructure, _1.SQLIntoList), extResult, creating);
|
|
4621
4620
|
const intoForPackSize = (0, combi_1.seq)(_1.SQLIntoTable, extResult, creating);
|
|
4622
4621
|
if (!allowInto) {
|
|
4623
|
-
const afterFromNoInto = (0, combi_1.seq)(_1.SQLFrom, client, byp, (0, combi_1.seq)((0, combi_1.optPrio)(sqlFields), fae, whereClause, groupHaving, ...
|
|
4622
|
+
const afterFromNoInto = (0, combi_1.seq)(_1.SQLFrom, client, byp, (0, combi_1.seq)((0, combi_1.optPrio)(sqlFields), fae, whereClause, groupHaving, ...orderBy, trailingOpts));
|
|
4624
4623
|
return (0, combi_1.altPrio)((0, combi_1.seq)("SINGLE", buildSelectSingleCore(false)), (0, combi_1.seq)((0, combi_1.optPrio)("DISTINCT"), fieldList, byp, afterFromNoInto));
|
|
4625
4624
|
}
|
|
4626
4625
|
const fromPackSize = (0, combi_1.seq)((0, combi_1.optPrio)(_1.SQLPackageSize), (0, combi_1.optPrio)(sql_up_to_1.SQLUpTo), byp, conn, byp, (0, combi_1.optPrio)(sql_up_to_1.SQLUpTo));
|
|
4627
4626
|
const trailingInto = (0, combi_1.seq)((0, combi_1.optPrio)((0, combi_1.altPrio)((0, combi_1.seq)(intoForPackSize, (0, combi_1.optPrio)(_1.SQLPackageSize), byp, (0, combi_1.optPrio)(sql_up_to_1.SQLUpTo), byp, (0, combi_1.optPrio)(offset), (0, combi_1.optPrio)(_1.SQLOrderBy)), (0, combi_1.seq)(intoSingle, byp, (0, combi_1.optPrio)(sql_up_to_1.SQLUpTo), byp, (0, combi_1.optPrio)(offset)))), (0, combi_1.optPrio)(_1.SQLOptions));
|
|
4628
|
-
const afterFromWithInto = (0, combi_1.seq)((0, combi_1.optPrio)(_1.SQLFrom), client, byp, fromPackSize, (0, combi_1.altPrio)((0, combi_1.seq)(intoForPackSize, (0, combi_1.optPrio)(_1.SQLPackageSize), byp, conn, (0, combi_1.optPrio)(sql_up_to_1.SQLUpTo), byp, (0, combi_1.optPrio)(offset), fae, whereClause, groupHaving, ...
|
|
4627
|
+
const afterFromWithInto = (0, combi_1.seq)((0, combi_1.optPrio)(_1.SQLFrom), client, byp, fromPackSize, (0, combi_1.altPrio)((0, combi_1.seq)(intoForPackSize, (0, combi_1.optPrio)(_1.SQLPackageSize), byp, conn, (0, combi_1.optPrio)(sql_up_to_1.SQLUpTo), byp, (0, combi_1.optPrio)(offset), fae, whereClause, groupHaving, ...orderBy, trailingOpts), (0, combi_1.seq)(intoSingle, byp, (0, combi_1.optPrio)(sql_up_to_1.SQLUpTo), byp, fae, (0, combi_1.optPrio)(sql_up_to_1.SQLUpTo), byp, (0, combi_1.optPrio)(offset), whereClause, groupHaving, ...orderBy, trailingOpts), (0, combi_1.seq)((0, combi_1.optPrio)(sqlFields), fae, whereClause, groupHaving, ...orderBy, trailingOpts, trailingInto)));
|
|
4629
4628
|
const selectTableIntoThenFrom = (0, combi_1.seq)(intoForPackSize, (0, combi_1.optPrio)(_1.SQLPackageSize));
|
|
4630
4629
|
const selectOtherIntoThenFrom = intoSingle;
|
|
4631
4630
|
const nonSingleBody = (0, combi_1.seq)((0, combi_1.optPrio)("DISTINCT"), fieldList, (0, combi_1.optPrio)(sql_up_to_1.SQLUpTo), byp, (0, combi_1.optPrio)((0, combi_1.altPrio)(selectTableIntoThenFrom, selectOtherIntoThenFrom)), (0, combi_1.optPrio)(sql_up_to_1.SQLUpTo), byp, conn, afterFromWithInto);
|
|
@@ -9275,10 +9274,14 @@ class SQLCompare extends combi_1.Expression {
|
|
|
9275
9274
|
const nul = (0, combi_1.seq)("IS", (0, combi_1.optPrio)("NOT"), (0, combi_1.altPrio)("NULL", (0, combi_1.ver)(version_1.Release.v753, "INITIAL")));
|
|
9276
9275
|
const sub = (0, combi_1.seq)((0, combi_1.optPrio)((0, combi_1.altPrio)("ALL", "ANY", "SOME")), (0, combi_1.altPrio)(subSelect, simpleScalarSubSelect));
|
|
9277
9276
|
const source = new _1.SQLSource();
|
|
9278
|
-
const arith = (0, combi_1.ver)(version_1.Release.v750, (0, combi_1.plusPrio)((0, combi_1.seq)((0, combi_1.altPrio)("+", "-", "*", "/"), _1.SQLFieldName)), { also: combi_1.AlsoIn.OpenABAP });
|
|
9279
9277
|
const paren = (0, combi_1.seq)((0, combi_1.tok)(tokens_1.ParenLeftW), _1.Source, (0, combi_1.tok)(tokens_1.WParenRightW));
|
|
9280
9278
|
const at = (0, combi_1.ver)(version_1.Release.v740sp05, (0, combi_1.seq)((0, combi_1.tok)(tokens_1.WAt), (0, combi_1.altPrio)(_1.SimpleSource3, paren)), { also: combi_1.AlsoIn.OpenABAP });
|
|
9281
|
-
const
|
|
9279
|
+
const arithmetic = (0, combi_1.seq)((0, combi_1.altPrio)("+", "-", "*", "/"), _1.SQLFieldName);
|
|
9280
|
+
const arith = (0, combi_1.ver)(version_1.Release.v750, (0, combi_1.plusPrio)(arithmetic), { also: combi_1.AlsoIn.OpenABAP });
|
|
9281
|
+
// the left hand side can also concatenate with &&, the right hand side can not
|
|
9282
|
+
const concat = (0, combi_1.seq)("&&", (0, combi_1.altPrio)(_1.SQLFieldName, _1.ConstantString, at));
|
|
9283
|
+
const arithLeft = (0, combi_1.ver)(version_1.Release.v750, (0, combi_1.plusPrio)((0, combi_1.altPrio)(arithmetic, concat)), { also: combi_1.AlsoIn.OpenABAP });
|
|
9284
|
+
const lhs = (0, combi_1.altPrio)(_1.SQLCase, _1.SQLAggregation, _1.SQLFunction, (0, combi_1.seq)(_1.ConstantString, (0, combi_1.optPrio)(arithLeft)), (0, combi_1.seq)((0, combi_1.altPrio)(_1.SQLPathForColumn, _1.SQLAliasField, _1.SQLFieldName), (0, combi_1.optPrio)(arithLeft)), (0, combi_1.seq)(at, (0, combi_1.optPrio)(arithLeft)));
|
|
9282
9285
|
const rhs = (0, combi_1.altPrio)((0, combi_1.seq)(_1.SQLCompareOperator, (0, combi_1.altPrio)(sub, _1.SQLCase, _1.SQLAggregation, _1.SQLFunction, (0, combi_1.seq)(source, (0, combi_1.optPrio)(arith)))), (0, combi_1.seq)((0, combi_1.optPrio)("NOT"), (0, combi_1.altPrio)(_1.SQLIn, like, between)), sql_like_regexpr_1.SQLLikeRegexpr, nul);
|
|
9283
9286
|
const rett = (0, combi_1.seq)(lhs, rhs);
|
|
9284
9287
|
const exists = (0, combi_1.seq)("EXISTS", (0, combi_1.altPrio)(subSelect, simpleSubSelect));
|
|
@@ -10940,7 +10943,12 @@ class SQLOrderBy extends combi_1.Expression {
|
|
|
10940
10943
|
const ding = (0, combi_1.alt)("ASCENDING", "DESCENDING");
|
|
10941
10944
|
const nulls = (0, combi_1.ver)(version_1.Release.v778, (0, combi_1.seq)("NULLS", (0, combi_1.alt)("FIRST", "LAST")));
|
|
10942
10945
|
const item = (0, combi_1.altPrio)((0, combi_1.ver)(version_1.Release.v789, sql_field_1.SQLField), sql_field_name_1.SQLFieldName);
|
|
10943
|
-
const
|
|
10946
|
+
const entry = (0, combi_1.seq)(item, (0, combi_1.opt)(ding), (0, combi_1.opt)(nulls));
|
|
10947
|
+
// without commas only column names, SQL expressions need the comma separated list.
|
|
10948
|
+
// UP TO and OFFSET are not taken as column names, they are not allowed after ORDER BY, #2555
|
|
10949
|
+
const commaList = (0, combi_1.seq)(entry, (0, combi_1.star)((0, combi_1.seq)(",", entry)));
|
|
10950
|
+
const blankList = (0, combi_1.plus)((0, combi_1.seq)((0, combi_1.stopBefore)("UP", "TO"), (0, combi_1.stopBefore1)("OFFSET"), sql_field_name_1.SQLFieldName, (0, combi_1.opt)(ding), (0, combi_1.opt)(nulls)));
|
|
10951
|
+
const ofields = (0, combi_1.alt)(commaList, blankList);
|
|
10944
10952
|
const order = (0, combi_1.seq)("ORDER BY", (0, combi_1.altPrio)("PRIMARY KEY", dynamic_1.Dynamic, ofields));
|
|
10945
10953
|
return order;
|
|
10946
10954
|
}
|
|
@@ -11680,7 +11688,8 @@ class StringTemplateFormatting extends combi_1.Expression {
|
|
|
11680
11688
|
const xsd = (0, combi_1.ver)(version_1.Release.v740sp02, (0, combi_1.seq)("XSD =", zeroXSDOptions));
|
|
11681
11689
|
const country = (0, combi_1.seq)("COUNTRY =", _1.Source);
|
|
11682
11690
|
const currency = (0, combi_1.seq)("CURRENCY =", _1.Source);
|
|
11683
|
-
const
|
|
11691
|
+
const style = (0, combi_1.seq)("STYLE =", styleOptions);
|
|
11692
|
+
const formatting = (0, combi_1.altPrio)((0, combi_1.seq)("TIME =", dateTimeOptions), (0, combi_1.seq)("DATE =", dateTimeOptions), (0, combi_1.seq)("CASE =", caseOptions), (0, combi_1.seq)("ZERO =", zeroXSDOptions), xsd, (0, combi_1.per)(sign, number, decimals, width, pad, alpha, align, country, currency, style, (0, combi_1.seq)("EXPONENT =", _1.Source)), (0, combi_1.per)(timezone, timestamp));
|
|
11684
11693
|
return formatting;
|
|
11685
11694
|
}
|
|
11686
11695
|
}
|
|
@@ -30080,6 +30089,8 @@ const enum_type_1 = __webpack_require__(/*! ../types/basic/enum_type */ "./node_
|
|
|
30080
30089
|
const cgeneric_type_1 = __webpack_require__(/*! ../types/basic/cgeneric_type */ "./node_modules/@abaplint/core/build/src/abap/types/basic/cgeneric_type.js");
|
|
30081
30090
|
const Expressions = __importStar(__webpack_require__(/*! ../2_statements/expressions */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js"));
|
|
30082
30091
|
const nodes_1 = __webpack_require__(/*! ../nodes */ "./node_modules/@abaplint/core/build/src/abap/nodes/index.js");
|
|
30092
|
+
const ngeneric_type_1 = __webpack_require__(/*! ../types/basic/ngeneric_type */ "./node_modules/@abaplint/core/build/src/abap/types/basic/ngeneric_type.js");
|
|
30093
|
+
const _builtin_1 = __webpack_require__(/*! ./_builtin */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_builtin.js");
|
|
30083
30094
|
// todo: refactor to static? for performance
|
|
30084
30095
|
class TypeUtils {
|
|
30085
30096
|
constructor(scope) {
|
|
@@ -30377,8 +30388,119 @@ class TypeUtils {
|
|
|
30377
30388
|
|| node.findFirstExpression(Expressions.ArithOperator) !== undefined;
|
|
30378
30389
|
return calculated;
|
|
30379
30390
|
}
|
|
30380
|
-
|
|
30381
|
-
|
|
30391
|
+
/** the source is only a call of a functional method, not a built-in function */
|
|
30392
|
+
isFunctionalMethodResult(node) {
|
|
30393
|
+
var _a;
|
|
30394
|
+
if (!(node.get() instanceof Expressions.Source) || node.getChildren().length !== 1) {
|
|
30395
|
+
return false;
|
|
30396
|
+
}
|
|
30397
|
+
const chain = node.getFirstChild();
|
|
30398
|
+
if (!(chain instanceof nodes_1.ExpressionNode) || !(chain.get() instanceof Expressions.MethodCallChain)) {
|
|
30399
|
+
return false;
|
|
30400
|
+
}
|
|
30401
|
+
const children = chain.getChildren();
|
|
30402
|
+
const last = children[children.length - 1];
|
|
30403
|
+
if (!(last instanceof nodes_1.ExpressionNode) || !(last.get() instanceof Expressions.MethodCall)) {
|
|
30404
|
+
return false;
|
|
30405
|
+
}
|
|
30406
|
+
if (children.length === 1) {
|
|
30407
|
+
const name = (_a = last.findDirectExpression(Expressions.MethodName)) === null || _a === void 0 ? void 0 : _a.concatTokens().toUpperCase();
|
|
30408
|
+
if (name === undefined || _builtin_1.BuiltIn.searchBuiltin(name) !== undefined) {
|
|
30409
|
+
return false;
|
|
30410
|
+
}
|
|
30411
|
+
}
|
|
30412
|
+
return true;
|
|
30413
|
+
}
|
|
30414
|
+
/** the result of a functional method passed to a formal parameter: the result is expected to be of
|
|
30415
|
+
* the same kind as the parameter, numeric types mix, c, n and x only into the same or a longer length.
|
|
30416
|
+
* Returns false for a known mismatch of elementary types, true otherwise */
|
|
30417
|
+
isFunctionalResultAssignable(source, target) {
|
|
30418
|
+
const isNumber = (t) => t instanceof basic_1.IntegerType
|
|
30419
|
+
|| t instanceof basic_1.Integer8Type
|
|
30420
|
+
|| t instanceof basic_1.PackedType
|
|
30421
|
+
|| t instanceof basic_1.FloatType
|
|
30422
|
+
|| t instanceof basic_1.DecFloat16Type
|
|
30423
|
+
|| t instanceof basic_1.DecFloat34Type;
|
|
30424
|
+
let kind;
|
|
30425
|
+
if (isNumber(source)) {
|
|
30426
|
+
kind = "number";
|
|
30427
|
+
}
|
|
30428
|
+
else if (source instanceof basic_1.CharacterType) {
|
|
30429
|
+
kind = "c";
|
|
30430
|
+
}
|
|
30431
|
+
else if (source instanceof basic_1.NumericType && !(source instanceof ngeneric_type_1.NGenericType)) {
|
|
30432
|
+
kind = "n";
|
|
30433
|
+
}
|
|
30434
|
+
else if (source instanceof basic_1.HexType) {
|
|
30435
|
+
kind = "x";
|
|
30436
|
+
}
|
|
30437
|
+
else if (source instanceof basic_1.StringType) {
|
|
30438
|
+
kind = "string";
|
|
30439
|
+
}
|
|
30440
|
+
else if (source instanceof basic_1.XStringType) {
|
|
30441
|
+
kind = "xstring";
|
|
30442
|
+
}
|
|
30443
|
+
else if (source instanceof basic_1.DateType) {
|
|
30444
|
+
kind = "d";
|
|
30445
|
+
}
|
|
30446
|
+
else if (source instanceof basic_1.TimeType) {
|
|
30447
|
+
kind = "t";
|
|
30448
|
+
}
|
|
30449
|
+
else if (source instanceof basic_1.UTCLongType) {
|
|
30450
|
+
kind = "utclong";
|
|
30451
|
+
}
|
|
30452
|
+
else {
|
|
30453
|
+
return true;
|
|
30454
|
+
}
|
|
30455
|
+
if (isNumber(target) || target instanceof basic_1.NumericGenericType || target instanceof basic_1.PGenericType) {
|
|
30456
|
+
return kind === "number";
|
|
30457
|
+
}
|
|
30458
|
+
else if (target instanceof basic_1.CharacterType) {
|
|
30459
|
+
return source instanceof basic_1.CharacterType && source.getLength() <= target.getLength();
|
|
30460
|
+
}
|
|
30461
|
+
else if (target instanceof ngeneric_type_1.NGenericType) {
|
|
30462
|
+
return kind === "n";
|
|
30463
|
+
}
|
|
30464
|
+
else if (target instanceof basic_1.NumericType) {
|
|
30465
|
+
return source instanceof basic_1.NumericType && source.getLength() <= target.getLength();
|
|
30466
|
+
}
|
|
30467
|
+
else if (target instanceof basic_1.HexType) {
|
|
30468
|
+
return source instanceof basic_1.HexType && source.getLength() <= target.getLength();
|
|
30469
|
+
}
|
|
30470
|
+
else if (target instanceof basic_1.StringType) {
|
|
30471
|
+
return kind === "c" || kind === "string";
|
|
30472
|
+
}
|
|
30473
|
+
else if (target instanceof basic_1.XStringType) {
|
|
30474
|
+
return kind === "x" || kind === "xstring";
|
|
30475
|
+
}
|
|
30476
|
+
else if (target instanceof basic_1.DateType) {
|
|
30477
|
+
return kind === "d";
|
|
30478
|
+
}
|
|
30479
|
+
else if (target instanceof basic_1.TimeType) {
|
|
30480
|
+
return kind === "t";
|
|
30481
|
+
}
|
|
30482
|
+
else if (target instanceof basic_1.UTCLongType) {
|
|
30483
|
+
return kind === "utclong";
|
|
30484
|
+
}
|
|
30485
|
+
else if (target instanceof cgeneric_type_1.CGenericType) {
|
|
30486
|
+
return kind === "c";
|
|
30487
|
+
}
|
|
30488
|
+
else if (target instanceof basic_1.XGenericType) {
|
|
30489
|
+
return kind === "x";
|
|
30490
|
+
}
|
|
30491
|
+
else if (target instanceof basic_1.CSequenceType) {
|
|
30492
|
+
return kind === "c" || kind === "string";
|
|
30493
|
+
}
|
|
30494
|
+
else if (target instanceof basic_1.XSequenceType) {
|
|
30495
|
+
return kind === "x" || kind === "xstring";
|
|
30496
|
+
}
|
|
30497
|
+
else if (target instanceof basic_1.CLikeType) {
|
|
30498
|
+
return kind !== "number" && kind !== "x" && kind !== "xstring" && kind !== "utclong";
|
|
30499
|
+
}
|
|
30500
|
+
return true;
|
|
30501
|
+
}
|
|
30502
|
+
// a text or string literal is only assignable to an xstring or xsequence parameter if its
|
|
30503
|
+
// content is hexadecimal: one or more of 0-9 and A-F, upper case, nothing else, or ``
|
|
30382
30504
|
isHexConstant(node) {
|
|
30383
30505
|
const constant = node === null || node === void 0 ? void 0 : node.concatTokens();
|
|
30384
30506
|
if (constant === undefined) {
|
|
@@ -30387,7 +30509,8 @@ class TypeUtils {
|
|
|
30387
30509
|
if ((constant.startsWith("'") && constant.endsWith("'"))
|
|
30388
30510
|
|| (constant.startsWith("`") && constant.endsWith("`"))) {
|
|
30389
30511
|
const value = constant.substring(1, constant.length - 1);
|
|
30390
|
-
|
|
30512
|
+
// an empty string literal is an empty byte string, while '' is a text field of one blank
|
|
30513
|
+
return /^[0-9A-F]+$/.test(value) || constant === "``";
|
|
30391
30514
|
}
|
|
30392
30515
|
return true;
|
|
30393
30516
|
}
|
|
@@ -30398,8 +30521,8 @@ class TypeUtils {
|
|
|
30398
30521
|
}
|
|
30399
30522
|
return this.isAssignable(source, target);
|
|
30400
30523
|
}
|
|
30401
|
-
isAssignableStrict(source, target, node) {
|
|
30402
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
30524
|
+
isAssignableStrict(source, target, node, builtin = false) {
|
|
30525
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
30403
30526
|
const calculated = node ? this.isCalculated(node) : false;
|
|
30404
30527
|
/*
|
|
30405
30528
|
console.dir(source);
|
|
@@ -30424,9 +30547,19 @@ class TypeUtils {
|
|
|
30424
30547
|
return false;
|
|
30425
30548
|
}
|
|
30426
30549
|
}
|
|
30550
|
+
if (node && builtin === false && this.isFunctionalMethodResult(node)
|
|
30551
|
+
&& this.isFunctionalResultAssignable(source, target) === false) {
|
|
30552
|
+
return false;
|
|
30553
|
+
}
|
|
30427
30554
|
if (calculated) {
|
|
30428
30555
|
return this.isAssignable(source, target);
|
|
30429
30556
|
}
|
|
30557
|
+
// an elementary text field is not compatible with a structure, also not with a flat character-like one
|
|
30558
|
+
if (target instanceof basic_1.StructureType
|
|
30559
|
+
&& target.containsVoid() === false
|
|
30560
|
+
&& (source instanceof basic_1.CharacterType || source instanceof basic_1.StringType || source instanceof basic_1.NumericType)) {
|
|
30561
|
+
return false;
|
|
30562
|
+
}
|
|
30430
30563
|
if (target instanceof basic_1.CLikeType) {
|
|
30431
30564
|
return this.isCharLikeStrict(source);
|
|
30432
30565
|
}
|
|
@@ -30460,8 +30593,14 @@ class TypeUtils {
|
|
|
30460
30593
|
}
|
|
30461
30594
|
return false;
|
|
30462
30595
|
}
|
|
30463
|
-
else if (target instanceof basic_1.
|
|
30596
|
+
else if (target instanceof basic_1.XSequenceType) {
|
|
30464
30597
|
if (((_e = source.getAbstractTypeData()) === null || _e === void 0 ? void 0 : _e.derivedFromConstant) === true) {
|
|
30598
|
+
return this.isHexConstant(node);
|
|
30599
|
+
}
|
|
30600
|
+
return true;
|
|
30601
|
+
}
|
|
30602
|
+
else if (target instanceof basic_1.StringType) {
|
|
30603
|
+
if (((_f = source.getAbstractTypeData()) === null || _f === void 0 ? void 0 : _f.derivedFromConstant) === true) {
|
|
30465
30604
|
return true;
|
|
30466
30605
|
}
|
|
30467
30606
|
return false;
|
|
@@ -30469,7 +30608,7 @@ class TypeUtils {
|
|
|
30469
30608
|
}
|
|
30470
30609
|
else if (source instanceof basic_1.HexType) {
|
|
30471
30610
|
if (target instanceof basic_1.HexType) {
|
|
30472
|
-
if (((
|
|
30611
|
+
if (((_g = source.getAbstractTypeData()) === null || _g === void 0 ? void 0 : _g.derivedFromConstant) === true) {
|
|
30473
30612
|
return source.getLength() <= target.getLength();
|
|
30474
30613
|
}
|
|
30475
30614
|
return source.getLength() === target.getLength();
|
|
@@ -30478,7 +30617,7 @@ class TypeUtils {
|
|
|
30478
30617
|
return false;
|
|
30479
30618
|
}
|
|
30480
30619
|
else if (target instanceof basic_1.IntegerType || target instanceof basic_1.Integer8Type) {
|
|
30481
|
-
if (((
|
|
30620
|
+
if (((_h = source.getAbstractTypeData()) === null || _h === void 0 ? void 0 : _h.derivedFromConstant) === true) {
|
|
30482
30621
|
return true;
|
|
30483
30622
|
}
|
|
30484
30623
|
return false;
|
|
@@ -30494,13 +30633,13 @@ class TypeUtils {
|
|
|
30494
30633
|
return false;
|
|
30495
30634
|
}
|
|
30496
30635
|
else if (target instanceof basic_1.CharacterType) {
|
|
30497
|
-
if (((
|
|
30636
|
+
if (((_j = source.getAbstractTypeData()) === null || _j === void 0 ? void 0 : _j.derivedFromConstant) === true) {
|
|
30498
30637
|
return true;
|
|
30499
30638
|
}
|
|
30500
30639
|
return false;
|
|
30501
30640
|
}
|
|
30502
30641
|
else if (target instanceof basic_1.IntegerType) {
|
|
30503
|
-
if (((
|
|
30642
|
+
if (((_k = source.getAbstractTypeData()) === null || _k === void 0 ? void 0 : _k.derivedFromConstant) === true) {
|
|
30504
30643
|
return true;
|
|
30505
30644
|
}
|
|
30506
30645
|
return false;
|
|
@@ -30510,8 +30649,8 @@ class TypeUtils {
|
|
|
30510
30649
|
return false;
|
|
30511
30650
|
}
|
|
30512
30651
|
else if (target instanceof basic_1.XSequenceType || target instanceof basic_1.XStringType) {
|
|
30513
|
-
if (((
|
|
30514
|
-
return
|
|
30652
|
+
if (((_l = source.getAbstractTypeData()) === null || _l === void 0 ? void 0 : _l.derivedFromConstant) === true) {
|
|
30653
|
+
return this.isHexConstant(node);
|
|
30515
30654
|
}
|
|
30516
30655
|
return false;
|
|
30517
30656
|
}
|
|
@@ -30564,7 +30703,7 @@ class TypeUtils {
|
|
|
30564
30703
|
return false;
|
|
30565
30704
|
}
|
|
30566
30705
|
else if (target instanceof basic_1.Integer8Type || target instanceof basic_1.PackedType) {
|
|
30567
|
-
if (((
|
|
30706
|
+
if (((_m = source.getAbstractTypeData()) === null || _m === void 0 ? void 0 : _m.derivedFromConstant) === true) {
|
|
30568
30707
|
return true;
|
|
30569
30708
|
}
|
|
30570
30709
|
return false;
|
|
@@ -30607,8 +30746,14 @@ class TypeUtils {
|
|
|
30607
30746
|
return false;
|
|
30608
30747
|
}
|
|
30609
30748
|
}
|
|
30749
|
+
else if (source instanceof basic_1.DataReference && target instanceof basic_1.DataReference) {
|
|
30750
|
+
return this.isDataReferenceCompatible(source, target);
|
|
30751
|
+
}
|
|
30610
30752
|
else if (source instanceof basic_1.TableType) {
|
|
30611
|
-
if (
|
|
30753
|
+
if (target instanceof basic_1.TableType && this.isTableKindCompatible(source, target) === false) {
|
|
30754
|
+
return false;
|
|
30755
|
+
}
|
|
30756
|
+
else if (source.getRowType() instanceof basic_1.AnyType) {
|
|
30612
30757
|
// then its a generic table, todo: add top level generic table type?
|
|
30613
30758
|
return true;
|
|
30614
30759
|
}
|
|
@@ -30638,6 +30783,81 @@ class TypeUtils {
|
|
|
30638
30783
|
}
|
|
30639
30784
|
return this.isAssignable(source, target);
|
|
30640
30785
|
}
|
|
30786
|
+
// a standard, sorted or hashed table only fits a table type of the same kind, generic or not,
|
|
30787
|
+
// INDEX TABLE takes standard and sorted tables, ANY TABLE takes all
|
|
30788
|
+
isTableKindCompatible(source, target) {
|
|
30789
|
+
const sourceAccess = source.getAccessType();
|
|
30790
|
+
const targetAccess = target.getAccessType();
|
|
30791
|
+
if (sourceAccess === undefined
|
|
30792
|
+
|| targetAccess === undefined
|
|
30793
|
+
|| sourceAccess === table_type_1.TableAccessType.index
|
|
30794
|
+
|| sourceAccess === table_type_1.TableAccessType.any
|
|
30795
|
+
|| source.isWithHeader()
|
|
30796
|
+
|| target.isWithHeader()) {
|
|
30797
|
+
return true;
|
|
30798
|
+
}
|
|
30799
|
+
else if (targetAccess === table_type_1.TableAccessType.any) {
|
|
30800
|
+
return true;
|
|
30801
|
+
}
|
|
30802
|
+
else if (targetAccess === table_type_1.TableAccessType.index) {
|
|
30803
|
+
return sourceAccess !== table_type_1.TableAccessType.hashed;
|
|
30804
|
+
}
|
|
30805
|
+
return sourceAccess === targetAccess;
|
|
30806
|
+
}
|
|
30807
|
+
// a data reference fits REF TO data, or a reference to the same type, no down cast
|
|
30808
|
+
isDataReferenceCompatible(source, target) {
|
|
30809
|
+
const targetType = target.getType();
|
|
30810
|
+
const sourceType = source.getType();
|
|
30811
|
+
if (targetType instanceof basic_1.DataType || targetType instanceof basic_1.AnyType || target.isGeneric()) {
|
|
30812
|
+
return true;
|
|
30813
|
+
}
|
|
30814
|
+
else if (sourceType instanceof basic_1.DataType || sourceType instanceof basic_1.AnyType) {
|
|
30815
|
+
return false;
|
|
30816
|
+
}
|
|
30817
|
+
return this.isSameType(sourceType, targetType);
|
|
30818
|
+
}
|
|
30819
|
+
// types of the same kind and technical attributes, structures also with the same component names;
|
|
30820
|
+
// returns true whenever this cannot be decided
|
|
30821
|
+
isSameType(source, target) {
|
|
30822
|
+
if (source instanceof basic_1.VoidType || target instanceof basic_1.VoidType
|
|
30823
|
+
|| source instanceof basic_1.UnknownType || target instanceof basic_1.UnknownType
|
|
30824
|
+
|| source instanceof basic_1.AnyType || target instanceof basic_1.AnyType
|
|
30825
|
+
|| source.containsVoid() || target.containsVoid()) {
|
|
30826
|
+
return true;
|
|
30827
|
+
}
|
|
30828
|
+
else if (source.constructor !== target.constructor) {
|
|
30829
|
+
return false;
|
|
30830
|
+
}
|
|
30831
|
+
if ((source instanceof basic_1.CharacterType && target instanceof basic_1.CharacterType)
|
|
30832
|
+
|| (source instanceof basic_1.HexType && target instanceof basic_1.HexType)
|
|
30833
|
+
|| (source instanceof basic_1.NumericType && target instanceof basic_1.NumericType)) {
|
|
30834
|
+
return source.getLength() === target.getLength();
|
|
30835
|
+
}
|
|
30836
|
+
else if (source instanceof basic_1.PackedType && target instanceof basic_1.PackedType) {
|
|
30837
|
+
return source.getLength() === target.getLength() && source.getDecimals() === target.getDecimals();
|
|
30838
|
+
}
|
|
30839
|
+
else if (source instanceof basic_1.StructureType && target instanceof basic_1.StructureType) {
|
|
30840
|
+
const sourceComponents = source.getComponents();
|
|
30841
|
+
const targetComponents = target.getComponents();
|
|
30842
|
+
if (sourceComponents.length !== targetComponents.length) {
|
|
30843
|
+
return false;
|
|
30844
|
+
}
|
|
30845
|
+
for (let i = 0; i < sourceComponents.length; i++) {
|
|
30846
|
+
if (sourceComponents[i].name.toUpperCase() !== targetComponents[i].name.toUpperCase()
|
|
30847
|
+
|| this.isSameType(sourceComponents[i].type, targetComponents[i].type) === false) {
|
|
30848
|
+
return false;
|
|
30849
|
+
}
|
|
30850
|
+
}
|
|
30851
|
+
}
|
|
30852
|
+
else if (source instanceof basic_1.TableType && target instanceof basic_1.TableType) {
|
|
30853
|
+
return source.getAccessType() === target.getAccessType()
|
|
30854
|
+
&& this.isSameType(source.getRowType(), target.getRowType());
|
|
30855
|
+
}
|
|
30856
|
+
else if (source instanceof basic_1.DataReference && target instanceof basic_1.DataReference) {
|
|
30857
|
+
return this.isSameType(source.getType(), target.getType());
|
|
30858
|
+
}
|
|
30859
|
+
return true;
|
|
30860
|
+
}
|
|
30641
30861
|
// character-like arguments of built-in functions must be elementary, flat character-like structures are not allowed
|
|
30642
30862
|
isAssignableBuiltin(source, target, node) {
|
|
30643
30863
|
if (target instanceof basic_1.CLikeType
|
|
@@ -30645,7 +30865,7 @@ class TypeUtils {
|
|
|
30645
30865
|
|| (source instanceof basic_1.TableType && source.isWithHeader() && source.getRowType() instanceof basic_1.StructureType))) {
|
|
30646
30866
|
return false;
|
|
30647
30867
|
}
|
|
30648
|
-
return this.isAssignableStrict(source, target, node);
|
|
30868
|
+
return this.isAssignableStrict(source, target, node, true);
|
|
30649
30869
|
}
|
|
30650
30870
|
// Typing with the classic STRUCTURE addition, ie. "FORM foo USING bar STRUCTURE zkey",
|
|
30651
30871
|
// is not a compatibility check: ABAP only checks the fragment view up to the end of the
|
|
@@ -31186,6 +31406,18 @@ class BasicTypes {
|
|
|
31186
31406
|
else if (type instanceof Types.TimeType) {
|
|
31187
31407
|
type = new Types.TimeType(data);
|
|
31188
31408
|
}
|
|
31409
|
+
else if (type instanceof Types.PackedType) {
|
|
31410
|
+
type = new Types.PackedType(type.getLength(), type.getDecimals(), data);
|
|
31411
|
+
}
|
|
31412
|
+
else if (type instanceof Types.DecFloat16Type) {
|
|
31413
|
+
type = new Types.DecFloat16Type(data);
|
|
31414
|
+
}
|
|
31415
|
+
else if (type instanceof Types.DecFloat34Type) {
|
|
31416
|
+
type = new Types.DecFloat34Type(data);
|
|
31417
|
+
}
|
|
31418
|
+
else if (type instanceof Types.UTCLongType) {
|
|
31419
|
+
type = new Types.UTCLongType(data);
|
|
31420
|
+
}
|
|
31189
31421
|
else if (type instanceof basic_1.StructureType) {
|
|
31190
31422
|
type = new basic_1.StructureType(type.getComponents().slice(), qualifiedName, undefined, type.getDescription());
|
|
31191
31423
|
}
|
|
@@ -31533,7 +31765,13 @@ class BasicTypes {
|
|
|
31533
31765
|
|| text === "TYPE HASHED TABLE"
|
|
31534
31766
|
|| text === "TYPE INDEX TABLE"
|
|
31535
31767
|
|| text === "TYPE ANY TABLE") {
|
|
31536
|
-
|
|
31768
|
+
// the table kind is kept, the key is left open
|
|
31769
|
+
const access = text.split(" ")[1];
|
|
31770
|
+
return new Types.TableType(Types.AnyType.get(), {
|
|
31771
|
+
withHeader: node.concatTokens().toUpperCase().includes("WITH HEADER LINE"),
|
|
31772
|
+
keyType: Types.TableKeyType.user,
|
|
31773
|
+
primaryKey: { name: "primary_key", type: access, isUnique: false, keyFields: [] },
|
|
31774
|
+
});
|
|
31537
31775
|
}
|
|
31538
31776
|
else if (text.startsWith("LIKE ")) {
|
|
31539
31777
|
let sub = node.findFirstExpression(Expressions.Type);
|
|
@@ -31712,6 +31950,10 @@ class BasicTypes {
|
|
|
31712
31950
|
this.input.scope.addReference(token, foundId, _reference_1.ReferenceType.TypeReference, this.input.filename);
|
|
31713
31951
|
}
|
|
31714
31952
|
}
|
|
31953
|
+
else if (className === "ME") {
|
|
31954
|
+
// me is the reference to the instance, not a class or interface; "me->ty" names the type through it
|
|
31955
|
+
return new Types.UnknownType("\"me\" is not a class or interface, \"" + chainText + "\" cannot be resolved");
|
|
31956
|
+
}
|
|
31715
31957
|
else {
|
|
31716
31958
|
// lookup in local and global scope
|
|
31717
31959
|
const obj = this.input.scope.findObjectDefinition(className);
|
|
@@ -31969,6 +32211,10 @@ class BasicTypes {
|
|
|
31969
32211
|
else if (chain.concatTokens().toUpperCase() === "DATA") {
|
|
31970
32212
|
return new Types.DataReference(new Types.DataType());
|
|
31971
32213
|
}
|
|
32214
|
+
else if (found instanceof Types.UnknownType && name.toUpperCase() === "ME") {
|
|
32215
|
+
// "REF TO me=>ty", me is not a class or interface whatever the error namespace
|
|
32216
|
+
return found;
|
|
32217
|
+
}
|
|
31972
32218
|
if (this.input.scope.isBadiDef(name) === true) {
|
|
31973
32219
|
return Types.VoidType.get(name);
|
|
31974
32220
|
}
|
|
@@ -32406,10 +32652,13 @@ exports.checkHeaderLine = checkHeaderLine;
|
|
|
32406
32652
|
const Expressions = __importStar(__webpack_require__(/*! ../../2_statements/expressions */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js"));
|
|
32407
32653
|
const basic_1 = __webpack_require__(/*! ../../types/basic */ "./node_modules/@abaplint/core/build/src/abap/types/basic/index.js");
|
|
32408
32654
|
const _syntax_input_1 = __webpack_require__(/*! ../_syntax_input */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_syntax_input.js");
|
|
32655
|
+
const _builtin_1 = __webpack_require__(/*! ../_builtin */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_builtin.js");
|
|
32409
32656
|
// A table with header line written without [] is the header line, not the table body,
|
|
32410
|
-
// so it cannot be passed to a table typed method parameter.
|
|
32411
|
-
|
|
32657
|
+
// so it cannot be passed to a table typed method parameter. Built-in functions like lines( ) use
|
|
32658
|
+
// the table body, so they are not checked. Returns true if an issue was reported.
|
|
32659
|
+
function checkHeaderLine(source, sourceType, parameterType, method, input) {
|
|
32412
32660
|
if (source === undefined
|
|
32661
|
+
|| method instanceof _builtin_1.BuiltInMethod
|
|
32413
32662
|
|| !(parameterType instanceof basic_1.TableType)
|
|
32414
32663
|
|| !(sourceType instanceof basic_1.TableType)
|
|
32415
32664
|
|| sourceType.isWithHeader() === false) {
|
|
@@ -33154,6 +33403,11 @@ class Compare {
|
|
|
33154
33403
|
if (operandMessage !== undefined) {
|
|
33155
33404
|
return;
|
|
33156
33405
|
}
|
|
33406
|
+
const arithmeticMessage = this.checkArithmeticOperands(node, sources, sourceTypes);
|
|
33407
|
+
if (arithmeticMessage !== undefined) {
|
|
33408
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), arithmeticMessage));
|
|
33409
|
+
return;
|
|
33410
|
+
}
|
|
33157
33411
|
const typeUtils = new _type_utils_1.TypeUtils(input.scope);
|
|
33158
33412
|
const compareOperator = (_a = node.findDirectExpression(Expressions.CompareOperator)) === null || _a === void 0 ? void 0 : _a.concatTokens().toUpperCase();
|
|
33159
33413
|
if (compareOperator === "CS"
|
|
@@ -33222,6 +33476,67 @@ class Compare {
|
|
|
33222
33476
|
const call = _builtin_call_1.BuiltInCall.fromSource(source, input);
|
|
33223
33477
|
return call === undefined ? undefined : _builtin_call_1.BuiltInCall.callName(call);
|
|
33224
33478
|
}
|
|
33479
|
+
// an arithmetic expression can only be compared with a numeric operand or another arithmetic expression,
|
|
33480
|
+
// a character-like, byte-like, date, time or structured operand is expected to be a syntax error,
|
|
33481
|
+
// the operand can be made an arithmetic expression with a "+" in front, "+ lv_c"
|
|
33482
|
+
static checkArithmeticOperands(node, sources, types) {
|
|
33483
|
+
let pairs = [];
|
|
33484
|
+
if (node.findDirectExpression(Expressions.CompareOperator) !== undefined && sources.length === 2) {
|
|
33485
|
+
pairs = [[0, 1]];
|
|
33486
|
+
}
|
|
33487
|
+
else if (node.findDirectTokenByText("BETWEEN") !== undefined && sources.length === 3) {
|
|
33488
|
+
pairs = [[0, 1], [0, 2]];
|
|
33489
|
+
}
|
|
33490
|
+
for (const [a, b] of pairs) {
|
|
33491
|
+
for (const [arith, other] of [[a, b], [b, a]]) {
|
|
33492
|
+
if (this.isArithmetic(sources[arith]) === true
|
|
33493
|
+
&& this.isArithmetic(sources[other]) === false
|
|
33494
|
+
&& this.isNonNumeric(types[other]) === true) {
|
|
33495
|
+
const operand = sources[other].concatTokens();
|
|
33496
|
+
return `Arithmetic expression cannot be compared with non-numeric operand "${operand}", use "+ ${operand}"`;
|
|
33497
|
+
}
|
|
33498
|
+
}
|
|
33499
|
+
}
|
|
33500
|
+
return undefined;
|
|
33501
|
+
}
|
|
33502
|
+
// "a + b", "- a", "( a * b )", but not "( a )", "a && b" or "a BIT-AND b"
|
|
33503
|
+
static isArithmetic(source) {
|
|
33504
|
+
const children = source.getChildren();
|
|
33505
|
+
const first = children[0];
|
|
33506
|
+
if (first instanceof nodes_1.TokenNode) {
|
|
33507
|
+
const str = first.getFirstToken().getStr();
|
|
33508
|
+
if (str === "+" || str === "-") {
|
|
33509
|
+
return true;
|
|
33510
|
+
}
|
|
33511
|
+
else if (str === "(" && children.length === 3 && children[1] instanceof nodes_1.ExpressionNode) {
|
|
33512
|
+
return this.isArithmetic(children[1]);
|
|
33513
|
+
}
|
|
33514
|
+
}
|
|
33515
|
+
for (const child of children) {
|
|
33516
|
+
if (child instanceof nodes_1.ExpressionNode
|
|
33517
|
+
&& child.get() instanceof Expressions.ArithOperator
|
|
33518
|
+
&& child.concatTokens().toUpperCase().startsWith("BIT-") === false) {
|
|
33519
|
+
return true;
|
|
33520
|
+
}
|
|
33521
|
+
}
|
|
33522
|
+
return false;
|
|
33523
|
+
}
|
|
33524
|
+
static isNonNumeric(type) {
|
|
33525
|
+
return type instanceof basic_1.CharacterType
|
|
33526
|
+
|| type instanceof basic_1.StringType
|
|
33527
|
+
|| type instanceof basic_1.NumericType
|
|
33528
|
+
|| type instanceof basic_1.DateType
|
|
33529
|
+
|| type instanceof basic_1.TimeType
|
|
33530
|
+
|| type instanceof basic_1.HexType
|
|
33531
|
+
|| type instanceof basic_1.XStringType
|
|
33532
|
+
|| type instanceof basic_1.StructureType
|
|
33533
|
+
|| type instanceof basic_1.CLikeType
|
|
33534
|
+
|| type instanceof basic_1.CSequenceType
|
|
33535
|
+
|| type instanceof basic_1.CGenericType
|
|
33536
|
+
|| type instanceof basic_1.NGenericType
|
|
33537
|
+
|| type instanceof basic_1.XSequenceType
|
|
33538
|
+
|| type instanceof basic_1.XGenericType;
|
|
33539
|
+
}
|
|
33225
33540
|
}
|
|
33226
33541
|
exports.Compare = Compare;
|
|
33227
33542
|
//# sourceMappingURL=compare.js.map
|
|
@@ -34363,6 +34678,7 @@ const Expressions = __importStar(__webpack_require__(/*! ../../2_statements/expr
|
|
|
34363
34678
|
const basic_1 = __webpack_require__(/*! ../../types/basic */ "./node_modules/@abaplint/core/build/src/abap/types/basic/index.js");
|
|
34364
34679
|
const _syntax_input_1 = __webpack_require__(/*! ../_syntax_input */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_syntax_input.js");
|
|
34365
34680
|
const source_1 = __webpack_require__(/*! ./source */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/source.js");
|
|
34681
|
+
const _type_utils_1 = __webpack_require__(/*! ../_type_utils */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_type_utils.js");
|
|
34366
34682
|
class FieldAssignment {
|
|
34367
34683
|
static runSyntax(node, input, targetType) {
|
|
34368
34684
|
const fieldSub = node.findDirectExpression(Expressions.FieldSub);
|
|
@@ -34396,7 +34712,19 @@ class FieldAssignment {
|
|
|
34396
34712
|
else if (targetType instanceof basic_1.VoidType) {
|
|
34397
34713
|
type = targetType;
|
|
34398
34714
|
}
|
|
34399
|
-
source_1.Source.runSyntax(s, input, type);
|
|
34715
|
+
const sourceType = source_1.Source.runSyntax(s, input, type);
|
|
34716
|
+
if (this.isReference(type)
|
|
34717
|
+
&& !(type instanceof basic_1.ObjectReferenceType && sourceType instanceof basic_1.ObjectReferenceType)
|
|
34718
|
+
&& new _type_utils_1.TypeUtils(input.scope).isAssignable(sourceType, type) === false) {
|
|
34719
|
+
// a reference component only takes a reference, values like '' or 1 are not converted
|
|
34720
|
+
const message = `Type of source cannot be converted to the type of ${fieldSub.concatTokens()}`;
|
|
34721
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, s.getFirstToken(), message));
|
|
34722
|
+
}
|
|
34723
|
+
}
|
|
34724
|
+
static isReference(type) {
|
|
34725
|
+
return type instanceof basic_1.ObjectReferenceType
|
|
34726
|
+
|| type instanceof basic_1.GenericObjectReferenceType
|
|
34727
|
+
|| type instanceof basic_1.DataReference;
|
|
34400
34728
|
}
|
|
34401
34729
|
}
|
|
34402
34730
|
exports.FieldAssignment = FieldAssignment;
|
|
@@ -35168,6 +35496,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
35168
35496
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
35169
35497
|
exports.FunctionParameters = void 0;
|
|
35170
35498
|
const Expressions = __importStar(__webpack_require__(/*! ../../2_statements/expressions */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js"));
|
|
35499
|
+
const nodes_1 = __webpack_require__(/*! ../../nodes */ "./node_modules/@abaplint/core/build/src/abap/nodes/index.js");
|
|
35171
35500
|
const source_1 = __webpack_require__(/*! ./source */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/source.js");
|
|
35172
35501
|
const target_1 = __webpack_require__(/*! ./target */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/target.js");
|
|
35173
35502
|
const field_chain_1 = __webpack_require__(/*! ./field_chain */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/field_chain.js");
|
|
@@ -35175,6 +35504,7 @@ const _reference_1 = __webpack_require__(/*! ../_reference */ "./node_modules/@a
|
|
|
35175
35504
|
const _syntax_input_1 = __webpack_require__(/*! ../_syntax_input */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_syntax_input.js");
|
|
35176
35505
|
class FunctionParameters {
|
|
35177
35506
|
static runSyntax(node, input) {
|
|
35507
|
+
this.checkDuplicates(node, input);
|
|
35178
35508
|
// EXPORTING: process sources in each FunctionExportingParameter
|
|
35179
35509
|
for (const param of node.findAllExpressions(Expressions.FunctionExportingParameter)) {
|
|
35180
35510
|
const s = param.findDirectExpression(Expressions.Source);
|
|
@@ -35215,6 +35545,47 @@ class FunctionParameters {
|
|
|
35215
35545
|
}
|
|
35216
35546
|
}
|
|
35217
35547
|
}
|
|
35548
|
+
/** a parameter or exception name given twice within the same section, EXPORTING, IMPORTING, TABLES, CHANGING or EXCEPTIONS */
|
|
35549
|
+
static checkDuplicates(node, input) {
|
|
35550
|
+
var _a;
|
|
35551
|
+
const sections = [];
|
|
35552
|
+
const exporting = node.findDirectExpression(Expressions.FunctionExporting);
|
|
35553
|
+
if (exporting) {
|
|
35554
|
+
sections.push(exporting);
|
|
35555
|
+
}
|
|
35556
|
+
sections.push(...node.findDirectExpressions(Expressions.ParameterListT));
|
|
35557
|
+
for (const section of sections) {
|
|
35558
|
+
const supplied = new Set();
|
|
35559
|
+
for (const p of section.getChildren()) {
|
|
35560
|
+
const token = p instanceof nodes_1.ExpressionNode ? (_a = p.findDirectExpression(Expressions.ParameterName)) === null || _a === void 0 ? void 0 : _a.getFirstToken() : undefined;
|
|
35561
|
+
this.checkDuplicate(token, token === null || token === void 0 ? void 0 : token.getStr().toUpperCase(), supplied, "Function module parameter", input);
|
|
35562
|
+
}
|
|
35563
|
+
}
|
|
35564
|
+
const exceptions = node.findDirectExpression(Expressions.ParameterListExceptions);
|
|
35565
|
+
const supplied = new Set();
|
|
35566
|
+
for (const e of (exceptions === null || exceptions === void 0 ? void 0 : exceptions.findDirectExpressions(Expressions.ParameterException)) || []) {
|
|
35567
|
+
this.checkDuplicate(e.getFirstToken(), this.exceptionName(e), supplied, "Exception", input);
|
|
35568
|
+
}
|
|
35569
|
+
}
|
|
35570
|
+
static exceptionName(node) {
|
|
35571
|
+
let name = "";
|
|
35572
|
+
for (const c of node.getChildren()) {
|
|
35573
|
+
if (c instanceof nodes_1.TokenNode && c.getFirstToken().getStr() === "=") {
|
|
35574
|
+
break;
|
|
35575
|
+
}
|
|
35576
|
+
name += c.concatTokens();
|
|
35577
|
+
}
|
|
35578
|
+
return name.toUpperCase();
|
|
35579
|
+
}
|
|
35580
|
+
static checkDuplicate(token, name, supplied, what, input) {
|
|
35581
|
+
if (token === undefined || name === undefined) {
|
|
35582
|
+
return;
|
|
35583
|
+
}
|
|
35584
|
+
else if (supplied.has(name)) {
|
|
35585
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, token, `${what} "${name}" is supplied more than once`));
|
|
35586
|
+
}
|
|
35587
|
+
supplied.add(name);
|
|
35588
|
+
}
|
|
35218
35589
|
}
|
|
35219
35590
|
exports.FunctionParameters = FunctionParameters;
|
|
35220
35591
|
//# sourceMappingURL=function_parameters.js.map
|
|
@@ -36395,7 +36766,7 @@ class MethodCallParam {
|
|
|
36395
36766
|
else if ((0, _check_text_symbol_1.checkTextSymbol)(child, targetType, input)) {
|
|
36396
36767
|
return;
|
|
36397
36768
|
}
|
|
36398
|
-
else if ((0, _check_header_line_1.checkHeaderLine)(child, sourceType, targetType, input)) {
|
|
36769
|
+
else if ((0, _check_header_line_1.checkHeaderLine)(child, sourceType, targetType, method, input)) {
|
|
36399
36770
|
return;
|
|
36400
36771
|
}
|
|
36401
36772
|
else if (this.isAssignable(sourceType, targetType, child, method, input) === false) {
|
|
@@ -36795,7 +37166,11 @@ class MethodParameters {
|
|
|
36795
37166
|
}
|
|
36796
37167
|
// the parameter is supplied, even if its type is wrong
|
|
36797
37168
|
(_a = this.requiredParameters) === null || _a === void 0 ? void 0 : _a.delete(item.name);
|
|
36798
|
-
|
|
37169
|
+
const typeUtils = new _type_utils_1.TypeUtils(input.scope);
|
|
37170
|
+
if (item.targetType && (typeUtils.isAssignableStrict(parameterType, item.targetType) === false
|
|
37171
|
+
// a CHANGING parameter is read and written, so a data reference is checked in both directions
|
|
37172
|
+
|| (parameterType instanceof basic_1.DataReference && item.targetType instanceof basic_1.DataReference
|
|
37173
|
+
&& typeUtils.isAssignableStrict(item.targetType, parameterType) === false))) {
|
|
36799
37174
|
const message = "Method parameter type not compatible, " + item.name;
|
|
36800
37175
|
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
|
|
36801
37176
|
return;
|
|
@@ -36827,7 +37202,7 @@ class MethodParameters {
|
|
|
36827
37202
|
if ((0, _check_text_symbol_1.checkTextSymbol)(item.source, parameter.getType(), input)) {
|
|
36828
37203
|
return;
|
|
36829
37204
|
}
|
|
36830
|
-
else if ((0, _check_header_line_1.checkHeaderLine)(item.source, item.sourceType, parameter.getType(), input)) {
|
|
37205
|
+
else if ((0, _check_header_line_1.checkHeaderLine)(item.source, item.sourceType, parameter.getType(), method, input)) {
|
|
36831
37206
|
return;
|
|
36832
37207
|
}
|
|
36833
37208
|
else if (assignable(item.sourceType, parameter.getType(), item.source) === false) {
|
|
@@ -37863,17 +38238,19 @@ class Select {
|
|
|
37863
38238
|
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
|
|
37864
38239
|
}
|
|
37865
38240
|
}
|
|
38241
|
+
/** an inline declaration cannot be the target of INTO or APPENDING CORRESPONDING FIELDS OF,
|
|
38242
|
+
* the declaration is still made, so later reads give no follow-up errors */
|
|
38243
|
+
static checkCorrespondingInline(into, inline, node, input) {
|
|
38244
|
+
if (inline !== undefined && into.findDirectTokenByText("CORRESPONDING") !== undefined) {
|
|
38245
|
+
const message = "Inline declarations cannot be used together with INTO CORRESPONDING FIELDS OF";
|
|
38246
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
|
|
38247
|
+
}
|
|
38248
|
+
}
|
|
37866
38249
|
static handleInto(node, input, fields, dbSources, from) {
|
|
37867
38250
|
const intoTable = node.findDirectExpression(Expressions.SQLIntoTable);
|
|
37868
38251
|
if (intoTable) {
|
|
37869
38252
|
const inline = intoTable.findFirstExpression(Expressions.InlineData);
|
|
37870
|
-
|
|
37871
|
-
&& intoTable.findDirectTokenByText("INTO") !== undefined
|
|
37872
|
-
&& intoTable.findDirectTokenByText("CORRESPONDING") !== undefined
|
|
37873
|
-
&& !(0, version_1.releaseAtLeast)(input.scope.getRelease(), version_1.Release.v755)) {
|
|
37874
|
-
const message = "INTO CORRESPONDING FIELDS OF TABLE with an inline declaration requires 7.55";
|
|
37875
|
-
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
|
|
37876
|
-
}
|
|
38253
|
+
this.checkCorrespondingInline(intoTable, inline, node, input);
|
|
37877
38254
|
if (inline) {
|
|
37878
38255
|
inline_data_1.InlineData.runSyntax(inline, input, this.buildTableType(fields, dbSources, input.scope, from));
|
|
37879
38256
|
}
|
|
@@ -37882,6 +38259,7 @@ class Select {
|
|
|
37882
38259
|
const intoStructure = node.findDirectExpression(Expressions.SQLIntoStructure);
|
|
37883
38260
|
if (intoStructure) {
|
|
37884
38261
|
const inlineList = intoStructure.findAllExpressions(Expressions.InlineData);
|
|
38262
|
+
this.checkCorrespondingInline(intoStructure, inlineList[0], node, input);
|
|
37885
38263
|
if (inlineList.length === 1) {
|
|
37886
38264
|
inline_data_1.InlineData.runSyntax(inlineList[0], input, this.buildStructureType(fields, dbSources, input, from));
|
|
37887
38265
|
}
|
|
@@ -38359,13 +38737,17 @@ class Source {
|
|
|
38359
38737
|
}
|
|
38360
38738
|
const children = node.getChildren().slice();
|
|
38361
38739
|
let first = children.shift();
|
|
38740
|
+
// a leading sign makes the operand part of a calculation, "- foo"
|
|
38741
|
+
let signed = false;
|
|
38362
38742
|
if (first instanceof nodes_1.TokenNode) {
|
|
38363
38743
|
const token = first.getFirstToken();
|
|
38364
38744
|
const tok = token.getStr().toUpperCase();
|
|
38365
38745
|
switch (tok) {
|
|
38366
|
-
case "(":
|
|
38367
38746
|
case "-":
|
|
38368
38747
|
case "+":
|
|
38748
|
+
signed = true;
|
|
38749
|
+
break;
|
|
38750
|
+
case "(":
|
|
38369
38751
|
case "BIT":
|
|
38370
38752
|
break;
|
|
38371
38753
|
case "BOOLC":
|
|
@@ -38558,9 +38940,14 @@ class Source {
|
|
|
38558
38940
|
// an arithmetic operator has been seen, so the operands that follow
|
|
38559
38941
|
// determine a calculation type rather than simply replacing the context
|
|
38560
38942
|
let arithmetic = false;
|
|
38943
|
+
// the expressions of the operand in front of the next arithmetic operator
|
|
38944
|
+
let operand = [];
|
|
38561
38945
|
while (children.length >= 0) {
|
|
38562
38946
|
if (first instanceof nodes_1.ExpressionNode) {
|
|
38563
38947
|
const get = first.get();
|
|
38948
|
+
if (!(get instanceof Expressions.ArithOperator) && !(get instanceof Expressions.Source && arithmetic === true)) {
|
|
38949
|
+
operand.push(first);
|
|
38950
|
+
}
|
|
38564
38951
|
if (get instanceof Expressions.MethodCallChain) {
|
|
38565
38952
|
const predicate = this.predicateCall(node, first, input);
|
|
38566
38953
|
if (predicate !== undefined) {
|
|
@@ -38591,6 +38978,9 @@ class Source {
|
|
|
38591
38978
|
}
|
|
38592
38979
|
else if (get instanceof Expressions.Source) {
|
|
38593
38980
|
const found = Source.runSyntax(first, input);
|
|
38981
|
+
if (arithmetic === true && this.reportReferenceOperand(found, first, input)) {
|
|
38982
|
+
return basic_1.VoidType.get(_syntax_input_1.CheckSyntaxKey);
|
|
38983
|
+
}
|
|
38594
38984
|
context = this.infer(context, found, arithmetic);
|
|
38595
38985
|
}
|
|
38596
38986
|
else if (get instanceof Expressions.Constant) {
|
|
@@ -38609,11 +38999,15 @@ class Source {
|
|
|
38609
38999
|
context = component_chain_1.ComponentChain.runSyntax(context, first, input);
|
|
38610
39000
|
}
|
|
38611
39001
|
else if (get instanceof Expressions.ArithOperator) {
|
|
39002
|
+
const operator = first.concatTokens().toUpperCase();
|
|
39003
|
+
if (!operator.startsWith("BIT-") && this.reportReferenceOperand(context, operand, input)) {
|
|
39004
|
+
return basic_1.VoidType.get(_syntax_input_1.CheckSyntaxKey);
|
|
39005
|
+
}
|
|
39006
|
+
operand = [];
|
|
38612
39007
|
arithmetic = true;
|
|
38613
|
-
if (
|
|
39008
|
+
if (operator === "**") {
|
|
38614
39009
|
context = new basic_1.FloatType();
|
|
38615
39010
|
}
|
|
38616
|
-
const operator = first.concatTokens().toUpperCase();
|
|
38617
39011
|
if (operator === "BIT-OR" || operator === "BIT-AND" || operator === "BIT-XOR") {
|
|
38618
39012
|
hexExpected = true;
|
|
38619
39013
|
hexNext = true;
|
|
@@ -38647,8 +39041,28 @@ class Source {
|
|
|
38647
39041
|
if (node.findDirectTokenByText("&&")) {
|
|
38648
39042
|
return basic_1.StringType.get();
|
|
38649
39043
|
}
|
|
39044
|
+
if (signed === true && arithmetic === false && this.reportReferenceOperand(context, operand, input)) {
|
|
39045
|
+
return basic_1.VoidType.get(_syntax_input_1.CheckSyntaxKey);
|
|
39046
|
+
}
|
|
38650
39047
|
return context;
|
|
38651
39048
|
}
|
|
39049
|
+
static isReference(type) {
|
|
39050
|
+
return type instanceof basic_1.ObjectReferenceType
|
|
39051
|
+
|| type instanceof basic_1.GenericObjectReferenceType
|
|
39052
|
+
|| type instanceof basic_1.DataReference;
|
|
39053
|
+
}
|
|
39054
|
+
/** an operand of an arithmetic calculation is converted into a number, which is not possible for a
|
|
39055
|
+
* data or object reference, "foo - 1"; a dereferenced "foo->* - 1" is fine. Returns true if reported */
|
|
39056
|
+
static reportReferenceOperand(type, operand, input) {
|
|
39057
|
+
const nodes = Array.isArray(operand) ? operand : [operand];
|
|
39058
|
+
if (nodes.length === 0 || this.isReference(type) === false) {
|
|
39059
|
+
return false;
|
|
39060
|
+
}
|
|
39061
|
+
const name = nodes.map(n => n.concatTokens()).join("");
|
|
39062
|
+
const message = `"${name}" is a reference, it cannot be used in a calculation`;
|
|
39063
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, nodes[0].getFirstToken(), message));
|
|
39064
|
+
return true;
|
|
39065
|
+
}
|
|
38652
39066
|
////////////////////////////////
|
|
38653
39067
|
static traverseRemainingChildren(children, input) {
|
|
38654
39068
|
const last = children[children.length - 1];
|
|
@@ -38881,9 +39295,21 @@ Source.logicalArguments = new WeakSet();
|
|
|
38881
39295
|
|
|
38882
39296
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
38883
39297
|
exports.SourceField = void 0;
|
|
39298
|
+
exports.checkMeInStaticMethod = checkMeInStaticMethod;
|
|
38884
39299
|
const basic_1 = __webpack_require__(/*! ../../types/basic */ "./node_modules/@abaplint/core/build/src/abap/types/basic/index.js");
|
|
38885
39300
|
const _reference_1 = __webpack_require__(/*! ../_reference */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_reference.js");
|
|
38886
39301
|
const _syntax_input_1 = __webpack_require__(/*! ../_syntax_input */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_syntax_input.js");
|
|
39302
|
+
const _builtin_1 = __webpack_require__(/*! ../_builtin */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_builtin.js");
|
|
39303
|
+
/** "me" is only available in instance methods, returns true if an issue was added */
|
|
39304
|
+
function checkMeInStaticMethod(found, token, input) {
|
|
39305
|
+
if (found.getName().toLowerCase() === "me"
|
|
39306
|
+
&& found.getFilename() === _builtin_1.BuiltIn.filename
|
|
39307
|
+
&& input.scope.isInStaticMethod() === true) {
|
|
39308
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, token, "\"me\" cannot be used in static methods"));
|
|
39309
|
+
return true;
|
|
39310
|
+
}
|
|
39311
|
+
return false;
|
|
39312
|
+
}
|
|
38887
39313
|
class SourceField {
|
|
38888
39314
|
static runSyntax(node, input, type, error = true) {
|
|
38889
39315
|
const token = node.getFirstToken();
|
|
@@ -38896,6 +39322,9 @@ class SourceField {
|
|
|
38896
39322
|
}
|
|
38897
39323
|
return basic_1.VoidType.get(_syntax_input_1.CheckSyntaxKey);
|
|
38898
39324
|
}
|
|
39325
|
+
else if (checkMeInStaticMethod(found, token, input) === true) {
|
|
39326
|
+
return basic_1.VoidType.get(_syntax_input_1.CheckSyntaxKey);
|
|
39327
|
+
}
|
|
38899
39328
|
if (type) {
|
|
38900
39329
|
input.scope.addReference(token, found, type, input.filename);
|
|
38901
39330
|
}
|
|
@@ -39582,6 +40011,13 @@ class StringTemplate {
|
|
|
39582
40011
|
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, format.getFirstToken(), message));
|
|
39583
40012
|
return basic_1.VoidType.get(_syntax_input_1.CheckSyntaxKey);
|
|
39584
40013
|
}
|
|
40014
|
+
if (format) {
|
|
40015
|
+
const message = this.checkStyleExponent(format, type);
|
|
40016
|
+
if (message) {
|
|
40017
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, format.getFirstToken(), message));
|
|
40018
|
+
return basic_1.VoidType.get(_syntax_input_1.CheckSyntaxKey);
|
|
40019
|
+
}
|
|
40020
|
+
}
|
|
39585
40021
|
}
|
|
39586
40022
|
else if (child instanceof nodes_1.TokenNode) {
|
|
39587
40023
|
const token = child.get();
|
|
@@ -39599,6 +40035,37 @@ class StringTemplate {
|
|
|
39599
40035
|
}
|
|
39600
40036
|
return ret;
|
|
39601
40037
|
}
|
|
40038
|
+
static checkStyleExponent(format, type) {
|
|
40039
|
+
// option name -> the node following "=", only keyword options are direct tokens
|
|
40040
|
+
const children = format.getChildren();
|
|
40041
|
+
const options = {};
|
|
40042
|
+
for (let i = 0; i < children.length - 1; i++) {
|
|
40043
|
+
const c = children[i];
|
|
40044
|
+
if (c instanceof nodes_1.TokenNode && children[i + 1].concatTokens() === "=") {
|
|
40045
|
+
options[c.concatTokens().toUpperCase()] = children[i + 2];
|
|
40046
|
+
}
|
|
40047
|
+
}
|
|
40048
|
+
const style = options["STYLE"];
|
|
40049
|
+
if (style !== undefined && options["SIGN"] !== undefined) {
|
|
40050
|
+
return "STYLE cannot be combined with SIGN";
|
|
40051
|
+
}
|
|
40052
|
+
if (options["EXPONENT"] !== undefined) {
|
|
40053
|
+
if (style instanceof nodes_1.TokenNode && style.concatTokens().toUpperCase() !== "SCIENTIFIC") {
|
|
40054
|
+
return "EXPONENT can only be combined with STYLE = SCIENTIFIC";
|
|
40055
|
+
}
|
|
40056
|
+
if (!(type instanceof basic_1.FloatType)
|
|
40057
|
+
&& !(type instanceof basic_1.DecFloatType)
|
|
40058
|
+
&& !(type instanceof basic_1.DecFloat16Type)
|
|
40059
|
+
&& !(type instanceof basic_1.DecFloat34Type)
|
|
40060
|
+
&& !(type instanceof basic_1.UnknownType)
|
|
40061
|
+
&& !(type instanceof basic_1.VoidType)
|
|
40062
|
+
&& !(type instanceof basic_1.AnyType)
|
|
40063
|
+
&& !(type instanceof basic_1.NumericGenericType)) {
|
|
40064
|
+
return `Cannot apply EXPONENT to this type (${type.constructor.name})`;
|
|
40065
|
+
}
|
|
40066
|
+
}
|
|
40067
|
+
return undefined;
|
|
40068
|
+
}
|
|
39602
40069
|
static validateEscapeSequences(str, input, node) {
|
|
39603
40070
|
// Valid escape sequences in ABAP string templates: \|, \{, \}, \\, \n, \r, \t
|
|
39604
40071
|
const validEscapes = new Set(["\\|", "\\{", "\\}", "\\\\", "\\n", "\\r", "\\t"]);
|
|
@@ -39855,6 +40322,7 @@ const table_expression_1 = __webpack_require__(/*! ./table_expression */ "./node
|
|
|
39855
40322
|
const expressions_1 = __webpack_require__(/*! ../../2_statements/expressions */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js");
|
|
39856
40323
|
const field_length_1 = __webpack_require__(/*! ./field_length */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/field_length.js");
|
|
39857
40324
|
const cast_1 = __webpack_require__(/*! ./cast */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/cast.js");
|
|
40325
|
+
const source_field_1 = __webpack_require__(/*! ./source_field */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/source_field.js");
|
|
39858
40326
|
const _substring_1 = __webpack_require__(/*! ./_substring */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/_substring.js");
|
|
39859
40327
|
const _syntax_input_1 = __webpack_require__(/*! ../_syntax_input */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_syntax_input.js");
|
|
39860
40328
|
const version_1 = __webpack_require__(/*! ../../../version */ "./node_modules/@abaplint/core/build/src/version.js");
|
|
@@ -40009,7 +40477,10 @@ class Target {
|
|
|
40009
40477
|
if (node.get() instanceof Expressions.TargetField
|
|
40010
40478
|
|| node.get() instanceof Expressions.TargetFieldSymbol) {
|
|
40011
40479
|
const found = input.scope.findVariable(name);
|
|
40012
|
-
if (found) {
|
|
40480
|
+
if (found && (0, source_field_1.checkMeInStaticMethod)(found, token, input) === true) {
|
|
40481
|
+
return basic_1.VoidType.get(_syntax_input_1.CheckSyntaxKey);
|
|
40482
|
+
}
|
|
40483
|
+
else if (found) {
|
|
40013
40484
|
input.scope.addReference(token, found, _reference_1.ReferenceType.DataWriteReference, input.filename);
|
|
40014
40485
|
}
|
|
40015
40486
|
if (name.includes("~")) {
|
|
@@ -40365,6 +40836,14 @@ class ValueBody {
|
|
|
40365
40836
|
const message = "VALUE, source type CharacterType not compatible with " + rowType.constructor.name;
|
|
40366
40837
|
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, s.getFirstToken(), message));
|
|
40367
40838
|
}
|
|
40839
|
+
else if (this.isDataObject(s)
|
|
40840
|
+
&& this.numericKind(rowType) !== undefined
|
|
40841
|
+
&& this.numericKind(sourceType) !== undefined
|
|
40842
|
+
&& this.numericKind(rowType) !== this.numericKind(sourceType)) {
|
|
40843
|
+
// a data object given as a row must be compatible with the row type, it is not converted
|
|
40844
|
+
const message = `VALUE, source type ${this.numericKind(sourceType)} not compatible with row type ${this.numericKind(rowType)}`;
|
|
40845
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, s.getFirstToken(), message));
|
|
40846
|
+
}
|
|
40368
40847
|
else if (this.insertsUsingTableKey(targetType)) {
|
|
40369
40848
|
// only STANDARD tables append the rows, and thus allow padding of shorter c and x values
|
|
40370
40849
|
const row = this.characterOrHexLength(rowType);
|
|
@@ -40401,6 +40880,34 @@ class ValueBody {
|
|
|
40401
40880
|
const accessType = targetType.getAccessType();
|
|
40402
40881
|
return accessType === basic_1.TableAccessType.sorted || accessType === basic_1.TableAccessType.hashed;
|
|
40403
40882
|
}
|
|
40883
|
+
/** true for a row given as a single data object, a literal or a variable, not an expression */
|
|
40884
|
+
static isDataObject(source) {
|
|
40885
|
+
const children = source.getChildren();
|
|
40886
|
+
return children.length === 1
|
|
40887
|
+
&& children[0] instanceof nodes_1.ExpressionNode
|
|
40888
|
+
&& (children[0].get() instanceof Expressions.Constant || children[0].get() instanceof Expressions.FieldChain);
|
|
40889
|
+
}
|
|
40890
|
+
static numericKind(type) {
|
|
40891
|
+
if (type instanceof basic_1.IntegerType) {
|
|
40892
|
+
return "i";
|
|
40893
|
+
}
|
|
40894
|
+
else if (type instanceof basic_1.Integer8Type) {
|
|
40895
|
+
return "int8";
|
|
40896
|
+
}
|
|
40897
|
+
else if (type instanceof basic_1.FloatType) {
|
|
40898
|
+
return "f";
|
|
40899
|
+
}
|
|
40900
|
+
else if (type instanceof basic_1.DecFloat16Type) {
|
|
40901
|
+
return "decfloat16";
|
|
40902
|
+
}
|
|
40903
|
+
else if (type instanceof basic_1.DecFloat34Type) {
|
|
40904
|
+
return "decfloat34";
|
|
40905
|
+
}
|
|
40906
|
+
else if (type instanceof basic_1.DecFloatType) {
|
|
40907
|
+
return "decfloat";
|
|
40908
|
+
}
|
|
40909
|
+
return undefined;
|
|
40910
|
+
}
|
|
40404
40911
|
static characterOrHexLength(type) {
|
|
40405
40912
|
if (type instanceof basic_1.CharacterType) {
|
|
40406
40913
|
return { abap: "c", length: type.getLength() };
|
|
@@ -41028,11 +41535,18 @@ const source_1 = __webpack_require__(/*! ../expressions/source */ "./node_module
|
|
|
41028
41535
|
const target_1 = __webpack_require__(/*! ../expressions/target */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/target.js");
|
|
41029
41536
|
class Add {
|
|
41030
41537
|
runSyntax(node, input) {
|
|
41538
|
+
// both operands are converted into numbers, a reference cannot be
|
|
41031
41539
|
for (const s of node.findDirectExpressions(Expressions.Source)) {
|
|
41032
|
-
source_1.Source.runSyntax(s, input);
|
|
41540
|
+
const type = source_1.Source.runSyntax(s, input);
|
|
41541
|
+
if (source_1.Source.reportReferenceOperand(type, s, input)) {
|
|
41542
|
+
return;
|
|
41543
|
+
}
|
|
41033
41544
|
}
|
|
41034
41545
|
for (const t of node.findDirectExpressions(Expressions.Target)) {
|
|
41035
|
-
target_1.Target.runSyntax(t, input);
|
|
41546
|
+
const type = target_1.Target.runSyntax(t, input);
|
|
41547
|
+
if (source_1.Source.reportReferenceOperand(type, t, input)) {
|
|
41548
|
+
return;
|
|
41549
|
+
}
|
|
41036
41550
|
}
|
|
41037
41551
|
}
|
|
41038
41552
|
}
|
|
@@ -42196,12 +42710,9 @@ class Catch {
|
|
|
42196
42710
|
if (token) {
|
|
42197
42711
|
const classNames = Array.from(names);
|
|
42198
42712
|
const unknownClass = classNames.find(name => input.scope.findClassDefinition(name) === undefined);
|
|
42199
|
-
const
|
|
42200
|
-
? this.
|
|
42201
|
-
:
|
|
42202
|
-
const type = commonSuperclass
|
|
42203
|
-
? new basic_1.ObjectReferenceType(commonSuperclass)
|
|
42204
|
-
: basic_1.VoidType.get(unknownClass || classNames.join(" "));
|
|
42713
|
+
const type = unknownClass === undefined
|
|
42714
|
+
? this.inlineType(classNames, input)
|
|
42715
|
+
: basic_1.VoidType.get(unknownClass);
|
|
42205
42716
|
const identifier = new _typed_identifier_1.TypedIdentifier(token, input.filename, type, ["inline" /* IdentifierMeta.InlineDefinition */]);
|
|
42206
42717
|
input.scope.addIdentifier(identifier);
|
|
42207
42718
|
input.scope.addReference(token, identifier, _reference_1.ReferenceType.DataWriteReference, input.filename);
|
|
@@ -42226,21 +42737,35 @@ class Catch {
|
|
|
42226
42737
|
}
|
|
42227
42738
|
}
|
|
42228
42739
|
}
|
|
42229
|
-
|
|
42230
|
-
|
|
42231
|
-
|
|
42232
|
-
|
|
42233
|
-
|
|
42234
|
-
|
|
42235
|
-
|
|
42236
|
-
|
|
42237
|
-
|
|
42238
|
-
|
|
42239
|
-
|
|
42740
|
+
// static type of an inline target: the first class, replaced by each following class that is one of its
|
|
42741
|
+
// super classes; any other following class makes it CX_ROOT, also when the classes share a closer super class
|
|
42742
|
+
inlineType(classNames, input) {
|
|
42743
|
+
let current = input.scope.findClassDefinition(classNames[0]);
|
|
42744
|
+
for (const name of classNames.slice(1)) {
|
|
42745
|
+
if (current === undefined) {
|
|
42746
|
+
break;
|
|
42747
|
+
}
|
|
42748
|
+
const next = input.scope.findClassDefinition(name);
|
|
42749
|
+
current = next && this.isSuperClass(next, current, input) ? next : undefined;
|
|
42750
|
+
}
|
|
42751
|
+
if (current !== undefined) {
|
|
42752
|
+
return new basic_1.ObjectReferenceType(current);
|
|
42753
|
+
}
|
|
42754
|
+
const root = input.scope.findClassDefinition("CX_ROOT");
|
|
42755
|
+
return root ? new basic_1.ObjectReferenceType(root) : basic_1.VoidType.get("CX_ROOT");
|
|
42756
|
+
}
|
|
42757
|
+
isSuperClass(candidate, cls, input) {
|
|
42758
|
+
const name = candidate.getName().toUpperCase();
|
|
42759
|
+
const visited = new Set();
|
|
42760
|
+
let current = cls;
|
|
42761
|
+
while (current && visited.has(current.getName().toUpperCase()) === false) {
|
|
42762
|
+
if (current.getName().toUpperCase() === name) {
|
|
42763
|
+
return true;
|
|
42240
42764
|
}
|
|
42241
|
-
|
|
42765
|
+
visited.add(current.getName().toUpperCase());
|
|
42766
|
+
current = input.scope.findClassDefinition(current.getSuperClass());
|
|
42242
42767
|
}
|
|
42243
|
-
return
|
|
42768
|
+
return false;
|
|
42244
42769
|
}
|
|
42245
42770
|
}
|
|
42246
42771
|
exports.Catch = Catch;
|
|
@@ -42642,9 +43167,17 @@ exports.Clear = void 0;
|
|
|
42642
43167
|
const Expressions = __importStar(__webpack_require__(/*! ../../2_statements/expressions */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js"));
|
|
42643
43168
|
const source_1 = __webpack_require__(/*! ../expressions/source */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/source.js");
|
|
42644
43169
|
const target_1 = __webpack_require__(/*! ../expressions/target */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/target.js");
|
|
43170
|
+
const _syntax_input_1 = __webpack_require__(/*! ../_syntax_input */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_syntax_input.js");
|
|
42645
43171
|
class Clear {
|
|
42646
43172
|
runSyntax(node, input) {
|
|
43173
|
+
var _a;
|
|
42647
43174
|
for (const t of node.findDirectExpressions(Expressions.Target)) {
|
|
43175
|
+
const inline = (_a = t.findDirectExpression(Expressions.InlineData)) !== null && _a !== void 0 ? _a : t.findDirectExpression(Expressions.InlineFS);
|
|
43176
|
+
if (inline) {
|
|
43177
|
+
const message = `Inline declaration "${inline.concatTokens()}" not possible in CLEAR`;
|
|
43178
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, inline.getFirstToken(), message));
|
|
43179
|
+
return;
|
|
43180
|
+
}
|
|
42648
43181
|
target_1.Target.runSyntax(t, input);
|
|
42649
43182
|
}
|
|
42650
43183
|
for (const s of node.findDirectExpressions(Expressions.Source)) {
|
|
@@ -44343,11 +44876,18 @@ const source_1 = __webpack_require__(/*! ../expressions/source */ "./node_module
|
|
|
44343
44876
|
const target_1 = __webpack_require__(/*! ../expressions/target */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/target.js");
|
|
44344
44877
|
class Divide {
|
|
44345
44878
|
runSyntax(node, input) {
|
|
44879
|
+
// both operands are converted into numbers, a reference cannot be
|
|
44346
44880
|
for (const s of node.findDirectExpressions(Expressions.Source)) {
|
|
44347
|
-
source_1.Source.runSyntax(s, input);
|
|
44881
|
+
const type = source_1.Source.runSyntax(s, input);
|
|
44882
|
+
if (source_1.Source.reportReferenceOperand(type, s, input)) {
|
|
44883
|
+
return;
|
|
44884
|
+
}
|
|
44348
44885
|
}
|
|
44349
44886
|
for (const t of node.findDirectExpressions(Expressions.Target)) {
|
|
44350
|
-
target_1.Target.runSyntax(t, input);
|
|
44887
|
+
const type = target_1.Target.runSyntax(t, input);
|
|
44888
|
+
if (source_1.Source.reportReferenceOperand(type, t, input)) {
|
|
44889
|
+
return;
|
|
44890
|
+
}
|
|
44351
44891
|
}
|
|
44352
44892
|
}
|
|
44353
44893
|
}
|
|
@@ -45085,9 +45625,17 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
|
45085
45625
|
exports.Free = void 0;
|
|
45086
45626
|
const Expressions = __importStar(__webpack_require__(/*! ../../2_statements/expressions */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js"));
|
|
45087
45627
|
const target_1 = __webpack_require__(/*! ../expressions/target */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/target.js");
|
|
45628
|
+
const _syntax_input_1 = __webpack_require__(/*! ../_syntax_input */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_syntax_input.js");
|
|
45088
45629
|
class Free {
|
|
45089
45630
|
runSyntax(node, input) {
|
|
45631
|
+
var _a;
|
|
45090
45632
|
for (const t of node.findDirectExpressions(Expressions.Target)) {
|
|
45633
|
+
const inline = (_a = t.findDirectExpression(Expressions.InlineData)) !== null && _a !== void 0 ? _a : t.findDirectExpression(Expressions.InlineFS);
|
|
45634
|
+
if (inline) {
|
|
45635
|
+
const message = `Inline declaration "${inline.concatTokens()}" not possible in FREE`;
|
|
45636
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, inline.getFirstToken(), message));
|
|
45637
|
+
return;
|
|
45638
|
+
}
|
|
45091
45639
|
target_1.Target.runSyntax(t, input);
|
|
45092
45640
|
}
|
|
45093
45641
|
}
|
|
@@ -46992,6 +47540,7 @@ const _object_oriented_1 = __webpack_require__(/*! ../_object_oriented */ "./nod
|
|
|
46992
47540
|
const _builtin_call_1 = __webpack_require__(/*! ../_builtin_call */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_builtin_call.js");
|
|
46993
47541
|
class Message {
|
|
46994
47542
|
runSyntax(node, input) {
|
|
47543
|
+
var _a;
|
|
46995
47544
|
const exceptionName = node.findDirectExpression(Expressions.ExceptionName);
|
|
46996
47545
|
const classicMessage = exceptionName ? new _object_oriented_1.ObjectOriented(input.scope).checkClassicException() : undefined;
|
|
46997
47546
|
if (exceptionName && classicMessage) {
|
|
@@ -47032,6 +47581,63 @@ class Message {
|
|
|
47032
47581
|
for (const s of node.findDirectExpressions(Expressions.MessageSource)) {
|
|
47033
47582
|
message_source_1.MessageSource.runSyntax(s, input);
|
|
47034
47583
|
}
|
|
47584
|
+
const messageTypes = [
|
|
47585
|
+
node.findExpressionAfterToken("TYPE"),
|
|
47586
|
+
node.findExpressionAfterToken("LIKE"),
|
|
47587
|
+
(_a = node.findDirectExpression(Expressions.MessageSource)) === null || _a === void 0 ? void 0 : _a.findExpressionAfterToken("TYPE"),
|
|
47588
|
+
];
|
|
47589
|
+
for (const messageType of messageTypes) {
|
|
47590
|
+
if (messageType !== undefined && this.checkMessageType(messageType, input) === false) {
|
|
47591
|
+
return;
|
|
47592
|
+
}
|
|
47593
|
+
}
|
|
47594
|
+
}
|
|
47595
|
+
// the message type is checked when it is known statically, ie. a literal or a constant
|
|
47596
|
+
checkMessageType(node, input) {
|
|
47597
|
+
const value = this.staticValue(node, input);
|
|
47598
|
+
if (value === undefined || /^[AEISWX]$/i.test(value.trimEnd())) {
|
|
47599
|
+
return true;
|
|
47600
|
+
}
|
|
47601
|
+
const message = `Message type "${value}" is not valid, expected A, E, I, S, W or X`;
|
|
47602
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
|
|
47603
|
+
return false;
|
|
47604
|
+
}
|
|
47605
|
+
staticValue(node, input) {
|
|
47606
|
+
var _a;
|
|
47607
|
+
const literal = this.literalValue(node.concatTokens());
|
|
47608
|
+
if (literal !== undefined) {
|
|
47609
|
+
return literal;
|
|
47610
|
+
}
|
|
47611
|
+
const name = node.concatTokens();
|
|
47612
|
+
if (/^[\w\/]+$/.test(name) === false) {
|
|
47613
|
+
return undefined;
|
|
47614
|
+
}
|
|
47615
|
+
const found = input.scope.findVariable(name);
|
|
47616
|
+
const meta = (_a = found === null || found === void 0 ? void 0 : found.getMeta()) !== null && _a !== void 0 ? _a : [];
|
|
47617
|
+
if (found === undefined
|
|
47618
|
+
|| meta.includes("read_only" /* IdentifierMeta.ReadOnly */) === false
|
|
47619
|
+
|| meta.includes("static" /* IdentifierMeta.Static */) === false) {
|
|
47620
|
+
return undefined;
|
|
47621
|
+
}
|
|
47622
|
+
const value = found.getValue();
|
|
47623
|
+
if (typeof value !== "string") {
|
|
47624
|
+
return undefined;
|
|
47625
|
+
}
|
|
47626
|
+
let constant = this.literalValue(value);
|
|
47627
|
+
const type = found.getType();
|
|
47628
|
+
if (constant !== undefined && type instanceof basic_1.CharacterType) {
|
|
47629
|
+
constant = constant.substring(0, type.getLength());
|
|
47630
|
+
}
|
|
47631
|
+
return constant;
|
|
47632
|
+
}
|
|
47633
|
+
literalValue(code) {
|
|
47634
|
+
if (/^'([^']|'')*'$/.test(code)) {
|
|
47635
|
+
return code.substring(1, code.length - 1).replace(/''/g, "'");
|
|
47636
|
+
}
|
|
47637
|
+
else if (/^`([^`]|``)*`$/.test(code)) {
|
|
47638
|
+
return code.substring(1, code.length - 1).replace(/``/g, "`");
|
|
47639
|
+
}
|
|
47640
|
+
return undefined;
|
|
47035
47641
|
}
|
|
47036
47642
|
}
|
|
47037
47643
|
exports.Message = Message;
|
|
@@ -47754,11 +48360,18 @@ const source_1 = __webpack_require__(/*! ../expressions/source */ "./node_module
|
|
|
47754
48360
|
const target_1 = __webpack_require__(/*! ../expressions/target */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/target.js");
|
|
47755
48361
|
class Multiply {
|
|
47756
48362
|
runSyntax(node, input) {
|
|
48363
|
+
// both operands are converted into numbers, a reference cannot be
|
|
47757
48364
|
for (const s of node.findDirectExpressions(Expressions.Source)) {
|
|
47758
|
-
source_1.Source.runSyntax(s, input);
|
|
48365
|
+
const type = source_1.Source.runSyntax(s, input);
|
|
48366
|
+
if (source_1.Source.reportReferenceOperand(type, s, input)) {
|
|
48367
|
+
return;
|
|
48368
|
+
}
|
|
47759
48369
|
}
|
|
47760
48370
|
for (const t of node.findDirectExpressions(Expressions.Target)) {
|
|
47761
|
-
target_1.Target.runSyntax(t, input);
|
|
48371
|
+
const type = target_1.Target.runSyntax(t, input);
|
|
48372
|
+
if (source_1.Source.reportReferenceOperand(type, t, input)) {
|
|
48373
|
+
return;
|
|
48374
|
+
}
|
|
47762
48375
|
}
|
|
47763
48376
|
}
|
|
47764
48377
|
}
|
|
@@ -49153,15 +49766,71 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
49153
49766
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
49154
49767
|
exports.Replace = void 0;
|
|
49155
49768
|
const Expressions = __importStar(__webpack_require__(/*! ../../2_statements/expressions */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js"));
|
|
49769
|
+
const nodes_1 = __webpack_require__(/*! ../../nodes */ "./node_modules/@abaplint/core/build/src/abap/nodes/index.js");
|
|
49156
49770
|
const source_1 = __webpack_require__(/*! ../expressions/source */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/source.js");
|
|
49157
49771
|
const target_1 = __webpack_require__(/*! ../expressions/target */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/target.js");
|
|
49772
|
+
const _syntax_input_1 = __webpack_require__(/*! ../_syntax_input */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_syntax_input.js");
|
|
49773
|
+
const basic_1 = __webpack_require__(/*! ../../types/basic */ "./node_modules/@abaplint/core/build/src/abap/types/basic/index.js");
|
|
49774
|
+
const _type_utils_1 = __webpack_require__(/*! ../_type_utils */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_type_utils.js");
|
|
49158
49775
|
class Replace {
|
|
49159
49776
|
runSyntax(node, input) {
|
|
49160
|
-
|
|
49161
|
-
|
|
49777
|
+
var _a;
|
|
49778
|
+
const byteMode = node.findDirectTokenByText("BYTE") !== undefined;
|
|
49779
|
+
const regex = (_a = node.findDirectExpression(Expressions.FindType)) === null || _a === void 0 ? void 0 : _a.concatTokens().toUpperCase();
|
|
49780
|
+
const isRegex = regex === "REGEX" || regex === "PCRE";
|
|
49781
|
+
// operands which must be character like, or byte like in BYTE MODE
|
|
49782
|
+
const checks = [];
|
|
49783
|
+
let previous = undefined;
|
|
49784
|
+
let first = true;
|
|
49785
|
+
for (const child of node.getChildren()) {
|
|
49786
|
+
if (child instanceof nodes_1.TokenNode) {
|
|
49787
|
+
previous = child.concatTokens().toUpperCase();
|
|
49788
|
+
continue;
|
|
49789
|
+
}
|
|
49790
|
+
else if (child.get() instanceof Expressions.FindType) {
|
|
49791
|
+
previous = child.concatTokens() === "" ? previous : "FINDTYPE";
|
|
49792
|
+
continue;
|
|
49793
|
+
}
|
|
49794
|
+
if (child.get() instanceof Expressions.Source) {
|
|
49795
|
+
const type = source_1.Source.runSyntax(child, input);
|
|
49796
|
+
if (previous === "WITH"
|
|
49797
|
+
|| (first === true && previous === "REPLACE")
|
|
49798
|
+
|| ((previous === "OF" || previous === "FINDTYPE") && isRegex === false)) {
|
|
49799
|
+
checks.push({ node: child, type, table: false });
|
|
49800
|
+
}
|
|
49801
|
+
}
|
|
49802
|
+
else if (child.get() instanceof Expressions.Target) {
|
|
49803
|
+
const type = target_1.Target.runSyntax(child, input);
|
|
49804
|
+
if (previous === "IN" || previous === "OF" || previous === "INTO") {
|
|
49805
|
+
checks.push({ node: child, type, table: false });
|
|
49806
|
+
}
|
|
49807
|
+
else if (previous === "TABLE") {
|
|
49808
|
+
checks.push({ node: child, type, table: true });
|
|
49809
|
+
}
|
|
49810
|
+
}
|
|
49811
|
+
first = false;
|
|
49162
49812
|
}
|
|
49163
|
-
|
|
49164
|
-
|
|
49813
|
+
const utils = new _type_utils_1.TypeUtils(input.scope);
|
|
49814
|
+
for (const check of checks) {
|
|
49815
|
+
let type = check.type;
|
|
49816
|
+
if (check.table === true) {
|
|
49817
|
+
if (!(type instanceof basic_1.TableType)) {
|
|
49818
|
+
continue;
|
|
49819
|
+
}
|
|
49820
|
+
type = type.getRowType();
|
|
49821
|
+
}
|
|
49822
|
+
if (type === undefined) {
|
|
49823
|
+
continue;
|
|
49824
|
+
}
|
|
49825
|
+
const ok = byteMode ? utils.isHexLike(type) : utils.isCharLikeStrict(type);
|
|
49826
|
+
if (ok === false) {
|
|
49827
|
+
const kind = byteMode ? "byte like" : "character like";
|
|
49828
|
+
const message = check.table === true
|
|
49829
|
+
? "REPLACE, table row type must be " + kind
|
|
49830
|
+
: "REPLACE, \"" + check.node.concatTokens() + "\" must be " + kind;
|
|
49831
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, check.node.getFirstToken(), message));
|
|
49832
|
+
return;
|
|
49833
|
+
}
|
|
49165
49834
|
}
|
|
49166
49835
|
}
|
|
49167
49836
|
}
|
|
@@ -50483,11 +51152,18 @@ const source_1 = __webpack_require__(/*! ../expressions/source */ "./node_module
|
|
|
50483
51152
|
const target_1 = __webpack_require__(/*! ../expressions/target */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/target.js");
|
|
50484
51153
|
class Subtract {
|
|
50485
51154
|
runSyntax(node, input) {
|
|
51155
|
+
// both operands are converted into numbers, a reference cannot be
|
|
50486
51156
|
for (const s of node.findDirectExpressions(Expressions.Source)) {
|
|
50487
|
-
source_1.Source.runSyntax(s, input);
|
|
51157
|
+
const type = source_1.Source.runSyntax(s, input);
|
|
51158
|
+
if (source_1.Source.reportReferenceOperand(type, s, input)) {
|
|
51159
|
+
return;
|
|
51160
|
+
}
|
|
50488
51161
|
}
|
|
50489
51162
|
for (const t of node.findDirectExpressions(Expressions.Target)) {
|
|
50490
|
-
target_1.Target.runSyntax(t, input);
|
|
51163
|
+
const type = target_1.Target.runSyntax(t, input);
|
|
51164
|
+
if (source_1.Source.reportReferenceOperand(type, t, input)) {
|
|
51165
|
+
return;
|
|
51166
|
+
}
|
|
50491
51167
|
}
|
|
50492
51168
|
}
|
|
50493
51169
|
}
|
|
@@ -51007,6 +51683,14 @@ class Type {
|
|
|
51007
51683
|
return new _typed_identifier_1.TypedIdentifier(found.getToken(), input.filename, basic_1.VoidType.get(_syntax_input_1.CheckSyntaxKey));
|
|
51008
51684
|
}
|
|
51009
51685
|
}
|
|
51686
|
+
if (input.scope.isAnyOO()) {
|
|
51687
|
+
const missing = this.lengthMissing(node);
|
|
51688
|
+
if (missing) {
|
|
51689
|
+
const message = "Specify LENGTH in OO context for types c, n, x and p";
|
|
51690
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, missing, message));
|
|
51691
|
+
return new _typed_identifier_1.TypedIdentifier(found.getToken(), input.filename, basic_1.VoidType.get(_syntax_input_1.CheckSyntaxKey));
|
|
51692
|
+
}
|
|
51693
|
+
}
|
|
51010
51694
|
return found;
|
|
51011
51695
|
}
|
|
51012
51696
|
const fallback = node.findFirstExpression(Expressions.NamespaceSimpleName);
|
|
@@ -51015,6 +51699,31 @@ class Type {
|
|
|
51015
51699
|
}
|
|
51016
51700
|
return undefined;
|
|
51017
51701
|
}
|
|
51702
|
+
/** returns the token to report when built-in c, n, x or p is used without a length */
|
|
51703
|
+
lengthMissing(node) {
|
|
51704
|
+
if (node.findDirectExpression(Expressions.Length) !== undefined
|
|
51705
|
+
|| node.findDirectExpression(Expressions.ConstantFieldLength) !== undefined) {
|
|
51706
|
+
return undefined;
|
|
51707
|
+
}
|
|
51708
|
+
const type = node.findDirectExpression(Expressions.Type);
|
|
51709
|
+
if (type === undefined) {
|
|
51710
|
+
// "TYPES foo." is implicitly type c with length 1
|
|
51711
|
+
const onlyName = node.getChildren().every(c => c.get() instanceof Expressions.NamespaceSimpleName
|
|
51712
|
+
|| ["TYPES", "BOXED", ".", ","].includes(c.concatTokens().toUpperCase()));
|
|
51713
|
+
return onlyName ? node.getFirstToken() : undefined;
|
|
51714
|
+
}
|
|
51715
|
+
const children = type.getChildren();
|
|
51716
|
+
if (children.length !== 2
|
|
51717
|
+
|| children[0].concatTokens().toUpperCase() !== "TYPE"
|
|
51718
|
+
|| !(children[1].get() instanceof Expressions.TypeName)) {
|
|
51719
|
+
return undefined;
|
|
51720
|
+
}
|
|
51721
|
+
const name = children[1].concatTokens().toUpperCase();
|
|
51722
|
+
if (["C", "N", "X", "P"].includes(name)) {
|
|
51723
|
+
return children[1].getFirstToken();
|
|
51724
|
+
}
|
|
51725
|
+
return undefined;
|
|
51726
|
+
}
|
|
51018
51727
|
}
|
|
51019
51728
|
exports.Type = Type;
|
|
51020
51729
|
//# sourceMappingURL=type.js.map
|
|
@@ -52384,7 +53093,8 @@ const Statements = __importStar(__webpack_require__(/*! ../../2_statements/state
|
|
|
52384
53093
|
const Structures = __importStar(__webpack_require__(/*! ../../3_structures/structures */ "./node_modules/@abaplint/core/build/src/abap/3_structures/structures/index.js"));
|
|
52385
53094
|
const _syntax_input_1 = __webpack_require__(/*! ../_syntax_input */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_syntax_input.js");
|
|
52386
53095
|
// "special exceptions must be caught before general exceptions", a CATCH of a class that inherits
|
|
52387
|
-
// from a class named in an earlier CATCH
|
|
53096
|
+
// from a class named before it in the same TRY, in an earlier CATCH or earlier in the same CATCH, is never reached,
|
|
53097
|
+
// this is a syntax error
|
|
52388
53098
|
// only reported when the lineage of the later class is known up to the earlier class, void classes are skipped
|
|
52389
53099
|
class Try {
|
|
52390
53100
|
static runSyntax(node, input) {
|
|
@@ -52394,23 +53104,17 @@ class Try {
|
|
|
52394
53104
|
if (statement === undefined) {
|
|
52395
53105
|
continue;
|
|
52396
53106
|
}
|
|
52397
|
-
|
|
53107
|
+
// each class counts as caught right after it, also for the next classes of the same CATCH statement
|
|
52398
53108
|
for (const c of statement.findDirectExpressions(Expressions.ClassName)) {
|
|
52399
53109
|
const token = c.getFirstToken();
|
|
52400
53110
|
const className = token.getStr().toUpperCase();
|
|
52401
|
-
|
|
52402
|
-
if (caught.size === 0) {
|
|
52403
|
-
continue;
|
|
52404
|
-
}
|
|
52405
|
-
const superclass = this.findCaughtSuperclass(className, caught, input);
|
|
53111
|
+
const superclass = caught.size === 0 ? undefined : this.findCaughtSuperclass(className, caught, input);
|
|
52406
53112
|
if (superclass !== undefined) {
|
|
52407
53113
|
const message = `CATCH of ${className} after the CATCH of its superclass ${superclass}`;
|
|
52408
53114
|
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, token, message));
|
|
52409
53115
|
return;
|
|
52410
53116
|
}
|
|
52411
|
-
|
|
52412
|
-
for (const name of names) {
|
|
52413
|
-
caught.add(name);
|
|
53117
|
+
caught.add(className);
|
|
52414
53118
|
}
|
|
52415
53119
|
}
|
|
52416
53120
|
}
|
|
@@ -54921,6 +55625,35 @@ exports.TokenNodeRegex = TokenNodeRegex;
|
|
|
54921
55625
|
|
|
54922
55626
|
/***/ },
|
|
54923
55627
|
|
|
55628
|
+
/***/ "./node_modules/@abaplint/core/build/src/abap/types/_alias_conflicts.js"
|
|
55629
|
+
/*!******************************************************************************!*\
|
|
55630
|
+
!*** ./node_modules/@abaplint/core/build/src/abap/types/_alias_conflicts.js ***!
|
|
55631
|
+
\******************************************************************************/
|
|
55632
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
55633
|
+
|
|
55634
|
+
"use strict";
|
|
55635
|
+
|
|
55636
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
55637
|
+
exports.checkAliasNameConflicts = checkAliasNameConflicts;
|
|
55638
|
+
const _syntax_input_1 = __webpack_require__(/*! ../5_syntax/_syntax_input */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_syntax_input.js");
|
|
55639
|
+
/** an alias cannot have the name of a method, attribute or type of the same class or interface,
|
|
55640
|
+
* reported at the later of the two declarations */
|
|
55641
|
+
function checkAliasNameConflicts(input, aliases, methods, attributes, types) {
|
|
55642
|
+
var _a, _b;
|
|
55643
|
+
for (const alias of aliases) {
|
|
55644
|
+
const name = alias.getName();
|
|
55645
|
+
const other = (_b = (_a = methods.getByName(name)) !== null && _a !== void 0 ? _a : attributes.findByName(name)) !== null && _b !== void 0 ? _b : types.getByName(name);
|
|
55646
|
+
if (other === undefined || other.getFilename() !== alias.getFilename()) {
|
|
55647
|
+
continue;
|
|
55648
|
+
}
|
|
55649
|
+
const later = other.getStart().isAfter(alias.getStart()) ? other : alias;
|
|
55650
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, later.getToken(), `"${name}" already defined, ALIASES`));
|
|
55651
|
+
}
|
|
55652
|
+
}
|
|
55653
|
+
//# sourceMappingURL=_alias_conflicts.js.map
|
|
55654
|
+
|
|
55655
|
+
/***/ },
|
|
55656
|
+
|
|
54924
55657
|
/***/ "./node_modules/@abaplint/core/build/src/abap/types/_typed_identifier.js"
|
|
54925
55658
|
/*!*******************************************************************************!*\
|
|
54926
55659
|
!*** ./node_modules/@abaplint/core/build/src/abap/types/_typed_identifier.js ***!
|
|
@@ -57044,6 +57777,7 @@ const visibility_1 = __webpack_require__(/*! ../4_file_information/visibility */
|
|
|
57044
57777
|
const _object_oriented_1 = __webpack_require__(/*! ../5_syntax/_object_oriented */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_object_oriented.js");
|
|
57045
57778
|
const _reference_1 = __webpack_require__(/*! ../5_syntax/_reference */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_reference.js");
|
|
57046
57779
|
const _syntax_input_1 = __webpack_require__(/*! ../5_syntax/_syntax_input */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_syntax_input.js");
|
|
57780
|
+
const _alias_conflicts_1 = __webpack_require__(/*! ./_alias_conflicts */ "./node_modules/@abaplint/core/build/src/abap/types/_alias_conflicts.js");
|
|
57047
57781
|
class ClassDefinition extends _identifier_1.Identifier {
|
|
57048
57782
|
constructor(node, input) {
|
|
57049
57783
|
var _a;
|
|
@@ -57095,11 +57829,13 @@ class ClassDefinition extends _identifier_1.Identifier {
|
|
|
57095
57829
|
this.checkInterfaceVisibility(input, node);
|
|
57096
57830
|
this.checkMethodsFromSuperClasses(input);
|
|
57097
57831
|
this.checkMethodNameConflicts(input);
|
|
57832
|
+
(0, _alias_conflicts_1.checkAliasNameConflicts)(input, this.aliases, this.methodDefs, this.attributes, this.types);
|
|
57098
57833
|
this.checkEventNameConflicts(input);
|
|
57099
57834
|
this.checkClassNameLength(input);
|
|
57100
57835
|
this.checkMethodNameLength(input);
|
|
57101
57836
|
this.checkClassConstructor(input);
|
|
57102
57837
|
this.checkLocalTypesInPublicSections(input, node, scope.getTop());
|
|
57838
|
+
this.checkTestMethodsInTestClass(input, node);
|
|
57103
57839
|
}
|
|
57104
57840
|
getFriends() {
|
|
57105
57841
|
return this.friends;
|
|
@@ -57154,6 +57890,41 @@ class ClassDefinition extends _identifier_1.Identifier {
|
|
|
57154
57890
|
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, this.getToken(), message));
|
|
57155
57891
|
}
|
|
57156
57892
|
}
|
|
57893
|
+
checkTestMethodsInTestClass(input, node) {
|
|
57894
|
+
var _a;
|
|
57895
|
+
if (this.isTestClass(input)) {
|
|
57896
|
+
return;
|
|
57897
|
+
}
|
|
57898
|
+
for (const m of node.findAllStatements(Statements.MethodDef)) {
|
|
57899
|
+
if (m.concatTokens().toUpperCase().includes(" FOR TESTING") === false) {
|
|
57900
|
+
continue;
|
|
57901
|
+
}
|
|
57902
|
+
const name = (_a = m.findDirectExpression(Expressions.MethodName)) === null || _a === void 0 ? void 0 : _a.getFirstToken();
|
|
57903
|
+
const message = `Test method "${name === null || name === void 0 ? void 0 : name.getStr()}" can only be defined in a test class, FOR TESTING`;
|
|
57904
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, name !== null && name !== void 0 ? name : m.getFirstToken(), message));
|
|
57905
|
+
}
|
|
57906
|
+
}
|
|
57907
|
+
/** the class or one of its super classes is defined FOR TESTING */
|
|
57908
|
+
isTestClass(input) {
|
|
57909
|
+
if (this.testing === true) {
|
|
57910
|
+
return true;
|
|
57911
|
+
}
|
|
57912
|
+
const visited = new Set();
|
|
57913
|
+
let sup = this.superClass;
|
|
57914
|
+
while (sup !== undefined && visited.has(sup.toUpperCase()) === false) {
|
|
57915
|
+
visited.add(sup.toUpperCase());
|
|
57916
|
+
const def = input.scope.findClassDefinition(sup);
|
|
57917
|
+
if (def === undefined) {
|
|
57918
|
+
// void or unknown super class, cannot tell
|
|
57919
|
+
return true;
|
|
57920
|
+
}
|
|
57921
|
+
else if (def.isForTesting()) {
|
|
57922
|
+
return true;
|
|
57923
|
+
}
|
|
57924
|
+
sup = def.getSuperClass();
|
|
57925
|
+
}
|
|
57926
|
+
return false;
|
|
57927
|
+
}
|
|
57157
57928
|
// the local types, classes and interfaces of a class pool can only be used in the PRIVATE SECTION of the global class
|
|
57158
57929
|
checkLocalTypesInPublicSections(input, node, scope) {
|
|
57159
57930
|
if (this.globalValue === false || input.filename.toLowerCase().endsWith(".clas.abap") === false) {
|
|
@@ -57209,8 +57980,48 @@ class ClassDefinition extends _identifier_1.Identifier {
|
|
|
57209
57980
|
const token = (_a = def === null || def === void 0 ? void 0 : def.findDirectExpression(expressions_1.SuperClassName)) === null || _a === void 0 ? void 0 : _a.getFirstToken();
|
|
57210
57981
|
this.addReference(token, input);
|
|
57211
57982
|
const name = token === null || token === void 0 ? void 0 : token.getStr();
|
|
57983
|
+
if (token === undefined || name === undefined) {
|
|
57984
|
+
return undefined;
|
|
57985
|
+
}
|
|
57986
|
+
const cycle = this.findInheritanceCycle(name, input);
|
|
57987
|
+
if (cycle !== undefined) {
|
|
57988
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, token, "Cyclic inheritance: " + cycle.join(" -> ")));
|
|
57989
|
+
// the class is kept without super class, so nothing walking the super classes loops
|
|
57990
|
+
return undefined;
|
|
57991
|
+
}
|
|
57212
57992
|
return name;
|
|
57213
57993
|
}
|
|
57994
|
+
/** returns the class names of the cycle when the super class chain leads back to this class */
|
|
57995
|
+
findInheritanceCycle(superName, input) {
|
|
57996
|
+
var _a;
|
|
57997
|
+
const own = this.getName().toUpperCase();
|
|
57998
|
+
const chain = [own];
|
|
57999
|
+
let current = superName.toUpperCase();
|
|
58000
|
+
while (current !== undefined) {
|
|
58001
|
+
chain.push(current);
|
|
58002
|
+
if (current === own) {
|
|
58003
|
+
return chain;
|
|
58004
|
+
}
|
|
58005
|
+
else if (chain.indexOf(current) < chain.length - 1) {
|
|
58006
|
+
// a cycle not involving this class, reported for the classes in it
|
|
58007
|
+
return undefined;
|
|
58008
|
+
}
|
|
58009
|
+
current = (_a = this.findSuperName(current, input)) === null || _a === void 0 ? void 0 : _a.toUpperCase();
|
|
58010
|
+
}
|
|
58011
|
+
return undefined;
|
|
58012
|
+
}
|
|
58013
|
+
findSuperName(name, input) {
|
|
58014
|
+
var _a;
|
|
58015
|
+
var _b;
|
|
58016
|
+
const found = input.scope.findClassDefinition(name);
|
|
58017
|
+
if (found !== undefined && found.isGlobal() === false) {
|
|
58018
|
+
return found.getSuperClass();
|
|
58019
|
+
}
|
|
58020
|
+
// global classes are followed via the file information, their definition is not
|
|
58021
|
+
// available yet or has its super class removed when they are part of a cycle
|
|
58022
|
+
const clas = input.scope.getRegistry().getObject("CLAS", name);
|
|
58023
|
+
return (_b = (_a = clas === null || clas === void 0 ? void 0 : clas.getClassDefinition()) === null || _a === void 0 ? void 0 : _a.superClassName) !== null && _b !== void 0 ? _b : found === null || found === void 0 ? void 0 : found.getSuperClass();
|
|
58024
|
+
}
|
|
57214
58025
|
checkMethodNameLength(input) {
|
|
57215
58026
|
for (const m of this.methodDefs.getAll()) {
|
|
57216
58027
|
if (m.getName().length > 30 && m.getName().includes("~") === false) {
|
|
@@ -57898,6 +58709,7 @@ const method_definitions_1 = __webpack_require__(/*! ./method_definitions */ "./
|
|
|
57898
58709
|
const _reference_1 = __webpack_require__(/*! ../5_syntax/_reference */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_reference.js");
|
|
57899
58710
|
const _syntax_input_1 = __webpack_require__(/*! ../5_syntax/_syntax_input */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_syntax_input.js");
|
|
57900
58711
|
const _object_oriented_1 = __webpack_require__(/*! ../5_syntax/_object_oriented */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_object_oriented.js");
|
|
58712
|
+
const _alias_conflicts_1 = __webpack_require__(/*! ./_alias_conflicts */ "./node_modules/@abaplint/core/build/src/abap/types/_alias_conflicts.js");
|
|
57901
58713
|
class InterfaceDefinition extends _identifier_1.Identifier {
|
|
57902
58714
|
constructor(node, input) {
|
|
57903
58715
|
if (!(node.get() instanceof Structures.Interface)) {
|
|
@@ -57914,6 +58726,7 @@ class InterfaceDefinition extends _identifier_1.Identifier {
|
|
|
57914
58726
|
input.scope.pop(node.getLastToken().getEnd());
|
|
57915
58727
|
// perform checks after everything has been initialized
|
|
57916
58728
|
this.checkMethodNameLength(input);
|
|
58729
|
+
(0, _alias_conflicts_1.checkAliasNameConflicts)(input, this.aliases, this.methodDefinitions, this.attributes, this.typeDefinitions);
|
|
57917
58730
|
}
|
|
57918
58731
|
getSuperClass() {
|
|
57919
58732
|
return undefined;
|
|
@@ -58477,7 +59290,6 @@ class MethodParameters {
|
|
|
58477
59290
|
try {
|
|
58478
59291
|
this.parse(node, input, parentName, abstractMethod);
|
|
58479
59292
|
this.checkNameLengths(input);
|
|
58480
|
-
this.checkDuplicateNames();
|
|
58481
59293
|
}
|
|
58482
59294
|
finally {
|
|
58483
59295
|
input.scope.pop(node.getEnd());
|
|
@@ -58614,19 +59426,21 @@ class MethodParameters {
|
|
|
58614
59426
|
}
|
|
58615
59427
|
const returning = node.findFirstExpression(Expressions.MethodDefReturning);
|
|
58616
59428
|
if (returning) {
|
|
58617
|
-
|
|
59429
|
+
const id = method_def_returning_1.MethodDefReturning.runSyntax(returning, input, ["returning" /* IdentifierMeta.MethodReturning */]);
|
|
59430
|
+
if (this.isDuplicateName(id, input) === false) {
|
|
59431
|
+
this.returning = id;
|
|
59432
|
+
}
|
|
58618
59433
|
}
|
|
58619
59434
|
this.workaroundRAP(node, input, parentName);
|
|
58620
59435
|
}
|
|
58621
|
-
|
|
58622
|
-
|
|
58623
|
-
|
|
58624
|
-
|
|
58625
|
-
|
|
58626
|
-
|
|
58627
|
-
}
|
|
58628
|
-
names.add(name);
|
|
59436
|
+
/** reports a parameter with the name of an earlier one, the method definition is kept without it */
|
|
59437
|
+
isDuplicateName(id, input) {
|
|
59438
|
+
const name = id.getName().toUpperCase();
|
|
59439
|
+
if (this.getAll().some(p => p.getName().toUpperCase() === name)) {
|
|
59440
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, id.getToken(), `Method parameter "${name}" already defined`));
|
|
59441
|
+
return true;
|
|
58629
59442
|
}
|
|
59443
|
+
return false;
|
|
58630
59444
|
}
|
|
58631
59445
|
checkNameLengths(input) {
|
|
58632
59446
|
for (const parameter of this.getAll()) {
|
|
@@ -58702,7 +59516,8 @@ class MethodParameters {
|
|
|
58702
59516
|
add(target, source, input, meta, abstractMethod) {
|
|
58703
59517
|
var _a;
|
|
58704
59518
|
this.checkKeywordNames(source, input);
|
|
58705
|
-
|
|
59519
|
+
const optionals = source.findAllExpressions(Expressions.MethodParamOptional);
|
|
59520
|
+
for (const opt of optionals) {
|
|
58706
59521
|
const p = opt.findDirectExpression(Expressions.MethodParam);
|
|
58707
59522
|
if (p === undefined) {
|
|
58708
59523
|
continue;
|
|
@@ -58718,6 +59533,9 @@ class MethodParameters {
|
|
|
58718
59533
|
extraMeta.push("abstract" /* IdentifierMeta.Abstract */);
|
|
58719
59534
|
}
|
|
58720
59535
|
const id = method_param_1.MethodParam.runSyntax(p, input, [...meta, ...extraMeta]);
|
|
59536
|
+
if (this.isDuplicateName(id, input)) {
|
|
59537
|
+
continue;
|
|
59538
|
+
}
|
|
58721
59539
|
input.scope.addIdentifier(id);
|
|
58722
59540
|
target.push(id);
|
|
58723
59541
|
const optionalToken = opt.findDirectTokenByText("OPTIONAL");
|
|
@@ -58738,13 +59556,16 @@ class MethodParameters {
|
|
|
58738
59556
|
}
|
|
58739
59557
|
}
|
|
58740
59558
|
}
|
|
58741
|
-
if (
|
|
59559
|
+
if (optionals.length > 0) {
|
|
58742
59560
|
return;
|
|
58743
59561
|
}
|
|
58744
59562
|
const params = source.findAllExpressions(Expressions.MethodParam);
|
|
58745
59563
|
for (const param of params) {
|
|
58746
59564
|
const extraMeta = this.isPassByValue(param) ? ["pass_by_value" /* IdentifierMeta.PassByValue */] : [];
|
|
58747
|
-
|
|
59565
|
+
const id = method_param_1.MethodParam.runSyntax(param, input, [...meta, ...extraMeta]);
|
|
59566
|
+
if (this.isDuplicateName(id, input) === false) {
|
|
59567
|
+
target.push(id);
|
|
59568
|
+
}
|
|
58748
59569
|
}
|
|
58749
59570
|
}
|
|
58750
59571
|
// A system reads a plain parameter name as a keyword wherever that keyword can stand, measured on 758:
|
|
@@ -75936,7 +76757,7 @@ class Registry {
|
|
|
75936
76757
|
}
|
|
75937
76758
|
static abaplintVersion() {
|
|
75938
76759
|
// magic, see build script "version.js"
|
|
75939
|
-
return "2.120.
|
|
76760
|
+
return "2.120.116";
|
|
75940
76761
|
}
|
|
75941
76762
|
getDDICReferences() {
|
|
75942
76763
|
return this.ddicReferences;
|
|
@@ -88859,14 +89680,12 @@ Make sure to test the downported code, it might not always be completely correct
|
|
|
88859
89680
|
if (from === undefined) {
|
|
88860
89681
|
return undefined;
|
|
88861
89682
|
}
|
|
88862
|
-
// UP TO after INTO is
|
|
89683
|
+
// UP TO after INTO is not valid behind WHERE or ORDER BY, move it along in front of INTO
|
|
88863
89684
|
let move = into.concatTokens();
|
|
88864
89685
|
const fixes = [];
|
|
88865
89686
|
const upTo = high.findFirstExpression(Expressions.SQLUpTo);
|
|
88866
|
-
const orderBy = high.findFirstExpression(Expressions.SQLOrderBy);
|
|
88867
89687
|
if (upTo !== undefined
|
|
88868
|
-
&& into.getLastToken().getEnd().isBefore(upTo.getFirstToken().getStart())
|
|
88869
|
-
&& (orderBy === undefined || upTo.getFirstToken().getStart().isBefore(orderBy.getFirstToken().getStart()))) {
|
|
89688
|
+
&& into.getLastToken().getEnd().isBefore(upTo.getFirstToken().getStart())) {
|
|
88870
89689
|
move = upTo.concatTokens() + ` ` + move;
|
|
88871
89690
|
fixes.push(edit_helper_1.EditHelper.deleteRange(lowFile, upTo.getFirstToken().getStart(), upTo.getLastToken().getEnd()));
|
|
88872
89691
|
}
|
|
@@ -89630,7 +90449,7 @@ ${indentation}`);
|
|
|
89630
90449
|
|| !(targetType instanceof basic_1.TableType)
|
|
89631
90450
|
|| sourceType.isWithHeader() === true
|
|
89632
90451
|
|| targetType.isWithHeader() === true
|
|
89633
|
-
|| (
|
|
90452
|
+
|| (this.concreteAccessType(targetType) !== basic_1.TableAccessType.standard && this.concreteAccessType(targetType) !== undefined)) {
|
|
89634
90453
|
return undefined;
|
|
89635
90454
|
}
|
|
89636
90455
|
for (const t of [sourceType, targetType]) {
|
|
@@ -89642,7 +90461,7 @@ ${indentation}`);
|
|
|
89642
90461
|
const fsType = (name, type) => type.isGeneric() ? "TYPE any" : "LIKE LINE OF " + name;
|
|
89643
90462
|
const sourceFS = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax, true);
|
|
89644
90463
|
const targetFS = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax, true);
|
|
89645
|
-
const addRow =
|
|
90464
|
+
const addRow = this.concreteAccessType(targetType) === undefined
|
|
89646
90465
|
? `INSERT INITIAL LINE INTO TABLE ${targetName}`
|
|
89647
90466
|
: `APPEND INITIAL LINE TO ${targetName}`;
|
|
89648
90467
|
const indentation = " ".repeat(high.getFirstToken().getStart().getCol() - 1);
|
|
@@ -91576,6 +92395,10 @@ ${indentation} output = ${uniqueName}.\n`;
|
|
|
91576
92395
|
}
|
|
91577
92396
|
return undefined;
|
|
91578
92397
|
}
|
|
92398
|
+
/** the table kind of a table with a known line type, undefined for generic tables such as TYPE STANDARD TABLE */
|
|
92399
|
+
concreteAccessType(type) {
|
|
92400
|
+
return type.getRowType() instanceof basic_1.AnyType ? undefined : type.getAccessType();
|
|
92401
|
+
}
|
|
91579
92402
|
/** a FIELD-SYMBOLS declaration is known to the scope under its bracketed spelling, so
|
|
91580
92403
|
* the collision check has to use that spelling too - otherwise a second outline in the
|
|
91581
92404
|
* same method is handed a name that is already taken and the result does not compile */
|
|
@@ -96509,6 +97332,8 @@ class ImplementMethods extends _abap_rule_1.ABAPRule {
|
|
|
96509
97332
|
}
|
|
96510
97333
|
checkInterfaces(def, impl) {
|
|
96511
97334
|
const ret = [];
|
|
97335
|
+
// an interface can be reached via several implemented interfaces, check each method once
|
|
97336
|
+
const checked = new Set();
|
|
96512
97337
|
for (const interfaceInfo of def.interfaces) {
|
|
96513
97338
|
const idef = this.findInterface(def.identifier, interfaceInfo.name);
|
|
96514
97339
|
if (idef === undefined || interfaceInfo.partial === true || interfaceInfo.allAbstract === true) {
|
|
@@ -96518,6 +97343,11 @@ class ImplementMethods extends _abap_rule_1.ABAPRule {
|
|
|
96518
97343
|
return [idef];
|
|
96519
97344
|
}
|
|
96520
97345
|
for (const m of this.findInterfaceMethods(idef)) {
|
|
97346
|
+
const key = (m.objectName + "~" + m.method.name).toUpperCase();
|
|
97347
|
+
if (checked.has(key)) {
|
|
97348
|
+
continue;
|
|
97349
|
+
}
|
|
97350
|
+
checked.add(key);
|
|
96521
97351
|
if (m.method.isDefaultIgnore === true || m.method.isDefaultFail === true) {
|
|
96522
97352
|
// the interface says an implementation is optional, so asking for one
|
|
96523
97353
|
// reports an error where ABAP reports none
|
|
@@ -96577,12 +97407,11 @@ class ImplementMethods extends _abap_rule_1.ABAPRule {
|
|
|
96577
97407
|
const name = m.objectName + "~" + m.method.name;
|
|
96578
97408
|
let found = impl.methods.find(m => m.getName().toUpperCase() === name.toUpperCase());
|
|
96579
97409
|
if (found === undefined) {
|
|
96580
|
-
// try looking for ALIASes
|
|
96581
|
-
|
|
96582
|
-
|
|
96583
|
-
|
|
96584
|
-
|
|
96585
|
-
}
|
|
97410
|
+
// try looking for ALIASes, also the ones inherited from super classes,
|
|
97411
|
+
// "METHODS alias_name REDEFINITION" implements the method through an alias of the super class
|
|
97412
|
+
const alias = this.findAlias(def, name);
|
|
97413
|
+
if (alias !== undefined) {
|
|
97414
|
+
found = impl.methods.find(m => m.getName().toUpperCase() === alias.toUpperCase());
|
|
96586
97415
|
}
|
|
96587
97416
|
}
|
|
96588
97417
|
if (found === undefined && def.superClassName !== undefined) {
|
|
@@ -96605,6 +97434,21 @@ class ImplementMethods extends _abap_rule_1.ABAPRule {
|
|
|
96605
97434
|
}
|
|
96606
97435
|
return found !== undefined;
|
|
96607
97436
|
}
|
|
97437
|
+
/** name of the alias for the component, in the class or in one of its super classes */
|
|
97438
|
+
findAlias(def, component) {
|
|
97439
|
+
var _a;
|
|
97440
|
+
const visited = new Set();
|
|
97441
|
+
let current = def;
|
|
97442
|
+
while (current !== undefined && !visited.has(current.name.toUpperCase())) {
|
|
97443
|
+
visited.add(current.name.toUpperCase());
|
|
97444
|
+
const alias = current.aliases.find(a => a.component.toUpperCase() === component.toUpperCase());
|
|
97445
|
+
if (alias !== undefined) {
|
|
97446
|
+
return alias.name;
|
|
97447
|
+
}
|
|
97448
|
+
current = current.superClassName ? (_a = this.findClass(current.superClassName)) === null || _a === void 0 ? void 0 : _a.def : undefined;
|
|
97449
|
+
}
|
|
97450
|
+
return undefined;
|
|
97451
|
+
}
|
|
96608
97452
|
viaAliasInInterface(m, intf, impl) {
|
|
96609
97453
|
for (const a of intf.aliases) {
|
|
96610
97454
|
if (a.component.toUpperCase() === m.objectName.toUpperCase() + "~" + m.method.name.toUpperCase()) {
|
|
@@ -105647,15 +106491,25 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
105647
106491
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
105648
106492
|
exports.ParserMissingSpace = exports.ParserMissingSpaceConf = void 0;
|
|
105649
106493
|
const Expressions = __importStar(__webpack_require__(/*! ../abap/2_statements/expressions */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js"));
|
|
106494
|
+
const Tokens = __importStar(__webpack_require__(/*! ../abap/1_lexer/tokens */ "./node_modules/@abaplint/core/build/src/abap/1_lexer/tokens/index.js"));
|
|
105650
106495
|
const issue_1 = __webpack_require__(/*! ../issue */ "./node_modules/@abaplint/core/build/src/issue.js");
|
|
105651
106496
|
const _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ "./node_modules/@abaplint/core/build/src/rules/_abap_rule.js");
|
|
105652
106497
|
const nodes_1 = __webpack_require__(/*! ../abap/nodes */ "./node_modules/@abaplint/core/build/src/abap/nodes/index.js");
|
|
105653
106498
|
const _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ "./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js");
|
|
105654
106499
|
const _irule_1 = __webpack_require__(/*! ./_irule */ "./node_modules/@abaplint/core/build/src/rules/_irule.js");
|
|
105655
|
-
// todo: this rule needs refactoring
|
|
105656
106500
|
class ParserMissingSpaceConf extends _basic_rule_config_1.BasicRuleConfig {
|
|
105657
106501
|
}
|
|
105658
106502
|
exports.ParserMissingSpaceConf = ParserMissingSpaceConf;
|
|
106503
|
+
/*
|
|
106504
|
+
* The lexer records whitespace around parentheses in the token type, eg. "WParenLeft" is a "(" with whitespace
|
|
106505
|
+
* before but not after. In the expressions below the grammar also accepts the variants without inner whitespace,
|
|
106506
|
+
* this rule reports them. Elsewhere the grammar is strict, and missing whitespace gives a parser error instead.
|
|
106507
|
+
* Matched on the constructor, none of these expressions is subclassed.
|
|
106508
|
+
*/
|
|
106509
|
+
const PAREN_EXPRESSIONS = new Set([
|
|
106510
|
+
Expressions.MethodCallParam, Expressions.CondSub, Expressions.ComponentCondSub, Expressions.SQLCond,
|
|
106511
|
+
Expressions.ValueBodyLine, Expressions.NewObject, Expressions.Source
|
|
106512
|
+
]);
|
|
105659
106513
|
class ParserMissingSpace extends _abap_rule_1.ABAPRule {
|
|
105660
106514
|
constructor() {
|
|
105661
106515
|
super(...arguments);
|
|
@@ -105680,261 +106534,104 @@ This rule makes sure the spaces are consistently required across the language.`,
|
|
|
105680
106534
|
}
|
|
105681
106535
|
runParsed(file) {
|
|
105682
106536
|
const issues = [];
|
|
105683
|
-
|
|
106537
|
+
const message = "Missing space between string or character literal and parentheses";
|
|
105684
106538
|
for (const statement of file.getStatements()) {
|
|
105685
106539
|
const missing = this.missingSpace(statement);
|
|
105686
106540
|
if (missing) {
|
|
105687
|
-
|
|
105688
|
-
start = missing;
|
|
105689
|
-
const issue = issue_1.Issue.atPosition(file, start, message, this.getMetadata().key, this.conf.severity);
|
|
105690
|
-
issues.push(issue);
|
|
106541
|
+
issues.push(issue_1.Issue.atPosition(file, missing, message, this.getMetadata().key, this.conf.severity));
|
|
105691
106542
|
}
|
|
105692
106543
|
}
|
|
105693
106544
|
return issues;
|
|
105694
106545
|
}
|
|
106546
|
+
/** returns the position of the first missing space in the statement, the rule reports one issue per statement */
|
|
105695
106547
|
missingSpace(statement) {
|
|
105696
|
-
{
|
|
105697
|
-
|
|
105698
|
-
|
|
105699
|
-
const prev = tokens[i - 1];
|
|
105700
|
-
const current = tokens[i];
|
|
105701
|
-
if (prev.getStr() === ")"
|
|
105702
|
-
&& current.getStr() === "="
|
|
105703
|
-
&& prev.getRow() === current.getRow()
|
|
105704
|
-
&& prev.getEnd().getCol() === current.getStart().getCol()) {
|
|
105705
|
-
return current.getStart();
|
|
105706
|
-
}
|
|
105707
|
-
}
|
|
105708
|
-
}
|
|
105709
|
-
const found = statement.findAllExpressionsMulti([
|
|
105710
|
-
Expressions.CondSub, Expressions.SQLCond, Expressions.ValueBodyLine,
|
|
105711
|
-
Expressions.NewObject, Expressions.Cond, Expressions.ComponentCond,
|
|
105712
|
-
Expressions.Source,
|
|
105713
|
-
Expressions.ComponentCondSub, Expressions.MethodCallParam
|
|
105714
|
-
], true);
|
|
105715
|
-
let pos = undefined;
|
|
105716
|
-
for (const f of found) {
|
|
105717
|
-
const type = f.get();
|
|
105718
|
-
if (type instanceof Expressions.Cond) {
|
|
105719
|
-
pos = this.checkCond(f);
|
|
105720
|
-
}
|
|
105721
|
-
else if (type instanceof Expressions.Source) {
|
|
105722
|
-
pos = this.checkSource(f);
|
|
105723
|
-
}
|
|
105724
|
-
else if (type instanceof Expressions.CondSub) {
|
|
105725
|
-
pos = this.checkCondSub(f);
|
|
105726
|
-
}
|
|
105727
|
-
else if (type instanceof Expressions.ComponentCond) {
|
|
105728
|
-
pos = this.checkComponentCond(f);
|
|
105729
|
-
}
|
|
105730
|
-
else if (type instanceof Expressions.ComponentCondSub) {
|
|
105731
|
-
pos = this.checkComponentCondSub(f);
|
|
105732
|
-
}
|
|
105733
|
-
else if (type instanceof Expressions.SQLCond) {
|
|
105734
|
-
pos = this.checkSQLCond(f);
|
|
105735
|
-
}
|
|
105736
|
-
else if (type instanceof Expressions.ValueBodyLine) {
|
|
105737
|
-
pos = this.checkValueBodyLine(f);
|
|
105738
|
-
}
|
|
105739
|
-
else if (type instanceof Expressions.NewObject) {
|
|
105740
|
-
pos = this.checkNewObject(f);
|
|
105741
|
-
}
|
|
105742
|
-
else if (type instanceof Expressions.MethodCallParam) {
|
|
105743
|
-
pos = this.checkMethodCallParam(f);
|
|
105744
|
-
}
|
|
105745
|
-
if (pos) {
|
|
105746
|
-
return pos;
|
|
105747
|
-
}
|
|
106548
|
+
const state = { prev: undefined, prevCond: undefined, prevInDynamic: false, first: undefined };
|
|
106549
|
+
for (const child of statement.getChildren()) {
|
|
106550
|
+
this.walk(child, undefined, false, state);
|
|
105748
106551
|
}
|
|
105749
|
-
return
|
|
106552
|
+
return state.first;
|
|
105750
106553
|
}
|
|
105751
|
-
|
|
105752
|
-
|
|
105753
|
-
|
|
105754
|
-
if (children[i].get() instanceof Expressions.SQLCond) {
|
|
105755
|
-
const current = children[i];
|
|
105756
|
-
const prev = children[i - 1].getLastToken();
|
|
105757
|
-
const next = children[i + 1].getFirstToken();
|
|
105758
|
-
if (prev.getStr() === "("
|
|
105759
|
-
&& prev.getRow() === current.getFirstToken().getRow()
|
|
105760
|
-
&& prev.getCol() + 1 === current.getFirstToken().getStart().getCol()) {
|
|
105761
|
-
return current.getFirstToken().getStart();
|
|
105762
|
-
}
|
|
105763
|
-
if (next.getStr() === ")"
|
|
105764
|
-
&& next.getRow() === current.getLastToken().getRow()
|
|
105765
|
-
&& next.getCol() === current.getLastToken().getEnd().getCol()) {
|
|
105766
|
-
return current.getLastToken().getEnd();
|
|
105767
|
-
}
|
|
105768
|
-
}
|
|
106554
|
+
report(state, pos) {
|
|
106555
|
+
if (state.first === undefined || pos.isBefore(state.first)) {
|
|
106556
|
+
state.first = pos;
|
|
105769
106557
|
}
|
|
105770
|
-
return undefined;
|
|
105771
106558
|
}
|
|
105772
|
-
|
|
105773
|
-
|
|
105774
|
-
{
|
|
105775
|
-
|
|
105776
|
-
|
|
105777
|
-
if (first.getRow() === second.getRow()
|
|
105778
|
-
&& first.getEnd().getCol() === second.getStart().getCol()) {
|
|
105779
|
-
return second.getStart();
|
|
105780
|
-
}
|
|
106559
|
+
/** visits each node once in source order, checking the parentheses of expressions and each pair of tokens */
|
|
106560
|
+
walk(node, cond, inDynamic, state) {
|
|
106561
|
+
if (node instanceof nodes_1.TokenNode) {
|
|
106562
|
+
this.checkToken(node.get(), cond, inDynamic, state);
|
|
106563
|
+
return;
|
|
105781
106564
|
}
|
|
105782
|
-
|
|
105783
|
-
|
|
105784
|
-
|
|
105785
|
-
const children = cond.getChildren();
|
|
105786
|
-
for (let i = 0; i < children.length; i++) {
|
|
105787
|
-
if (children[i].get() instanceof Expressions.Cond) {
|
|
105788
|
-
const current = children[i];
|
|
105789
|
-
const prev = children[i - 1].getLastToken();
|
|
105790
|
-
const next = children[i + 1].getFirstToken();
|
|
105791
|
-
if (prev.getStr() === "("
|
|
105792
|
-
&& prev.getRow() === current.getFirstToken().getRow()
|
|
105793
|
-
&& prev.getCol() + 1 === current.getFirstToken().getStart().getCol()) {
|
|
105794
|
-
return current.getFirstToken().getStart();
|
|
105795
|
-
}
|
|
105796
|
-
if (next.getStr() === ")"
|
|
105797
|
-
&& next.getRow() === current.getLastToken().getRow()
|
|
105798
|
-
&& next.getCol() === current.getLastToken().getEnd().getCol()) {
|
|
105799
|
-
return current.getLastToken().getEnd();
|
|
105800
|
-
}
|
|
105801
|
-
}
|
|
106565
|
+
const type = node.get();
|
|
106566
|
+
if (cond === undefined && (type instanceof Expressions.Cond || type instanceof Expressions.ComponentCond)) {
|
|
106567
|
+
cond = node;
|
|
105802
106568
|
}
|
|
105803
|
-
|
|
105804
|
-
|
|
105805
|
-
|
|
105806
|
-
const children = cond.getChildren();
|
|
105807
|
-
for (let i = 0; i < children.length; i++) {
|
|
105808
|
-
if (children[i].get() instanceof Expressions.ComponentCond) {
|
|
105809
|
-
const current = children[i];
|
|
105810
|
-
const prev = children[i - 1].getLastToken();
|
|
105811
|
-
const next = children[i + 1].getFirstToken();
|
|
105812
|
-
if (prev.getStr() === "("
|
|
105813
|
-
&& prev.getRow() === current.getFirstToken().getRow()
|
|
105814
|
-
&& prev.getCol() + 1 === current.getFirstToken().getStart().getCol()) {
|
|
105815
|
-
return current.getFirstToken().getStart();
|
|
105816
|
-
}
|
|
105817
|
-
if (next.getStr() === ")"
|
|
105818
|
-
&& next.getRow() === current.getLastToken().getRow()
|
|
105819
|
-
&& next.getCol() === current.getLastToken().getEnd().getCol()) {
|
|
105820
|
-
return current.getLastToken().getEnd();
|
|
105821
|
-
}
|
|
105822
|
-
}
|
|
106569
|
+
inDynamic = inDynamic || type instanceof Expressions.Dynamic;
|
|
106570
|
+
if (PAREN_EXPRESSIONS.has(type.constructor)) {
|
|
106571
|
+
this.checkParens(node, state);
|
|
105823
106572
|
}
|
|
105824
|
-
|
|
105825
|
-
|
|
105826
|
-
checkComponentCond(cond) {
|
|
105827
|
-
const children = cond.getAllTokens();
|
|
105828
|
-
for (let i = 0; i < children.length - 1; i++) {
|
|
105829
|
-
const current = children[i];
|
|
105830
|
-
const next = children[i + 1];
|
|
105831
|
-
if (next.getStr().startsWith("'")
|
|
105832
|
-
&& next.getRow() === current.getRow()
|
|
105833
|
-
&& next.getCol() === current.getEnd().getCol()) {
|
|
105834
|
-
return current.getEnd();
|
|
105835
|
-
}
|
|
106573
|
+
for (const child of node.getChildren()) {
|
|
106574
|
+
this.walk(child, cond, inDynamic, state);
|
|
105836
106575
|
}
|
|
105837
|
-
return undefined;
|
|
105838
106576
|
}
|
|
105839
|
-
|
|
105840
|
-
|
|
105841
|
-
|
|
106577
|
+
/** "foo( 'bar')" and "IF (foo = bar )", parentheses directly part of the expression need inner whitespace */
|
|
106578
|
+
checkParens(node, state) {
|
|
106579
|
+
var _a;
|
|
106580
|
+
const children = node.getChildren();
|
|
106581
|
+
let dynamicAccess = false;
|
|
105842
106582
|
for (let i = 0; i < children.length; i++) {
|
|
105843
|
-
const
|
|
105844
|
-
if (
|
|
105845
|
-
|
|
105846
|
-
|
|
105847
|
-
|
|
105848
|
-
|
|
105849
|
-
|
|
105850
|
-
|
|
105851
|
-
|
|
106583
|
+
const child = children[i];
|
|
106584
|
+
if (!(child instanceof nodes_1.TokenNode)) {
|
|
106585
|
+
continue;
|
|
106586
|
+
}
|
|
106587
|
+
const token = child.get();
|
|
106588
|
+
if (token instanceof Tokens.ParenLeft || token instanceof Tokens.WParenLeft) {
|
|
106589
|
+
// dynamic component and attribute access, "foo-(name)" and "foo->(name)"
|
|
106590
|
+
const prev = (_a = children[i - 1]) === null || _a === void 0 ? void 0 : _a.get();
|
|
106591
|
+
if (prev instanceof Tokens.Dash || prev instanceof Tokens.InstanceArrow) {
|
|
106592
|
+
dynamicAccess = true;
|
|
105852
106593
|
}
|
|
105853
|
-
|
|
105854
|
-
|
|
105855
|
-
&& prev.getRow() === current.getFirstToken().getRow()
|
|
105856
|
-
&& prev.getEnd().getCol() === current.getFirstToken().getStart().getCol()) {
|
|
105857
|
-
return current.getLastToken().getEnd();
|
|
106594
|
+
else {
|
|
106595
|
+
this.report(state, token.getEnd());
|
|
105858
106596
|
}
|
|
105859
106597
|
}
|
|
105860
|
-
|
|
105861
|
-
|
|
105862
|
-
|
|
105863
|
-
checkCond(cond) {
|
|
105864
|
-
const children = cond.getAllTokens();
|
|
105865
|
-
const dynamic = cond.findAllExpressions(Expressions.Dynamic);
|
|
105866
|
-
for (let i = 0; i < children.length - 1; i++) {
|
|
105867
|
-
const current = children[i];
|
|
105868
|
-
const next = children[i + 1];
|
|
105869
|
-
if (next.getStr().startsWith("'")
|
|
105870
|
-
&& next.getRow() === current.getRow()
|
|
105871
|
-
&& next.getCol() === current.getEnd().getCol()) {
|
|
105872
|
-
// skip if the token is part of a DYNAMIC expression
|
|
105873
|
-
let isDynamic = false;
|
|
105874
|
-
outer: for (const d of dynamic) {
|
|
105875
|
-
for (const t of d.getAllTokens()) {
|
|
105876
|
-
if (t === next || t === current) {
|
|
105877
|
-
isDynamic = true;
|
|
105878
|
-
break outer;
|
|
105879
|
-
}
|
|
105880
|
-
}
|
|
106598
|
+
else if (token instanceof Tokens.ParenRight || token instanceof Tokens.ParenRightW) {
|
|
106599
|
+
if (dynamicAccess) {
|
|
106600
|
+
dynamicAccess = false;
|
|
105881
106601
|
}
|
|
105882
|
-
|
|
105883
|
-
|
|
106602
|
+
else {
|
|
106603
|
+
this.report(state, token.getStart());
|
|
105884
106604
|
}
|
|
105885
106605
|
}
|
|
105886
|
-
|
|
105887
|
-
|
|
105888
|
-
}
|
|
105889
|
-
checkSource(cond) {
|
|
105890
|
-
var _a, _b;
|
|
105891
|
-
const children = cond.getAllTokens();
|
|
105892
|
-
if (children.length < 2) {
|
|
105893
|
-
return undefined;
|
|
105894
|
-
}
|
|
105895
|
-
if (children.length >= 4
|
|
105896
|
-
&& children[0].getStr().toUpperCase() === "CONV") {
|
|
105897
|
-
const directChildren = cond.getChildren();
|
|
105898
|
-
const first = (_a = directChildren[2]) === null || _a === void 0 ? void 0 : _a.getLastToken();
|
|
105899
|
-
const second = (_b = directChildren[3]) === null || _b === void 0 ? void 0 : _b.getFirstToken();
|
|
105900
|
-
if (first
|
|
105901
|
-
&& first.getStr() === "("
|
|
105902
|
-
&& second
|
|
105903
|
-
&& first.getRow() === second.getRow()
|
|
105904
|
-
&& first.getCol() + 1 === second.getStart().getCol()) {
|
|
105905
|
-
return second.getStart();
|
|
106606
|
+
else if (token instanceof Tokens.WParenRight || token instanceof Tokens.WParenRightW) {
|
|
106607
|
+
dynamicAccess = false;
|
|
105906
106608
|
}
|
|
105907
106609
|
}
|
|
105908
|
-
{
|
|
105909
|
-
const nextLast = children[children.length - 2];
|
|
105910
|
-
const last = children[children.length - 1];
|
|
105911
|
-
if (nextLast.getStr().startsWith("'")
|
|
105912
|
-
&& nextLast.getRow() === last.getRow()
|
|
105913
|
-
&& nextLast.getEnd().getCol() === last.getStart().getCol()) {
|
|
105914
|
-
return last.getEnd();
|
|
105915
|
-
}
|
|
105916
|
-
}
|
|
105917
|
-
return undefined;
|
|
105918
106610
|
}
|
|
105919
|
-
|
|
105920
|
-
const
|
|
105921
|
-
{
|
|
105922
|
-
|
|
105923
|
-
|
|
105924
|
-
|
|
105925
|
-
&& first.getCol() + 1 === second.getStart().getCol()) {
|
|
105926
|
-
return second.getStart();
|
|
106611
|
+
checkToken(current, cond, inDynamic, state) {
|
|
106612
|
+
const prev = state.prev;
|
|
106613
|
+
if (prev !== undefined) {
|
|
106614
|
+
// "foo( )= bar"
|
|
106615
|
+
if ((prev instanceof Tokens.ParenRight || prev instanceof Tokens.WParenRight) && current.getStr() === "=") {
|
|
106616
|
+
this.report(state, current.getStart());
|
|
105927
106617
|
}
|
|
105928
|
-
|
|
105929
|
-
|
|
105930
|
-
|
|
105931
|
-
|
|
105932
|
-
|
|
105933
|
-
&&
|
|
105934
|
-
|
|
106618
|
+
// "IF foo ='bar'", dynamic parts like "('NAME')" are allowed without spaces
|
|
106619
|
+
if (current.getStr().startsWith("'")
|
|
106620
|
+
&& cond !== undefined
|
|
106621
|
+
&& cond === state.prevCond
|
|
106622
|
+
&& state.prevInDynamic === false
|
|
106623
|
+
&& inDynamic === false
|
|
106624
|
+
&& this.isAdjacent(prev, current)) {
|
|
106625
|
+
this.report(state, prev.getEnd());
|
|
105935
106626
|
}
|
|
105936
106627
|
}
|
|
105937
|
-
|
|
106628
|
+
state.prev = current;
|
|
106629
|
+
state.prevCond = cond;
|
|
106630
|
+
state.prevInDynamic = inDynamic;
|
|
106631
|
+
}
|
|
106632
|
+
isAdjacent(first, second) {
|
|
106633
|
+
return first.getRow() === second.getRow()
|
|
106634
|
+
&& first.getEnd().getCol() === second.getStart().getCol();
|
|
105938
106635
|
}
|
|
105939
106636
|
}
|
|
105940
106637
|
exports.ParserMissingSpace = ParserMissingSpace;
|
|
@@ -108498,7 +109195,7 @@ ENDMETHOD.`,
|
|
|
108498
109195
|
else if (this.conf.omitMeInstanceCalls === true
|
|
108499
109196
|
&& concat.includes(meAccess)
|
|
108500
109197
|
&& s.findFirstExpression(expressions_1.MethodCall)) {
|
|
108501
|
-
const tokenPos =
|
|
109198
|
+
const tokenPos = this.findMeMethodCall(s);
|
|
108502
109199
|
if (tokenPos) {
|
|
108503
109200
|
const end = new position_1.Position(tokenPos.getRow(), tokenPos.getCol() + 4);
|
|
108504
109201
|
const fix = edit_helper_1.EditHelper.deleteRange(file, tokenPos, end);
|
|
@@ -108509,6 +109206,20 @@ ENDMETHOD.`,
|
|
|
108509
109206
|
}
|
|
108510
109207
|
return issues;
|
|
108511
109208
|
}
|
|
109209
|
+
/** finds "me->method( )", position is the start of "me", "me->attribute" is not a method call */
|
|
109210
|
+
findMeMethodCall(s) {
|
|
109211
|
+
const tokens = s.getTokens();
|
|
109212
|
+
for (const call of s.findAllExpressionsRecursive(expressions_1.MethodCall)) {
|
|
109213
|
+
const start = call.getFirstToken().getStart();
|
|
109214
|
+
const index = tokens.findIndex(t => t.getStart().equals(start));
|
|
109215
|
+
if (index >= 2
|
|
109216
|
+
&& tokens[index - 1].getStr() === "->"
|
|
109217
|
+
&& tokens[index - 2].getStr().toUpperCase() === "ME") {
|
|
109218
|
+
return tokens[index - 2].getStart();
|
|
109219
|
+
}
|
|
109220
|
+
}
|
|
109221
|
+
return undefined;
|
|
109222
|
+
}
|
|
108512
109223
|
/** finds "className=>member" references in the statement, position is the start of the class name */
|
|
108513
109224
|
findStaticReferences(s, className) {
|
|
108514
109225
|
var _a;
|
|
@@ -126565,6 +127276,10 @@ class NewObjectTranspiler {
|
|
|
126565
127276
|
ret.appendString(traversal.toType(type) + ".set(await (new " + clas + "()).constructor_(" + para + "))");
|
|
126566
127277
|
}
|
|
126567
127278
|
else {
|
|
127279
|
+
if (typeNameOrInfer.concatTokens() === "#" && type instanceof abaplint.BasicTypes.DataReference) {
|
|
127280
|
+
// NEW #( ) infers the type of the target, a data reference: the new data object has the referenced type
|
|
127281
|
+
type = type.getType();
|
|
127282
|
+
}
|
|
126568
127283
|
// a new data object with a copy of the value, never the source itself; async, as sources can await
|
|
126569
127284
|
const typeCode = traversal.toType(type);
|
|
126570
127285
|
const setCode = this.buildValue(node, type, traversal);
|
|
@@ -127251,6 +127966,13 @@ class SourceTranspiler {
|
|
|
127251
127966
|
ret.appendChunk(traversal.traverse(c));
|
|
127252
127967
|
}
|
|
127253
127968
|
else if (c.get() instanceof core_1.Expressions.ArithOperator) {
|
|
127969
|
+
// a leading sign belongs to the first operand: - a + b is ( - a ) + b, and the
|
|
127970
|
+
// same for -, *, /, DIV and MOD. It binds weaker than **, - a ** 2 is - ( a ** 2 ),
|
|
127971
|
+
// so there the whole expression stays negated, below
|
|
127972
|
+
if (prefixNegated === true && c.concatTokens().trim() !== "**") {
|
|
127973
|
+
ret = new chunk_1.Chunk().appendString("abap.operators.minus(0, ").appendChunk(ret).appendString(")");
|
|
127974
|
+
prefixNegated = false;
|
|
127975
|
+
}
|
|
127254
127976
|
// "/" rounds in calculation type int8, the runtime's divide() does not know the target
|
|
127255
127977
|
const operator = this.int8 === true && c.concatTokens().trim() === "/"
|
|
127256
127978
|
? new chunk_1.Chunk().append("abap.operators.divideInt8", c, traversal)
|
|
@@ -131848,9 +132570,9 @@ class Rearranger {
|
|
|
131848
132570
|
break;
|
|
131849
132571
|
}
|
|
131850
132572
|
}
|
|
131851
|
-
// fallback: all ** operators
|
|
132573
|
+
// fallback: all ** operators, right-associative: 2 ** 3 ** 2 is 2 ** ( 3 ** 2 )
|
|
131852
132574
|
if (splitAt === undefined) {
|
|
131853
|
-
splitAt = arith[
|
|
132575
|
+
splitAt = arith[0];
|
|
131854
132576
|
}
|
|
131855
132577
|
const index = children.indexOf(splitAt);
|
|
131856
132578
|
let left = [];
|
|
@@ -133436,6 +134158,27 @@ exports.CallTranspiler = CallTranspiler;
|
|
|
133436
134158
|
|
|
133437
134159
|
/***/ },
|
|
133438
134160
|
|
|
134161
|
+
/***/ "./node_modules/@abaplint/transpiler/build/src/statements/call_badi.js"
|
|
134162
|
+
/*!*****************************************************************************!*\
|
|
134163
|
+
!*** ./node_modules/@abaplint/transpiler/build/src/statements/call_badi.js ***!
|
|
134164
|
+
\*****************************************************************************/
|
|
134165
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
134166
|
+
|
|
134167
|
+
"use strict";
|
|
134168
|
+
|
|
134169
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
134170
|
+
exports.CallBadiTranspiler = void 0;
|
|
134171
|
+
const chunk_1 = __webpack_require__(/*! ../chunk */ "./node_modules/@abaplint/transpiler/build/src/chunk.js");
|
|
134172
|
+
class CallBadiTranspiler {
|
|
134173
|
+
transpile(_node, _traversal) {
|
|
134174
|
+
return new chunk_1.Chunk(`throw new Error("CALL BADI, not supported, transpiler");`);
|
|
134175
|
+
}
|
|
134176
|
+
}
|
|
134177
|
+
exports.CallBadiTranspiler = CallBadiTranspiler;
|
|
134178
|
+
//# sourceMappingURL=call_badi.js.map
|
|
134179
|
+
|
|
134180
|
+
/***/ },
|
|
134181
|
+
|
|
133439
134182
|
/***/ "./node_modules/@abaplint/transpiler/build/src/statements/call_database.js"
|
|
133440
134183
|
/*!*********************************************************************************!*\
|
|
133441
134184
|
!*** ./node_modules/@abaplint/transpiler/build/src/statements/call_database.js ***!
|
|
@@ -135622,8 +136365,15 @@ const abaplint = __importStar(__webpack_require__(/*! @abaplint/core */ "./node_
|
|
|
135622
136365
|
const chunk_1 = __webpack_require__(/*! ../chunk */ "./node_modules/@abaplint/transpiler/build/src/chunk.js");
|
|
135623
136366
|
class DeleteInternalTranspiler {
|
|
135624
136367
|
transpile(node, traversal) {
|
|
135625
|
-
const
|
|
136368
|
+
const targetNode = node.findDirectExpression(abaplint.Expressions.Target);
|
|
136369
|
+
const target = traversal.traverse(targetNode).getCode();
|
|
135626
136370
|
const concat = node.concatTokens().toUpperCase();
|
|
136371
|
+
if (node.getChildren().length <= 5 && (node.getChildren().length === 3 || node.findDirectTokenByText("FROM"))
|
|
136372
|
+
&& concat.startsWith("DELETE TABLE ") === false && traversal.isDatabaseShortForm(targetNode)) {
|
|
136373
|
+
const row = node.findExpressionAfterToken("FROM");
|
|
136374
|
+
const source = row ? traversal.traverse(row).getCode() : target;
|
|
136375
|
+
return new chunk_1.Chunk(`await abap.statements.deleteDatabase("${targetNode.concatTokens().toLowerCase()}", {from: ${source}});`);
|
|
136376
|
+
}
|
|
135627
136377
|
const extra = [];
|
|
135628
136378
|
const componentCond = node.findDirectExpression(abaplint.Expressions.ComponentCond);
|
|
135629
136379
|
if (componentCond) {
|
|
@@ -136917,6 +137667,28 @@ exports.FieldSymbolTranspiler = FieldSymbolTranspiler;
|
|
|
136917
137667
|
|
|
136918
137668
|
/***/ },
|
|
136919
137669
|
|
|
137670
|
+
/***/ "./node_modules/@abaplint/transpiler/build/src/statements/fields.js"
|
|
137671
|
+
/*!**************************************************************************!*\
|
|
137672
|
+
!*** ./node_modules/@abaplint/transpiler/build/src/statements/fields.js ***!
|
|
137673
|
+
\**************************************************************************/
|
|
137674
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
137675
|
+
|
|
137676
|
+
"use strict";
|
|
137677
|
+
|
|
137678
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
137679
|
+
exports.FieldsTranspiler = void 0;
|
|
137680
|
+
const chunk_1 = __webpack_require__(/*! ../chunk */ "./node_modules/@abaplint/transpiler/build/src/chunk.js");
|
|
137681
|
+
class FieldsTranspiler {
|
|
137682
|
+
transpile(_node, _traversal) {
|
|
137683
|
+
// obsolete, FIELDS only marks a data object as used, it has no effect when the program runs
|
|
137684
|
+
return new chunk_1.Chunk(``);
|
|
137685
|
+
}
|
|
137686
|
+
}
|
|
137687
|
+
exports.FieldsTranspiler = FieldsTranspiler;
|
|
137688
|
+
//# sourceMappingURL=fields.js.map
|
|
137689
|
+
|
|
137690
|
+
/***/ },
|
|
137691
|
+
|
|
136920
137692
|
/***/ "./node_modules/@abaplint/transpiler/build/src/statements/find.js"
|
|
136921
137693
|
/*!************************************************************************!*\
|
|
136922
137694
|
!*** ./node_modules/@abaplint/transpiler/build/src/statements/find.js ***!
|
|
@@ -137112,6 +137884,28 @@ exports.FormTranspiler = FormTranspiler;
|
|
|
137112
137884
|
|
|
137113
137885
|
/***/ },
|
|
137114
137886
|
|
|
137887
|
+
/***/ "./node_modules/@abaplint/transpiler/build/src/statements/form_definition.js"
|
|
137888
|
+
/*!***********************************************************************************!*\
|
|
137889
|
+
!*** ./node_modules/@abaplint/transpiler/build/src/statements/form_definition.js ***!
|
|
137890
|
+
\***********************************************************************************/
|
|
137891
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
137892
|
+
|
|
137893
|
+
"use strict";
|
|
137894
|
+
|
|
137895
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
137896
|
+
exports.FormDefinitionTranspiler = void 0;
|
|
137897
|
+
const chunk_1 = __webpack_require__(/*! ../chunk */ "./node_modules/@abaplint/transpiler/build/src/chunk.js");
|
|
137898
|
+
class FormDefinitionTranspiler {
|
|
137899
|
+
transpile(_node, _traversal) {
|
|
137900
|
+
// only declares the interface of a FORM, no effect when the program runs
|
|
137901
|
+
return new chunk_1.Chunk(``);
|
|
137902
|
+
}
|
|
137903
|
+
}
|
|
137904
|
+
exports.FormDefinitionTranspiler = FormDefinitionTranspiler;
|
|
137905
|
+
//# sourceMappingURL=form_definition.js.map
|
|
137906
|
+
|
|
137907
|
+
/***/ },
|
|
137908
|
+
|
|
137115
137909
|
/***/ "./node_modules/@abaplint/transpiler/build/src/statements/format.js"
|
|
137116
137910
|
/*!**************************************************************************!*\
|
|
137117
137911
|
!*** ./node_modules/@abaplint/transpiler/build/src/statements/format.js ***!
|
|
@@ -137374,6 +138168,27 @@ exports.GetTranspiler = GetTranspiler;
|
|
|
137374
138168
|
|
|
137375
138169
|
/***/ },
|
|
137376
138170
|
|
|
138171
|
+
/***/ "./node_modules/@abaplint/transpiler/build/src/statements/get_badi.js"
|
|
138172
|
+
/*!****************************************************************************!*\
|
|
138173
|
+
!*** ./node_modules/@abaplint/transpiler/build/src/statements/get_badi.js ***!
|
|
138174
|
+
\****************************************************************************/
|
|
138175
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
138176
|
+
|
|
138177
|
+
"use strict";
|
|
138178
|
+
|
|
138179
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
138180
|
+
exports.GetBadiTranspiler = void 0;
|
|
138181
|
+
const chunk_1 = __webpack_require__(/*! ../chunk */ "./node_modules/@abaplint/transpiler/build/src/chunk.js");
|
|
138182
|
+
class GetBadiTranspiler {
|
|
138183
|
+
transpile(_node, _traversal) {
|
|
138184
|
+
return new chunk_1.Chunk(`throw new Error("GET BADI, not supported, transpiler");`);
|
|
138185
|
+
}
|
|
138186
|
+
}
|
|
138187
|
+
exports.GetBadiTranspiler = GetBadiTranspiler;
|
|
138188
|
+
//# sourceMappingURL=get_badi.js.map
|
|
138189
|
+
|
|
138190
|
+
/***/ },
|
|
138191
|
+
|
|
137377
138192
|
/***/ "./node_modules/@abaplint/transpiler/build/src/statements/get_bit.js"
|
|
137378
138193
|
/*!***************************************************************************!*\
|
|
137379
138194
|
!*** ./node_modules/@abaplint/transpiler/build/src/statements/get_bit.js ***!
|
|
@@ -137607,6 +138422,27 @@ exports.GetParameterTranspiler = GetParameterTranspiler;
|
|
|
137607
138422
|
|
|
137608
138423
|
/***/ },
|
|
137609
138424
|
|
|
138425
|
+
/***/ "./node_modules/@abaplint/transpiler/build/src/statements/get_permissions.js"
|
|
138426
|
+
/*!***********************************************************************************!*\
|
|
138427
|
+
!*** ./node_modules/@abaplint/transpiler/build/src/statements/get_permissions.js ***!
|
|
138428
|
+
\***********************************************************************************/
|
|
138429
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
138430
|
+
|
|
138431
|
+
"use strict";
|
|
138432
|
+
|
|
138433
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
138434
|
+
exports.GetPermissionsTranspiler = void 0;
|
|
138435
|
+
const chunk_1 = __webpack_require__(/*! ../chunk */ "./node_modules/@abaplint/transpiler/build/src/chunk.js");
|
|
138436
|
+
class GetPermissionsTranspiler {
|
|
138437
|
+
transpile(_node, _traversal) {
|
|
138438
|
+
return new chunk_1.Chunk(`throw new Error("GET PERMISSIONS, not supported, transpiler");`);
|
|
138439
|
+
}
|
|
138440
|
+
}
|
|
138441
|
+
exports.GetPermissionsTranspiler = GetPermissionsTranspiler;
|
|
138442
|
+
//# sourceMappingURL=get_permissions.js.map
|
|
138443
|
+
|
|
138444
|
+
/***/ },
|
|
138445
|
+
|
|
137610
138446
|
/***/ "./node_modules/@abaplint/transpiler/build/src/statements/get_pf_status.js"
|
|
137611
138447
|
/*!*********************************************************************************!*\
|
|
137612
138448
|
!*** ./node_modules/@abaplint/transpiler/build/src/statements/get_pf_status.js ***!
|
|
@@ -138214,6 +139050,11 @@ __exportStar(__webpack_require__(/*! ./break_id */ "./node_modules/@abaplint/tra
|
|
|
138214
139050
|
__exportStar(__webpack_require__(/*! ./break */ "./node_modules/@abaplint/transpiler/build/src/statements/break.js"), exports);
|
|
138215
139051
|
__exportStar(__webpack_require__(/*! ./call_function */ "./node_modules/@abaplint/transpiler/build/src/statements/call_function.js"), exports);
|
|
138216
139052
|
__exportStar(__webpack_require__(/*! ./call_kernel */ "./node_modules/@abaplint/transpiler/build/src/statements/call_kernel.js"), exports);
|
|
139053
|
+
__exportStar(__webpack_require__(/*! ./call_badi */ "./node_modules/@abaplint/transpiler/build/src/statements/call_badi.js"), exports);
|
|
139054
|
+
__exportStar(__webpack_require__(/*! ./get_permissions */ "./node_modules/@abaplint/transpiler/build/src/statements/get_permissions.js"), exports);
|
|
139055
|
+
__exportStar(__webpack_require__(/*! ./raise_entity_event */ "./node_modules/@abaplint/transpiler/build/src/statements/raise_entity_event.js"), exports);
|
|
139056
|
+
__exportStar(__webpack_require__(/*! ./set_locks */ "./node_modules/@abaplint/transpiler/build/src/statements/set_locks.js"), exports);
|
|
139057
|
+
__exportStar(__webpack_require__(/*! ./get_badi */ "./node_modules/@abaplint/transpiler/build/src/statements/get_badi.js"), exports);
|
|
138217
139058
|
__exportStar(__webpack_require__(/*! ./call_screen */ "./node_modules/@abaplint/transpiler/build/src/statements/call_screen.js"), exports);
|
|
138218
139059
|
__exportStar(__webpack_require__(/*! ./call_selection_screen */ "./node_modules/@abaplint/transpiler/build/src/statements/call_selection_screen.js"), exports);
|
|
138219
139060
|
__exportStar(__webpack_require__(/*! ./call_transaction */ "./node_modules/@abaplint/transpiler/build/src/statements/call_transaction.js"), exports);
|
|
@@ -138322,6 +139163,7 @@ __exportStar(__webpack_require__(/*! ./input */ "./node_modules/@abaplint/transp
|
|
|
138322
139163
|
__exportStar(__webpack_require__(/*! ./leave */ "./node_modules/@abaplint/transpiler/build/src/statements/leave.js"), exports);
|
|
138323
139164
|
__exportStar(__webpack_require__(/*! ./log_point */ "./node_modules/@abaplint/transpiler/build/src/statements/log_point.js"), exports);
|
|
138324
139165
|
__exportStar(__webpack_require__(/*! ./loop_at_screen */ "./node_modules/@abaplint/transpiler/build/src/statements/loop_at_screen.js"), exports);
|
|
139166
|
+
__exportStar(__webpack_require__(/*! ./local */ "./node_modules/@abaplint/transpiler/build/src/statements/local.js"), exports);
|
|
138325
139167
|
__exportStar(__webpack_require__(/*! ./loop */ "./node_modules/@abaplint/transpiler/build/src/statements/loop.js"), exports);
|
|
138326
139168
|
__exportStar(__webpack_require__(/*! ./macro_call */ "./node_modules/@abaplint/transpiler/build/src/statements/macro_call.js"), exports);
|
|
138327
139169
|
__exportStar(__webpack_require__(/*! ./message */ "./node_modules/@abaplint/transpiler/build/src/statements/message.js"), exports);
|
|
@@ -138401,6 +139243,12 @@ __exportStar(__webpack_require__(/*! ./top_of_page */ "./node_modules/@abaplint/
|
|
|
138401
139243
|
__exportStar(__webpack_require__(/*! ./truncate_dataset */ "./node_modules/@abaplint/transpiler/build/src/statements/truncate_dataset.js"), exports);
|
|
138402
139244
|
__exportStar(__webpack_require__(/*! ./try */ "./node_modules/@abaplint/transpiler/build/src/statements/try.js"), exports);
|
|
138403
139245
|
__exportStar(__webpack_require__(/*! ./type_pools */ "./node_modules/@abaplint/transpiler/build/src/statements/type_pools.js"), exports);
|
|
139246
|
+
__exportStar(__webpack_require__(/*! ./fields */ "./node_modules/@abaplint/transpiler/build/src/statements/fields.js"), exports);
|
|
139247
|
+
__exportStar(__webpack_require__(/*! ./form_definition */ "./node_modules/@abaplint/transpiler/build/src/statements/form_definition.js"), exports);
|
|
139248
|
+
__exportStar(__webpack_require__(/*! ./interface_deferred */ "./node_modules/@abaplint/transpiler/build/src/statements/interface_deferred.js"), exports);
|
|
139249
|
+
__exportStar(__webpack_require__(/*! ./interface_load */ "./node_modules/@abaplint/transpiler/build/src/statements/interface_load.js"), exports);
|
|
139250
|
+
__exportStar(__webpack_require__(/*! ./set_run_time */ "./node_modules/@abaplint/transpiler/build/src/statements/set_run_time.js"), exports);
|
|
139251
|
+
__exportStar(__webpack_require__(/*! ./type_pool */ "./node_modules/@abaplint/transpiler/build/src/statements/type_pool.js"), exports);
|
|
138404
139252
|
__exportStar(__webpack_require__(/*! ./type */ "./node_modules/@abaplint/transpiler/build/src/statements/type.js"), exports);
|
|
138405
139253
|
__exportStar(__webpack_require__(/*! ./uline */ "./node_modules/@abaplint/transpiler/build/src/statements/uline.js"), exports);
|
|
138406
139254
|
__exportStar(__webpack_require__(/*! ./unassign */ "./node_modules/@abaplint/transpiler/build/src/statements/unassign.js"), exports);
|
|
@@ -138740,6 +139588,50 @@ exports.InsertTextpoolTranspiler = InsertTextpoolTranspiler;
|
|
|
138740
139588
|
|
|
138741
139589
|
/***/ },
|
|
138742
139590
|
|
|
139591
|
+
/***/ "./node_modules/@abaplint/transpiler/build/src/statements/interface_deferred.js"
|
|
139592
|
+
/*!**************************************************************************************!*\
|
|
139593
|
+
!*** ./node_modules/@abaplint/transpiler/build/src/statements/interface_deferred.js ***!
|
|
139594
|
+
\**************************************************************************************/
|
|
139595
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
139596
|
+
|
|
139597
|
+
"use strict";
|
|
139598
|
+
|
|
139599
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
139600
|
+
exports.InterfaceDeferredTranspiler = void 0;
|
|
139601
|
+
const chunk_1 = __webpack_require__(/*! ../chunk */ "./node_modules/@abaplint/transpiler/build/src/chunk.js");
|
|
139602
|
+
class InterfaceDeferredTranspiler {
|
|
139603
|
+
transpile(_node, _traversal) {
|
|
139604
|
+
// only makes the interface known before its definition, like CLASS ... DEFINITION DEFERRED
|
|
139605
|
+
return new chunk_1.Chunk(``);
|
|
139606
|
+
}
|
|
139607
|
+
}
|
|
139608
|
+
exports.InterfaceDeferredTranspiler = InterfaceDeferredTranspiler;
|
|
139609
|
+
//# sourceMappingURL=interface_deferred.js.map
|
|
139610
|
+
|
|
139611
|
+
/***/ },
|
|
139612
|
+
|
|
139613
|
+
/***/ "./node_modules/@abaplint/transpiler/build/src/statements/interface_load.js"
|
|
139614
|
+
/*!**********************************************************************************!*\
|
|
139615
|
+
!*** ./node_modules/@abaplint/transpiler/build/src/statements/interface_load.js ***!
|
|
139616
|
+
\**********************************************************************************/
|
|
139617
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
139618
|
+
|
|
139619
|
+
"use strict";
|
|
139620
|
+
|
|
139621
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
139622
|
+
exports.InterfaceLoadTranspiler = void 0;
|
|
139623
|
+
const chunk_1 = __webpack_require__(/*! ../chunk */ "./node_modules/@abaplint/transpiler/build/src/chunk.js");
|
|
139624
|
+
class InterfaceLoadTranspiler {
|
|
139625
|
+
transpile(_node, _traversal) {
|
|
139626
|
+
// obsolete, only loads the interface for the compiler, like CLASS ... DEFINITION LOAD
|
|
139627
|
+
return new chunk_1.Chunk(``);
|
|
139628
|
+
}
|
|
139629
|
+
}
|
|
139630
|
+
exports.InterfaceLoadTranspiler = InterfaceLoadTranspiler;
|
|
139631
|
+
//# sourceMappingURL=interface_load.js.map
|
|
139632
|
+
|
|
139633
|
+
/***/ },
|
|
139634
|
+
|
|
138743
139635
|
/***/ "./node_modules/@abaplint/transpiler/build/src/statements/leave.js"
|
|
138744
139636
|
/*!*************************************************************************!*\
|
|
138745
139637
|
!*** ./node_modules/@abaplint/transpiler/build/src/statements/leave.js ***!
|
|
@@ -138803,6 +139695,85 @@ exports.LoadReportTranspiler = LoadReportTranspiler;
|
|
|
138803
139695
|
|
|
138804
139696
|
/***/ },
|
|
138805
139697
|
|
|
139698
|
+
/***/ "./node_modules/@abaplint/transpiler/build/src/statements/local.js"
|
|
139699
|
+
/*!*************************************************************************!*\
|
|
139700
|
+
!*** ./node_modules/@abaplint/transpiler/build/src/statements/local.js ***!
|
|
139701
|
+
\*************************************************************************/
|
|
139702
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
139703
|
+
|
|
139704
|
+
"use strict";
|
|
139705
|
+
|
|
139706
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
139707
|
+
if (k2 === undefined) k2 = k;
|
|
139708
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
139709
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
139710
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
139711
|
+
}
|
|
139712
|
+
Object.defineProperty(o, k2, desc);
|
|
139713
|
+
}) : (function(o, m, k, k2) {
|
|
139714
|
+
if (k2 === undefined) k2 = k;
|
|
139715
|
+
o[k2] = m[k];
|
|
139716
|
+
}));
|
|
139717
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
139718
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
139719
|
+
}) : function(o, v) {
|
|
139720
|
+
o["default"] = v;
|
|
139721
|
+
});
|
|
139722
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
139723
|
+
var ownKeys = function(o) {
|
|
139724
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
139725
|
+
var ar = [];
|
|
139726
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
139727
|
+
return ar;
|
|
139728
|
+
};
|
|
139729
|
+
return ownKeys(o);
|
|
139730
|
+
};
|
|
139731
|
+
return function (mod) {
|
|
139732
|
+
if (mod && mod.__esModule) return mod;
|
|
139733
|
+
var result = {};
|
|
139734
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
139735
|
+
__setModuleDefault(result, mod);
|
|
139736
|
+
return result;
|
|
139737
|
+
};
|
|
139738
|
+
})();
|
|
139739
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
139740
|
+
exports.LocalTranspiler = void 0;
|
|
139741
|
+
const abaplint = __importStar(__webpack_require__(/*! @abaplint/core */ "./node_modules/@abaplint/core/build/src/index.js"));
|
|
139742
|
+
const chunk_1 = __webpack_require__(/*! ../chunk */ "./node_modules/@abaplint/transpiler/build/src/chunk.js");
|
|
139743
|
+
/** LOCAL f (obsolete): f gets its value back when the FORM or function module ends, see FormTranspiler */
|
|
139744
|
+
class LocalTranspiler {
|
|
139745
|
+
transpile(node, traversal) {
|
|
139746
|
+
const field = node.findDirectExpression(abaplint.Expressions.FieldSub);
|
|
139747
|
+
if (field === undefined) {
|
|
139748
|
+
throw new Error("LocalTranspiler, field not found");
|
|
139749
|
+
}
|
|
139750
|
+
// a data object, or a component of a structure (LOCAL struc-comp)
|
|
139751
|
+
const first = field.getFirstToken();
|
|
139752
|
+
const variable = traversal.findCurrentScopeByToken(first)?.findVariable(first.getStr());
|
|
139753
|
+
const [, ...components] = field.concatTokens().toLowerCase().split("-");
|
|
139754
|
+
const name = traversal.prefixAndName(first, variable?.getFilename()).replace("~", "$")
|
|
139755
|
+
+ components.map(c => ".get()." + c).join("");
|
|
139756
|
+
const code = `{ const saved = ${name}.clone(); ${LocalTranspiler.LIST}.push(() => ${name}.set(saved)); }`;
|
|
139757
|
+
return new chunk_1.Chunk().append(code, node, traversal);
|
|
139758
|
+
}
|
|
139759
|
+
/** the variable of a procedure that holds what LOCAL puts back */
|
|
139760
|
+
static LIST = "localRestore";
|
|
139761
|
+
/** code around the body of a procedure with LOCAL: the values are put back however the procedure ends */
|
|
139762
|
+
static wrap(node) {
|
|
139763
|
+
if (node.findFirstStatement(abaplint.Statements.Local) === undefined) {
|
|
139764
|
+
return undefined;
|
|
139765
|
+
}
|
|
139766
|
+
return {
|
|
139767
|
+
open: `const ${LocalTranspiler.LIST} = [];\ntry {\n`,
|
|
139768
|
+
close: `} finally {\nfor (const restore of ${LocalTranspiler.LIST}.reverse()) {\nrestore();\n}\n}\n`,
|
|
139769
|
+
};
|
|
139770
|
+
}
|
|
139771
|
+
}
|
|
139772
|
+
exports.LocalTranspiler = LocalTranspiler;
|
|
139773
|
+
//# sourceMappingURL=local.js.map
|
|
139774
|
+
|
|
139775
|
+
/***/ },
|
|
139776
|
+
|
|
138806
139777
|
/***/ "./node_modules/@abaplint/transpiler/build/src/statements/log_point.js"
|
|
138807
139778
|
/*!*****************************************************************************!*\
|
|
138808
139779
|
!*** ./node_modules/@abaplint/transpiler/build/src/statements/log_point.js ***!
|
|
@@ -139369,6 +140340,15 @@ class MethodImplementationTranspiler {
|
|
|
139369
140340
|
after += `if (${varPrefixed}.constructor.name === "Character") {
|
|
139370
140341
|
${varPrefixed} = ${traversal.toType(identifier.getType())};
|
|
139371
140342
|
${varPrefixed}.set(${unique}?.${varName});
|
|
140343
|
+
}\n`;
|
|
140344
|
+
}
|
|
140345
|
+
else if (type instanceof abaplint.BasicTypes.XSequenceType) {
|
|
140346
|
+
// only a literal can be character-like here, its content is the bytes: '010203' is
|
|
140347
|
+
// x LENGTH 3, and an odd number of digits is filled with 0 on the right, '012' is 0120.
|
|
140348
|
+
// The empty string literal `` has no bytes; a Hex cannot have length 0
|
|
140349
|
+
after += `if (${varPrefixed}?.constructor.name === "Character" || ${varPrefixed}?.constructor.name === "String") {
|
|
140350
|
+
const hex = ${varPrefixed}.get().trimEnd();
|
|
140351
|
+
${varPrefixed} = hex.length === 0 ? new abap.types.XString() : new abap.types.Hex({length: Math.ceil(hex.length / 2)}).set(hex.padEnd(Math.ceil(hex.length / 2) * 2, "0"));
|
|
139372
140352
|
}\n`;
|
|
139373
140353
|
}
|
|
139374
140354
|
}
|
|
@@ -139815,7 +140795,11 @@ const chunk_1 = __webpack_require__(/*! ../chunk */ "./node_modules/@abaplint/tr
|
|
|
139815
140795
|
const modify_database_1 = __webpack_require__(/*! ./modify_database */ "./node_modules/@abaplint/transpiler/build/src/statements/modify_database.js");
|
|
139816
140796
|
class ModifyInternalTranspiler {
|
|
139817
140797
|
transpile(node, traversal) {
|
|
139818
|
-
const
|
|
140798
|
+
const targetNode = node.findDirectExpression(abaplint.Expressions.Target);
|
|
140799
|
+
const target = traversal.traverse(targetNode).getCode();
|
|
140800
|
+
if (node.getChildren().length === 3 && traversal.isDatabaseShortForm(targetNode)) {
|
|
140801
|
+
return new chunk_1.Chunk(`await abap.statements.modifyDatabase("${targetNode.concatTokens().toLowerCase()}", {values: ${target}});`);
|
|
140802
|
+
}
|
|
139819
140803
|
const extra = [];
|
|
139820
140804
|
const index = node.findExpressionAfterToken("INDEX");
|
|
139821
140805
|
if (index) {
|
|
@@ -140177,9 +141161,18 @@ class MoveCorrespondingTranspiler {
|
|
|
140177
141161
|
transpile(node, traversal) {
|
|
140178
141162
|
const target = new expressions_1.TargetTranspiler().transpile(node.findDirectExpression(abaplint.Expressions.SimpleTarget), traversal);
|
|
140179
141163
|
const source = traversal.traverse(node.findDirectExpression(abaplint.Expressions.Source));
|
|
141164
|
+
const concat = node.concatTokens().toUpperCase();
|
|
141165
|
+
const options = [];
|
|
141166
|
+
if (concat.includes(" KEEPING TARGET LINES")) {
|
|
141167
|
+
options.push("keepingTargetLines: true");
|
|
141168
|
+
}
|
|
141169
|
+
if (concat.includes(" EXPANDING NESTED TABLES")) {
|
|
141170
|
+
options.push("expandingNestedTables: true");
|
|
141171
|
+
}
|
|
141172
|
+
const extra = options.length > 0 ? ", {" + options.join(", ") + "}" : "";
|
|
140180
141173
|
return new chunk_1.Chunk().append("abap.statements.moveCorresponding(", node, traversal)
|
|
140181
141174
|
.join([source, target])
|
|
140182
|
-
.append(");", node.getLastToken(), traversal);
|
|
141175
|
+
.append(extra + ");", node.getLastToken(), traversal);
|
|
140183
141176
|
}
|
|
140184
141177
|
}
|
|
140185
141178
|
exports.MoveCorrespondingTranspiler = MoveCorrespondingTranspiler;
|
|
@@ -141019,6 +142012,27 @@ exports.RaiseTranspiler = RaiseTranspiler;
|
|
|
141019
142012
|
|
|
141020
142013
|
/***/ },
|
|
141021
142014
|
|
|
142015
|
+
/***/ "./node_modules/@abaplint/transpiler/build/src/statements/raise_entity_event.js"
|
|
142016
|
+
/*!**************************************************************************************!*\
|
|
142017
|
+
!*** ./node_modules/@abaplint/transpiler/build/src/statements/raise_entity_event.js ***!
|
|
142018
|
+
\**************************************************************************************/
|
|
142019
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
142020
|
+
|
|
142021
|
+
"use strict";
|
|
142022
|
+
|
|
142023
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
142024
|
+
exports.RaiseEntityEventTranspiler = void 0;
|
|
142025
|
+
const chunk_1 = __webpack_require__(/*! ../chunk */ "./node_modules/@abaplint/transpiler/build/src/chunk.js");
|
|
142026
|
+
class RaiseEntityEventTranspiler {
|
|
142027
|
+
transpile(_node, _traversal) {
|
|
142028
|
+
return new chunk_1.Chunk(`throw new Error("RAISE ENTITY EVENT, not supported, transpiler");`);
|
|
142029
|
+
}
|
|
142030
|
+
}
|
|
142031
|
+
exports.RaiseEntityEventTranspiler = RaiseEntityEventTranspiler;
|
|
142032
|
+
//# sourceMappingURL=raise_entity_event.js.map
|
|
142033
|
+
|
|
142034
|
+
/***/ },
|
|
142035
|
+
|
|
141022
142036
|
/***/ "./node_modules/@abaplint/transpiler/build/src/statements/raise_event.js"
|
|
141023
142037
|
/*!*******************************************************************************!*\
|
|
141024
142038
|
!*** ./node_modules/@abaplint/transpiler/build/src/statements/raise_event.js ***!
|
|
@@ -143021,6 +144035,27 @@ exports.SetLocaleTranspiler = SetLocaleTranspiler;
|
|
|
143021
144035
|
|
|
143022
144036
|
/***/ },
|
|
143023
144037
|
|
|
144038
|
+
/***/ "./node_modules/@abaplint/transpiler/build/src/statements/set_locks.js"
|
|
144039
|
+
/*!*****************************************************************************!*\
|
|
144040
|
+
!*** ./node_modules/@abaplint/transpiler/build/src/statements/set_locks.js ***!
|
|
144041
|
+
\*****************************************************************************/
|
|
144042
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
144043
|
+
|
|
144044
|
+
"use strict";
|
|
144045
|
+
|
|
144046
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
144047
|
+
exports.SetLocksTranspiler = void 0;
|
|
144048
|
+
const chunk_1 = __webpack_require__(/*! ../chunk */ "./node_modules/@abaplint/transpiler/build/src/chunk.js");
|
|
144049
|
+
class SetLocksTranspiler {
|
|
144050
|
+
transpile(_node, _traversal) {
|
|
144051
|
+
return new chunk_1.Chunk(`throw new Error("SET LOCKS, not supported, transpiler");`);
|
|
144052
|
+
}
|
|
144053
|
+
}
|
|
144054
|
+
exports.SetLocksTranspiler = SetLocksTranspiler;
|
|
144055
|
+
//# sourceMappingURL=set_locks.js.map
|
|
144056
|
+
|
|
144057
|
+
/***/ },
|
|
144058
|
+
|
|
143024
144059
|
/***/ "./node_modules/@abaplint/transpiler/build/src/statements/set_margin.js"
|
|
143025
144060
|
/*!******************************************************************************!*\
|
|
143026
144061
|
!*** ./node_modules/@abaplint/transpiler/build/src/statements/set_margin.js ***!
|
|
@@ -143147,6 +144182,32 @@ exports.SetPropertyTranspiler = SetPropertyTranspiler;
|
|
|
143147
144182
|
|
|
143148
144183
|
/***/ },
|
|
143149
144184
|
|
|
144185
|
+
/***/ "./node_modules/@abaplint/transpiler/build/src/statements/set_run_time.js"
|
|
144186
|
+
/*!********************************************************************************!*\
|
|
144187
|
+
!*** ./node_modules/@abaplint/transpiler/build/src/statements/set_run_time.js ***!
|
|
144188
|
+
\********************************************************************************/
|
|
144189
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
144190
|
+
|
|
144191
|
+
"use strict";
|
|
144192
|
+
|
|
144193
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
144194
|
+
exports.SetRunTimeTranspiler = void 0;
|
|
144195
|
+
const chunk_1 = __webpack_require__(/*! ../chunk */ "./node_modules/@abaplint/transpiler/build/src/chunk.js");
|
|
144196
|
+
class SetRunTimeTranspiler {
|
|
144197
|
+
transpile(node, traversal) {
|
|
144198
|
+
if (node.findDirectTokenByText("CLOCK")) {
|
|
144199
|
+
const resolution = node.findDirectTokenByText("LOW") ? "LOW" : "HIGH";
|
|
144200
|
+
return new chunk_1.Chunk().append(`abap.statements.setRunTimeClock("${resolution}");`, node, traversal);
|
|
144201
|
+
}
|
|
144202
|
+
// SET RUN TIME ANALYZER ON | OFF only switches the runtime analysis
|
|
144203
|
+
return new chunk_1.Chunk(``);
|
|
144204
|
+
}
|
|
144205
|
+
}
|
|
144206
|
+
exports.SetRunTimeTranspiler = SetRunTimeTranspiler;
|
|
144207
|
+
//# sourceMappingURL=set_run_time.js.map
|
|
144208
|
+
|
|
144209
|
+
/***/ },
|
|
144210
|
+
|
|
143150
144211
|
/***/ "./node_modules/@abaplint/transpiler/build/src/statements/set_screen.js"
|
|
143151
144212
|
/*!******************************************************************************!*\
|
|
143152
144213
|
!*** ./node_modules/@abaplint/transpiler/build/src/statements/set_screen.js ***!
|
|
@@ -144070,7 +145131,7 @@ class TranslateTranspiler {
|
|
|
144070
145131
|
else {
|
|
144071
145132
|
const s = node.findDirectExpression(abaplint.Expressions.Source);
|
|
144072
145133
|
if (s) {
|
|
144073
|
-
type = new expressions_1.SourceTranspiler(
|
|
145134
|
+
type = new expressions_1.SourceTranspiler(false).transpile(s, traversal).getCode();
|
|
144074
145135
|
}
|
|
144075
145136
|
else {
|
|
144076
145137
|
throw new Error("TranslateTranspiler, Source expression not found");
|
|
@@ -144147,6 +145208,28 @@ exports.TypeTranspiler = TypeTranspiler;
|
|
|
144147
145208
|
|
|
144148
145209
|
/***/ },
|
|
144149
145210
|
|
|
145211
|
+
/***/ "./node_modules/@abaplint/transpiler/build/src/statements/type_pool.js"
|
|
145212
|
+
/*!*****************************************************************************!*\
|
|
145213
|
+
!*** ./node_modules/@abaplint/transpiler/build/src/statements/type_pool.js ***!
|
|
145214
|
+
\*****************************************************************************/
|
|
145215
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
145216
|
+
|
|
145217
|
+
"use strict";
|
|
145218
|
+
|
|
145219
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
145220
|
+
exports.TypePoolTranspiler = void 0;
|
|
145221
|
+
const chunk_1 = __webpack_require__(/*! ../chunk */ "./node_modules/@abaplint/transpiler/build/src/chunk.js");
|
|
145222
|
+
class TypePoolTranspiler {
|
|
145223
|
+
transpile(_node, _traversal) {
|
|
145224
|
+
// a type pool is transpiled from its declarations, the statement itself has no code
|
|
145225
|
+
return new chunk_1.Chunk(``);
|
|
145226
|
+
}
|
|
145227
|
+
}
|
|
145228
|
+
exports.TypePoolTranspiler = TypePoolTranspiler;
|
|
145229
|
+
//# sourceMappingURL=type_pool.js.map
|
|
145230
|
+
|
|
145231
|
+
/***/ },
|
|
145232
|
+
|
|
144150
145233
|
/***/ "./node_modules/@abaplint/transpiler/build/src/statements/type_pools.js"
|
|
144151
145234
|
/*!******************************************************************************!*\
|
|
144152
145235
|
!*** ./node_modules/@abaplint/transpiler/build/src/statements/type_pools.js ***!
|
|
@@ -145937,16 +147020,24 @@ const abaplint = __importStar(__webpack_require__(/*! @abaplint/core */ "./node_
|
|
|
145937
147020
|
const traversal_1 = __webpack_require__(/*! ../traversal */ "./node_modules/@abaplint/transpiler/build/src/traversal.js");
|
|
145938
147021
|
const chunk_1 = __webpack_require__(/*! ../chunk */ "./node_modules/@abaplint/transpiler/build/src/chunk.js");
|
|
145939
147022
|
const inline_1 = __webpack_require__(/*! ../inline */ "./node_modules/@abaplint/transpiler/build/src/inline.js");
|
|
147023
|
+
const local_1 = __webpack_require__(/*! ../statements/local */ "./node_modules/@abaplint/transpiler/build/src/statements/local.js");
|
|
145940
147024
|
class FormTranspiler {
|
|
145941
147025
|
transpile(node, traversal) {
|
|
145942
147026
|
const formName = node.findFirstStatement(abaplint.Statements.Form)
|
|
145943
147027
|
?.findDirectExpression(abaplint.Expressions.FormName)?.concatTokens().toUpperCase();
|
|
145944
147028
|
const ret = new chunk_1.Chunk();
|
|
147029
|
+
const local = local_1.LocalTranspiler.wrap(node);
|
|
145945
147030
|
for (const c of node.getChildren()) {
|
|
147031
|
+
if (local && c.get() instanceof abaplint.Statements.EndForm) {
|
|
147032
|
+
ret.appendString(local.close);
|
|
147033
|
+
}
|
|
145946
147034
|
ret.appendChunk(traversal.traverse(c));
|
|
145947
147035
|
if (c.get() instanceof abaplint.Statements.Form) {
|
|
145948
147036
|
const declare = inline_1.InlineDeclarations.buildDeclarations(node, traversal);
|
|
145949
147037
|
ret.appendString(declare);
|
|
147038
|
+
if (local) {
|
|
147039
|
+
ret.appendString(local.open);
|
|
147040
|
+
}
|
|
145950
147041
|
}
|
|
145951
147042
|
}
|
|
145952
147043
|
if (formName && traversal.getCurrentObject().getType() === "PROG") {
|
|
@@ -146008,9 +147099,11 @@ const traversal_1 = __webpack_require__(/*! ../traversal */ "./node_modules/@aba
|
|
|
146008
147099
|
const chunk_1 = __webpack_require__(/*! ../chunk */ "./node_modules/@abaplint/transpiler/build/src/chunk.js");
|
|
146009
147100
|
const unique_identifier_1 = __webpack_require__(/*! ../unique_identifier */ "./node_modules/@abaplint/transpiler/build/src/unique_identifier.js");
|
|
146010
147101
|
const inline_1 = __webpack_require__(/*! ../inline */ "./node_modules/@abaplint/transpiler/build/src/inline.js");
|
|
147102
|
+
const local_1 = __webpack_require__(/*! ../statements/local */ "./node_modules/@abaplint/transpiler/build/src/statements/local.js");
|
|
146011
147103
|
class FunctionModuleTranspiler {
|
|
146012
147104
|
transpile(node, traversal) {
|
|
146013
147105
|
const chunk = new chunk_1.Chunk();
|
|
147106
|
+
const local = local_1.LocalTranspiler.wrap(node);
|
|
146014
147107
|
let name = "";
|
|
146015
147108
|
for (const c of node.getChildren()) {
|
|
146016
147109
|
if (c.get() instanceof abaplint.Statements.FunctionModule && c instanceof abaplint.Nodes.StatementNode) {
|
|
@@ -146021,8 +147114,14 @@ class FunctionModuleTranspiler {
|
|
|
146021
147114
|
chunk.append(`async function ${traversal_1.Traversal.escapeNamespace(name)}(INPUT) {\n`, c, traversal);
|
|
146022
147115
|
chunk.appendString(this.findSignature(traversal, name, c));
|
|
146023
147116
|
chunk.appendString(inline_1.InlineDeclarations.buildDeclarations(node, traversal));
|
|
147117
|
+
if (local) {
|
|
147118
|
+
chunk.appendString(local.open);
|
|
147119
|
+
}
|
|
146024
147120
|
}
|
|
146025
147121
|
else if (c.get() instanceof abaplint.Statements.EndFunction) {
|
|
147122
|
+
if (local) {
|
|
147123
|
+
chunk.appendString(local.close);
|
|
147124
|
+
}
|
|
146026
147125
|
chunk.append("}\n", c, traversal);
|
|
146027
147126
|
chunk.appendString(`abap.FunctionModules['${name.toUpperCase()}'] = ${traversal_1.Traversal.escapeNamespace(name)};\n`);
|
|
146028
147127
|
}
|
|
@@ -146118,12 +147217,14 @@ __exportStar(__webpack_require__(/*! ./interface */ "./node_modules/@abaplint/tr
|
|
|
146118
147217
|
__exportStar(__webpack_require__(/*! ./loop */ "./node_modules/@abaplint/transpiler/build/src/structures/loop.js"), exports);
|
|
146119
147218
|
__exportStar(__webpack_require__(/*! ./loop_extract */ "./node_modules/@abaplint/transpiler/build/src/structures/loop_extract.js"), exports);
|
|
146120
147219
|
__exportStar(__webpack_require__(/*! ./provide */ "./node_modules/@abaplint/transpiler/build/src/structures/provide.js"), exports);
|
|
147220
|
+
__exportStar(__webpack_require__(/*! ./on_change */ "./node_modules/@abaplint/transpiler/build/src/structures/on_change.js"), exports);
|
|
146121
147221
|
__exportStar(__webpack_require__(/*! ./module */ "./node_modules/@abaplint/transpiler/build/src/structures/module.js"), exports);
|
|
146122
147222
|
__exportStar(__webpack_require__(/*! ./select */ "./node_modules/@abaplint/transpiler/build/src/structures/select.js"), exports);
|
|
146123
147223
|
__exportStar(__webpack_require__(/*! ./method */ "./node_modules/@abaplint/transpiler/build/src/structures/method.js"), exports);
|
|
146124
147224
|
__exportStar(__webpack_require__(/*! ./try */ "./node_modules/@abaplint/transpiler/build/src/structures/try.js"), exports);
|
|
146125
147225
|
__exportStar(__webpack_require__(/*! ./type_enum */ "./node_modules/@abaplint/transpiler/build/src/structures/type_enum.js"), exports);
|
|
146126
147226
|
__exportStar(__webpack_require__(/*! ./types */ "./node_modules/@abaplint/transpiler/build/src/structures/types.js"), exports);
|
|
147227
|
+
__exportStar(__webpack_require__(/*! ./type_mesh */ "./node_modules/@abaplint/transpiler/build/src/structures/type_mesh.js"), exports);
|
|
146127
147228
|
__exportStar(__webpack_require__(/*! ./when */ "./node_modules/@abaplint/transpiler/build/src/structures/when.js"), exports);
|
|
146128
147229
|
__exportStar(__webpack_require__(/*! ./while */ "./node_modules/@abaplint/transpiler/build/src/structures/while.js"), exports);
|
|
146129
147230
|
__exportStar(__webpack_require__(/*! ./with */ "./node_modules/@abaplint/transpiler/build/src/structures/with.js"), exports);
|
|
@@ -146637,6 +147738,85 @@ exports.ModuleTranspiler = ModuleTranspiler;
|
|
|
146637
147738
|
|
|
146638
147739
|
/***/ },
|
|
146639
147740
|
|
|
147741
|
+
/***/ "./node_modules/@abaplint/transpiler/build/src/structures/on_change.js"
|
|
147742
|
+
/*!*****************************************************************************!*\
|
|
147743
|
+
!*** ./node_modules/@abaplint/transpiler/build/src/structures/on_change.js ***!
|
|
147744
|
+
\*****************************************************************************/
|
|
147745
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
147746
|
+
|
|
147747
|
+
"use strict";
|
|
147748
|
+
|
|
147749
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
147750
|
+
if (k2 === undefined) k2 = k;
|
|
147751
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
147752
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
147753
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
147754
|
+
}
|
|
147755
|
+
Object.defineProperty(o, k2, desc);
|
|
147756
|
+
}) : (function(o, m, k, k2) {
|
|
147757
|
+
if (k2 === undefined) k2 = k;
|
|
147758
|
+
o[k2] = m[k];
|
|
147759
|
+
}));
|
|
147760
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
147761
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
147762
|
+
}) : function(o, v) {
|
|
147763
|
+
o["default"] = v;
|
|
147764
|
+
});
|
|
147765
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
147766
|
+
var ownKeys = function(o) {
|
|
147767
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
147768
|
+
var ar = [];
|
|
147769
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
147770
|
+
return ar;
|
|
147771
|
+
};
|
|
147772
|
+
return ownKeys(o);
|
|
147773
|
+
};
|
|
147774
|
+
return function (mod) {
|
|
147775
|
+
if (mod && mod.__esModule) return mod;
|
|
147776
|
+
var result = {};
|
|
147777
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
147778
|
+
__setModuleDefault(result, mod);
|
|
147779
|
+
return result;
|
|
147780
|
+
};
|
|
147781
|
+
})();
|
|
147782
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
147783
|
+
exports.OnChangeTranspiler = void 0;
|
|
147784
|
+
const abaplint = __importStar(__webpack_require__(/*! @abaplint/core */ "./node_modules/@abaplint/core/build/src/index.js"));
|
|
147785
|
+
const chunk_1 = __webpack_require__(/*! ../chunk */ "./node_modules/@abaplint/transpiler/build/src/chunk.js");
|
|
147786
|
+
/** ON CHANGE OF f [OR g ...] (obsolete): the block runs when a field differs from what this statement saw the last
|
|
147787
|
+
* time it ran, the first time when a field is not initial; the runtime keeps the last values per statement */
|
|
147788
|
+
class OnChangeTranspiler {
|
|
147789
|
+
transpile(node, traversal) {
|
|
147790
|
+
const ret = new chunk_1.Chunk();
|
|
147791
|
+
const on = node.findDirectStatement(abaplint.Statements.OnChange);
|
|
147792
|
+
if (on === undefined) {
|
|
147793
|
+
throw new Error("OnChangeTranspiler, statement not found");
|
|
147794
|
+
}
|
|
147795
|
+
const fields = on.findDirectExpressions(abaplint.Expressions.Target).map(t => traversal.traverse(t).getCode());
|
|
147796
|
+
const start = on.getFirstToken().getStart();
|
|
147797
|
+
const key = JSON.stringify(traversal.getFilename() + ":" + start.getRow() + ":" + start.getCol());
|
|
147798
|
+
ret.append(`if (abap.statements.onChange(${key}, [${fields.join(", ")}])) {\n`, on, traversal);
|
|
147799
|
+
const body = node.findDirectStructure(abaplint.Structures.Body);
|
|
147800
|
+
if (body) {
|
|
147801
|
+
ret.appendChunk(traversal.traverse(body));
|
|
147802
|
+
}
|
|
147803
|
+
const otherwise = node.findDirectStructure(abaplint.Structures.Else);
|
|
147804
|
+
if (otherwise) {
|
|
147805
|
+
ret.appendString("} else {\n");
|
|
147806
|
+
const elseBody = otherwise.findDirectStructure(abaplint.Structures.Body);
|
|
147807
|
+
if (elseBody) {
|
|
147808
|
+
ret.appendChunk(traversal.traverse(elseBody));
|
|
147809
|
+
}
|
|
147810
|
+
}
|
|
147811
|
+
ret.appendString("}\n");
|
|
147812
|
+
return ret;
|
|
147813
|
+
}
|
|
147814
|
+
}
|
|
147815
|
+
exports.OnChangeTranspiler = OnChangeTranspiler;
|
|
147816
|
+
//# sourceMappingURL=on_change.js.map
|
|
147817
|
+
|
|
147818
|
+
/***/ },
|
|
147819
|
+
|
|
146640
147820
|
/***/ "./node_modules/@abaplint/transpiler/build/src/structures/provide.js"
|
|
146641
147821
|
/*!***************************************************************************!*\
|
|
146642
147822
|
!*** ./node_modules/@abaplint/transpiler/build/src/structures/provide.js ***!
|
|
@@ -147008,6 +148188,28 @@ exports.TypeEnumTranspiler = TypeEnumTranspiler;
|
|
|
147008
148188
|
|
|
147009
148189
|
/***/ },
|
|
147010
148190
|
|
|
148191
|
+
/***/ "./node_modules/@abaplint/transpiler/build/src/structures/type_mesh.js"
|
|
148192
|
+
/*!*****************************************************************************!*\
|
|
148193
|
+
!*** ./node_modules/@abaplint/transpiler/build/src/structures/type_mesh.js ***!
|
|
148194
|
+
\*****************************************************************************/
|
|
148195
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
148196
|
+
|
|
148197
|
+
"use strict";
|
|
148198
|
+
|
|
148199
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
148200
|
+
exports.TypeMeshTranspiler = void 0;
|
|
148201
|
+
const chunk_1 = __webpack_require__(/*! ../chunk */ "./node_modules/@abaplint/transpiler/build/src/chunk.js");
|
|
148202
|
+
class TypeMeshTranspiler {
|
|
148203
|
+
transpile(_node, _traversal) {
|
|
148204
|
+
// a mesh is a type, and types have no code, see TypesTranspiler
|
|
148205
|
+
return new chunk_1.Chunk("");
|
|
148206
|
+
}
|
|
148207
|
+
}
|
|
148208
|
+
exports.TypeMeshTranspiler = TypeMeshTranspiler;
|
|
148209
|
+
//# sourceMappingURL=type_mesh.js.map
|
|
148210
|
+
|
|
148211
|
+
/***/ },
|
|
148212
|
+
|
|
147011
148213
|
/***/ "./node_modules/@abaplint/transpiler/build/src/structures/types.js"
|
|
147012
148214
|
/*!*************************************************************************!*\
|
|
147013
148215
|
!*** ./node_modules/@abaplint/transpiler/build/src/structures/types.js ***!
|
|
@@ -147793,6 +148995,15 @@ class Traversal {
|
|
|
147793
148995
|
return undefined;
|
|
147794
148996
|
}
|
|
147795
148997
|
scopeCache = undefined;
|
|
148998
|
+
/** MODIFY name. and DELETE name [FROM wa].: the name is a database table unless it is a variable of table type */
|
|
148999
|
+
isDatabaseShortForm(target) {
|
|
149000
|
+
if (target === undefined || target.getChildren().length !== 1) {
|
|
149001
|
+
return false;
|
|
149002
|
+
}
|
|
149003
|
+
const token = target.getFirstToken();
|
|
149004
|
+
const type = this.findCurrentScopeByToken(token)?.findVariable(token.getStr())?.getType();
|
|
149005
|
+
return !(type instanceof abaplint.BasicTypes.TableType);
|
|
149006
|
+
}
|
|
147796
149007
|
findCurrentScopeByToken(token) {
|
|
147797
149008
|
const filename = this.file.getFilename();
|
|
147798
149009
|
if (this.scopeCache
|
|
@@ -149745,10 +150956,11 @@ class Validation {
|
|
|
149745
150956
|
const conf = new core_1.Config(JSON.stringify(exports.config));
|
|
149746
150957
|
reg.setConfig(conf);
|
|
149747
150958
|
const issues = reg.findIssues();
|
|
149748
|
-
return issues.filter(i => i.getKey() !== "ambiguous_statement" || this.
|
|
150959
|
+
return issues.filter(i => i.getKey() !== "ambiguous_statement" || this.isUnambiguous(reg, i) === false);
|
|
149749
150960
|
}
|
|
149750
|
-
/**
|
|
149751
|
-
|
|
150961
|
+
/** DELETE name., DELETE name FROM x., MODIFY name. and MODIFY name FROM x. read two ways, so abaplint calls them
|
|
150962
|
+
* ambiguous. ABAP decides by the name: a variable of table type is the internal table, anything else the database table */
|
|
150963
|
+
isUnambiguous(reg, issue) {
|
|
149752
150964
|
const file = reg.getFileByName(issue.getFilename());
|
|
149753
150965
|
const obj = file ? reg.findObjectForFile(file) : undefined;
|
|
149754
150966
|
if (!(obj instanceof core_1.ABAPObject)) {
|
|
@@ -149757,9 +150969,11 @@ class Validation {
|
|
|
149757
150969
|
const statement = obj.getABAPFileByName(issue.getFilename())?.getStatements()
|
|
149758
150970
|
.find(s => s.getStart().equals(issue.getStart()));
|
|
149759
150971
|
const token = statement?.getTokens()[1];
|
|
149760
|
-
if (statement === undefined || token === undefined
|
|
149761
|
-
|
|
149762
|
-
|
|
150972
|
+
if (statement === undefined || token === undefined || token.getStr().toUpperCase() === "TABLE") {
|
|
150973
|
+
return false;
|
|
150974
|
+
}
|
|
150975
|
+
const modify = statement.getFirstToken().getStr().toUpperCase() === "MODIFY";
|
|
150976
|
+
if (modify === false && !(statement.get() instanceof core_1.Statements.DeleteInternal)) {
|
|
149763
150977
|
return false;
|
|
149764
150978
|
}
|
|
149765
150979
|
let spaghetti = this.scopes.get(obj);
|
|
@@ -149768,7 +150982,10 @@ class Validation {
|
|
|
149768
150982
|
this.scopes.set(obj, spaghetti);
|
|
149769
150983
|
}
|
|
149770
150984
|
const variable = spaghetti.lookupPosition(token.getStart(), issue.getFilename())?.findVariable(token.getStr());
|
|
149771
|
-
|
|
150985
|
+
if (variable?.getType() instanceof core_1.BasicTypes.TableType) {
|
|
150986
|
+
return true;
|
|
150987
|
+
}
|
|
150988
|
+
return variable !== undefined || statement.findExpressionAfterToken("FROM") !== undefined;
|
|
149772
150989
|
}
|
|
149773
150990
|
}
|
|
149774
150991
|
exports.Validation = Validation;
|