@abaplint/transpiler-cli 2.14.28 → 2.14.29
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 +527 -47
- package/package.json +3 -3
package/build/bundle.js
CHANGED
|
@@ -28985,6 +28985,167 @@ exports.Procedural = Procedural;
|
|
|
28985
28985
|
|
|
28986
28986
|
/***/ },
|
|
28987
28987
|
|
|
28988
|
+
/***/ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_raise_message.js"
|
|
28989
|
+
/*!*******************************************************************************!*\
|
|
28990
|
+
!*** ./node_modules/@abaplint/core/build/src/abap/5_syntax/_raise_message.js ***!
|
|
28991
|
+
\*******************************************************************************/
|
|
28992
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
28993
|
+
|
|
28994
|
+
"use strict";
|
|
28995
|
+
|
|
28996
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
28997
|
+
if (k2 === undefined) k2 = k;
|
|
28998
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
28999
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
29000
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
29001
|
+
}
|
|
29002
|
+
Object.defineProperty(o, k2, desc);
|
|
29003
|
+
}) : (function(o, m, k, k2) {
|
|
29004
|
+
if (k2 === undefined) k2 = k;
|
|
29005
|
+
o[k2] = m[k];
|
|
29006
|
+
}));
|
|
29007
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
29008
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
29009
|
+
}) : function(o, v) {
|
|
29010
|
+
o["default"] = v;
|
|
29011
|
+
});
|
|
29012
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
29013
|
+
var ownKeys = function(o) {
|
|
29014
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
29015
|
+
var ar = [];
|
|
29016
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
29017
|
+
return ar;
|
|
29018
|
+
};
|
|
29019
|
+
return ownKeys(o);
|
|
29020
|
+
};
|
|
29021
|
+
return function (mod) {
|
|
29022
|
+
if (mod && mod.__esModule) return mod;
|
|
29023
|
+
var result = {};
|
|
29024
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
29025
|
+
__setModuleDefault(result, mod);
|
|
29026
|
+
return result;
|
|
29027
|
+
};
|
|
29028
|
+
})();
|
|
29029
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
29030
|
+
exports.RaiseMessage = void 0;
|
|
29031
|
+
const Expressions = __importStar(__webpack_require__(/*! ../2_statements/expressions */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js"));
|
|
29032
|
+
const nodes_1 = __webpack_require__(/*! ../nodes */ "./node_modules/@abaplint/core/build/src/abap/nodes/index.js");
|
|
29033
|
+
const _syntax_input_1 = __webpack_require__(/*! ./_syntax_input */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_syntax_input.js");
|
|
29034
|
+
const T100_INTERFACES = new Set(["IF_T100_MESSAGE", "IF_T100_DYN_MSG"]);
|
|
29035
|
+
// the root exception classes, they implement IF_MESSAGE and IF_SERIALIZABLE_OBJECT, but not the T100 interfaces
|
|
29036
|
+
const ROOT_EXCEPTIONS = new Set(["CX_ROOT", "CX_STATIC_CHECK", "CX_DYNAMIC_CHECK", "CX_NO_CHECK"]);
|
|
29037
|
+
/** RAISE EXCEPTION TYPE cx MESSAGE ... and THROW cx( MESSAGE ... ) require the exception class to implement
|
|
29038
|
+
* IF_T100_MESSAGE or IF_T100_DYN_MSG, and with RAISE EXCEPTION the constructor parameter TEXTID cannot be
|
|
29039
|
+
* passed in addition to MESSAGE, see the ABAP keyword documentation for RAISE EXCEPTION, MESSAGE.
|
|
29040
|
+
* The interface check only reports when the full class hierarchy is known, void classes and void interfaces
|
|
29041
|
+
* in the hierarchy are skipped, except for the root exception classes. */
|
|
29042
|
+
class RaiseMessage {
|
|
29043
|
+
static checkRaise(node, input) {
|
|
29044
|
+
var _a, _b, _c;
|
|
29045
|
+
var _d;
|
|
29046
|
+
const classTok = (_a = node.findDirectExpression(Expressions.ClassName)) === null || _a === void 0 ? void 0 : _a.getFirstToken();
|
|
29047
|
+
if (classTok === undefined || RaiseMessage.hasMessage(node) === false) {
|
|
29048
|
+
return;
|
|
29049
|
+
}
|
|
29050
|
+
for (const p of (_d = (_b = node.findDirectExpression(Expressions.ParameterListS)) === null || _b === void 0 ? void 0 : _b.findDirectExpressions(Expressions.ParameterS)) !== null && _d !== void 0 ? _d : []) {
|
|
29051
|
+
const name = (_c = p.findDirectExpression(Expressions.ParameterName)) === null || _c === void 0 ? void 0 : _c.getFirstToken();
|
|
29052
|
+
if ((name === null || name === void 0 ? void 0 : name.getStr().toUpperCase()) === "TEXTID") {
|
|
29053
|
+
const message = "RAISE EXCEPTION with MESSAGE, TEXTID cannot be passed";
|
|
29054
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, name, message));
|
|
29055
|
+
return;
|
|
29056
|
+
}
|
|
29057
|
+
}
|
|
29058
|
+
RaiseMessage.checkClass(classTok.getStr(), input, classTok);
|
|
29059
|
+
}
|
|
29060
|
+
static checkThrow(node, input) {
|
|
29061
|
+
var _a;
|
|
29062
|
+
const classTok = (_a = node.findDirectExpression(Expressions.ClassName)) === null || _a === void 0 ? void 0 : _a.getFirstToken();
|
|
29063
|
+
if (classTok === undefined || node.findDirectExpression(Expressions.MessageSource) === undefined) {
|
|
29064
|
+
return;
|
|
29065
|
+
}
|
|
29066
|
+
RaiseMessage.checkClass(classTok.getStr(), input, classTok);
|
|
29067
|
+
}
|
|
29068
|
+
/** MESSAGE msg or MESSAGE ID, but not USING MESSAGE */
|
|
29069
|
+
static hasMessage(node) {
|
|
29070
|
+
const children = node.getChildren();
|
|
29071
|
+
for (let i = 0; i < children.length; i++) {
|
|
29072
|
+
const c = children[i];
|
|
29073
|
+
if (c instanceof nodes_1.TokenNode && c.getFirstToken().getStr().toUpperCase() === "MESSAGE") {
|
|
29074
|
+
const previous = children[i - 1];
|
|
29075
|
+
if (previous === undefined || previous.getFirstToken().getStr().toUpperCase() !== "USING") {
|
|
29076
|
+
return true;
|
|
29077
|
+
}
|
|
29078
|
+
}
|
|
29079
|
+
}
|
|
29080
|
+
return false;
|
|
29081
|
+
}
|
|
29082
|
+
static checkClass(className, input, classTok) {
|
|
29083
|
+
const def = input.scope.findClassDefinition(className);
|
|
29084
|
+
if (def === undefined) {
|
|
29085
|
+
return;
|
|
29086
|
+
}
|
|
29087
|
+
if (RaiseMessage.isT100(def, input.scope, new Set()) === false) {
|
|
29088
|
+
const message = "Exception class " + def.getName().toUpperCase() +
|
|
29089
|
+
" must implement IF_T100_MESSAGE or IF_T100_DYN_MSG to be raised with MESSAGE";
|
|
29090
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, classTok, message));
|
|
29091
|
+
}
|
|
29092
|
+
}
|
|
29093
|
+
/** true or false when known, undefined when the hierarchy contains void parts */
|
|
29094
|
+
static isT100(def, scope, visited) {
|
|
29095
|
+
var _a;
|
|
29096
|
+
const upper = def.getName().toUpperCase();
|
|
29097
|
+
if (visited.has(upper)) {
|
|
29098
|
+
return undefined;
|
|
29099
|
+
}
|
|
29100
|
+
visited.add(upper);
|
|
29101
|
+
let unknown = false;
|
|
29102
|
+
const interfaces = def.getImplementing().map(i => i.name.toUpperCase());
|
|
29103
|
+
const seen = new Set();
|
|
29104
|
+
while (interfaces.length > 0) {
|
|
29105
|
+
const name = interfaces.pop();
|
|
29106
|
+
if (seen.has(name)) {
|
|
29107
|
+
continue;
|
|
29108
|
+
}
|
|
29109
|
+
seen.add(name);
|
|
29110
|
+
if (T100_INTERFACES.has(name)) {
|
|
29111
|
+
return true;
|
|
29112
|
+
}
|
|
29113
|
+
const idef = scope.findInterfaceDefinition(name);
|
|
29114
|
+
if (idef === undefined) {
|
|
29115
|
+
unknown = true;
|
|
29116
|
+
}
|
|
29117
|
+
else {
|
|
29118
|
+
interfaces.push(...idef.getImplementing().map(i => i.name.toUpperCase()));
|
|
29119
|
+
}
|
|
29120
|
+
}
|
|
29121
|
+
const superName = (_a = def.getSuperClass()) === null || _a === void 0 ? void 0 : _a.toUpperCase();
|
|
29122
|
+
if (superName !== undefined) {
|
|
29123
|
+
const superDef = scope.findClassDefinition(superName);
|
|
29124
|
+
if (superDef !== undefined) {
|
|
29125
|
+
const res = RaiseMessage.isT100(superDef, scope, visited);
|
|
29126
|
+
if (res === true) {
|
|
29127
|
+
return true;
|
|
29128
|
+
}
|
|
29129
|
+
else if (res === undefined) {
|
|
29130
|
+
unknown = true;
|
|
29131
|
+
}
|
|
29132
|
+
}
|
|
29133
|
+
else if (ROOT_EXCEPTIONS.has(superName) === false) {
|
|
29134
|
+
unknown = true;
|
|
29135
|
+
}
|
|
29136
|
+
}
|
|
29137
|
+
else if (ROOT_EXCEPTIONS.has(upper) === false) {
|
|
29138
|
+
// not an exception class, reported elsewhere or not at all
|
|
29139
|
+
unknown = true;
|
|
29140
|
+
}
|
|
29141
|
+
return unknown ? undefined : false;
|
|
29142
|
+
}
|
|
29143
|
+
}
|
|
29144
|
+
exports.RaiseMessage = RaiseMessage;
|
|
29145
|
+
//# sourceMappingURL=_raise_message.js.map
|
|
29146
|
+
|
|
29147
|
+
/***/ },
|
|
29148
|
+
|
|
28988
29149
|
/***/ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_reference.js"
|
|
28989
29150
|
/*!***************************************************************************!*\
|
|
28990
29151
|
!*** ./node_modules/@abaplint/core/build/src/abap/5_syntax/_reference.js ***!
|
|
@@ -29163,16 +29324,19 @@ class SortedKeyWrite {
|
|
|
29163
29324
|
if (this.procedure === undefined) {
|
|
29164
29325
|
return;
|
|
29165
29326
|
}
|
|
29166
|
-
// any assignment of a field symbol or reference ends its binding
|
|
29167
|
-
|
|
29168
|
-
|
|
29169
|
-
|
|
29170
|
-
|
|
29171
|
-
|
|
29172
|
-
|
|
29173
|
-
|
|
29174
|
-
|
|
29175
|
-
|
|
29327
|
+
// any assignment of a field symbol or reference ends its binding,
|
|
29328
|
+
// skipped when nothing is bound, this runs for every statement
|
|
29329
|
+
if (this.bindings.size > 0) {
|
|
29330
|
+
for (const fs of node.findAllExpressions(Expressions.FSTarget)) {
|
|
29331
|
+
this.unbind(fs.findFirstExpression(Expressions.TargetFieldSymbol), input.scope);
|
|
29332
|
+
}
|
|
29333
|
+
if (node.get() instanceof Statements.Unassign) {
|
|
29334
|
+
this.unbind(node.findDirectExpression(Expressions.TargetFieldSymbol), input.scope);
|
|
29335
|
+
}
|
|
29336
|
+
for (const target of node.findAllExpressions(Expressions.Target)) {
|
|
29337
|
+
if (target.getChildren().length === 1) {
|
|
29338
|
+
this.unbind(target.findDirectExpression(Expressions.TargetField), input.scope);
|
|
29339
|
+
}
|
|
29176
29340
|
}
|
|
29177
29341
|
}
|
|
29178
29342
|
const s = node.get();
|
|
@@ -31764,7 +31928,19 @@ const _syntax_input_1 = __webpack_require__(/*! ../_syntax_input */ "./node_modu
|
|
|
31764
31928
|
// a syntax error. Other types, a dynamic offset or length and "*" (undefined) are left alone, as is
|
|
31765
31929
|
// length 0. The offset is applied first, so the length is compared to what remains after the offset.
|
|
31766
31930
|
// A substring of a date, time or numeric text field has type n; its bounds are not checked.
|
|
31931
|
+
// An offset or length on a numeric field (i, int8, p, f, decfloat) is a syntax error, whatever its value,
|
|
31932
|
+
// except a length without offset covering the full packed field, eg. "lv_p(5)" for "lv_p(5) TYPE p".
|
|
31767
31933
|
function substringType(context, offset, length, node, input) {
|
|
31934
|
+
const numericName = numericTypeName(context);
|
|
31935
|
+
if (context instanceof basic_1.PackedType && offset === undefined && length === context.getLength()) {
|
|
31936
|
+
// the offset is checked in a separate call before the length, so this is a length without offset
|
|
31937
|
+
return context;
|
|
31938
|
+
}
|
|
31939
|
+
else if (numericName !== undefined) {
|
|
31940
|
+
const message = `Offset or length specification not possible on a field of numeric type "${numericName}"`;
|
|
31941
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
|
|
31942
|
+
return basic_1.VoidType.get(_syntax_input_1.CheckSyntaxKey);
|
|
31943
|
+
}
|
|
31768
31944
|
if (context instanceof basic_1.DateType || context instanceof basic_1.TimeType || context instanceof basic_1.NumericType) {
|
|
31769
31945
|
return numericSubstringType(context, offset, length);
|
|
31770
31946
|
}
|
|
@@ -31790,6 +31966,30 @@ function substringType(context, offset, length, node, input) {
|
|
|
31790
31966
|
}
|
|
31791
31967
|
return context;
|
|
31792
31968
|
}
|
|
31969
|
+
function numericTypeName(context) {
|
|
31970
|
+
if (context instanceof basic_1.IntegerType) {
|
|
31971
|
+
return "I";
|
|
31972
|
+
}
|
|
31973
|
+
else if (context instanceof basic_1.Integer8Type) {
|
|
31974
|
+
return "INT8";
|
|
31975
|
+
}
|
|
31976
|
+
else if (context instanceof basic_1.PackedType) {
|
|
31977
|
+
return "P";
|
|
31978
|
+
}
|
|
31979
|
+
else if (context instanceof basic_1.FloatType || context instanceof basic_1.FloatingPointType) {
|
|
31980
|
+
return "F";
|
|
31981
|
+
}
|
|
31982
|
+
else if (context instanceof basic_1.DecFloat16Type) {
|
|
31983
|
+
return "DECFLOAT16";
|
|
31984
|
+
}
|
|
31985
|
+
else if (context instanceof basic_1.DecFloat34Type) {
|
|
31986
|
+
return "DECFLOAT34";
|
|
31987
|
+
}
|
|
31988
|
+
else if (context instanceof basic_1.DecFloatType) {
|
|
31989
|
+
return "DECFLOAT";
|
|
31990
|
+
}
|
|
31991
|
+
return undefined;
|
|
31992
|
+
}
|
|
31793
31993
|
function numericSubstringType(context, offset, length) {
|
|
31794
31994
|
const hasOffset = offset !== undefined && offset > 0;
|
|
31795
31995
|
const hasLength = length !== undefined && length > 0;
|
|
@@ -32929,6 +33129,7 @@ const Expressions = __importStar(__webpack_require__(/*! ../../2_statements/expr
|
|
|
32929
33129
|
const source_1 = __webpack_require__(/*! ./source */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/source.js");
|
|
32930
33130
|
const let_1 = __webpack_require__(/*! ./let */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/let.js");
|
|
32931
33131
|
const cond_1 = __webpack_require__(/*! ./cond */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/cond.js");
|
|
33132
|
+
const _raise_message_1 = __webpack_require__(/*! ../_raise_message */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_raise_message.js");
|
|
32932
33133
|
class CondBody {
|
|
32933
33134
|
static runSyntax(node, input, targetType) {
|
|
32934
33135
|
if (node === undefined) {
|
|
@@ -32939,6 +33140,9 @@ class CondBody {
|
|
|
32939
33140
|
if (l) {
|
|
32940
33141
|
scoped = let_1.Let.runSyntax(l, input);
|
|
32941
33142
|
}
|
|
33143
|
+
for (const t of node.findDirectExpressions(Expressions.Throw)) {
|
|
33144
|
+
_raise_message_1.RaiseMessage.checkThrow(t, input);
|
|
33145
|
+
}
|
|
32942
33146
|
for (const s of node.findDirectExpressions(Expressions.Cond)) {
|
|
32943
33147
|
cond_1.Cond.runSyntax(s, input);
|
|
32944
33148
|
}
|
|
@@ -37579,8 +37783,9 @@ class Source {
|
|
|
37579
37783
|
/** The calculation type of an arithmetic expression is the most general of the
|
|
37580
37784
|
* operand types. An operand of type c, n, d, t or string is converted into it and
|
|
37581
37785
|
* never becomes the result: "lv_f * '0.25'" is a float, not a character field of
|
|
37582
|
-
* length four.
|
|
37583
|
-
*
|
|
37786
|
+
* length four. Date and time operands count as numbers of days and seconds, type i:
|
|
37787
|
+
* "lv_end - lv_start" is a number of days, not a date. Returns undefined when neither
|
|
37788
|
+
* operand is numeric, leaving the decision to the caller. */
|
|
37584
37789
|
static calculationType(left, right) {
|
|
37585
37790
|
if (left === undefined || right === undefined) {
|
|
37586
37791
|
return undefined;
|
|
@@ -37592,12 +37797,27 @@ class Source {
|
|
|
37592
37797
|
else if (right instanceof basic_1.VoidType || right instanceof unknown_type_1.UnknownType) {
|
|
37593
37798
|
return right;
|
|
37594
37799
|
}
|
|
37800
|
+
const dateOrTime = left instanceof basic_1.DateType || left instanceof basic_1.TimeType
|
|
37801
|
+
|| right instanceof basic_1.DateType || right instanceof basic_1.TimeType;
|
|
37802
|
+
if (left instanceof basic_1.DateType || left instanceof basic_1.TimeType) {
|
|
37803
|
+
left = basic_1.IntegerType.get();
|
|
37804
|
+
}
|
|
37805
|
+
if (right instanceof basic_1.DateType || right instanceof basic_1.TimeType) {
|
|
37806
|
+
right = basic_1.IntegerType.get();
|
|
37807
|
+
}
|
|
37595
37808
|
const leftRank = this.numericRank(left);
|
|
37596
37809
|
const rightRank = this.numericRank(right);
|
|
37597
37810
|
if (leftRank === undefined && rightRank === undefined) {
|
|
37598
37811
|
return undefined;
|
|
37599
37812
|
}
|
|
37600
|
-
|
|
37813
|
+
// a character-like operand next to a date or time counts as p: "lv_date + '5'" is p
|
|
37814
|
+
if (leftRank === undefined && this.isCharacterLike(left) && dateOrTime) {
|
|
37815
|
+
return rightRank >= 3 ? right : new basic_1.PackedType(8, 0);
|
|
37816
|
+
}
|
|
37817
|
+
else if (rightRank === undefined && this.isCharacterLike(right) && dateOrTime) {
|
|
37818
|
+
return leftRank >= 3 ? left : new basic_1.PackedType(8, 0);
|
|
37819
|
+
}
|
|
37820
|
+
if (rightRank === undefined) {
|
|
37601
37821
|
return left;
|
|
37602
37822
|
}
|
|
37603
37823
|
else if (leftRank === undefined) {
|
|
@@ -37605,6 +37825,9 @@ class Source {
|
|
|
37605
37825
|
}
|
|
37606
37826
|
return leftRank >= rightRank ? left : right;
|
|
37607
37827
|
}
|
|
37828
|
+
static isCharacterLike(type) {
|
|
37829
|
+
return type instanceof basic_1.CharacterType || type instanceof basic_1.NumericType || type instanceof basic_1.StringType;
|
|
37830
|
+
}
|
|
37608
37831
|
static numericRank(type) {
|
|
37609
37832
|
if (type instanceof basic_1.DecFloat34Type) {
|
|
37610
37833
|
return 6;
|
|
@@ -38512,6 +38735,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
|
38512
38735
|
exports.SwitchBody = void 0;
|
|
38513
38736
|
const Expressions = __importStar(__webpack_require__(/*! ../../2_statements/expressions */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js"));
|
|
38514
38737
|
const source_1 = __webpack_require__(/*! ./source */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/source.js");
|
|
38738
|
+
const _raise_message_1 = __webpack_require__(/*! ../_raise_message */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_raise_message.js");
|
|
38515
38739
|
const _syntax_input_1 = __webpack_require__(/*! ../_syntax_input */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_syntax_input.js");
|
|
38516
38740
|
const basic_1 = __webpack_require__(/*! ../../types/basic */ "./node_modules/@abaplint/core/build/src/abap/types/basic/index.js");
|
|
38517
38741
|
class SwitchBody {
|
|
@@ -38519,6 +38743,9 @@ class SwitchBody {
|
|
|
38519
38743
|
if (node === undefined) {
|
|
38520
38744
|
return;
|
|
38521
38745
|
}
|
|
38746
|
+
for (const t of node.findDirectExpressions(Expressions.Throw)) {
|
|
38747
|
+
_raise_message_1.RaiseMessage.checkThrow(t, input);
|
|
38748
|
+
}
|
|
38522
38749
|
const thenSource = node.findExpressionAfterToken("THEN");
|
|
38523
38750
|
if (!((thenSource === null || thenSource === void 0 ? void 0 : thenSource.get()) instanceof Expressions.Source)) {
|
|
38524
38751
|
const message = "SwitchBody, unexpected";
|
|
@@ -45460,6 +45687,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
45460
45687
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
45461
45688
|
exports.Loop = void 0;
|
|
45462
45689
|
const Expressions = __importStar(__webpack_require__(/*! ../../2_statements/expressions */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js"));
|
|
45690
|
+
const nodes_1 = __webpack_require__(/*! ../../nodes */ "./node_modules/@abaplint/core/build/src/abap/nodes/index.js");
|
|
45463
45691
|
const basic_1 = __webpack_require__(/*! ../../types/basic */ "./node_modules/@abaplint/core/build/src/abap/types/basic/index.js");
|
|
45464
45692
|
const target_1 = __webpack_require__(/*! ../expressions/target */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/target.js");
|
|
45465
45693
|
const source_1 = __webpack_require__(/*! ../expressions/source */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/source.js");
|
|
@@ -45571,6 +45799,17 @@ class Loop {
|
|
|
45571
45799
|
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
|
|
45572
45800
|
return;
|
|
45573
45801
|
}
|
|
45802
|
+
if (key.type === basic_1.TableAccessType.sorted && key.keyFields.length > 0) {
|
|
45803
|
+
// the first component of a sorted secondary key must be compared with = or IS INITIAL
|
|
45804
|
+
// in a part of the condition joined by AND, otherwise the WHERE cannot be optimized
|
|
45805
|
+
const first = key.keyFields[0].toUpperCase();
|
|
45806
|
+
if (this.hasKeyCompare(cond, first) === false) {
|
|
45807
|
+
const message = "Loop, WHERE cannot be optimized for secondary key " + name +
|
|
45808
|
+
", key component " + first + " needs a comparison with = or IS INITIAL joined by AND";
|
|
45809
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
|
|
45810
|
+
return;
|
|
45811
|
+
}
|
|
45812
|
+
}
|
|
45574
45813
|
if (!(0, version_1.releaseAtLeast)(input.scope.getRelease(), version_1.Release.v740sp02)) {
|
|
45575
45814
|
const compares = cond.findAllExpressionsRecursive(Expressions.ComponentCompare).map(c => c.concatTokens().toUpperCase());
|
|
45576
45815
|
for (const keyField of key.keyFields) {
|
|
@@ -45611,6 +45850,31 @@ class Loop {
|
|
|
45611
45850
|
loop_group_by_1.LoopGroupBy.runSyntax(group, input);
|
|
45612
45851
|
}
|
|
45613
45852
|
}
|
|
45853
|
+
// true if a conjunct reachable through AND only, ie. not under OR or NOT, compares the component with = or IS INITIAL
|
|
45854
|
+
hasKeyCompare(cond, component) {
|
|
45855
|
+
if (cond.findDirectTokenByText("OR") !== undefined) {
|
|
45856
|
+
return false;
|
|
45857
|
+
}
|
|
45858
|
+
for (const child of cond.getChildren()) {
|
|
45859
|
+
if (child.get() instanceof Expressions.ComponentCompare && child instanceof nodes_1.ExpressionNode) {
|
|
45860
|
+
const concat = child.concatTokens().toUpperCase().replace(/\s+/g, " ");
|
|
45861
|
+
if (concat.startsWith(component + " = ")
|
|
45862
|
+
|| concat.startsWith(component + " EQ ")
|
|
45863
|
+
|| concat === component + " IS INITIAL") {
|
|
45864
|
+
return true;
|
|
45865
|
+
}
|
|
45866
|
+
}
|
|
45867
|
+
else if (child.get() instanceof Expressions.ComponentCondSub
|
|
45868
|
+
&& child instanceof nodes_1.ExpressionNode
|
|
45869
|
+
&& child.findDirectTokenByText("NOT") === undefined) {
|
|
45870
|
+
const sub = child.findDirectExpression(Expressions.ComponentCond);
|
|
45871
|
+
if (sub !== undefined && this.hasKeyCompare(sub, component)) {
|
|
45872
|
+
return true;
|
|
45873
|
+
}
|
|
45874
|
+
}
|
|
45875
|
+
}
|
|
45876
|
+
return false;
|
|
45877
|
+
}
|
|
45614
45878
|
}
|
|
45615
45879
|
exports.Loop = Loop;
|
|
45616
45880
|
//# sourceMappingURL=loop.js.map
|
|
@@ -46978,6 +47242,7 @@ const raise_with_1 = __webpack_require__(/*! ../expressions/raise_with */ "./nod
|
|
|
46978
47242
|
const _object_oriented_1 = __webpack_require__(/*! ../_object_oriented */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_object_oriented.js");
|
|
46979
47243
|
const method_parameters_1 = __webpack_require__(/*! ../expressions/method_parameters */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/method_parameters.js");
|
|
46980
47244
|
const _syntax_input_1 = __webpack_require__(/*! ../_syntax_input */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_syntax_input.js");
|
|
47245
|
+
const _raise_message_1 = __webpack_require__(/*! ../_raise_message */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_raise_message.js");
|
|
46981
47246
|
class Raise {
|
|
46982
47247
|
runSyntax(node, input) {
|
|
46983
47248
|
// todo
|
|
@@ -47037,6 +47302,7 @@ class Raise {
|
|
|
47037
47302
|
if (param) {
|
|
47038
47303
|
new method_parameters_1.MethodParameters().checkExporting(param, input, method, true);
|
|
47039
47304
|
}
|
|
47305
|
+
_raise_message_1.RaiseMessage.checkRaise(node, input);
|
|
47040
47306
|
for (const s of node.findDirectExpressions(Expressions.RaiseWith)) {
|
|
47041
47307
|
raise_with_1.RaiseWith.runSyntax(s, input);
|
|
47042
47308
|
}
|
|
@@ -51024,6 +51290,107 @@ exports.Statics = Statics;
|
|
|
51024
51290
|
|
|
51025
51291
|
/***/ },
|
|
51026
51292
|
|
|
51293
|
+
/***/ "./node_modules/@abaplint/core/build/src/abap/5_syntax/structures/try.js"
|
|
51294
|
+
/*!*******************************************************************************!*\
|
|
51295
|
+
!*** ./node_modules/@abaplint/core/build/src/abap/5_syntax/structures/try.js ***!
|
|
51296
|
+
\*******************************************************************************/
|
|
51297
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
51298
|
+
|
|
51299
|
+
"use strict";
|
|
51300
|
+
|
|
51301
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
51302
|
+
if (k2 === undefined) k2 = k;
|
|
51303
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
51304
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
51305
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
51306
|
+
}
|
|
51307
|
+
Object.defineProperty(o, k2, desc);
|
|
51308
|
+
}) : (function(o, m, k, k2) {
|
|
51309
|
+
if (k2 === undefined) k2 = k;
|
|
51310
|
+
o[k2] = m[k];
|
|
51311
|
+
}));
|
|
51312
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
51313
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
51314
|
+
}) : function(o, v) {
|
|
51315
|
+
o["default"] = v;
|
|
51316
|
+
});
|
|
51317
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
51318
|
+
var ownKeys = function(o) {
|
|
51319
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
51320
|
+
var ar = [];
|
|
51321
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
51322
|
+
return ar;
|
|
51323
|
+
};
|
|
51324
|
+
return ownKeys(o);
|
|
51325
|
+
};
|
|
51326
|
+
return function (mod) {
|
|
51327
|
+
if (mod && mod.__esModule) return mod;
|
|
51328
|
+
var result = {};
|
|
51329
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
51330
|
+
__setModuleDefault(result, mod);
|
|
51331
|
+
return result;
|
|
51332
|
+
};
|
|
51333
|
+
})();
|
|
51334
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
51335
|
+
exports.Try = void 0;
|
|
51336
|
+
const Expressions = __importStar(__webpack_require__(/*! ../../2_statements/expressions */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js"));
|
|
51337
|
+
const Statements = __importStar(__webpack_require__(/*! ../../2_statements/statements */ "./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js"));
|
|
51338
|
+
const Structures = __importStar(__webpack_require__(/*! ../../3_structures/structures */ "./node_modules/@abaplint/core/build/src/abap/3_structures/structures/index.js"));
|
|
51339
|
+
const _syntax_input_1 = __webpack_require__(/*! ../_syntax_input */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_syntax_input.js");
|
|
51340
|
+
// "special exceptions must be caught before general exceptions", a CATCH of a class that inherits
|
|
51341
|
+
// from a class named in an earlier CATCH of the same TRY can never be reached, this is a syntax error
|
|
51342
|
+
// only reported when the lineage of the later class is known up to the earlier class, void classes are skipped
|
|
51343
|
+
class Try {
|
|
51344
|
+
static runSyntax(node, input) {
|
|
51345
|
+
const caught = new Set();
|
|
51346
|
+
for (const catchStructure of node.findDirectStructures(Structures.Catch)) {
|
|
51347
|
+
const statement = catchStructure.findDirectStatement(Statements.Catch);
|
|
51348
|
+
if (statement === undefined) {
|
|
51349
|
+
continue;
|
|
51350
|
+
}
|
|
51351
|
+
const names = [];
|
|
51352
|
+
for (const c of statement.findDirectExpressions(Expressions.ClassName)) {
|
|
51353
|
+
const token = c.getFirstToken();
|
|
51354
|
+
const className = token.getStr().toUpperCase();
|
|
51355
|
+
names.push(className);
|
|
51356
|
+
if (caught.size === 0) {
|
|
51357
|
+
continue;
|
|
51358
|
+
}
|
|
51359
|
+
const superclass = this.findCaughtSuperclass(className, caught, input);
|
|
51360
|
+
if (superclass !== undefined) {
|
|
51361
|
+
const message = `CATCH of ${className} after the CATCH of its superclass ${superclass}`;
|
|
51362
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, token, message));
|
|
51363
|
+
return;
|
|
51364
|
+
}
|
|
51365
|
+
}
|
|
51366
|
+
for (const name of names) {
|
|
51367
|
+
caught.add(name);
|
|
51368
|
+
}
|
|
51369
|
+
}
|
|
51370
|
+
}
|
|
51371
|
+
static findCaughtSuperclass(className, caught, input) {
|
|
51372
|
+
var _a;
|
|
51373
|
+
const visited = new Set([className]);
|
|
51374
|
+
let current = input.scope.findClassDefinition(className);
|
|
51375
|
+
while (current !== undefined) {
|
|
51376
|
+
const superclass = (_a = current.getSuperClass()) === null || _a === void 0 ? void 0 : _a.toUpperCase();
|
|
51377
|
+
if (superclass === undefined || visited.has(superclass)) {
|
|
51378
|
+
return undefined;
|
|
51379
|
+
}
|
|
51380
|
+
else if (caught.has(superclass)) {
|
|
51381
|
+
return superclass;
|
|
51382
|
+
}
|
|
51383
|
+
visited.add(superclass);
|
|
51384
|
+
current = input.scope.findClassDefinition(superclass);
|
|
51385
|
+
}
|
|
51386
|
+
return undefined;
|
|
51387
|
+
}
|
|
51388
|
+
}
|
|
51389
|
+
exports.Try = Try;
|
|
51390
|
+
//# sourceMappingURL=try.js.map
|
|
51391
|
+
|
|
51392
|
+
/***/ },
|
|
51393
|
+
|
|
51027
51394
|
/***/ "./node_modules/@abaplint/core/build/src/abap/5_syntax/structures/type_enum.js"
|
|
51028
51395
|
/*!*************************************************************************************!*\
|
|
51029
51396
|
!*** ./node_modules/@abaplint/core/build/src/abap/5_syntax/structures/type_enum.js ***!
|
|
@@ -51431,6 +51798,7 @@ const types_1 = __webpack_require__(/*! ./structures/types */ "./node_modules/@a
|
|
|
51431
51798
|
const statics_1 = __webpack_require__(/*! ./structures/statics */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/structures/statics.js");
|
|
51432
51799
|
const constants_1 = __webpack_require__(/*! ./structures/constants */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/structures/constants.js");
|
|
51433
51800
|
const cleanup_1 = __webpack_require__(/*! ./structures/cleanup */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/structures/cleanup.js");
|
|
51801
|
+
const try_1 = __webpack_require__(/*! ./structures/try */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/structures/try.js");
|
|
51434
51802
|
const class_definition_1 = __webpack_require__(/*! ../types/class_definition */ "./node_modules/@abaplint/core/build/src/abap/types/class_definition.js");
|
|
51435
51803
|
const interface_definition_1 = __webpack_require__(/*! ../types/interface_definition */ "./node_modules/@abaplint/core/build/src/abap/types/interface_definition.js");
|
|
51436
51804
|
const delete_memory_1 = __webpack_require__(/*! ./statements/delete_memory */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/statements/delete_memory.js");
|
|
@@ -51916,6 +52284,9 @@ class SyntaxLogic {
|
|
|
51916
52284
|
else if (stru instanceof Structures.Cleanup) {
|
|
51917
52285
|
cleanup_1.Cleanup.runSyntax(node, input);
|
|
51918
52286
|
}
|
|
52287
|
+
else if (stru instanceof Structures.Try) {
|
|
52288
|
+
try_1.Try.runSyntax(node, input);
|
|
52289
|
+
}
|
|
51919
52290
|
return false;
|
|
51920
52291
|
}
|
|
51921
52292
|
updateScopeStatement(node) {
|
|
@@ -74376,7 +74747,7 @@ class Registry {
|
|
|
74376
74747
|
}
|
|
74377
74748
|
static abaplintVersion() {
|
|
74378
74749
|
// magic, see build script "version.js"
|
|
74379
|
-
return "2.120.
|
|
74750
|
+
return "2.120.103";
|
|
74380
74751
|
}
|
|
74381
74752
|
getDDICReferences() {
|
|
74382
74753
|
return this.ddicReferences;
|
|
@@ -92004,13 +92375,18 @@ class FullyTypeConstants extends _abap_rule_1.ABAPRule {
|
|
|
92004
92375
|
if ((stat.get() instanceof Statements.Constant
|
|
92005
92376
|
|| (this.conf.checkData === true && stat.get() instanceof Statements.Data))
|
|
92006
92377
|
&& !this.isTyped(stat)) {
|
|
92378
|
+
if (stat.get() instanceof Statements.Data && stat.findDirectExpression(expressions_1.DataDefinition) === undefined) {
|
|
92379
|
+
// unnamed field, eg. "DATA (10)." inside DATA BEGIN OF, cannot be typed
|
|
92380
|
+
continue;
|
|
92381
|
+
}
|
|
92007
92382
|
const type = stat.get() instanceof Statements.Constant ? "constant definition" : "data definition";
|
|
92008
92383
|
let token = (_a = stat.findFirstExpression(expressions_1.NamespaceSimpleName)) === null || _a === void 0 ? void 0 : _a.getFirstToken();
|
|
92009
92384
|
if (token === undefined) {
|
|
92010
92385
|
token = (_b = stat.findFirstExpression(expressions_1.DefinitionName)) === null || _b === void 0 ? void 0 : _b.getFirstToken();
|
|
92011
92386
|
}
|
|
92012
92387
|
if (token === undefined) {
|
|
92013
|
-
|
|
92388
|
+
const start = stat.getFirstToken().getStart();
|
|
92389
|
+
throw new Error(`fully type constants: unexpected node, ${file.getFilename()}, row ${start.getRow()}, col ${start.getCol()}, statement "${stat.concatTokens()}"`);
|
|
92014
92390
|
}
|
|
92015
92391
|
issues.push(issue_1.Issue.atToken(file, token, this.getDescription(type), this.getMetadata().key, this.conf.severity));
|
|
92016
92392
|
}
|
|
@@ -125505,8 +125881,12 @@ exports.InlineDeclarations = void 0;
|
|
|
125505
125881
|
const abaplint = __importStar(__webpack_require__(/*! @abaplint/core */ "./node_modules/@abaplint/core/build/src/index.js"));
|
|
125506
125882
|
const statements_1 = __webpack_require__(/*! ./statements */ "./node_modules/@abaplint/transpiler/build/src/statements/index.js");
|
|
125507
125883
|
class InlineDeclarations {
|
|
125508
|
-
static buildDeclarations(node, traversal) {
|
|
125509
|
-
const
|
|
125884
|
+
static buildDeclarations(node, traversal, programLevelOnly = false) {
|
|
125885
|
+
const include = (expression) => {
|
|
125886
|
+
return programLevelOnly === false
|
|
125887
|
+
|| InlineDeclarations.isProgramLevelScope(traversal.findCurrentScopeByToken(expression.getFirstToken()));
|
|
125888
|
+
};
|
|
125889
|
+
const inlineDataExpressions = node.findAllExpressionsRecursive(abaplint.Expressions.InlineData).filter(include);
|
|
125510
125890
|
let result = "";
|
|
125511
125891
|
for (const expression of inlineDataExpressions) {
|
|
125512
125892
|
const name = expression.findFirstExpression(abaplint.Expressions.TargetField)?.concatTokens();
|
|
@@ -125521,7 +125901,7 @@ class InlineDeclarations {
|
|
|
125521
125901
|
result += traversal.declare(variable) + "\n";
|
|
125522
125902
|
}
|
|
125523
125903
|
// todo: declare DATA and FSes according to when they appear in the code
|
|
125524
|
-
const inlineFieldSymbols = node.findAllExpressionsRecursive(abaplint.Expressions.InlineFS);
|
|
125904
|
+
const inlineFieldSymbols = node.findAllExpressionsRecursive(abaplint.Expressions.InlineFS).filter(include);
|
|
125525
125905
|
for (const expression of inlineFieldSymbols) {
|
|
125526
125906
|
const target = expression.findFirstExpression(abaplint.Expressions.TargetFieldSymbol);
|
|
125527
125907
|
if (target === undefined) {
|
|
@@ -125531,6 +125911,12 @@ class InlineDeclarations {
|
|
|
125531
125911
|
}
|
|
125532
125912
|
return result;
|
|
125533
125913
|
}
|
|
125914
|
+
/** inline declarations outside FORMs, methods and function modules belong to the program, or to an
|
|
125915
|
+
* event block like START-OF-SELECTION, which is also program global */
|
|
125916
|
+
static isProgramLevelScope(scope) {
|
|
125917
|
+
const stype = scope?.getIdentifier().stype;
|
|
125918
|
+
return stype === abaplint.ScopeType.Program || stype === abaplint.ScopeType.SelectionEvent;
|
|
125919
|
+
}
|
|
125534
125920
|
}
|
|
125535
125921
|
exports.InlineDeclarations = InlineDeclarations;
|
|
125536
125922
|
//# sourceMappingURL=inline.js.map
|
|
@@ -127940,8 +128326,14 @@ exports.ClearTranspiler = void 0;
|
|
|
127940
128326
|
const abaplint = __importStar(__webpack_require__(/*! @abaplint/core */ "./node_modules/@abaplint/core/build/src/index.js"));
|
|
127941
128327
|
const chunk_1 = __webpack_require__(/*! ../chunk */ "./node_modules/@abaplint/transpiler/build/src/chunk.js");
|
|
127942
128328
|
class ClearTranspiler {
|
|
128329
|
+
body;
|
|
128330
|
+
/** body: FREE, which clears the body of a table with a header line; CLEAR clears its header line */
|
|
128331
|
+
constructor(body = false) {
|
|
128332
|
+
this.body = body;
|
|
128333
|
+
}
|
|
127943
128334
|
transpile(node, traversal) {
|
|
127944
|
-
const
|
|
128335
|
+
const targetNode = node.findDirectExpression(abaplint.Expressions.Target);
|
|
128336
|
+
const target = traversal.traverse(targetNode);
|
|
127945
128337
|
// Reference implementation for the source-map convention:
|
|
127946
128338
|
// - keep the target's own expression-level mappings by appending its Chunk
|
|
127947
128339
|
// (do NOT flatten with target.getCode(), that discards the mappings)
|
|
@@ -127949,9 +128341,24 @@ class ClearTranspiler {
|
|
|
127949
128341
|
// getEnd() which points one column past the statement
|
|
127950
128342
|
const ret = new chunk_1.Chunk();
|
|
127951
128343
|
ret.appendChunk(target);
|
|
127952
|
-
|
|
128344
|
+
if (this.body === false && targetNode && ClearTranspiler.isHeaderLineTable(targetNode, traversal)) {
|
|
128345
|
+
// CLEAR itab of a table with a header line clears the header line, CLEAR itab[] the rows
|
|
128346
|
+
ret.append(".getHeader().clear();", node.getLastToken(), traversal);
|
|
128347
|
+
}
|
|
128348
|
+
else {
|
|
128349
|
+
ret.append(".clear();", node.getLastToken(), traversal);
|
|
128350
|
+
}
|
|
127953
128351
|
return ret;
|
|
127954
128352
|
}
|
|
128353
|
+
/** the target is the plain name of a table with a header line (not itab[]) */
|
|
128354
|
+
static isHeaderLineTable(target, traversal) {
|
|
128355
|
+
if (target.getChildren().length !== 1 || !(target.getFirstChild()?.get() instanceof abaplint.Expressions.TargetField)) {
|
|
128356
|
+
return false;
|
|
128357
|
+
}
|
|
128358
|
+
const name = target.getFirstToken();
|
|
128359
|
+
const type = traversal.findCurrentScopeByToken(name)?.findVariable(name.getStr().replace(/^!/, ""))?.getType();
|
|
128360
|
+
return type instanceof abaplint.BasicTypes.TableType && type.isWithHeader();
|
|
128361
|
+
}
|
|
127955
128362
|
}
|
|
127956
128363
|
exports.ClearTranspiler = ClearTranspiler;
|
|
127957
128364
|
//# sourceMappingURL=clear.js.map
|
|
@@ -130564,7 +130971,8 @@ exports.FreeTranspiler = void 0;
|
|
|
130564
130971
|
const clear_1 = __webpack_require__(/*! ./clear */ "./node_modules/@abaplint/transpiler/build/src/statements/clear.js");
|
|
130565
130972
|
class FreeTranspiler {
|
|
130566
130973
|
transpile(node, traversal) {
|
|
130567
|
-
|
|
130974
|
+
// FREE of a table with a header line frees the table body, not the header line
|
|
130975
|
+
return new clear_1.ClearTranspiler(true).transpile(node, traversal);
|
|
130568
130976
|
}
|
|
130569
130977
|
}
|
|
130570
130978
|
exports.FreeTranspiler = FreeTranspiler;
|
|
@@ -131439,6 +131847,7 @@ __exportStar(__webpack_require__(/*! ./move_corresponding */ "./node_modules/@ab
|
|
|
131439
131847
|
__exportStar(__webpack_require__(/*! ./move */ "./node_modules/@abaplint/transpiler/build/src/statements/move.js"), exports);
|
|
131440
131848
|
__exportStar(__webpack_require__(/*! ./multiply */ "./node_modules/@abaplint/transpiler/build/src/statements/multiply.js"), exports);
|
|
131441
131849
|
__exportStar(__webpack_require__(/*! ./native_sql */ "./node_modules/@abaplint/transpiler/build/src/statements/native_sql.js"), exports);
|
|
131850
|
+
__exportStar(__webpack_require__(/*! ./new_line */ "./node_modules/@abaplint/transpiler/build/src/statements/new_line.js"), exports);
|
|
131442
131851
|
__exportStar(__webpack_require__(/*! ./new_page */ "./node_modules/@abaplint/transpiler/build/src/statements/new_page.js"), exports);
|
|
131443
131852
|
__exportStar(__webpack_require__(/*! ./open_cursor */ "./node_modules/@abaplint/transpiler/build/src/statements/open_cursor.js"), exports);
|
|
131444
131853
|
__exportStar(__webpack_require__(/*! ./open_dataset */ "./node_modules/@abaplint/transpiler/build/src/statements/open_dataset.js"), exports);
|
|
@@ -133177,6 +133586,28 @@ exports.NativeSQLTranspiler = NativeSQLTranspiler;
|
|
|
133177
133586
|
|
|
133178
133587
|
/***/ },
|
|
133179
133588
|
|
|
133589
|
+
/***/ "./node_modules/@abaplint/transpiler/build/src/statements/new_line.js"
|
|
133590
|
+
/*!****************************************************************************!*\
|
|
133591
|
+
!*** ./node_modules/@abaplint/transpiler/build/src/statements/new_line.js ***!
|
|
133592
|
+
\****************************************************************************/
|
|
133593
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
133594
|
+
|
|
133595
|
+
"use strict";
|
|
133596
|
+
|
|
133597
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
133598
|
+
exports.NewLineTranspiler = void 0;
|
|
133599
|
+
const chunk_1 = __webpack_require__(/*! ../chunk */ "./node_modules/@abaplint/transpiler/build/src/chunk.js");
|
|
133600
|
+
class NewLineTranspiler {
|
|
133601
|
+
transpile(node, traversal) {
|
|
133602
|
+
// NEW-LINE [NO-SCROLLING | SCROLLING]: the next output starts a new line, scrolling has no effect on the text
|
|
133603
|
+
return new chunk_1.Chunk().append("abap.statements.newLine();", node, traversal);
|
|
133604
|
+
}
|
|
133605
|
+
}
|
|
133606
|
+
exports.NewLineTranspiler = NewLineTranspiler;
|
|
133607
|
+
//# sourceMappingURL=new_line.js.map
|
|
133608
|
+
|
|
133609
|
+
/***/ },
|
|
133610
|
+
|
|
133180
133611
|
/***/ "./node_modules/@abaplint/transpiler/build/src/statements/new_page.js"
|
|
133181
133612
|
/*!****************************************************************************!*\
|
|
133182
133613
|
!*** ./node_modules/@abaplint/transpiler/build/src/statements/new_page.js ***!
|
|
@@ -134207,6 +134638,34 @@ class ReadTableTranspiler {
|
|
|
134207
134638
|
extra.push("into: " + name);
|
|
134208
134639
|
}
|
|
134209
134640
|
}
|
|
134641
|
+
// COMPARING comp1 comp2 ... | ALL FIELDS, TRANSPORTING comp1 comp2 ...
|
|
134642
|
+
const children = node.getChildren();
|
|
134643
|
+
const comparingAt = children.findIndex(c => c instanceof abaplint.Nodes.TokenNode && c.concatTokens().toUpperCase() === "COMPARING");
|
|
134644
|
+
let transported = undefined;
|
|
134645
|
+
if (comparingAt >= 0) {
|
|
134646
|
+
const names = [];
|
|
134647
|
+
for (let i = comparingAt + 1; i < children.length; i++) {
|
|
134648
|
+
const c = children[i];
|
|
134649
|
+
if (!(c instanceof abaplint.Nodes.ExpressionNode) || !(c.get() instanceof abaplint.Expressions.FieldSub)) {
|
|
134650
|
+
break;
|
|
134651
|
+
}
|
|
134652
|
+
names.push(c.concatTokens().toLowerCase());
|
|
134653
|
+
}
|
|
134654
|
+
// the parser can read "COMPARING a TRANSPORTING b" as four compared names
|
|
134655
|
+
const cut = names.indexOf("transporting");
|
|
134656
|
+
if (cut >= 0) {
|
|
134657
|
+
transported = names.slice(cut + 1);
|
|
134658
|
+
names.splice(cut);
|
|
134659
|
+
}
|
|
134660
|
+
extra.push("comparing: " + JSON.stringify(names.join(" ") === "all fields" ? ["*"] : names));
|
|
134661
|
+
}
|
|
134662
|
+
const transportingFields = node.findDirectExpression(abaplint.Expressions.TransportingFields);
|
|
134663
|
+
if (transportingFields) {
|
|
134664
|
+
transported = transportingFields.findAllExpressions(abaplint.Expressions.FieldSub).map(f => f.concatTokens().toLowerCase());
|
|
134665
|
+
}
|
|
134666
|
+
if (transported !== undefined && transported.join(" ") !== "all fields") {
|
|
134667
|
+
extra.push("transporting: " + JSON.stringify(transported));
|
|
134668
|
+
}
|
|
134210
134669
|
const compare = node.findDirectExpression(abaplint.Expressions.ComponentCompareSimple);
|
|
134211
134670
|
if (compare) {
|
|
134212
134671
|
const withKey = [];
|
|
@@ -138660,7 +139119,6 @@ const at_last_1 = __webpack_require__(/*! ./at_last */ "./node_modules/@abaplint
|
|
|
138660
139119
|
const unique_identifier_1 = __webpack_require__(/*! ../unique_identifier */ "./node_modules/@abaplint/transpiler/build/src/unique_identifier.js");
|
|
138661
139120
|
const statements_1 = __webpack_require__(/*! ../statements */ "./node_modules/@abaplint/transpiler/build/src/statements/index.js");
|
|
138662
139121
|
const at_1 = __webpack_require__(/*! ./at */ "./node_modules/@abaplint/transpiler/build/src/structures/at.js");
|
|
138663
|
-
const inline_1 = __webpack_require__(/*! ../inline */ "./node_modules/@abaplint/transpiler/build/src/inline.js");
|
|
138664
139122
|
class LoopTranspiler {
|
|
138665
139123
|
transpile(node, traversal) {
|
|
138666
139124
|
const ret = new chunk_1.Chunk();
|
|
@@ -138682,11 +139140,6 @@ class LoopTranspiler {
|
|
|
138682
139140
|
const hasAtLast = (node.findDirectStructure(abaplint.Structures.Body)
|
|
138683
139141
|
?.findDirectStructures(abaplint.Structures.Normal) || [])
|
|
138684
139142
|
.some(n => n.findDirectStructure(abaplint.Structures.AtLast) !== undefined);
|
|
138685
|
-
const scope = traversal.findCurrentScopeByToken(node.getFirstToken());
|
|
138686
|
-
if (scope?.getIdentifier().stype === abaplint.ScopeType.Program
|
|
138687
|
-
|| scope?.getIdentifier().stype === abaplint.ScopeType.SelectionEvent) {
|
|
138688
|
-
ret.appendString(inline_1.InlineDeclarations.buildDeclarations(node, traversal));
|
|
138689
|
-
}
|
|
138690
139143
|
if (hasAtLast) {
|
|
138691
139144
|
atLastFlag = unique_identifier_1.UniqueIdentifier.get();
|
|
138692
139145
|
ret.appendString(`let ${atLastFlag} = false;\n`);
|
|
@@ -139024,54 +139477,71 @@ class TryTranspiler {
|
|
|
139024
139477
|
return ret;
|
|
139025
139478
|
}
|
|
139026
139479
|
/////////////////////
|
|
139480
|
+
// Built as chunks, not as strings: the bodies keep their source mappings, so a stack frame, a
|
|
139481
|
+
// source map or a debugger can name an ABAP line inside a CATCH or CLEANUP block
|
|
139027
139482
|
buildHandlerCode(nodes, cleanup, traversal) {
|
|
139028
|
-
let ret = "";
|
|
139029
|
-
let first = true;
|
|
139030
139483
|
if (nodes.length === 0 && cleanup === undefined) {
|
|
139031
139484
|
return undefined;
|
|
139032
139485
|
}
|
|
139033
|
-
ret
|
|
139486
|
+
const ret = new chunk_1.Chunk();
|
|
139487
|
+
ret.appendString(`} catch (e) {\n`);
|
|
139488
|
+
let first = true;
|
|
139034
139489
|
for (const n of nodes) {
|
|
139035
139490
|
const catchStatement = n.findDirectStatement(abaplint.Statements.Catch);
|
|
139036
139491
|
if (catchStatement === undefined) {
|
|
139037
139492
|
throw "TryTranspiler, unexpected structure";
|
|
139038
139493
|
}
|
|
139039
139494
|
const catchNames = catchStatement.findDirectExpressions(abaplint.Expressions.ClassName).map(e => traversal.lookupClassOrInterface(e.concatTokens(), e.getFirstToken()));
|
|
139040
|
-
|
|
139495
|
+
if (first === false) {
|
|
139496
|
+
ret.appendString(" else ");
|
|
139497
|
+
}
|
|
139041
139498
|
first = false;
|
|
139042
|
-
ret
|
|
139499
|
+
ret.append("if (" + catchNames?.map(n => "(" + n + " && e instanceof " + n + ")").join(" || ") + ") {\n", catchStatement, traversal);
|
|
139043
139500
|
const intoNode = catchStatement.findExpressionAfterToken("INTO");
|
|
139044
139501
|
if (intoNode) {
|
|
139045
|
-
ret
|
|
139502
|
+
ret.appendChunk(traversal.traverse(intoNode)).appendString(".set(e);\n");
|
|
139046
139503
|
}
|
|
139047
139504
|
const body = n.findDirectStructure(abaplint.Structures.Body);
|
|
139048
139505
|
if (body) {
|
|
139049
|
-
ret
|
|
139506
|
+
ret.appendChunk(traversal.traverse(body));
|
|
139050
139507
|
}
|
|
139051
|
-
ret
|
|
139508
|
+
ret.appendString("}");
|
|
139052
139509
|
}
|
|
139053
139510
|
// unhandled in this TRY-CATCH, or a javascript runtime error
|
|
139054
|
-
|
|
139055
|
-
|
|
139056
|
-
|
|
139511
|
+
if (nodes.length > 0) {
|
|
139512
|
+
ret.appendString(` else {\n`);
|
|
139513
|
+
}
|
|
139514
|
+
this.appendCleanupCode(ret, cleanup, traversal);
|
|
139515
|
+
ret.appendString(`throw e;\n`);
|
|
139516
|
+
if (nodes.length > 0) {
|
|
139517
|
+
ret.appendString(`}\n`);
|
|
139518
|
+
}
|
|
139519
|
+
return ret;
|
|
139057
139520
|
}
|
|
139058
139521
|
/** CLEANUP runs when a class based exception leaves the TRY block, not for an exception raised
|
|
139059
139522
|
* in a CATCH block of the same TRY, and not for javascript runtime errors */
|
|
139060
|
-
|
|
139523
|
+
appendCleanupCode(ret, cleanup, traversal) {
|
|
139061
139524
|
if (cleanup === undefined) {
|
|
139062
|
-
return
|
|
139525
|
+
return;
|
|
139063
139526
|
}
|
|
139064
139527
|
const cxRoot = traversal.lookupClassOrInterface("CX_ROOT", cleanup.getFirstToken());
|
|
139065
|
-
|
|
139066
|
-
const
|
|
139528
|
+
const cleanupStatement = cleanup.findDirectStatement(abaplint.Statements.Cleanup);
|
|
139529
|
+
const head = `if (${cxRoot} && e instanceof ${cxRoot}) {\n`;
|
|
139530
|
+
if (cleanupStatement) {
|
|
139531
|
+
ret.append(head, cleanupStatement, traversal);
|
|
139532
|
+
}
|
|
139533
|
+
else {
|
|
139534
|
+
ret.appendString(head);
|
|
139535
|
+
}
|
|
139536
|
+
const intoNode = cleanupStatement?.findExpressionAfterToken("INTO");
|
|
139067
139537
|
if (intoNode) {
|
|
139068
|
-
ret
|
|
139538
|
+
ret.appendChunk(traversal.traverse(intoNode)).appendString(".set(e);\n");
|
|
139069
139539
|
}
|
|
139070
139540
|
const body = cleanup.findDirectStructure(abaplint.Structures.Body);
|
|
139071
139541
|
if (body) {
|
|
139072
|
-
ret
|
|
139542
|
+
ret.appendChunk(traversal.traverse(body));
|
|
139073
139543
|
}
|
|
139074
|
-
|
|
139544
|
+
ret.appendString(`}\n`);
|
|
139075
139545
|
}
|
|
139076
139546
|
}
|
|
139077
139547
|
exports.TryTranspiler = TryTranspiler;
|
|
@@ -139718,6 +140188,7 @@ const chunk_1 = __webpack_require__(/*! ./chunk */ "./node_modules/@abaplint/tra
|
|
|
139718
140188
|
const expressions_1 = __webpack_require__(/*! ./expressions */ "./node_modules/@abaplint/transpiler/build/src/expressions/index.js");
|
|
139719
140189
|
const keywords_1 = __webpack_require__(/*! ./keywords */ "./node_modules/@abaplint/transpiler/build/src/keywords.js");
|
|
139720
140190
|
const transpile_types_1 = __webpack_require__(/*! ./transpile_types */ "./node_modules/@abaplint/transpiler/build/src/transpile_types.js");
|
|
140191
|
+
const inline_1 = __webpack_require__(/*! ./inline */ "./node_modules/@abaplint/transpiler/build/src/inline.js");
|
|
139721
140192
|
/** the references of one scope, by where they start: built once per scope,
|
|
139722
140193
|
* so finding the reference at a token no longer walks every reference of
|
|
139723
140194
|
* the scope for every token, which made a long method quadratic */
|
|
@@ -140077,8 +140548,10 @@ class Traversal {
|
|
|
140077
140548
|
}
|
|
140078
140549
|
const methodDefinitions = def.getMethodDefinitions();
|
|
140079
140550
|
if (methodDefinitions === undefined) {
|
|
140080
|
-
//
|
|
140081
|
-
|
|
140551
|
+
// abaplint registers a definition before reading it, and stops reading at the first thing it cannot find
|
|
140552
|
+
const superClass = def.getSuperClass();
|
|
140553
|
+
const reason = superClass ? `its super class ${superClass} is not known` : "a super class, interface or type it names is not known";
|
|
140554
|
+
throw new Error(`${this.getFilename()}: the definition of ${def.getName()} could not be read: ${reason}`);
|
|
140082
140555
|
}
|
|
140083
140556
|
for (const m of methodDefinitions.getAll()) {
|
|
140084
140557
|
methods.push(this.buildMethod(m.getName(), m, m.getVisibility()));
|
|
@@ -140829,7 +141302,12 @@ this.INTERNAL_ID = abap.internalIdCounter++;\n`;
|
|
|
140829
141302
|
* and are initialized once, also when the block is a loop */
|
|
140830
141303
|
traverseProcedureLevel(node) {
|
|
140831
141304
|
const ret = new chunk_1.Chunk();
|
|
141305
|
+
// FORMs, methods and function modules declare their own inline declarations
|
|
141306
|
+
const programLevel = inline_1.InlineDeclarations.isProgramLevelScope(this.findCurrentScopeByToken(node.getFirstToken()));
|
|
140832
141307
|
for (const c of node.getChildren()) {
|
|
141308
|
+
if (programLevel === true) {
|
|
141309
|
+
ret.appendString(inline_1.InlineDeclarations.buildDeclarations(c, this, true));
|
|
141310
|
+
}
|
|
140833
141311
|
if (c instanceof abaplint.Nodes.StructureNode && Traversal.isDeclaration(c) === false) {
|
|
140834
141312
|
ret.appendChunk(this.declareNestedEarly(c));
|
|
140835
141313
|
this.blockDepth++;
|
|
@@ -140939,6 +141417,8 @@ this.INTERNAL_ID = abap.internalIdCounter++;\n`;
|
|
|
140939
141417
|
continue;
|
|
140940
141418
|
}
|
|
140941
141419
|
for (const n of c.getChildren()) {
|
|
141420
|
+
// inline declarations are program global like DATA, so they stay on module level too
|
|
141421
|
+
ret.appendString(inline_1.InlineDeclarations.buildDeclarations(n, this, true));
|
|
140942
141422
|
if (Traversal.isProgramLevelDeclaration(n)) {
|
|
140943
141423
|
ret.appendChunk(this.traverse(n));
|
|
140944
141424
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abaplint/transpiler-cli",
|
|
3
|
-
"version": "2.14.
|
|
3
|
+
"version": "2.14.29",
|
|
4
4
|
"description": "Transpiler - Command Line Interface",
|
|
5
5
|
"funding": "https://github.com/sponsors/larshp",
|
|
6
6
|
"bin": {
|
|
@@ -27,8 +27,8 @@
|
|
|
27
27
|
"author": "abaplint",
|
|
28
28
|
"license": "MIT",
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"@abaplint/core": "^2.120.
|
|
31
|
-
"@abaplint/transpiler": "^2.14.
|
|
30
|
+
"@abaplint/core": "^2.120.103",
|
|
31
|
+
"@abaplint/transpiler": "^2.14.29",
|
|
32
32
|
"@types/glob": "^9.0.0",
|
|
33
33
|
"@types/node": "^26.6.6",
|
|
34
34
|
"@types/progress": "^2.0.7",
|