@abaplint/transpiler-cli 2.14.40 → 2.14.41
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 +1036 -134
- package/package.json +3 -3
package/build/bundle.js
CHANGED
|
@@ -5108,7 +5108,7 @@ class Compare extends combi_1.Expression {
|
|
|
5108
5108
|
const predicate = (0, combi_1.ver)(version_1.Release.v740sp08, _1.MethodCallChain, { also: combi_1.AlsoIn.OpenABAP });
|
|
5109
5109
|
const rett = (0, combi_1.seq)(_1.Source, (0, combi_1.altPrio)((0, combi_1.seq)(_1.CompareOperator, _1.Source), inn, between, sopt));
|
|
5110
5110
|
const fsassign = (0, combi_1.seq)(_1.SourceFieldSymbolChain, "IS", (0, combi_1.optPrio)("NOT"), "ASSIGNED");
|
|
5111
|
-
const ret = (0, combi_1.seq)((0, combi_1.
|
|
5111
|
+
const ret = (0, combi_1.seq)((0, combi_1.star)("NOT"), (0, combi_1.altPrio)(rett, predicate, fsassign));
|
|
5112
5112
|
return ret;
|
|
5113
5113
|
}
|
|
5114
5114
|
}
|
|
@@ -5212,7 +5212,7 @@ class ComponentCompare extends combi_1.Expression {
|
|
|
5212
5212
|
const sopt = (0, combi_1.seq)("IS", (0, combi_1.opt)("NOT"), (0, combi_1.altPrio)("SUPPLIED", "BOUND", (0, combi_1.ver)(version_1.Release.v750, (0, combi_1.seq)("INSTANCE OF", _1.Source)), "REQUESTED", "ASSIGNED", "INITIAL"));
|
|
5213
5213
|
const between = (0, combi_1.seq)((0, combi_1.opt)("NOT"), "BETWEEN", _1.Source, "AND", _1.Source);
|
|
5214
5214
|
const rett = (0, combi_1.seq)(_1.ComponentChainSimple, (0, combi_1.altPrio)((0, combi_1.seq)(_1.CompareOperator, _1.Source), inn, between, sopt));
|
|
5215
|
-
const ret = (0, combi_1.seq)((0, combi_1.
|
|
5215
|
+
const ret = (0, combi_1.seq)((0, combi_1.star)("NOT"), rett);
|
|
5216
5216
|
return ret;
|
|
5217
5217
|
}
|
|
5218
5218
|
}
|
|
@@ -5311,7 +5311,7 @@ const tokens_1 = __webpack_require__(/*! ../../1_lexer/tokens */ "./node_modules
|
|
|
5311
5311
|
const _1 = __webpack_require__(/*! . */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js");
|
|
5312
5312
|
class ComponentCondSub extends combi_1.Expression {
|
|
5313
5313
|
getRunnable() {
|
|
5314
|
-
const another = (0, combi_1.seq)((0, combi_1.
|
|
5314
|
+
const another = (0, combi_1.seq)((0, combi_1.star)("NOT"), (0, combi_1.tok)(tokens_1.WParenLeftW), _1.ComponentCond, (0, combi_1.altPrio)((0, combi_1.tok)(tokens_1.WParenRightW), (0, combi_1.tok)(tokens_1.ParenRightW)));
|
|
5315
5315
|
return another;
|
|
5316
5316
|
}
|
|
5317
5317
|
}
|
|
@@ -5431,7 +5431,7 @@ const _1 = __webpack_require__(/*! . */ "./node_modules/@abaplint/core/build/src
|
|
|
5431
5431
|
class CondSub extends combi_1.Expression {
|
|
5432
5432
|
getRunnable() {
|
|
5433
5433
|
// rule ParserMissingSpace makes sure the whitespace is correct
|
|
5434
|
-
const another = (0, combi_1.seq)((0, combi_1.
|
|
5434
|
+
const another = (0, combi_1.seq)((0, combi_1.starPrio)("NOT"), (0, combi_1.altPrio)((0, combi_1.tok)(tokens_1.WParenLeftW), (0, combi_1.tok)(tokens_1.WParenLeft)), _1.Cond, (0, combi_1.altPrio)((0, combi_1.tok)(tokens_1.WParenRightW), (0, combi_1.tok)(tokens_1.ParenRightW)));
|
|
5435
5435
|
return another;
|
|
5436
5436
|
}
|
|
5437
5437
|
}
|
|
@@ -28226,10 +28226,22 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
28226
28226
|
};
|
|
28227
28227
|
})();
|
|
28228
28228
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
28229
|
+
exports.countLeadingNot = countLeadingNot;
|
|
28229
28230
|
exports.hasKeyCompare = hasKeyCompare;
|
|
28230
28231
|
const Expressions = __importStar(__webpack_require__(/*! ../2_statements/expressions */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js"));
|
|
28231
28232
|
const nodes_1 = __webpack_require__(/*! ../nodes */ "./node_modules/@abaplint/core/build/src/abap/nodes/index.js");
|
|
28232
|
-
/**
|
|
28233
|
+
/** The number of NOT in front of a relational expression or a parenthesized condition, "NOT NOT a = 1" gives 2 */
|
|
28234
|
+
function countLeadingNot(node) {
|
|
28235
|
+
const children = node.getChildren();
|
|
28236
|
+
let count = 0;
|
|
28237
|
+
while (count < children.length
|
|
28238
|
+
&& children[count] instanceof nodes_1.TokenNode
|
|
28239
|
+
&& children[count].getFirstToken().getStr().toUpperCase() === "NOT") {
|
|
28240
|
+
count++;
|
|
28241
|
+
}
|
|
28242
|
+
return count;
|
|
28243
|
+
}
|
|
28244
|
+
/** True if a conjunct of the WHERE condition reachable through AND only, ie. not under OR or an odd number of NOT,
|
|
28233
28245
|
* compares the key component with = or IS INITIAL. Without such a comparison of its first component,
|
|
28234
28246
|
* a sorted key cannot be used to optimize the WHERE condition */
|
|
28235
28247
|
function hasKeyCompare(cond, component) {
|
|
@@ -28237,17 +28249,19 @@ function hasKeyCompare(cond, component) {
|
|
|
28237
28249
|
return false;
|
|
28238
28250
|
}
|
|
28239
28251
|
for (const child of cond.getChildren()) {
|
|
28240
|
-
if (child
|
|
28241
|
-
|
|
28252
|
+
if (!(child instanceof nodes_1.ExpressionNode) || countLeadingNot(child) % 2 === 1) {
|
|
28253
|
+
continue;
|
|
28254
|
+
}
|
|
28255
|
+
if (child.get() instanceof Expressions.ComponentCompare) {
|
|
28256
|
+
const concat = child.getChildren().slice(countLeadingNot(child))
|
|
28257
|
+
.map(c => c.concatTokens()).join(" ").toUpperCase().replace(/\s+/g, " ");
|
|
28242
28258
|
if (concat.startsWith(component + " = ")
|
|
28243
28259
|
|| concat.startsWith(component + " EQ ")
|
|
28244
28260
|
|| concat === component + " IS INITIAL") {
|
|
28245
28261
|
return true;
|
|
28246
28262
|
}
|
|
28247
28263
|
}
|
|
28248
|
-
else if (child.get() instanceof Expressions.ComponentCondSub
|
|
28249
|
-
&& child instanceof nodes_1.ExpressionNode
|
|
28250
|
-
&& child.findDirectTokenByText("NOT") === undefined) {
|
|
28264
|
+
else if (child.get() instanceof Expressions.ComponentCondSub) {
|
|
28251
28265
|
const sub = child.findDirectExpression(Expressions.ComponentCond);
|
|
28252
28266
|
if (sub !== undefined && hasKeyCompare(sub, component)) {
|
|
28253
28267
|
return true;
|
|
@@ -30238,6 +30252,11 @@ class TypeUtils {
|
|
|
30238
30252
|
}
|
|
30239
30253
|
return false;
|
|
30240
30254
|
}
|
|
30255
|
+
/** a number literal beyond the range of i */
|
|
30256
|
+
isPackedConstant(type) {
|
|
30257
|
+
var _a;
|
|
30258
|
+
return type instanceof basic_1.PackedType && ((_a = type.getAbstractTypeData()) === null || _a === void 0 ? void 0 : _a.derivedFromConstant) === true;
|
|
30259
|
+
}
|
|
30241
30260
|
isOOAssignable(source, target) {
|
|
30242
30261
|
let sid = source.getIdentifier();
|
|
30243
30262
|
let tid = target.getIdentifier();
|
|
@@ -30356,12 +30375,8 @@ class TypeUtils {
|
|
|
30356
30375
|
if (source2 instanceof basic_1.HexType && this.isCalculated(node2) && source1 instanceof basic_1.IntegerType) {
|
|
30357
30376
|
return false;
|
|
30358
30377
|
}
|
|
30359
|
-
|
|
30360
|
-
|
|
30361
|
-
}
|
|
30362
|
-
if (source2 instanceof basic_1.DateType && this.isCalculated(node1) && source1 instanceof basic_1.IntegerType) {
|
|
30363
|
-
return false;
|
|
30364
|
-
}
|
|
30378
|
+
// a date compared with an arithmetic expression is reported by Compare, a date compared with
|
|
30379
|
+
// a function or method result of type i is compared like a date compared with a data object of type i
|
|
30365
30380
|
return true;
|
|
30366
30381
|
}
|
|
30367
30382
|
structureContainsString(structure) {
|
|
@@ -30577,6 +30592,22 @@ class TypeUtils {
|
|
|
30577
30592
|
if (calculated && strictResult === false) {
|
|
30578
30593
|
return this.isAssignable(source, target);
|
|
30579
30594
|
}
|
|
30595
|
+
// a number literal of type p fits a packed parameter of any length without decimals
|
|
30596
|
+
if (this.isPackedConstant(source)) {
|
|
30597
|
+
if (target instanceof basic_1.PackedType) {
|
|
30598
|
+
return target.getDecimals() === 0;
|
|
30599
|
+
}
|
|
30600
|
+
else if (target instanceof basic_1.StringType
|
|
30601
|
+
|| target instanceof basic_1.DateType
|
|
30602
|
+
|| target instanceof basic_1.CharacterType
|
|
30603
|
+
|| target instanceof cgeneric_type_1.CGenericType
|
|
30604
|
+
|| target instanceof basic_1.CSequenceType
|
|
30605
|
+
|| target instanceof basic_1.XStringType
|
|
30606
|
+
|| target instanceof basic_1.XGenericType
|
|
30607
|
+
|| (target instanceof basic_1.StructureType && target.containsVoid() === false)) {
|
|
30608
|
+
return false;
|
|
30609
|
+
}
|
|
30610
|
+
}
|
|
30580
30611
|
// an elementary text field is not compatible with a structure, also not with a flat character-like one
|
|
30581
30612
|
if (target instanceof basic_1.StructureType
|
|
30582
30613
|
&& target.containsVoid() === false
|
|
@@ -32912,17 +32943,23 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
32912
32943
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
32913
32944
|
exports.substringType = substringType;
|
|
32914
32945
|
exports.isFieldSymbolItself = isFieldSymbolItself;
|
|
32946
|
+
const nodes_1 = __webpack_require__(/*! ../../nodes */ "./node_modules/@abaplint/core/build/src/abap/nodes/index.js");
|
|
32947
|
+
const tokens_1 = __webpack_require__(/*! ../../1_lexer/tokens */ "./node_modules/@abaplint/core/build/src/abap/1_lexer/tokens/index.js");
|
|
32915
32948
|
const Expressions = __importStar(__webpack_require__(/*! ../../2_statements/expressions */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js"));
|
|
32916
32949
|
const basic_1 = __webpack_require__(/*! ../../types/basic */ "./node_modules/@abaplint/core/build/src/abap/types/basic/index.js");
|
|
32950
|
+
const class_attribute_1 = __webpack_require__(/*! ../../types/class_attribute */ "./node_modules/@abaplint/core/build/src/abap/types/class_attribute.js");
|
|
32951
|
+
const _object_oriented_1 = __webpack_require__(/*! ../_object_oriented */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_object_oriented.js");
|
|
32917
32952
|
const _syntax_input_1 = __webpack_require__(/*! ../_syntax_input */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_syntax_input.js");
|
|
32918
32953
|
// The type of a substring with a static offset or length, used for reading and writing positions.
|
|
32919
32954
|
// On a character or byte field of fixed length the substring must lie inside the field, else it is
|
|
32920
|
-
// a syntax error
|
|
32921
|
-
//
|
|
32955
|
+
// a syntax error, unless the offset or length is a variable: then the bounds are left to the runtime.
|
|
32956
|
+
// Other types, a dynamic offset or length and "*" (undefined) are left alone, as is length 0.
|
|
32957
|
+
// The offset is applied first, so the length is compared to what remains after the offset.
|
|
32958
|
+
// "chain" holds the nodes of the surrounding chain, including both the offset and the length.
|
|
32922
32959
|
// A substring of a date, time or numeric text field has type n; its bounds are not checked.
|
|
32923
32960
|
// An offset or length on a numeric field (i, int8, p, f, decfloat) is a syntax error, whatever its value,
|
|
32924
32961
|
// except a length without offset covering the full packed field, eg. "lv_p(5)" for "lv_p(5) TYPE p".
|
|
32925
|
-
function substringType(context, offset, length, node, input) {
|
|
32962
|
+
function substringType(context, offset, length, node, chain, input) {
|
|
32926
32963
|
const numericName = numericTypeName(context);
|
|
32927
32964
|
if (context instanceof basic_1.PackedType && offset === undefined && length === context.getLength()) {
|
|
32928
32965
|
// the offset is checked in a separate call before the length, so this is a length without offset
|
|
@@ -32942,6 +32979,9 @@ function substringType(context, offset, length, node, input) {
|
|
|
32942
32979
|
const fieldLength = context.getLength();
|
|
32943
32980
|
if (offset !== undefined && offset > 0) {
|
|
32944
32981
|
if (offset >= fieldLength) {
|
|
32982
|
+
if (hasVariablePart(chain, input)) {
|
|
32983
|
+
return context;
|
|
32984
|
+
}
|
|
32945
32985
|
const message = `Offset ${offset} is outside the field of length ${fieldLength}`;
|
|
32946
32986
|
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
|
|
32947
32987
|
return basic_1.VoidType.get(_syntax_input_1.CheckSyntaxKey);
|
|
@@ -32950,6 +32990,9 @@ function substringType(context, offset, length, node, input) {
|
|
|
32950
32990
|
}
|
|
32951
32991
|
if (length !== undefined && length > 0) {
|
|
32952
32992
|
if (length > fieldLength) {
|
|
32993
|
+
if (hasVariablePart(chain, input)) {
|
|
32994
|
+
return context;
|
|
32995
|
+
}
|
|
32953
32996
|
const message = `Length ${length} exceeds the remaining length ${fieldLength} of the field`;
|
|
32954
32997
|
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
|
|
32955
32998
|
return basic_1.VoidType.get(_syntax_input_1.CheckSyntaxKey);
|
|
@@ -32958,6 +33001,37 @@ function substringType(context, offset, length, node, input) {
|
|
|
32958
33001
|
}
|
|
32959
33002
|
return context;
|
|
32960
33003
|
}
|
|
33004
|
+
// true if the offset or the length is given by a variable, a constant counts as static
|
|
33005
|
+
function hasVariablePart(chain, input) {
|
|
33006
|
+
return chain.some(node => {
|
|
33007
|
+
if (!(node instanceof nodes_1.ExpressionNode)
|
|
33008
|
+
|| !(node.get() instanceof Expressions.FieldOffset || node.get() instanceof Expressions.FieldLength)) {
|
|
33009
|
+
return false;
|
|
33010
|
+
}
|
|
33011
|
+
const field = node.findDirectExpression(Expressions.SimpleFieldChain2);
|
|
33012
|
+
return field !== undefined && isConstant(field, input) === false;
|
|
33013
|
+
});
|
|
33014
|
+
}
|
|
33015
|
+
// a constant or a component of one, an attribute behind "->" is not resolved here
|
|
33016
|
+
function isConstant(field, input) {
|
|
33017
|
+
var _a;
|
|
33018
|
+
const children = field.getChildren();
|
|
33019
|
+
if (children.some(c => c.get() instanceof tokens_1.InstanceArrow)) {
|
|
33020
|
+
return false;
|
|
33021
|
+
}
|
|
33022
|
+
const name = children[0].getFirstToken().getStr();
|
|
33023
|
+
if (children[0].get() instanceof Expressions.ClassName) {
|
|
33024
|
+
const def = input.scope.findObjectDefinition(name);
|
|
33025
|
+
const attribute = (_a = children[2]) === null || _a === void 0 ? void 0 : _a.getFirstToken().getStr();
|
|
33026
|
+
return new _object_oriented_1.ObjectOriented(input.scope).searchConstantName(def, attribute) !== undefined;
|
|
33027
|
+
}
|
|
33028
|
+
const found = input.scope.findVariable(name);
|
|
33029
|
+
if (found === undefined || found instanceof class_attribute_1.ClassAttribute) {
|
|
33030
|
+
return false;
|
|
33031
|
+
}
|
|
33032
|
+
const meta = found.getMeta();
|
|
33033
|
+
return meta.includes("read_only" /* IdentifierMeta.ReadOnly */) && meta.includes("static" /* IdentifierMeta.Static */);
|
|
33034
|
+
}
|
|
32961
33035
|
// the internal type code the ABAP syntax check names: I, 8, P, F, a (decfloat16), e (decfloat34)
|
|
32962
33036
|
function numericTypeName(context) {
|
|
32963
33037
|
if (context instanceof basic_1.IntegerType) {
|
|
@@ -33152,11 +33226,11 @@ class AttributeChain {
|
|
|
33152
33226
|
}
|
|
33153
33227
|
else if (child instanceof nodes_1.ExpressionNode && child.get() instanceof Expressions.FieldOffset) {
|
|
33154
33228
|
const offset = field_offset_1.FieldOffset.runSyntax(child, input);
|
|
33155
|
-
contextType = (0, _substring_1.substringType)(contextType, offset, undefined, child, input);
|
|
33229
|
+
contextType = (0, _substring_1.substringType)(contextType, offset, undefined, child, children, input);
|
|
33156
33230
|
}
|
|
33157
33231
|
else if (child instanceof nodes_1.ExpressionNode && child.get() instanceof Expressions.FieldLength) {
|
|
33158
33232
|
const length = field_length_1.FieldLength.runSyntax(child, input);
|
|
33159
|
-
contextType = (0, _substring_1.substringType)(contextType, undefined, length, child, input);
|
|
33233
|
+
contextType = (0, _substring_1.substringType)(contextType, undefined, length, child, children, input);
|
|
33160
33234
|
}
|
|
33161
33235
|
}
|
|
33162
33236
|
return contextType;
|
|
@@ -33474,16 +33548,7 @@ class Compare {
|
|
|
33474
33548
|
else if (node.findDirectExpression(Expressions.CompareOperator)
|
|
33475
33549
|
&& typeUtils.isCompareable(sourceTypes[0], sourceTypes[1], sources[0], sources[1]) === false
|
|
33476
33550
|
&& sourceTypes.length === 2) {
|
|
33477
|
-
|
|
33478
|
-
if ((sourceTypes[0] instanceof basic_1.DateType
|
|
33479
|
-
&& sourceTypes[1] instanceof basic_1.IntegerType
|
|
33480
|
-
&& sources[1].findFirstExpression(Expressions.ArithOperator))
|
|
33481
|
-
|| (sourceTypes[1] instanceof basic_1.DateType
|
|
33482
|
-
&& sourceTypes[0] instanceof basic_1.IntegerType
|
|
33483
|
-
&& sources[0].findFirstExpression(Expressions.ArithOperator))) {
|
|
33484
|
-
message = "Date cannot be compared with arithmetic result of type Integer";
|
|
33485
|
-
}
|
|
33486
|
-
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
|
|
33551
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), "Incompatible types for comparison"));
|
|
33487
33552
|
}
|
|
33488
33553
|
}
|
|
33489
33554
|
// a built-in function with a character-like result cannot be the operand of IS [NOT] INITIAL,
|
|
@@ -34233,8 +34298,9 @@ const expressions_1 = __webpack_require__(/*! ../../2_statements/expressions */
|
|
|
34233
34298
|
class Constant {
|
|
34234
34299
|
static runSyntax(node) {
|
|
34235
34300
|
// todo: ConcatenatedConstant is not used?
|
|
34236
|
-
|
|
34237
|
-
|
|
34301
|
+
const integer = node.findDirectExpression(expressions_1.Integer);
|
|
34302
|
+
if (integer) {
|
|
34303
|
+
return this.numberType(integer.concatTokens());
|
|
34238
34304
|
}
|
|
34239
34305
|
const first = node.getFirstToken().getStr();
|
|
34240
34306
|
if (first.startsWith("'")) {
|
|
@@ -34251,6 +34317,16 @@ class Constant {
|
|
|
34251
34317
|
return basic_1.StringType.get();
|
|
34252
34318
|
}
|
|
34253
34319
|
}
|
|
34320
|
+
// a number literal is of type i if its value is in the range of i, else of type p without decimals,
|
|
34321
|
+
// with length 8 for up to 15 digits and length 16 above, leading zeros not counted
|
|
34322
|
+
static numberType(literal) {
|
|
34323
|
+
const value = Number(literal.replace(/\s/g, ""));
|
|
34324
|
+
if (value >= -2147483648 && value <= 2147483647) {
|
|
34325
|
+
return basic_1.IntegerType.get({ derivedFromConstant: true });
|
|
34326
|
+
}
|
|
34327
|
+
const digits = literal.replace(/\D/g, "").replace(/^0+/, "");
|
|
34328
|
+
return new basic_1.PackedType(digits.length <= 15 ? 8 : 16, 0, { derivedFromConstant: true });
|
|
34329
|
+
}
|
|
34254
34330
|
}
|
|
34255
34331
|
exports.Constant = Constant;
|
|
34256
34332
|
//# sourceMappingURL=constant.js.map
|
|
@@ -34967,13 +35043,13 @@ class FieldChain {
|
|
|
34967
35043
|
else if (current.get() instanceof Expressions.FieldOffset && current instanceof nodes_1.ExpressionNode) {
|
|
34968
35044
|
const offset = field_offset_1.FieldOffset.runSyntax(current, input);
|
|
34969
35045
|
if (!(0, _substring_1.isFieldSymbolItself)(children, i)) {
|
|
34970
|
-
context = (0, _substring_1.substringType)(context, offset, undefined, current, input);
|
|
35046
|
+
context = (0, _substring_1.substringType)(context, offset, undefined, current, children, input);
|
|
34971
35047
|
}
|
|
34972
35048
|
}
|
|
34973
35049
|
else if (current.get() instanceof Expressions.FieldLength && current instanceof nodes_1.ExpressionNode) {
|
|
34974
35050
|
const length = field_length_1.FieldLength.runSyntax(current, input);
|
|
34975
35051
|
if (!(0, _substring_1.isFieldSymbolItself)(children, i)) {
|
|
34976
|
-
context = (0, _substring_1.substringType)(context, undefined, length, current, input);
|
|
35052
|
+
context = (0, _substring_1.substringType)(context, undefined, length, current, children, input);
|
|
34977
35053
|
}
|
|
34978
35054
|
}
|
|
34979
35055
|
prev = current.concatTokens();
|
|
@@ -35777,6 +35853,9 @@ class InlineData {
|
|
|
35777
35853
|
else if (type instanceof basic_1.StringType) {
|
|
35778
35854
|
return basic_1.StringType.get(rest);
|
|
35779
35855
|
}
|
|
35856
|
+
else if (type instanceof basic_1.PackedType) {
|
|
35857
|
+
return new basic_1.PackedType(type.getLength(), type.getDecimals(), rest);
|
|
35858
|
+
}
|
|
35780
35859
|
return type;
|
|
35781
35860
|
}
|
|
35782
35861
|
}
|
|
@@ -40529,7 +40608,7 @@ class Target {
|
|
|
40529
40608
|
}
|
|
40530
40609
|
const value = field_offset_1.FieldOffset.runSyntax(offset, input);
|
|
40531
40610
|
if (!(0, _substring_1.isFieldSymbolItself)(children, children.indexOf(offset))) {
|
|
40532
|
-
substring = (0, _substring_1.substringType)(substring, value, undefined, offset, input);
|
|
40611
|
+
substring = (0, _substring_1.substringType)(substring, value, undefined, offset, children, input);
|
|
40533
40612
|
}
|
|
40534
40613
|
}
|
|
40535
40614
|
const length = node.findDirectExpression(Expressions.FieldLength);
|
|
@@ -40541,7 +40620,7 @@ class Target {
|
|
|
40541
40620
|
}
|
|
40542
40621
|
const value = field_length_1.FieldLength.runSyntax(length, input);
|
|
40543
40622
|
if (!(0, _substring_1.isFieldSymbolItself)(children, children.indexOf(length))) {
|
|
40544
|
-
substring = (0, _substring_1.substringType)(substring, undefined, value, length, input);
|
|
40623
|
+
substring = (0, _substring_1.substringType)(substring, undefined, value, length, children, input);
|
|
40545
40624
|
}
|
|
40546
40625
|
}
|
|
40547
40626
|
if (substring instanceof basic_1.VoidType && !(context instanceof basic_1.VoidType)) {
|
|
@@ -40832,6 +40911,7 @@ const let_1 = __webpack_require__(/*! ./let */ "./node_modules/@abaplint/core/bu
|
|
|
40832
40911
|
const field_assignment_1 = __webpack_require__(/*! ./field_assignment */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/field_assignment.js");
|
|
40833
40912
|
const basic_1 = __webpack_require__(/*! ../../types/basic */ "./node_modules/@abaplint/core/build/src/abap/types/basic/index.js");
|
|
40834
40913
|
const _syntax_input_1 = __webpack_require__(/*! ../_syntax_input */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_syntax_input.js");
|
|
40914
|
+
const _type_utils_1 = __webpack_require__(/*! ../_type_utils */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_type_utils.js");
|
|
40835
40915
|
class ValueBody {
|
|
40836
40916
|
static runSyntax(node, input, targetType) {
|
|
40837
40917
|
var _a, _b, _c;
|
|
@@ -40917,16 +40997,17 @@ class ValueBody {
|
|
|
40917
40997
|
}
|
|
40918
40998
|
for (const s of foo.findDirectExpressions(Expressions.Source)) {
|
|
40919
40999
|
const sourceType = source_1.Source.runSyntax(s, input, rowType);
|
|
41000
|
+
const sourceKind = new _type_utils_1.TypeUtils(input.scope).isPackedConstant(sourceType) ? "p" : this.numericKind(sourceType);
|
|
40920
41001
|
if ((rowType instanceof basic_1.StringType || rowType instanceof basic_1.XStringType) && sourceType instanceof basic_1.CharacterType) {
|
|
40921
41002
|
const message = "VALUE, source type CharacterType not compatible with " + rowType.constructor.name;
|
|
40922
41003
|
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, s.getFirstToken(), message));
|
|
40923
41004
|
}
|
|
40924
41005
|
else if (this.isDataObject(s)
|
|
40925
41006
|
&& this.numericKind(rowType) !== undefined
|
|
40926
|
-
&&
|
|
40927
|
-
&& this.numericKind(rowType) !==
|
|
41007
|
+
&& sourceKind !== undefined
|
|
41008
|
+
&& this.numericKind(rowType) !== sourceKind) {
|
|
40928
41009
|
// a data object given as a row must be compatible with the row type, it is not converted
|
|
40929
|
-
const message = `VALUE, source type ${
|
|
41010
|
+
const message = `VALUE, source type ${sourceKind} not compatible with row type ${this.numericKind(rowType)}`;
|
|
40930
41011
|
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, s.getFirstToken(), message));
|
|
40931
41012
|
}
|
|
40932
41013
|
else if (this.insertsUsingTableKey(targetType)) {
|
|
@@ -42783,6 +42864,10 @@ class Catch {
|
|
|
42783
42864
|
const found = input.scope.existsObject(className);
|
|
42784
42865
|
if (found === null || found === void 0 ? void 0 : found.id) {
|
|
42785
42866
|
input.scope.addReference(token, found.id, _reference_1.ReferenceType.ObjectOrientedReference, input.filename);
|
|
42867
|
+
const message = this.checkExceptionClass(className, input);
|
|
42868
|
+
if (message !== undefined) {
|
|
42869
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, token, message));
|
|
42870
|
+
}
|
|
42786
42871
|
}
|
|
42787
42872
|
else if (input.scope.getDDIC().inErrorNamespace(className) === false) {
|
|
42788
42873
|
const extra = { ooName: className, ooType: "Void" };
|
|
@@ -42831,6 +42916,30 @@ class Catch {
|
|
|
42831
42916
|
}
|
|
42832
42917
|
}
|
|
42833
42918
|
}
|
|
42919
|
+
// the classes of a CATCH are exception classes, that is CX_ROOT or a subclass of it. A class is only
|
|
42920
|
+
// reported when its superclasses are known up to the last one, a chain ending in a void class is skipped
|
|
42921
|
+
checkExceptionClass(name, input) {
|
|
42922
|
+
var _a;
|
|
42923
|
+
const visited = new Set();
|
|
42924
|
+
let current = input.scope.findClassDefinition(name);
|
|
42925
|
+
if (current === undefined) {
|
|
42926
|
+
return input.scope.findInterfaceDefinition(name)
|
|
42927
|
+
? `CATCH, ${name} is an interface, not an exception class`
|
|
42928
|
+
: undefined;
|
|
42929
|
+
}
|
|
42930
|
+
while (current !== undefined && visited.has(current.getName().toUpperCase()) === false) {
|
|
42931
|
+
visited.add(current.getName().toUpperCase());
|
|
42932
|
+
const superclass = (_a = current.getSuperClass()) === null || _a === void 0 ? void 0 : _a.toUpperCase();
|
|
42933
|
+
if (current.getName().toUpperCase() === "CX_ROOT" || superclass === "CX_ROOT") {
|
|
42934
|
+
return undefined;
|
|
42935
|
+
}
|
|
42936
|
+
else if (superclass === undefined) {
|
|
42937
|
+
return `CATCH, ${name} is not an exception class, it is not derived from CX_ROOT`;
|
|
42938
|
+
}
|
|
42939
|
+
current = input.scope.findClassDefinition(superclass);
|
|
42940
|
+
}
|
|
42941
|
+
return undefined;
|
|
42942
|
+
}
|
|
42834
42943
|
// static type of an inline target: the first class, replaced by each following class that is one of its
|
|
42835
42944
|
// super classes; any other following class makes it CX_ROOT, also when the classes share a closer super class
|
|
42836
42945
|
inlineType(classNames, input) {
|
|
@@ -47021,6 +47130,12 @@ class InsertInternal {
|
|
|
47021
47130
|
if (sourceType instanceof basic_1.IntegerType && targetType instanceof basic_1.Integer8Type) {
|
|
47022
47131
|
error = true;
|
|
47023
47132
|
}
|
|
47133
|
+
else if ((source === null || source === void 0 ? void 0 : source.getChildren().length) === 1
|
|
47134
|
+
&& new _type_utils_1.TypeUtils(input.scope).isPackedConstant(sourceType)
|
|
47135
|
+
&& (targetType instanceof basic_1.IntegerType || targetType instanceof basic_1.Integer8Type)) {
|
|
47136
|
+
// a literal of type p is not converted into an integer row
|
|
47137
|
+
error = true;
|
|
47138
|
+
}
|
|
47024
47139
|
else if (targetType instanceof basic_1.TableType && targetType.isWithHeader() && sourceType instanceof basic_1.TableType) {
|
|
47025
47140
|
// LINES OF into a table with header line, compare the row types
|
|
47026
47141
|
error = new _type_utils_1.TypeUtils(input.scope).isAssignable(sourceType.getRowType(), targetType.getRowType()) === false;
|
|
@@ -51043,8 +51158,11 @@ const _type_utils_1 = __webpack_require__(/*! ../_type_utils */ "./node_modules/
|
|
|
51043
51158
|
const _syntax_input_1 = __webpack_require__(/*! ../_syntax_input */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_syntax_input.js");
|
|
51044
51159
|
class Split {
|
|
51045
51160
|
runSyntax(node, input) {
|
|
51161
|
+
const byteMode = node.findDirectTokenByText("BYTE") !== undefined;
|
|
51046
51162
|
const intoTable = node.findTokenSequencePosition("INTO", "TABLE") !== undefined;
|
|
51047
|
-
const
|
|
51163
|
+
const segment = byteMode ? basic_1.XStringType.get() : basic_1.StringType.get();
|
|
51164
|
+
const type = intoTable ? new basic_1.TableType(segment, { withHeader: false, keyType: basic_1.TableKeyType.default }) : segment;
|
|
51165
|
+
const utils = new _type_utils_1.TypeUtils(input.scope);
|
|
51048
51166
|
for (const target of node.findAllExpressions(Expressions.Target)) {
|
|
51049
51167
|
const inline = target.findDirectExpression(Expressions.InlineData);
|
|
51050
51168
|
if (inline) {
|
|
@@ -51064,17 +51182,27 @@ class Split {
|
|
|
51064
51182
|
targetType = targetType.getRowType();
|
|
51065
51183
|
}
|
|
51066
51184
|
}
|
|
51067
|
-
|
|
51068
|
-
|
|
51185
|
+
const compatible = byteMode ? this.isByteLike(targetType, utils) : utils.isCharLikeStrict(targetType);
|
|
51186
|
+
if (compatible === false) {
|
|
51187
|
+
const message = "Incompatible, target not " + (byteMode ? "byte" : "character") + " like";
|
|
51069
51188
|
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
|
|
51070
51189
|
return;
|
|
51071
51190
|
}
|
|
51072
51191
|
}
|
|
51073
51192
|
}
|
|
51074
51193
|
for (const s of node.findDirectExpressions(Expressions.Source)) {
|
|
51075
|
-
source_1.Source.runSyntax(s, input);
|
|
51194
|
+
const sourceType = source_1.Source.runSyntax(s, input);
|
|
51195
|
+
if (byteMode && sourceType !== undefined && this.isByteLike(sourceType, utils) === false) {
|
|
51196
|
+
const message = "Incompatible, source not byte like";
|
|
51197
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, s.getFirstToken(), message));
|
|
51198
|
+
return;
|
|
51199
|
+
}
|
|
51076
51200
|
}
|
|
51077
51201
|
}
|
|
51202
|
+
isByteLike(type, utils) {
|
|
51203
|
+
// the actual type behind "data" and "simple" is only known at runtime
|
|
51204
|
+
return utils.isHexLike(type) || type instanceof basic_1.DataType || type instanceof basic_1.SimpleType;
|
|
51205
|
+
}
|
|
51078
51206
|
}
|
|
51079
51207
|
exports.Split = Split;
|
|
51080
51208
|
//# sourceMappingURL=split.js.map
|
|
@@ -73654,6 +73782,107 @@ exports.QueryUserGroup = QueryUserGroup;
|
|
|
73654
73782
|
|
|
73655
73783
|
/***/ },
|
|
73656
73784
|
|
|
73785
|
+
/***/ "./node_modules/@abaplint/core/build/src/objects/rename/rename_bsp_application.js"
|
|
73786
|
+
/*!****************************************************************************************!*\
|
|
73787
|
+
!*** ./node_modules/@abaplint/core/build/src/objects/rename/rename_bsp_application.js ***!
|
|
73788
|
+
\****************************************************************************************/
|
|
73789
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
73790
|
+
|
|
73791
|
+
"use strict";
|
|
73792
|
+
|
|
73793
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
73794
|
+
exports.RenameBSPApplication = void 0;
|
|
73795
|
+
const vscode_languageserver_types_1 = __webpack_require__(/*! vscode-languageserver-types */ "./node_modules/vscode-languageserver-types/lib/esm/main.js");
|
|
73796
|
+
const __1 = __webpack_require__(/*! .. */ "./node_modules/@abaplint/core/build/src/objects/index.js");
|
|
73797
|
+
const renamer_helper_1 = __webpack_require__(/*! ./renamer_helper */ "./node_modules/@abaplint/core/build/src/objects/rename/renamer_helper.js");
|
|
73798
|
+
/** Renames a BSP application: APPLNAME and APPLEXT in the XML, the name in front of ".wapa." of every
|
|
73799
|
+
* file and the URLs of the MIME objects in its MIME folder. The pages keep their names (PAGEKEY, PAGENAME and the page part of a file name): they are paths
|
|
73800
|
+
* inside the application, which its files refer to, e.g. "thirdparty/zfoo/lib.js" of the application ZFOO.
|
|
73801
|
+
* abapGit finds the file of a page by its page name, a renamed page name has no file */
|
|
73802
|
+
class RenameBSPApplication {
|
|
73803
|
+
constructor(reg) {
|
|
73804
|
+
this.reg = reg;
|
|
73805
|
+
}
|
|
73806
|
+
buildEdits(obj, oldName, newName) {
|
|
73807
|
+
if (!(obj instanceof __1.BSPApplication)) {
|
|
73808
|
+
throw new Error("RenameBSPApplication, not a BSP application");
|
|
73809
|
+
}
|
|
73810
|
+
let changes = [];
|
|
73811
|
+
const helper = new renamer_helper_1.RenamerHelper(this.reg);
|
|
73812
|
+
changes = changes.concat(helper.buildXMLFileEdits(obj, "APPLNAME", oldName, newName));
|
|
73813
|
+
changes = changes.concat(helper.buildXMLFileEdits(obj, "APPLEXT", oldName, newName));
|
|
73814
|
+
changes = changes.concat(this.renameFiles(obj, oldName, newName));
|
|
73815
|
+
changes = changes.concat(this.renameMIMEURLs(oldName, newName));
|
|
73816
|
+
return {
|
|
73817
|
+
documentChanges: changes,
|
|
73818
|
+
};
|
|
73819
|
+
}
|
|
73820
|
+
/** The MIME folder of the application and everything below it (SMIM objects) move with it:
|
|
73821
|
+
* /SAP/BC/BSP/SAP/ZFOO/... for an application ZFOO, /SAP/BC/BSP/NS/BAR/... for /NS/BAR.
|
|
73822
|
+
* abapGit creates MIME objects by their URL, the object and file names are GUIDs and stay */
|
|
73823
|
+
renameMIMEURLs(oldName, newName) {
|
|
73824
|
+
const oldPrefix = mimeFolder(oldName);
|
|
73825
|
+
const newPrefix = mimeFolder(newName);
|
|
73826
|
+
const changes = [];
|
|
73827
|
+
for (const o of this.reg.getObjectsByType("SMIM")) {
|
|
73828
|
+
if (!(o instanceof __1.MIMEObject) || this.reg.isDependency(o)) {
|
|
73829
|
+
continue;
|
|
73830
|
+
}
|
|
73831
|
+
const xml = o.getXMLFile();
|
|
73832
|
+
if (xml === undefined) {
|
|
73833
|
+
continue;
|
|
73834
|
+
}
|
|
73835
|
+
const rows = xml.getRawRows();
|
|
73836
|
+
for (let i = 0; i < rows.length; i++) {
|
|
73837
|
+
const start = rows[i].indexOf("<URL>");
|
|
73838
|
+
const end = rows[i].indexOf("</URL>");
|
|
73839
|
+
if (start < 0 || end < start) {
|
|
73840
|
+
continue;
|
|
73841
|
+
}
|
|
73842
|
+
const url = rows[i].substring(start + 5, end);
|
|
73843
|
+
const upper = url.toUpperCase();
|
|
73844
|
+
if (upper !== oldPrefix && upper.startsWith(oldPrefix + "/") === false) {
|
|
73845
|
+
continue;
|
|
73846
|
+
}
|
|
73847
|
+
const prefix = url.substring(0, oldPrefix.length) === oldPrefix ? newPrefix : newPrefix.toLowerCase();
|
|
73848
|
+
const range = vscode_languageserver_types_1.Range.create(i, start + 5, i, start + 5 + oldPrefix.length);
|
|
73849
|
+
changes.push(vscode_languageserver_types_1.TextDocumentEdit.create({ uri: xml.getFilename(), version: 1 }, [vscode_languageserver_types_1.TextEdit.replace(range, prefix)]));
|
|
73850
|
+
}
|
|
73851
|
+
}
|
|
73852
|
+
return changes;
|
|
73853
|
+
}
|
|
73854
|
+
/** only the name in front of ".wapa.", folders and page parts keep the old name if they contain it */
|
|
73855
|
+
renameFiles(obj, oldName, newName) {
|
|
73856
|
+
const list = [];
|
|
73857
|
+
const oldPrefix = oldName.toLowerCase().replace(/\//g, "#") + ".wapa.";
|
|
73858
|
+
const newPrefix = newName.toLowerCase().replace(/\//g, "#") + ".wapa.";
|
|
73859
|
+
for (const f of obj.getFiles()) {
|
|
73860
|
+
const filename = f.getFilename();
|
|
73861
|
+
const slash = Math.max(filename.lastIndexOf("/"), filename.lastIndexOf("\\"));
|
|
73862
|
+
const base = filename.substring(slash + 1);
|
|
73863
|
+
if (base.toLowerCase().startsWith(oldPrefix) === false) {
|
|
73864
|
+
continue;
|
|
73865
|
+
}
|
|
73866
|
+
list.push(vscode_languageserver_types_1.RenameFile.create(filename, filename.substring(0, slash + 1) + newPrefix + base.substring(oldPrefix.length)));
|
|
73867
|
+
}
|
|
73868
|
+
return list;
|
|
73869
|
+
}
|
|
73870
|
+
}
|
|
73871
|
+
exports.RenameBSPApplication = RenameBSPApplication;
|
|
73872
|
+
/** the URL of the MIME folder of a BSP application, upper case. A namespaced application sits below its
|
|
73873
|
+
* namespace instead of below SAP: ZFOO -> /SAP/BC/BSP/SAP/ZFOO, /NS/BAR -> /SAP/BC/BSP/NS/BAR */
|
|
73874
|
+
function mimeFolder(name) {
|
|
73875
|
+
const upper = name.toUpperCase();
|
|
73876
|
+
const namespaced = upper.match(/^\/([^/]+)\/([^/]+)$/);
|
|
73877
|
+
if (namespaced) {
|
|
73878
|
+
return "/SAP/BC/BSP/" + namespaced[1] + "/" + namespaced[2];
|
|
73879
|
+
}
|
|
73880
|
+
return "/SAP/BC/BSP/SAP/" + upper;
|
|
73881
|
+
}
|
|
73882
|
+
//# sourceMappingURL=rename_bsp_application.js.map
|
|
73883
|
+
|
|
73884
|
+
/***/ },
|
|
73885
|
+
|
|
73657
73886
|
/***/ "./node_modules/@abaplint/core/build/src/objects/rename/rename_data_element.js"
|
|
73658
73887
|
/*!*************************************************************************************!*\
|
|
73659
73888
|
!*** ./node_modules/@abaplint/core/build/src/objects/rename/rename_data_element.js ***!
|
|
@@ -73924,8 +74153,44 @@ exports.RenameGlobalInterface = RenameGlobalInterface;
|
|
|
73924
74153
|
|
|
73925
74154
|
"use strict";
|
|
73926
74155
|
|
|
74156
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
74157
|
+
if (k2 === undefined) k2 = k;
|
|
74158
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
74159
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
74160
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
74161
|
+
}
|
|
74162
|
+
Object.defineProperty(o, k2, desc);
|
|
74163
|
+
}) : (function(o, m, k, k2) {
|
|
74164
|
+
if (k2 === undefined) k2 = k;
|
|
74165
|
+
o[k2] = m[k];
|
|
74166
|
+
}));
|
|
74167
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
74168
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
74169
|
+
}) : function(o, v) {
|
|
74170
|
+
o["default"] = v;
|
|
74171
|
+
});
|
|
74172
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
74173
|
+
var ownKeys = function(o) {
|
|
74174
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
74175
|
+
var ar = [];
|
|
74176
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
74177
|
+
return ar;
|
|
74178
|
+
};
|
|
74179
|
+
return ownKeys(o);
|
|
74180
|
+
};
|
|
74181
|
+
return function (mod) {
|
|
74182
|
+
if (mod && mod.__esModule) return mod;
|
|
74183
|
+
var result = {};
|
|
74184
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
74185
|
+
__setModuleDefault(result, mod);
|
|
74186
|
+
return result;
|
|
74187
|
+
};
|
|
74188
|
+
})();
|
|
73927
74189
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
73928
74190
|
exports.RenameICFService = void 0;
|
|
74191
|
+
exports.namespacedURL = namespacedURL;
|
|
74192
|
+
const crypto = __importStar(__webpack_require__(/*! crypto */ "crypto"));
|
|
74193
|
+
const vscode_languageserver_types_1 = __webpack_require__(/*! vscode-languageserver-types */ "./node_modules/vscode-languageserver-types/lib/esm/main.js");
|
|
73929
74194
|
const __1 = __webpack_require__(/*! .. */ "./node_modules/@abaplint/core/build/src/objects/index.js");
|
|
73930
74195
|
const renamer_helper_1 = __webpack_require__(/*! ./renamer_helper */ "./node_modules/@abaplint/core/build/src/objects/rename/renamer_helper.js");
|
|
73931
74196
|
class RenameICFService {
|
|
@@ -73963,16 +74228,141 @@ class RenameICFService {
|
|
|
73963
74228
|
const cleanNewName = (_d = (_b = newName.match(/^[^ ]+/)) === null || _b === void 0 ? void 0 : _b[0]) !== null && _d !== void 0 ? _d : newName;
|
|
73964
74229
|
let changes = [];
|
|
73965
74230
|
const helper = new renamer_helper_1.RenamerHelper(this.reg);
|
|
73966
|
-
|
|
73967
|
-
|
|
73968
|
-
|
|
73969
|
-
|
|
74231
|
+
const namespaced = cleanNewName.match(/^\/([^/]+)\/([^/]+)$/);
|
|
74232
|
+
if (namespaced) {
|
|
74233
|
+
// ICF node names carry no slashes: "/NS/LEAF" is the node LEAF below a node NS
|
|
74234
|
+
const leaf = namespaced[2];
|
|
74235
|
+
if (leaf.length > ICF_NAME_LENGTH) {
|
|
74236
|
+
throw new Error("RenameICFService, " + leaf + " is longer than " + ICF_NAME_LENGTH + " characters");
|
|
74237
|
+
}
|
|
74238
|
+
const url = obj.getURL();
|
|
74239
|
+
const newURL = url === undefined ? undefined : namespacedURL(url, cleanOldName, namespaced[1], leaf);
|
|
74240
|
+
if (newURL !== undefined) {
|
|
74241
|
+
changes = changes.concat(this.buildURLEdit(obj, newURL));
|
|
74242
|
+
}
|
|
74243
|
+
changes = changes.concat(helper.buildXMLFileEdits(obj, "ICF_NAME", cleanOldName, leaf));
|
|
74244
|
+
changes = changes.concat(helper.buildXMLFileEdits(obj, "ORIG_NAME", cleanOldName, leaf, true));
|
|
74245
|
+
const files = newURL === undefined ? undefined : this.renameAbapGitFiles(obj, leaf, newURL);
|
|
74246
|
+
changes = changes.concat(files !== null && files !== void 0 ? files : helper.renameFiles(obj, cleanOldName, leaf));
|
|
74247
|
+
if (newURL !== undefined && files !== undefined) {
|
|
74248
|
+
changes = changes.concat(this.buildNamespaceNode(obj, namespaced[1], newURL));
|
|
74249
|
+
}
|
|
74250
|
+
}
|
|
74251
|
+
else {
|
|
74252
|
+
changes = changes.concat(helper.buildURLFileEdits(obj, cleanOldName, cleanNewName));
|
|
74253
|
+
changes = changes.concat(helper.buildXMLFileEdits(obj, "ICF_NAME", cleanOldName, cleanNewName));
|
|
74254
|
+
changes = changes.concat(helper.buildXMLFileEdits(obj, "ORIG_NAME", cleanOldName, cleanNewName, true));
|
|
74255
|
+
const url = obj.getURL();
|
|
74256
|
+
const files = url === undefined ? undefined :
|
|
74257
|
+
this.renameAbapGitFiles(obj, cleanNewName, url.replace(cleanOldName.toLowerCase(), cleanNewName.toLowerCase()));
|
|
74258
|
+
changes = changes.concat(files !== null && files !== void 0 ? files : helper.renameFiles(obj, oldName, fileNewName));
|
|
74259
|
+
}
|
|
73970
74260
|
return {
|
|
73971
74261
|
documentChanges: changes,
|
|
73972
74262
|
};
|
|
73973
74263
|
}
|
|
74264
|
+
buildURLEdit(obj, newURL) {
|
|
74265
|
+
const xml = obj.getXMLFile();
|
|
74266
|
+
if (xml === undefined) {
|
|
74267
|
+
return [];
|
|
74268
|
+
}
|
|
74269
|
+
const rows = xml.getRawRows();
|
|
74270
|
+
for (let i = 0; i < rows.length; i++) {
|
|
74271
|
+
const start = rows[i].indexOf("<URL>");
|
|
74272
|
+
const end = rows[i].indexOf("</URL>");
|
|
74273
|
+
if (start >= 0 && end > start) {
|
|
74274
|
+
const range = vscode_languageserver_types_1.Range.create(i, start + 5, i, end);
|
|
74275
|
+
return [vscode_languageserver_types_1.TextDocumentEdit.create({ uri: xml.getFilename(), version: 1 }, [vscode_languageserver_types_1.TextEdit.replace(range, newURL)])];
|
|
74276
|
+
}
|
|
74277
|
+
}
|
|
74278
|
+
return [];
|
|
74279
|
+
}
|
|
74280
|
+
/** The node of the namespace above the renamed one (/sap/bc/ns/ above /sap/bc/ns/leaf/). It does not exist
|
|
74281
|
+
* in a fresh system and abapGit does not create nodes in between, so it is added next to the renamed node,
|
|
74282
|
+
* unless the registry has a node with that URL already */
|
|
74283
|
+
buildNamespaceNode(obj, namespace, newURL) {
|
|
74284
|
+
var _a;
|
|
74285
|
+
const parentURL = newURL.replace(/[^/]+\/?$/, "");
|
|
74286
|
+
for (const o of this.reg.getObjects()) {
|
|
74287
|
+
if (o instanceof __1.ICFService && ((_a = o.getURL()) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === parentURL.toLowerCase()) {
|
|
74288
|
+
return [];
|
|
74289
|
+
}
|
|
74290
|
+
}
|
|
74291
|
+
const xml = obj.getXMLFile();
|
|
74292
|
+
if (xml === undefined) {
|
|
74293
|
+
return [];
|
|
74294
|
+
}
|
|
74295
|
+
const filename = xml.getFilename();
|
|
74296
|
+
const slash = Math.max(filename.lastIndexOf("/"), filename.lastIndexOf("\\"));
|
|
74297
|
+
const name = namespace.toLowerCase();
|
|
74298
|
+
const hash = crypto.createHash("sha1").update(parentURL).digest("hex").substring(0, ICF_HASH_LENGTH);
|
|
74299
|
+
const uri = filename.substring(0, slash + 1) + name.padEnd(ICF_NAME_LENGTH, " ") + hash + ".sicf.xml";
|
|
74300
|
+
// abapGit writes every XML file with a UTF-8 byte order mark, xml_bom checks it
|
|
74301
|
+
const content = `\ufeff<?xml version="1.0" encoding="utf-8"?>
|
|
74302
|
+
<abapGit version="v1.0.0" serializer="LCL_OBJECT_SICF" serializer_version="v1.0.0">
|
|
74303
|
+
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
|
|
74304
|
+
<asx:values>
|
|
74305
|
+
<URL>${parentURL}</URL>
|
|
74306
|
+
<ICFSERVICE>
|
|
74307
|
+
<ICF_NAME>${name.toUpperCase()}</ICF_NAME>
|
|
74308
|
+
<ORIG_NAME>${name}</ORIG_NAME>
|
|
74309
|
+
</ICFSERVICE>
|
|
74310
|
+
<ICFDOCU>
|
|
74311
|
+
<ICF_NAME>${name.toUpperCase()}</ICF_NAME>
|
|
74312
|
+
<ICF_LANGU>E</ICF_LANGU>
|
|
74313
|
+
<ICF_DOCU>Namespace ${name}</ICF_DOCU>
|
|
74314
|
+
</ICFDOCU>
|
|
74315
|
+
</asx:values>
|
|
74316
|
+
</asx:abap>
|
|
74317
|
+
</abapGit>
|
|
74318
|
+
`;
|
|
74319
|
+
return [
|
|
74320
|
+
vscode_languageserver_types_1.CreateFile.create(uri),
|
|
74321
|
+
vscode_languageserver_types_1.TextDocumentEdit.create({ uri, version: 1 }, [vscode_languageserver_types_1.TextEdit.insert({ line: 0, character: 0 }, content)]),
|
|
74322
|
+
];
|
|
74323
|
+
}
|
|
74324
|
+
/** abapGit names a SICF file "<ICF_NAME, lower case, padded to 15><first 25 hex chars of SHA1(URL)>.sicf.xml",
|
|
74325
|
+
* the URL is the one in the XML. Both parts change with the name, keeping the old ones gives an object name
|
|
74326
|
+
* abapGit does not derive from the node. Returns undefined if the files are not in this layout */
|
|
74327
|
+
renameAbapGitFiles(obj, newName, newURL) {
|
|
74328
|
+
if (newName.length > ICF_NAME_LENGTH) {
|
|
74329
|
+
return undefined;
|
|
74330
|
+
}
|
|
74331
|
+
const hash = crypto.createHash("sha1").update(newURL).digest("hex").substring(0, ICF_HASH_LENGTH);
|
|
74332
|
+
const stem = newName.toLowerCase().padEnd(ICF_NAME_LENGTH, " ") + hash;
|
|
74333
|
+
const list = [];
|
|
74334
|
+
for (const f of obj.getFiles()) {
|
|
74335
|
+
const filename = f.getFilename();
|
|
74336
|
+
const slash = Math.max(filename.lastIndexOf("/"), filename.lastIndexOf("\\"));
|
|
74337
|
+
const base = filename.substring(slash + 1);
|
|
74338
|
+
const match = base.match(/^[^ ]+ +[0-9a-f]{25}(\..+)$/i);
|
|
74339
|
+
if (match === null) {
|
|
74340
|
+
return undefined;
|
|
74341
|
+
}
|
|
74342
|
+
list.push(vscode_languageserver_types_1.RenameFile.create(filename, filename.substring(0, slash + 1) + stem + match[1]));
|
|
74343
|
+
}
|
|
74344
|
+
return list;
|
|
74345
|
+
}
|
|
73974
74346
|
}
|
|
73975
74347
|
exports.RenameICFService = RenameICFService;
|
|
74348
|
+
const ICF_NAME_LENGTH = 15;
|
|
74349
|
+
const ICF_HASH_LENGTH = 25;
|
|
74350
|
+
/** The URL of the node moved into a namespace. The node is the last segment of the URL. Below
|
|
74351
|
+
* /sap/bc/bsp/ and /sap/bc/ui5_ui5/ an SAP name sits below a node "sap", and a namespaced one
|
|
74352
|
+
* below the namespace instead: /sap/bc/bsp/sap/old/ -> /sap/bc/bsp/ns/leaf/. Elsewhere the
|
|
74353
|
+
* namespace node is added: /sap/bc/old/ -> /sap/bc/ns/leaf/ */
|
|
74354
|
+
function namespacedURL(url, oldName, namespace, leaf) {
|
|
74355
|
+
const segments = url.split("/");
|
|
74356
|
+
const last = segments.length - (url.endsWith("/") ? 2 : 1);
|
|
74357
|
+
if (last < 1 || segments[last].toLowerCase() !== oldName.toLowerCase()) {
|
|
74358
|
+
return undefined;
|
|
74359
|
+
}
|
|
74360
|
+
const before = segments.slice(0, last).join("/").toLowerCase();
|
|
74361
|
+
const replaceSap = before.endsWith("/sap/bc/bsp/sap") || before.endsWith("/sap/bc/ui5_ui5/sap");
|
|
74362
|
+
const start = replaceSap ? last - 1 : last;
|
|
74363
|
+
segments.splice(start, last - start + 1, namespace.toLowerCase(), leaf.toLowerCase());
|
|
74364
|
+
return segments.join("/");
|
|
74365
|
+
}
|
|
73976
74366
|
//# sourceMappingURL=rename_icf_service.js.map
|
|
73977
74367
|
|
|
73978
74368
|
/***/ },
|
|
@@ -74212,6 +74602,79 @@ exports.RenameTableType = RenameTableType;
|
|
|
74212
74602
|
|
|
74213
74603
|
/***/ },
|
|
74214
74604
|
|
|
74605
|
+
/***/ "./node_modules/@abaplint/core/build/src/objects/rename/rename_urls.js"
|
|
74606
|
+
/*!*****************************************************************************!*\
|
|
74607
|
+
!*** ./node_modules/@abaplint/core/build/src/objects/rename/rename_urls.js ***!
|
|
74608
|
+
\*****************************************************************************/
|
|
74609
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
74610
|
+
|
|
74611
|
+
"use strict";
|
|
74612
|
+
|
|
74613
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
74614
|
+
exports.RenameURLs = void 0;
|
|
74615
|
+
const vscode_languageserver_types_1 = __webpack_require__(/*! vscode-languageserver-types */ "./node_modules/vscode-languageserver-types/lib/esm/main.js");
|
|
74616
|
+
const bsp_application_1 = __webpack_require__(/*! ../bsp_application */ "./node_modules/@abaplint/core/build/src/objects/bsp_application.js");
|
|
74617
|
+
/** Renames the URLs of renamed ICF nodes in the pages of the BSP applications, eg. a data source
|
|
74618
|
+
* in a manifest.json, "/sap/bc/zfoo" -> "/sap/bc/ns/foo". A BSP refers to an ICF node by its URL,
|
|
74619
|
+
* which no reference of the renamer knows. A URL is matched as a whole path, without its trailing
|
|
74620
|
+
* "/" and in any case: "/sap/bc/zfoo", "/sap/bc/zfoo/" and "/sap/bc/zfoo?x=1", not "/sap/bc/zfoo_bar".
|
|
74621
|
+
* The XML of the application, its attributes and the list of its pages, is not changed */
|
|
74622
|
+
class RenameURLs {
|
|
74623
|
+
constructor(reg) {
|
|
74624
|
+
this.reg = reg;
|
|
74625
|
+
}
|
|
74626
|
+
buildEdits(urls) {
|
|
74627
|
+
var _a;
|
|
74628
|
+
const documentChanges = [];
|
|
74629
|
+
const map = new Map();
|
|
74630
|
+
for (const u of urls) {
|
|
74631
|
+
const oldPath = withoutSlash(u.oldURL).toLowerCase();
|
|
74632
|
+
if (oldPath !== "") {
|
|
74633
|
+
map.set(oldPath, withoutSlash(u.newURL).toLowerCase());
|
|
74634
|
+
}
|
|
74635
|
+
}
|
|
74636
|
+
if (map.size === 0) {
|
|
74637
|
+
return { documentChanges };
|
|
74638
|
+
}
|
|
74639
|
+
// longest first, one pass: a replaced URL is not matched again
|
|
74640
|
+
const alternatives = Array.from(map.keys()).sort((a, b) => b.length - a.length).map(escape);
|
|
74641
|
+
const regex = new RegExp("(" + alternatives.join("|") + ")(?![A-Za-z0-9_-])", "gi");
|
|
74642
|
+
for (const obj of this.reg.getObjectsByType("WAPA")) {
|
|
74643
|
+
if (!(obj instanceof bsp_application_1.BSPApplication) || this.reg.isDependency(obj)) {
|
|
74644
|
+
continue;
|
|
74645
|
+
}
|
|
74646
|
+
const descriptor = (_a = obj.getXMLFile()) === null || _a === void 0 ? void 0 : _a.getFilename();
|
|
74647
|
+
for (const file of obj.getFiles()) {
|
|
74648
|
+
if (file.getFilename() === descriptor) {
|
|
74649
|
+
continue;
|
|
74650
|
+
}
|
|
74651
|
+
const edits = [];
|
|
74652
|
+
const rows = file.getRawRows();
|
|
74653
|
+
for (let i = 0; i < rows.length; i++) {
|
|
74654
|
+
const replaced = rows[i].replace(regex, found => { var _a; return (_a = map.get(found.toLowerCase())) !== null && _a !== void 0 ? _a : found; });
|
|
74655
|
+
if (replaced !== rows[i]) {
|
|
74656
|
+
edits.push(vscode_languageserver_types_1.TextEdit.replace(vscode_languageserver_types_1.Range.create(i, 0, i, rows[i].length), replaced));
|
|
74657
|
+
}
|
|
74658
|
+
}
|
|
74659
|
+
if (edits.length > 0) {
|
|
74660
|
+
documentChanges.push(vscode_languageserver_types_1.TextDocumentEdit.create({ uri: file.getFilename(), version: 1 }, edits));
|
|
74661
|
+
}
|
|
74662
|
+
}
|
|
74663
|
+
}
|
|
74664
|
+
return { documentChanges };
|
|
74665
|
+
}
|
|
74666
|
+
}
|
|
74667
|
+
exports.RenameURLs = RenameURLs;
|
|
74668
|
+
function withoutSlash(url) {
|
|
74669
|
+
return url.endsWith("/") ? url.substring(0, url.length - 1) : url;
|
|
74670
|
+
}
|
|
74671
|
+
function escape(s) {
|
|
74672
|
+
return s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
74673
|
+
}
|
|
74674
|
+
//# sourceMappingURL=rename_urls.js.map
|
|
74675
|
+
|
|
74676
|
+
/***/ },
|
|
74677
|
+
|
|
74215
74678
|
/***/ "./node_modules/@abaplint/core/build/src/objects/rename/renamer.js"
|
|
74216
74679
|
/*!*************************************************************************!*\
|
|
74217
74680
|
!*** ./node_modules/@abaplint/core/build/src/objects/rename/renamer.js ***!
|
|
@@ -74233,13 +74696,18 @@ const rename_table_1 = __webpack_require__(/*! ./rename_table */ "./node_modules
|
|
|
74233
74696
|
const rename_table_type_1 = __webpack_require__(/*! ./rename_table_type */ "./node_modules/@abaplint/core/build/src/objects/rename/rename_table_type.js");
|
|
74234
74697
|
const rename_message_class_1 = __webpack_require__(/*! ./rename_message_class */ "./node_modules/@abaplint/core/build/src/objects/rename/rename_message_class.js");
|
|
74235
74698
|
const rename_icf_service_1 = __webpack_require__(/*! ./rename_icf_service */ "./node_modules/@abaplint/core/build/src/objects/rename/rename_icf_service.js");
|
|
74699
|
+
const rename_urls_1 = __webpack_require__(/*! ./rename_urls */ "./node_modules/@abaplint/core/build/src/objects/rename/rename_urls.js");
|
|
74700
|
+
const icf_service_1 = __webpack_require__(/*! ../icf_service */ "./node_modules/@abaplint/core/build/src/objects/icf_service.js");
|
|
74701
|
+
const rename_bsp_application_1 = __webpack_require__(/*! ./rename_bsp_application */ "./node_modules/@abaplint/core/build/src/objects/rename/rename_bsp_application.js");
|
|
74236
74702
|
class Renamer {
|
|
74237
74703
|
constructor(reg) {
|
|
74704
|
+
this.renamedURLs = [];
|
|
74238
74705
|
this.reg = reg;
|
|
74239
74706
|
}
|
|
74240
74707
|
/** Applies the renaming to the objects and files in the registry,
|
|
74241
74708
|
* after renaming the registry is not parsed */
|
|
74242
74709
|
rename(type, oldName, newName) {
|
|
74710
|
+
var _a;
|
|
74243
74711
|
const edits = this.buildEdits(type, oldName, newName);
|
|
74244
74712
|
if (edits === undefined) {
|
|
74245
74713
|
throw new Error("no changes could be determined");
|
|
@@ -74247,17 +74715,28 @@ class Renamer {
|
|
|
74247
74715
|
else if (edits.changes) {
|
|
74248
74716
|
throw new Error("only documentChanges expected");
|
|
74249
74717
|
}
|
|
74718
|
+
const before = type === "SICF" ? this.findObject(type, oldName) : undefined;
|
|
74719
|
+
const oldURL = before instanceof icf_service_1.ICFService ? before.getURL() : undefined;
|
|
74720
|
+
const oldXML = (_a = before === null || before === void 0 ? void 0 : before.getXMLFile()) === null || _a === void 0 ? void 0 : _a.getFilename();
|
|
74250
74721
|
const result = this.apply(edits);
|
|
74251
74722
|
this.reg.findIssues(); // hmm, this builds the ddic references
|
|
74723
|
+
if (oldURL !== undefined && oldXML !== undefined) {
|
|
74724
|
+
this.rememberURL(edits, oldURL, oldXML);
|
|
74725
|
+
}
|
|
74726
|
+
return result;
|
|
74727
|
+
}
|
|
74728
|
+
/** Renames the old URLs of the ICF nodes renamed by this renamer in the pages of the BSP
|
|
74729
|
+
* applications, see RenameURLs */
|
|
74730
|
+
renameURLs() {
|
|
74731
|
+
this.reg.parse();
|
|
74732
|
+
const result = this.apply(new rename_urls_1.RenameURLs(this.reg).buildEdits(this.renamedURLs));
|
|
74733
|
+
this.reg.parse();
|
|
74252
74734
|
return result;
|
|
74253
74735
|
}
|
|
74254
74736
|
/** Builds edits, but does not apply to registry, used by LSP */
|
|
74255
74737
|
buildEdits(type, oldName, newName) {
|
|
74256
74738
|
this.reg.parse(); // the registry must be parsed to dermine references
|
|
74257
|
-
|
|
74258
|
-
if (obj === undefined && type === "SICF") {
|
|
74259
|
-
obj = Array.from(this.reg.getObjects()).find(o => o.getType() === "SICF" && o.getName().toUpperCase().startsWith(oldName.toUpperCase() + " "));
|
|
74260
|
-
}
|
|
74739
|
+
const obj = this.findObject(type, oldName);
|
|
74261
74740
|
if (obj === undefined) {
|
|
74262
74741
|
throw new Error("rename, object not found");
|
|
74263
74742
|
}
|
|
@@ -74269,6 +74748,25 @@ class Renamer {
|
|
|
74269
74748
|
return r.buildEdits(obj, oldName.toUpperCase(), newName);
|
|
74270
74749
|
}
|
|
74271
74750
|
//////////////////
|
|
74751
|
+
findObject(type, name) {
|
|
74752
|
+
let obj = this.reg.getObject(type, name);
|
|
74753
|
+
if (obj === undefined && type === "SICF") {
|
|
74754
|
+
obj = Array.from(this.reg.getObjects()).find(o => o.getType() === "SICF" && o.getName().toUpperCase().startsWith(name.toUpperCase() + " "));
|
|
74755
|
+
}
|
|
74756
|
+
return obj;
|
|
74757
|
+
}
|
|
74758
|
+
/** the new URL is the one in the XML file the old XML file was renamed to */
|
|
74759
|
+
rememberURL(edits, oldURL, oldXML) {
|
|
74760
|
+
var _a, _b;
|
|
74761
|
+
for (const dc of edits.documentChanges || []) {
|
|
74762
|
+
if (vscode_languageserver_types_1.RenameFile.is(dc) && dc.oldUri === oldXML) {
|
|
74763
|
+
const newURL = (_b = (_a = this.reg.getFileByName(dc.newUri)) === null || _a === void 0 ? void 0 : _a.getRaw().match(/<URL>([^<]*)<\/URL>/)) === null || _b === void 0 ? void 0 : _b[1];
|
|
74764
|
+
if (newURL !== undefined && newURL.toLowerCase() !== oldURL.toLowerCase()) {
|
|
74765
|
+
this.renamedURLs.push({ oldURL, newURL });
|
|
74766
|
+
}
|
|
74767
|
+
}
|
|
74768
|
+
}
|
|
74769
|
+
}
|
|
74272
74770
|
factory(type) {
|
|
74273
74771
|
switch (type) {
|
|
74274
74772
|
case "CLAS":
|
|
@@ -74289,6 +74787,8 @@ class Renamer {
|
|
|
74289
74787
|
return new rename_message_class_1.RenameMessageClass(this.reg);
|
|
74290
74788
|
case "SICF":
|
|
74291
74789
|
return new rename_icf_service_1.RenameICFService(this.reg);
|
|
74790
|
+
case "WAPA":
|
|
74791
|
+
return new rename_bsp_application_1.RenameBSPApplication(this.reg);
|
|
74292
74792
|
default:
|
|
74293
74793
|
throw new Error("Renaming of " + type + " not yet supported");
|
|
74294
74794
|
}
|
|
@@ -74300,11 +74800,21 @@ class Renamer {
|
|
|
74300
74800
|
deletedFiles: new Set(),
|
|
74301
74801
|
updatedFiles: new Set(),
|
|
74302
74802
|
};
|
|
74303
|
-
// assumption: only renames or text changes, no deletes
|
|
74803
|
+
// assumption: only renames, creates or text changes, no deletes. A created file starts empty,
|
|
74804
|
+
// its content is a text edit after the create
|
|
74304
74805
|
for (const dc of edits.documentChanges || []) {
|
|
74305
74806
|
if (vscode_languageserver_types_1.TextDocumentEdit.is(dc)) {
|
|
74306
74807
|
this.applyEdit(dc);
|
|
74307
|
-
result.
|
|
74808
|
+
if (result.addedFiles.has(dc.textDocument.uri) === false) {
|
|
74809
|
+
result.updatedFiles.add(dc.textDocument.uri);
|
|
74810
|
+
}
|
|
74811
|
+
}
|
|
74812
|
+
else if (vscode_languageserver_types_1.CreateFile.is(dc)) {
|
|
74813
|
+
if (this.reg.getFileByName(dc.uri) !== undefined) {
|
|
74814
|
+
throw new Error("apply, file " + dc.uri + " already exists");
|
|
74815
|
+
}
|
|
74816
|
+
this.reg.addFile(new memory_file_1.MemoryFile(dc.uri, ""));
|
|
74817
|
+
result.addedFiles.add(dc.uri);
|
|
74308
74818
|
}
|
|
74309
74819
|
else if (vscode_languageserver_types_1.RenameFile.is(dc)) {
|
|
74310
74820
|
renames.push(dc);
|
|
@@ -76938,7 +77448,7 @@ class Registry {
|
|
|
76938
77448
|
}
|
|
76939
77449
|
static abaplintVersion() {
|
|
76940
77450
|
// magic, see build script "version.js"
|
|
76941
|
-
return "2.120.
|
|
77451
|
+
return "2.120.121";
|
|
76942
77452
|
}
|
|
76943
77453
|
getDDICReferences() {
|
|
76944
77454
|
return this.ddicReferences;
|
|
@@ -77554,6 +78064,7 @@ const _reference_1 = __webpack_require__(/*! ../abap/5_syntax/_reference */ "./n
|
|
|
77554
78064
|
const syntax_1 = __webpack_require__(/*! ../abap/5_syntax/syntax */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/syntax.js");
|
|
77555
78065
|
const raw_rows_cache_1 = __webpack_require__(/*! ../files/raw_rows_cache */ "./node_modules/@abaplint/core/build/src/files/raw_rows_cache.js");
|
|
77556
78066
|
const nodes_1 = __webpack_require__(/*! ../abap/nodes */ "./node_modules/@abaplint/core/build/src/abap/nodes/index.js");
|
|
78067
|
+
const _key_compare_1 = __webpack_require__(/*! ../abap/5_syntax/_key_compare */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_key_compare.js");
|
|
77557
78068
|
const _typed_identifier_1 = __webpack_require__(/*! ../abap/types/_typed_identifier */ "./node_modules/@abaplint/core/build/src/abap/types/_typed_identifier.js");
|
|
77558
78069
|
const basic_1 = __webpack_require__(/*! ../abap/types/basic */ "./node_modules/@abaplint/core/build/src/abap/types/basic/index.js");
|
|
77559
78070
|
const class_definition_1 = __webpack_require__(/*! ../abap/types/class_definition */ "./node_modules/@abaplint/core/build/src/abap/types/class_definition.js");
|
|
@@ -78391,12 +78902,8 @@ function simplePredicate(statement) {
|
|
|
78391
78902
|
return undefined;
|
|
78392
78903
|
}
|
|
78393
78904
|
const children = compare.getChildren();
|
|
78394
|
-
|
|
78395
|
-
|
|
78396
|
-
if (children[0] instanceof nodes_1.TokenNode && children[0].getFirstToken().getStr().toUpperCase() === "NOT") {
|
|
78397
|
-
negated = true;
|
|
78398
|
-
i = 1;
|
|
78399
|
-
}
|
|
78905
|
+
const i = (0, _key_compare_1.countLeadingNot)(compare);
|
|
78906
|
+
const negated = i % 2 === 1;
|
|
78400
78907
|
const left = children[i];
|
|
78401
78908
|
if (!(left instanceof nodes_1.ExpressionNode) || !(left.get() instanceof Expressions.Source)) {
|
|
78402
78909
|
return undefined;
|
|
@@ -87180,6 +87687,7 @@ exports.ConstantCondition = exports.ConstantConditionConf = void 0;
|
|
|
87180
87687
|
const Expressions = __importStar(__webpack_require__(/*! ../abap/2_statements/expressions */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js"));
|
|
87181
87688
|
const Statements = __importStar(__webpack_require__(/*! ../abap/2_statements/statements */ "./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js"));
|
|
87182
87689
|
const nodes_1 = __webpack_require__(/*! ../abap/nodes */ "./node_modules/@abaplint/core/build/src/abap/nodes/index.js");
|
|
87690
|
+
const _key_compare_1 = __webpack_require__(/*! ../abap/5_syntax/_key_compare */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_key_compare.js");
|
|
87183
87691
|
const basic_1 = __webpack_require__(/*! ../abap/types/basic */ "./node_modules/@abaplint/core/build/src/abap/types/basic/index.js");
|
|
87184
87692
|
const _typed_identifier_1 = __webpack_require__(/*! ../abap/types/_typed_identifier */ "./node_modules/@abaplint/core/build/src/abap/types/_typed_identifier.js");
|
|
87185
87693
|
const issue_1 = __webpack_require__(/*! ../issue */ "./node_modules/@abaplint/core/build/src/issue.js");
|
|
@@ -87412,8 +87920,9 @@ ENDIF.`,
|
|
|
87412
87920
|
/** x = a, x <> a, a = x, NOT x = a etc, x character-like and a a known character value */
|
|
87413
87921
|
valueComparison(procedure, compare) {
|
|
87414
87922
|
const children = compare.getChildren();
|
|
87415
|
-
const
|
|
87416
|
-
const
|
|
87923
|
+
const nots = (0, _key_compare_1.countLeadingNot)(compare);
|
|
87924
|
+
const negated = nots % 2 === 1;
|
|
87925
|
+
const rest = children.slice(nots);
|
|
87417
87926
|
if (rest.length !== 3 || !(rest[0] instanceof nodes_1.ExpressionNode) || !(rest[2] instanceof nodes_1.ExpressionNode)
|
|
87418
87927
|
|| !(rest[1].get() instanceof Expressions.CompareOperator)) {
|
|
87419
87928
|
return undefined;
|
|
@@ -89504,6 +90013,7 @@ Current rules:
|
|
|
89504
90013
|
* Some occurrences of string template formatting option ALPHA changed to function module call
|
|
89505
90014
|
* SELECT/INSERT/MODIFY/DELETE/UPDATE "," in field list removed, "@" in source/targets removed
|
|
89506
90015
|
* OPEN CURSOR/FETCH NEXT CURSOR/CLOSE CURSOR "@" in source/targets removed
|
|
90016
|
+
* the ABAP language version of an object, ABAP for Cloud Development or ABAP for Key Users, set to standard ABAP
|
|
89507
90017
|
* PARTIALLY IMPLEMENTED removed, it can be quick fixed via rule implement_methods
|
|
89508
90018
|
* RAISE EXCEPTION ... MESSAGE
|
|
89509
90019
|
* Moving with +=, -=, /=, *=, &&= is expanded
|
|
@@ -89531,6 +90041,29 @@ Make sure to test the downported code, it might not always be completely correct
|
|
|
89531
90041
|
}
|
|
89532
90042
|
return this;
|
|
89533
90043
|
}
|
|
90044
|
+
/** the ABAP language version of the object, which abapGit keeps in UNICODE (classes, interfaces) or
|
|
90045
|
+
* ABAP_LANGU_VERSION: 5 is ABAP for Cloud Development, 2 ABAP for Key Users. 7.02 has neither, and a
|
|
90046
|
+
* system that has them checks the downported code by their rules, eg. the downport's restore of
|
|
90047
|
+
* SY-TABIX is a write to a system field ABAP Cloud refuses. The downport is standard ABAP, X */
|
|
90048
|
+
downportLanguageVersion(obj) {
|
|
90049
|
+
const xml = obj.getXMLFile();
|
|
90050
|
+
if (xml === undefined) {
|
|
90051
|
+
return undefined;
|
|
90052
|
+
}
|
|
90053
|
+
const rows = xml.getRawRows();
|
|
90054
|
+
for (let i = 0; i < rows.length; i++) {
|
|
90055
|
+
const match = rows[i].match(/<(UNICODE|ABAP_LANGU_VERSION)>([25])<\/\1>/);
|
|
90056
|
+
if (match === null || match.index === undefined) {
|
|
90057
|
+
continue;
|
|
90058
|
+
}
|
|
90059
|
+
const start = new position_1.Position(i + 1, match.index + match[1].length + 3);
|
|
90060
|
+
const end = new position_1.Position(i + 1, start.getCol() + 1);
|
|
90061
|
+
const fix = edit_helper_1.EditHelper.replaceRange(xml, start, end, "X");
|
|
90062
|
+
const name = match[2] === "5" ? "ABAP for Cloud Development" : "ABAP for Key Users";
|
|
90063
|
+
return issue_1.Issue.atRowRange(xml, i + 1, start.getCol(), end.getCol(), "Language version " + name + ", standard ABAP", this.getMetadata().key, this.conf.severity, fix);
|
|
90064
|
+
}
|
|
90065
|
+
return undefined;
|
|
90066
|
+
}
|
|
89534
90067
|
listMainForInclude(filename) {
|
|
89535
90068
|
if (filename === undefined) {
|
|
89536
90069
|
return [];
|
|
@@ -89565,6 +90098,12 @@ Make sure to test the downported code, it might not always be completely correct
|
|
|
89565
90098
|
else if (!(lowObj instanceof _abap_object_1.ABAPObject)) {
|
|
89566
90099
|
return ret;
|
|
89567
90100
|
}
|
|
90101
|
+
if (config.getRelease() === version_1.Release.v702) {
|
|
90102
|
+
const languageVersion = this.downportLanguageVersion(lowObj);
|
|
90103
|
+
if (languageVersion !== undefined) {
|
|
90104
|
+
return [languageVersion];
|
|
90105
|
+
}
|
|
90106
|
+
}
|
|
89568
90107
|
const highObj = this.highReg.getObject(lowObj.getType(), lowObj.getName());
|
|
89569
90108
|
if (highObj === undefined || !(highObj instanceof _abap_object_1.ABAPObject)) {
|
|
89570
90109
|
return ret;
|
|
@@ -90041,11 +90580,18 @@ Make sure to test the downported code, it might not always be completely correct
|
|
|
90041
90580
|
&& !(high.get() instanceof Statements.SelectLoop)) {
|
|
90042
90581
|
return undefined;
|
|
90043
90582
|
}
|
|
90044
|
-
// note: SQLCond is also used in JOIN(FROM) conditions
|
|
90045
|
-
|
|
90046
|
-
|
|
90583
|
+
// note: SQLCond is also used in JOIN(FROM) conditions. INTO after any of WHERE, GROUP BY,
|
|
90584
|
+
// HAVING or ORDER BY is strict syntax, the first of them is where INTO has to be in front of
|
|
90585
|
+
const clauses = [
|
|
90586
|
+
(_a = high.findFirstExpression(Expressions.Select)) === null || _a === void 0 ? void 0 : _a.findDirectExpression(Expressions.SQLCond),
|
|
90587
|
+
high.findFirstExpression(Expressions.SQLGroupBy),
|
|
90588
|
+
high.findFirstExpression(Expressions.SQLHaving),
|
|
90589
|
+
high.findFirstExpression(Expressions.SQLOrderBy),
|
|
90590
|
+
].filter(c => c !== undefined);
|
|
90591
|
+
if (clauses.length === 0) {
|
|
90047
90592
|
return undefined;
|
|
90048
90593
|
}
|
|
90594
|
+
const first = clauses.reduce((a, b) => b.getFirstToken().getStart().isBefore(a.getFirstToken().getStart()) ? b : a);
|
|
90049
90595
|
// the FIELDS list sits between FROM and WHERE, wait for it to be removed first
|
|
90050
90596
|
if (high.findFirstExpression(Expressions.SQLFields) !== undefined) {
|
|
90051
90597
|
return undefined;
|
|
@@ -90060,21 +90606,26 @@ Make sure to test the downported code, it might not always be completely correct
|
|
|
90060
90606
|
if (into === undefined) {
|
|
90061
90607
|
return undefined;
|
|
90062
90608
|
}
|
|
90063
|
-
if (
|
|
90609
|
+
if (first.getFirstToken().getStart().isBefore(into.getFirstToken().getStart()) === false) {
|
|
90064
90610
|
return undefined;
|
|
90065
90611
|
}
|
|
90066
90612
|
const from = high.findFirstExpression(Expressions.SQLFrom);
|
|
90067
90613
|
if (from === undefined) {
|
|
90068
90614
|
return undefined;
|
|
90069
90615
|
}
|
|
90070
|
-
// UP TO after INTO
|
|
90616
|
+
// UP TO and BYPASSING BUFFER after INTO are not valid behind WHERE or ORDER BY, they belong to
|
|
90617
|
+
// FROM in the old syntax: move them along in front of INTO, FROM ... BYPASSING BUFFER UP TO n ROWS INTO
|
|
90071
90618
|
let move = into.concatTokens();
|
|
90072
90619
|
const fixes = [];
|
|
90073
|
-
const
|
|
90074
|
-
|
|
90075
|
-
|
|
90076
|
-
move =
|
|
90077
|
-
|
|
90620
|
+
const along = [high.findFirstExpression(Expressions.SQLUpTo), high.findFirstExpression(Expressions.SQLBypassingBuffer)]
|
|
90621
|
+
.filter(e => e !== undefined && into.getLastToken().getEnd().isBefore(e.getFirstToken().getStart()));
|
|
90622
|
+
for (const e of along) {
|
|
90623
|
+
move = e.concatTokens() + ` ` + move;
|
|
90624
|
+
}
|
|
90625
|
+
// edits are applied in sequence, so delete the later one first
|
|
90626
|
+
along.sort((a, b) => b.getFirstToken().getStart().isBefore(a.getFirstToken().getStart()) ? -1 : 1);
|
|
90627
|
+
for (const e of along) {
|
|
90628
|
+
fixes.push(edit_helper_1.EditHelper.deleteRange(lowFile, e.getFirstToken().getStart(), e.getLastToken().getEnd()));
|
|
90078
90629
|
}
|
|
90079
90630
|
// edits are applied in sequence, so work from the end of the statement towards the start
|
|
90080
90631
|
fixes.push(edit_helper_1.EditHelper.deleteRange(lowFile, into.getFirstToken().getStart(), into.getLastToken().getEnd()));
|
|
@@ -90121,15 +90672,11 @@ Make sure to test the downported code, it might not always be completely correct
|
|
|
90121
90672
|
&& !(high.get() instanceof Statements.CloseCursor)) {
|
|
90122
90673
|
return undefined;
|
|
90123
90674
|
}
|
|
90124
|
-
|
|
90675
|
+
// the edits of a fix are applied one after the other, a deletion moves what follows it in the
|
|
90676
|
+
// same row: collect the tokens and delete from the end of the statement towards its start
|
|
90677
|
+
const toDelete = [];
|
|
90125
90678
|
const addFix = (token) => {
|
|
90126
|
-
|
|
90127
|
-
if (fix === undefined) {
|
|
90128
|
-
fix = add;
|
|
90129
|
-
}
|
|
90130
|
-
else {
|
|
90131
|
-
fix = edit_helper_1.EditHelper.merge(fix, add);
|
|
90132
|
-
}
|
|
90679
|
+
toDelete.push(token);
|
|
90133
90680
|
};
|
|
90134
90681
|
const candidates = [high.findAllExpressionsRecursive(Expressions.SQLTarget),
|
|
90135
90682
|
high.findAllExpressionsRecursive(Expressions.SQLSource),
|
|
@@ -90168,14 +90715,17 @@ ${indentation}${uniqueName} = ${source === null || source === void 0 ? void 0 :
|
|
|
90168
90715
|
}
|
|
90169
90716
|
}
|
|
90170
90717
|
}
|
|
90171
|
-
for (const fieldList of high.findAllExpressionsMulti([Expressions.SQLFieldList, Expressions.SQLFieldListLoop, Expressions.SQLOrderBy
|
|
90718
|
+
for (const fieldList of high.findAllExpressionsMulti([Expressions.SQLFieldList, Expressions.SQLFieldListLoop, Expressions.SQLOrderBy,
|
|
90719
|
+
Expressions.SQLGroupBy], true)) {
|
|
90172
90720
|
for (const token of fieldList.getDirectTokens()) {
|
|
90173
90721
|
if (token.getStr() === ",") {
|
|
90174
90722
|
addFix(token);
|
|
90175
90723
|
}
|
|
90176
90724
|
}
|
|
90177
90725
|
}
|
|
90178
|
-
if (
|
|
90726
|
+
if (toDelete.length > 0) {
|
|
90727
|
+
toDelete.sort((a, b) => b.getStart().isBefore(a.getStart()) ? -1 : 1);
|
|
90728
|
+
const fix = edit_helper_1.EditHelper.mergeList(toDelete.map(t => edit_helper_1.EditHelper.deleteToken(lowFile, t)));
|
|
90179
90729
|
return issue_1.Issue.atToken(lowFile, low.getFirstToken(), "SQL, remove @ and ,", this.getMetadata().key, this.conf.severity, fix);
|
|
90180
90730
|
}
|
|
90181
90731
|
for (const c of high.findAllExpressionsRecursive(Expressions.SQLIn)) {
|
|
@@ -90192,7 +90742,7 @@ ${indentation}${uniqueName} = ${source === null || source === void 0 ? void 0 :
|
|
|
90192
90742
|
const lastStart = last.getFirstToken().getStart();
|
|
90193
90743
|
const startDelete = new position_1.Position(lastStart.getRow(), lastStart.getCol() - 1);
|
|
90194
90744
|
const fix2 = edit_helper_1.EditHelper.deleteRange(lowFile, startDelete, lastStart);
|
|
90195
|
-
fix = edit_helper_1.EditHelper.merge(fix2, fix1);
|
|
90745
|
+
const fix = edit_helper_1.EditHelper.merge(fix2, fix1);
|
|
90196
90746
|
return issue_1.Issue.atToken(lowFile, low.getFirstToken(), "SQL, remove spaces", this.getMetadata().key, this.conf.severity, fix);
|
|
90197
90747
|
}
|
|
90198
90748
|
}
|
|
@@ -90486,7 +91036,7 @@ ${indentation}`);
|
|
|
90486
91036
|
const indentation = " ".repeat(high.getFirstToken().getStart().getCol() - 1);
|
|
90487
91037
|
const firstToken = high.getFirstToken();
|
|
90488
91038
|
const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, firstToken.getStart(), `DATA ${uniqueName} LIKE LINE OF ${target === null || target === void 0 ? void 0 : target.concatTokens()}.
|
|
90489
|
-
${indentation}${uniqueName} = ${source.
|
|
91039
|
+
${indentation}${uniqueName} = ${source.concatTokensWithLinebreaks()}.\n${indentation}`);
|
|
90490
91040
|
const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, source.getFirstToken().getStart(), source.getLastToken().getEnd(), uniqueName);
|
|
90491
91041
|
const fix = edit_helper_1.EditHelper.merge(fix2, fix1);
|
|
90492
91042
|
return issue_1.Issue.atToken(lowFile, high.getFirstToken(), "Outline APPEND source expression", this.getMetadata().key, this.conf.severity, fix);
|
|
@@ -90542,7 +91092,7 @@ ${indentation}${uniqueName} = ${source.concatTokens()}.\n${indentation}`);
|
|
|
90542
91092
|
const indentation = " ".repeat(high.getFirstToken().getStart().getCol() - 1);
|
|
90543
91093
|
const firstToken = high.getFirstToken();
|
|
90544
91094
|
const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, firstToken.getStart(), `DATA ${uniqueName} LIKE LINE OF ${target === null || target === void 0 ? void 0 : target.concatTokens()}.
|
|
90545
|
-
${indentation}${uniqueName} = ${source.
|
|
91095
|
+
${indentation}${uniqueName} = ${source.concatTokensWithLinebreaks()}.\n${indentation}`);
|
|
90546
91096
|
const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, source.getFirstToken().getStart(), source.getLastToken().getEnd(), uniqueName);
|
|
90547
91097
|
const fix = edit_helper_1.EditHelper.merge(fix2, fix1);
|
|
90548
91098
|
return issue_1.Issue.atToken(lowFile, high.getFirstToken(), "Outline INSERT source expression", this.getMetadata().key, this.conf.severity, fix);
|
|
@@ -90608,7 +91158,7 @@ ENDIF.`;
|
|
|
90608
91158
|
${read.replace(/^/gm, " ")}
|
|
90609
91159
|
ENDIF.`;
|
|
90610
91160
|
}
|
|
90611
|
-
const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, firstToken.getStart(), `FIELD-SYMBOLS ${uniqueName}
|
|
91161
|
+
const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, firstToken.getStart(), `FIELD-SYMBOLS ${uniqueName} ${this.rowOf(pre, high, lowFile, highSyntax)}.
|
|
90612
91162
|
${indentation}DATA ${tabixBackup} LIKE sy-tabix.
|
|
90613
91163
|
${read.replace(/\n/g, "\n" + indentation).replace(/^/, indentation)}
|
|
90614
91164
|
${indentation}`);
|
|
@@ -91528,6 +92078,17 @@ CONSTANTS: BEGIN OF ${structureName},\n`;
|
|
|
91528
92078
|
const fix = edit_helper_1.EditHelper.replaceRange(lowFile, start, end, code);
|
|
91529
92079
|
return issue_1.Issue.atToken(lowFile, high.getFirstToken(), "Downport ENUM", this.getMetadata().key, this.conf.severity, fix);
|
|
91530
92080
|
}
|
|
92081
|
+
/** the type of a field symbol for a row of the table, LIKE LINE OF a generically typed table is
|
|
92082
|
+
* refused by the system, "<TAB> is a generic type" - the field symbol is then TYPE any */
|
|
92083
|
+
rowOf(table, high, lowFile, highSyntax) {
|
|
92084
|
+
var _a;
|
|
92085
|
+
const spag = highSyntax.spaghetti.lookupPosition(high.getFirstToken().getStart(), lowFile.getFilename());
|
|
92086
|
+
const type = (_a = spag === null || spag === void 0 ? void 0 : spag.findVariable(table)) === null || _a === void 0 ? void 0 : _a.getType();
|
|
92087
|
+
if (type instanceof basic_1.TableType && type.isGeneric() === true) {
|
|
92088
|
+
return "TYPE any";
|
|
92089
|
+
}
|
|
92090
|
+
return "LIKE LINE OF " + table;
|
|
92091
|
+
}
|
|
91531
92092
|
moveWithTableTarget(low, high, lowFile, highSyntax) {
|
|
91532
92093
|
var _a;
|
|
91533
92094
|
if (!(low.get() instanceof _statement_1.Unknown)) {
|
|
@@ -91562,7 +92123,7 @@ CONSTANTS: BEGIN OF ${structureName},\n`;
|
|
|
91562
92123
|
const tabixBackup = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
|
|
91563
92124
|
const indentation = " ".repeat(high.getFirstToken().getStart().getCol() - 1);
|
|
91564
92125
|
// restore tabix before exeption
|
|
91565
|
-
const code = `FIELD-SYMBOLS ${uniqueName}
|
|
92126
|
+
const code = `FIELD-SYMBOLS ${uniqueName} ${this.rowOf(tName, high, lowFile, highSyntax)}.
|
|
91566
92127
|
${indentation}DATA ${tabixBackup} LIKE sy-tabix.
|
|
91567
92128
|
${indentation}${tabixBackup} = sy-tabix.
|
|
91568
92129
|
${indentation}READ TABLE ${tName} ${condition}ASSIGNING ${uniqueName}.
|
|
@@ -92224,11 +92785,11 @@ ${indentation} output = ${uniqueName}.\n`;
|
|
|
92224
92785
|
}
|
|
92225
92786
|
else if (b.get() instanceof Expressions.Source) {
|
|
92226
92787
|
// note: it wont work with APPEND for Hashed/Sorted Tables, so use INSERT,
|
|
92227
|
-
body += indentation + "INSERT " + b.
|
|
92788
|
+
body += indentation + "INSERT " + b.concatTokensWithLinebreaks() + ` INTO TABLE ${uniqueName}.\n`;
|
|
92228
92789
|
skip = true;
|
|
92229
92790
|
}
|
|
92230
92791
|
else if (b.get() instanceof Expressions.ValueBodyLines) {
|
|
92231
|
-
body += indentation + "INSERT " + b.
|
|
92792
|
+
body += indentation + "INSERT " + b.concatTokensWithLinebreaks() + ` INTO TABLE ${uniqueName}.\n`;
|
|
92232
92793
|
skip = true;
|
|
92233
92794
|
}
|
|
92234
92795
|
else if (b.concatTokens() === ")") {
|
|
@@ -96622,6 +97183,7 @@ const _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ "./
|
|
|
96622
97183
|
const _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ "./node_modules/@abaplint/core/build/src/rules/_abap_rule.js");
|
|
96623
97184
|
const _irule_1 = __webpack_require__(/*! ./_irule */ "./node_modules/@abaplint/core/build/src/rules/_irule.js");
|
|
96624
97185
|
const nodes_1 = __webpack_require__(/*! ../abap/nodes */ "./node_modules/@abaplint/core/build/src/abap/nodes/index.js");
|
|
97186
|
+
const _key_compare_1 = __webpack_require__(/*! ../abap/5_syntax/_key_compare */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_key_compare.js");
|
|
96625
97187
|
class Conditions {
|
|
96626
97188
|
constructor() {
|
|
96627
97189
|
this.arr = [];
|
|
@@ -96715,8 +97277,9 @@ ENDIF.`,
|
|
|
96715
97277
|
}
|
|
96716
97278
|
for (const compare of statement.findAllExpressionsRecursive(Expressions.Compare)) {
|
|
96717
97279
|
const children = compare.getChildren();
|
|
96718
|
-
const
|
|
96719
|
-
const
|
|
97280
|
+
const nots = (0, _key_compare_1.countLeadingNot)(compare);
|
|
97281
|
+
const negated = nots % 2 === 1;
|
|
97282
|
+
const rest = children.slice(nots);
|
|
96720
97283
|
if (rest.length !== 3
|
|
96721
97284
|
|| !(rest[0] instanceof nodes_1.ExpressionNode) || !(rest[0].get() instanceof Expressions.Source)
|
|
96722
97285
|
|| !(rest[1] instanceof nodes_1.ExpressionNode) || !(rest[1].get() instanceof Expressions.CompareOperator)
|
|
@@ -101848,6 +102411,7 @@ const _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ "./
|
|
|
101848
102411
|
const _irule_1 = __webpack_require__(/*! ./_irule */ "./node_modules/@abaplint/core/build/src/rules/_irule.js");
|
|
101849
102412
|
const nodes_1 = __webpack_require__(/*! ../abap/nodes */ "./node_modules/@abaplint/core/build/src/abap/nodes/index.js");
|
|
101850
102413
|
const edit_helper_1 = __webpack_require__(/*! ../edit_helper */ "./node_modules/@abaplint/core/build/src/edit_helper.js");
|
|
102414
|
+
const _key_compare_1 = __webpack_require__(/*! ../abap/5_syntax/_key_compare */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_key_compare.js");
|
|
101851
102415
|
class ManyParenthesesConf extends _basic_rule_config_1.BasicRuleConfig {
|
|
101852
102416
|
}
|
|
101853
102417
|
exports.ManyParenthesesConf = ManyParenthesesConf;
|
|
@@ -101901,12 +102465,9 @@ ENDIF.`,
|
|
|
101901
102465
|
if (cond[0].getChildren().length === 1) {
|
|
101902
102466
|
const message = "Too many parentheses, simple";
|
|
101903
102467
|
const children = sub.getChildren();
|
|
101904
|
-
|
|
101905
|
-
|
|
101906
|
-
|
|
101907
|
-
startToken = children[1].getFirstToken();
|
|
101908
|
-
fixText = sub.getChildren()[2].concatTokens();
|
|
101909
|
-
}
|
|
102468
|
+
const nots = (0, _key_compare_1.countLeadingNot)(sub);
|
|
102469
|
+
const startToken = children[nots].getFirstToken();
|
|
102470
|
+
const fixText = children[nots + 1].concatTokens();
|
|
101910
102471
|
const fix = edit_helper_1.EditHelper.replaceRange(file, startToken.getStart(), sub.getLastToken().getEnd(), fixText);
|
|
101911
102472
|
const issue = issue_1.Issue.atToken(file, startToken, message, this.getMetadata().key, this.conf.severity, fix);
|
|
101912
102473
|
issues.push(issue);
|
|
@@ -101968,7 +102529,7 @@ ENDIF.`,
|
|
|
101968
102529
|
}
|
|
101969
102530
|
else if (c instanceof nodes_1.ExpressionNode
|
|
101970
102531
|
&& (c.get() instanceof Expressions.CondSub || c.get() instanceof Expressions.ComponentCondSub)) {
|
|
101971
|
-
if (
|
|
102532
|
+
if ((0, _key_compare_1.countLeadingNot)(c) > 0) {
|
|
101972
102533
|
return [];
|
|
101973
102534
|
}
|
|
101974
102535
|
let i = c.findDirectExpression(Expressions.Cond);
|
|
@@ -124148,6 +124709,137 @@ exports.Chunk = Chunk;
|
|
|
124148
124709
|
|
|
124149
124710
|
/***/ },
|
|
124150
124711
|
|
|
124712
|
+
/***/ "./node_modules/@abaplint/transpiler/build/src/constant_value.js"
|
|
124713
|
+
/*!***********************************************************************!*\
|
|
124714
|
+
!*** ./node_modules/@abaplint/transpiler/build/src/constant_value.js ***!
|
|
124715
|
+
\***********************************************************************/
|
|
124716
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
124717
|
+
|
|
124718
|
+
"use strict";
|
|
124719
|
+
|
|
124720
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
124721
|
+
if (k2 === undefined) k2 = k;
|
|
124722
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
124723
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
124724
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
124725
|
+
}
|
|
124726
|
+
Object.defineProperty(o, k2, desc);
|
|
124727
|
+
}) : (function(o, m, k, k2) {
|
|
124728
|
+
if (k2 === undefined) k2 = k;
|
|
124729
|
+
o[k2] = m[k];
|
|
124730
|
+
}));
|
|
124731
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
124732
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
124733
|
+
}) : function(o, v) {
|
|
124734
|
+
o["default"] = v;
|
|
124735
|
+
});
|
|
124736
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
124737
|
+
var ownKeys = function(o) {
|
|
124738
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
124739
|
+
var ar = [];
|
|
124740
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
124741
|
+
return ar;
|
|
124742
|
+
};
|
|
124743
|
+
return ownKeys(o);
|
|
124744
|
+
};
|
|
124745
|
+
return function (mod) {
|
|
124746
|
+
if (mod && mod.__esModule) return mod;
|
|
124747
|
+
var result = {};
|
|
124748
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
124749
|
+
__setModuleDefault(result, mod);
|
|
124750
|
+
return result;
|
|
124751
|
+
};
|
|
124752
|
+
})();
|
|
124753
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
124754
|
+
exports.constantSource = constantSource;
|
|
124755
|
+
exports.memberRead = memberRead;
|
|
124756
|
+
const abaplint = __importStar(__webpack_require__(/*! @abaplint/core */ "./node_modules/@abaplint/core/build/src/index.js"));
|
|
124757
|
+
function constantSource(reg, chain, path = []) {
|
|
124758
|
+
const match = /^([^\s=]+)\s*=>\s*([^\s-]+)(?:\s*-\s*(.+))?$/.exec(chain.concatTokens());
|
|
124759
|
+
if (match === null) {
|
|
124760
|
+
return { kind: "void" };
|
|
124761
|
+
}
|
|
124762
|
+
let objectName = match[1];
|
|
124763
|
+
let attribute = match[2];
|
|
124764
|
+
if (attribute.includes("~")) {
|
|
124765
|
+
[objectName, attribute] = attribute.split("~");
|
|
124766
|
+
}
|
|
124767
|
+
const components = match[3]?.split(/\s*-\s*/).map(c => c.toLowerCase()) ?? [];
|
|
124768
|
+
const obj = reg.getObject("INTF", objectName) || reg.getObject("CLAS", objectName);
|
|
124769
|
+
if (!(obj instanceof abaplint.ABAPObject)) {
|
|
124770
|
+
return { kind: "void" };
|
|
124771
|
+
}
|
|
124772
|
+
const key = (objectName + "=>" + attribute).toUpperCase();
|
|
124773
|
+
if (path.includes(key)) {
|
|
124774
|
+
throw new Error((obj.getMainABAPFile()?.getFilename() ?? obj.getName()) + ": constant chain "
|
|
124775
|
+
+ [...path, key].join(" -> ") + " never reaches a value");
|
|
124776
|
+
}
|
|
124777
|
+
const member = { kind: "member", object: obj, attribute: attribute, components: components };
|
|
124778
|
+
if (obj.getType() === "CLAS") {
|
|
124779
|
+
// a class's constant may change at run time
|
|
124780
|
+
return member;
|
|
124781
|
+
}
|
|
124782
|
+
const identifier = findConstant(reg, obj, attribute);
|
|
124783
|
+
if (identifier === undefined) {
|
|
124784
|
+
return member;
|
|
124785
|
+
}
|
|
124786
|
+
if (components.length > 0) {
|
|
124787
|
+
let value = identifier.getValue();
|
|
124788
|
+
for (const component of components) {
|
|
124789
|
+
const name = typeof value === "object" && value !== null
|
|
124790
|
+
? Object.keys(value).find(k => k.toLowerCase() === component) : undefined;
|
|
124791
|
+
value = name === undefined ? undefined : value[name];
|
|
124792
|
+
}
|
|
124793
|
+
return typeof value === "string" ? { kind: "literal", value: value } : member;
|
|
124794
|
+
}
|
|
124795
|
+
const declared = findStatement(obj, identifier)?.findDirectExpression(abaplint.Expressions.Value);
|
|
124796
|
+
const next = declared?.getChildren()[1];
|
|
124797
|
+
if (next instanceof abaplint.Nodes.ExpressionNode && next.get() instanceof abaplint.Expressions.SimpleFieldChain) {
|
|
124798
|
+
const further = constantSource(reg, next, [...path, key]);
|
|
124799
|
+
return further.kind === "void" ? member : further;
|
|
124800
|
+
}
|
|
124801
|
+
if (next instanceof abaplint.Nodes.TokenNode && next.concatTokens().toUpperCase() === "IS") {
|
|
124802
|
+
// VALUE IS INITIAL has no expression of its own: it is the one alternative of Value made of words
|
|
124803
|
+
return { kind: "initial", type: identifier.getType() };
|
|
124804
|
+
}
|
|
124805
|
+
const value = identifier.getValue();
|
|
124806
|
+
return typeof value === "string" ? { kind: "literal", value: value } : member;
|
|
124807
|
+
}
|
|
124808
|
+
function findConstant(reg, obj, attribute) {
|
|
124809
|
+
const found = [];
|
|
124810
|
+
const walk = (n) => {
|
|
124811
|
+
const id = n.getIdentifier();
|
|
124812
|
+
if (id.stype === abaplint.ScopeType.Interface && id.sname.toUpperCase() === obj.getName().toUpperCase()) {
|
|
124813
|
+
const v = n.findVariable(attribute);
|
|
124814
|
+
if (v !== undefined) {
|
|
124815
|
+
found.push(v);
|
|
124816
|
+
}
|
|
124817
|
+
}
|
|
124818
|
+
n.getChildren().forEach(walk);
|
|
124819
|
+
};
|
|
124820
|
+
walk(new abaplint.SyntaxLogic(reg, obj).run().spaghetti.getTop());
|
|
124821
|
+
return found[0];
|
|
124822
|
+
}
|
|
124823
|
+
function findStatement(obj, identifier) {
|
|
124824
|
+
const file = obj.getABAPFiles().find(f => f.getFilename() === identifier.getFilename());
|
|
124825
|
+
const start = identifier.getStart();
|
|
124826
|
+
return file?.getStatements().find(s => s.get() instanceof abaplint.Statements.Constant
|
|
124827
|
+
&& s.findDirectExpression(abaplint.Expressions.DefinitionName)?.getFirstToken().getStart().equals(start) === true);
|
|
124828
|
+
}
|
|
124829
|
+
/** the JS expression reading a member source at load */
|
|
124830
|
+
function memberRead(source) {
|
|
124831
|
+
const name = source.object.getName();
|
|
124832
|
+
const attribute = source.attribute.toLowerCase();
|
|
124833
|
+
const property = source.object.getType() === "INTF"
|
|
124834
|
+
? name.toLowerCase().replace(/\//g, "$") + "$" + attribute
|
|
124835
|
+
: attribute;
|
|
124836
|
+
return "abap.Classes['" + name.toUpperCase() + "']." + property.replace(/\//g, "$")
|
|
124837
|
+
+ source.components.map(c => c.includes("/") ? ".get()[\"" + c + "\"]" : ".get()." + c).join("");
|
|
124838
|
+
}
|
|
124839
|
+
//# sourceMappingURL=constant_value.js.map
|
|
124840
|
+
|
|
124841
|
+
/***/ },
|
|
124842
|
+
|
|
124151
124843
|
/***/ "./node_modules/@abaplint/transpiler/build/src/db/cds_database_view.js"
|
|
124152
124844
|
/*!*****************************************************************************!*\
|
|
124153
124845
|
!*** ./node_modules/@abaplint/transpiler/build/src/db/cds_database_view.js ***!
|
|
@@ -129026,11 +129718,21 @@ class SourceTranspiler {
|
|
|
129026
129718
|
addGet;
|
|
129027
129719
|
calculation;
|
|
129028
129720
|
/** calculation: the calculation type the target gives integer operands, each operation
|
|
129029
|
-
* gets its left operand as an int8, or as a decfloat34 when the target is p, f or decfloat34
|
|
129721
|
+
* gets its left operand as an int8, or as a decfloat34 when the target is p, f or decfloat34;
|
|
129722
|
+
* with "i" the operands stay as they are and "+", "-" and "*" are the operators that check
|
|
129723
|
+
* the range of i */
|
|
129030
129724
|
constructor(addGet = false, calculation) {
|
|
129031
129725
|
this.addGet = addGet;
|
|
129032
129726
|
this.calculation = calculation;
|
|
129033
129727
|
}
|
|
129728
|
+
static INTEGER_OPERATORS = {
|
|
129729
|
+
"+": "abap.operators.addInt",
|
|
129730
|
+
"-": "abap.operators.minusInt",
|
|
129731
|
+
"*": "abap.operators.multiplyInt",
|
|
129732
|
+
};
|
|
129733
|
+
negation() {
|
|
129734
|
+
return this.calculation === "i" ? "abap.operators.minusInt(0, " : "abap.operators.minus(0, ";
|
|
129735
|
+
}
|
|
129034
129736
|
// the operands of a chain of & / && (the rearranger leaves them as a binary
|
|
129035
129737
|
// tree of Source nodes); an empty list when the node is not such a chain
|
|
129036
129738
|
concatOperands(node) {
|
|
@@ -129120,14 +129822,19 @@ class SourceTranspiler {
|
|
|
129120
129822
|
// same for -, *, /, DIV and MOD. It binds weaker than **, - a ** 2 is - ( a ** 2 ),
|
|
129121
129823
|
// so there the whole expression stays negated, below
|
|
129122
129824
|
if (prefixNegated === true && c.concatTokens().trim() !== "**") {
|
|
129123
|
-
ret = new chunk_1.Chunk().appendString(
|
|
129825
|
+
ret = new chunk_1.Chunk().appendString(this.negation()).appendChunk(ret).appendString(")");
|
|
129124
129826
|
prefixNegated = false;
|
|
129125
129827
|
}
|
|
129126
129828
|
// "/" rounds in calculation type int8, the runtime's divide() does not know the target
|
|
129127
|
-
|
|
129829
|
+
let operator = this.calculation === "int8" && c.concatTokens().trim() === "/"
|
|
129128
129830
|
? new chunk_1.Chunk().append("abap.operators.divideInt8", c, traversal)
|
|
129129
129831
|
: traversal.traverse(c);
|
|
129130
|
-
|
|
129832
|
+
// calculation type i: the operator checks the range of i
|
|
129833
|
+
const checked = this.calculation === "i" ? SourceTranspiler.INTEGER_OPERATORS[c.concatTokens().trim()] : undefined;
|
|
129834
|
+
if (checked !== undefined) {
|
|
129835
|
+
operator = new chunk_1.Chunk().append(checked, c, traversal);
|
|
129836
|
+
}
|
|
129837
|
+
if (this.calculation !== undefined && this.calculation !== "i" && leftIsCalculation === false) {
|
|
129131
129838
|
const type = this.calculation === "int8" ? "Integer8" : "DecFloat34";
|
|
129132
129839
|
ret = new chunk_1.Chunk().appendChunk(operator).appendString(`(new abap.types.${type}().set(`).appendChunk(ret).appendString("),");
|
|
129133
129840
|
}
|
|
@@ -129333,7 +130040,7 @@ class SourceTranspiler {
|
|
|
129333
130040
|
}
|
|
129334
130041
|
ret.appendChunk(post);
|
|
129335
130042
|
if (prefixNegated) {
|
|
129336
|
-
ret = new chunk_1.Chunk().appendString(
|
|
130043
|
+
ret = new chunk_1.Chunk().appendString(this.negation()).appendChunk(ret).appendString(")");
|
|
129337
130044
|
}
|
|
129338
130045
|
// console.dir("return: " + ret.getCode());
|
|
129339
130046
|
return ret;
|
|
@@ -129785,7 +130492,9 @@ class SQLCondTranspiler {
|
|
|
129785
130492
|
const operator = children[1];
|
|
129786
130493
|
const source = children[2];
|
|
129787
130494
|
if (!(fieldName instanceof abaplint.Nodes.ExpressionNode)
|
|
129788
|
-
|
|
130495
|
+
// field = structure-component, and tab~field = structure-component
|
|
130496
|
+
|| !(fieldName.get() instanceof abaplint.Expressions.SQLFieldName
|
|
130497
|
+
|| fieldName.get() instanceof abaplint.Expressions.SQLAliasField)
|
|
129789
130498
|
|| !(operator instanceof abaplint.Nodes.ExpressionNode)
|
|
129790
130499
|
|| !(operator.get() instanceof abaplint.Expressions.SQLCompareOperator)
|
|
129791
130500
|
|| !(source instanceof abaplint.Nodes.ExpressionNode)
|
|
@@ -129798,8 +130507,10 @@ class SQLCondTranspiler {
|
|
|
129798
130507
|
for (let i = 3; i < children.length; i += 2) {
|
|
129799
130508
|
const dash = children[i];
|
|
129800
130509
|
const component = children[i + 1];
|
|
130510
|
+
// the component selector is the token Dash; a minus sign is arithmetic
|
|
129801
130511
|
if (!(dash instanceof abaplint.Nodes.TokenNode)
|
|
129802
130512
|
|| dash.getFirstToken().getStr() !== "-"
|
|
130513
|
+
|| !(dash.getFirstToken() instanceof abaplint.Tokens.Dash)
|
|
129803
130514
|
|| !(component instanceof abaplint.Nodes.ExpressionNode)
|
|
129804
130515
|
|| !(component.get() instanceof abaplint.Expressions.SQLFieldName)) {
|
|
129805
130516
|
return undefined;
|
|
@@ -130064,11 +130775,24 @@ const chunk_1 = __webpack_require__(/*! ../chunk */ "./node_modules/@abaplint/tr
|
|
|
130064
130775
|
const sql_field_1 = __webpack_require__(/*! ./sql_field */ "./node_modules/@abaplint/transpiler/build/src/expressions/sql_field.js");
|
|
130065
130776
|
const sql_field_name_1 = __webpack_require__(/*! ./sql_field_name */ "./node_modules/@abaplint/transpiler/build/src/expressions/sql_field_name.js");
|
|
130066
130777
|
class SQLFieldListTranspiler {
|
|
130067
|
-
|
|
130778
|
+
/**
|
|
130779
|
+
* byPosition: the rows are filled by position, but the database clients return
|
|
130780
|
+
* them keyed by column name, so two columns of one name (a~id b~id) come back as
|
|
130781
|
+
* one. Where a plain column repeats the name of another in the list, the entries
|
|
130782
|
+
* without an alias of their own get one, "#0", "#1", ... by position in the
|
|
130783
|
+
* list: a name no column or alias can have. A list without such a clash is
|
|
130784
|
+
* left exactly as it is.
|
|
130785
|
+
*/
|
|
130786
|
+
transpile(node, traversal, byPosition = false) {
|
|
130787
|
+
const clashing = byPosition ? this.clashingNames(node) : new Set();
|
|
130068
130788
|
const fields = [];
|
|
130069
130789
|
for (const f of node.getChildren() || []) {
|
|
130070
130790
|
if (f instanceof abaplint.Nodes.ExpressionNode && f.get() instanceof abaplint.Expressions.SQLField) {
|
|
130071
|
-
|
|
130791
|
+
let code = new sql_field_1.SQLFieldTranspiler().transpile(f, traversal).getCode();
|
|
130792
|
+
const column = this.plainColumn(f);
|
|
130793
|
+
if (column !== undefined && column.alias === false && clashing.has(column.name)) {
|
|
130794
|
+
code = code.trimEnd() + ` AS \\"#${fields.length}\\"`;
|
|
130795
|
+
}
|
|
130072
130796
|
fields.push(code);
|
|
130073
130797
|
}
|
|
130074
130798
|
else if (f instanceof abaplint.Nodes.ExpressionNode && f.get() instanceof abaplint.Expressions.SQLFieldName) {
|
|
@@ -130077,7 +130801,7 @@ class SQLFieldListTranspiler {
|
|
|
130077
130801
|
}
|
|
130078
130802
|
else if (f instanceof abaplint.Nodes.ExpressionNode && f.get() instanceof abaplint.Expressions.SQLFieldList) {
|
|
130079
130803
|
// todo, I have no idea why its nested like this when there is just one field
|
|
130080
|
-
return new SQLFieldListTranspiler().transpile(f, traversal);
|
|
130804
|
+
return new SQLFieldListTranspiler().transpile(f, traversal, byPosition);
|
|
130081
130805
|
}
|
|
130082
130806
|
else {
|
|
130083
130807
|
const concat = f.concatTokens();
|
|
@@ -130088,6 +130812,39 @@ class SQLFieldListTranspiler {
|
|
|
130088
130812
|
}
|
|
130089
130813
|
return new chunk_1.Chunk().append(fields.join(", "), node, traversal);
|
|
130090
130814
|
}
|
|
130815
|
+
// "col", "tab~col" or one of them with "AS name": the name its column has in the row
|
|
130816
|
+
plainColumn(field) {
|
|
130817
|
+
const children = field.getChildren();
|
|
130818
|
+
const first = children[0];
|
|
130819
|
+
if (!(first instanceof abaplint.Nodes.ExpressionNode) || !(first.get() instanceof abaplint.Expressions.SQLFieldName)) {
|
|
130820
|
+
return undefined;
|
|
130821
|
+
}
|
|
130822
|
+
const as = field.findDirectExpression(abaplint.Expressions.SQLAsName);
|
|
130823
|
+
if (children.length === 1) {
|
|
130824
|
+
return { name: first.concatTokens().split("~").pop().toLowerCase(), alias: false };
|
|
130825
|
+
}
|
|
130826
|
+
else if (children.length === 3 && as !== undefined && children[2] === as) {
|
|
130827
|
+
return { name: as.concatTokens().toLowerCase(), alias: true };
|
|
130828
|
+
}
|
|
130829
|
+
return undefined;
|
|
130830
|
+
}
|
|
130831
|
+
clashingNames(node) {
|
|
130832
|
+
const seen = new Set();
|
|
130833
|
+
const clashing = new Set();
|
|
130834
|
+
for (const f of node.getChildren() || []) {
|
|
130835
|
+
if (f instanceof abaplint.Nodes.ExpressionNode && f.get() instanceof abaplint.Expressions.SQLField) {
|
|
130836
|
+
const column = this.plainColumn(f);
|
|
130837
|
+
if (column === undefined) {
|
|
130838
|
+
continue;
|
|
130839
|
+
}
|
|
130840
|
+
else if (seen.has(column.name)) {
|
|
130841
|
+
clashing.add(column.name);
|
|
130842
|
+
}
|
|
130843
|
+
seen.add(column.name);
|
|
130844
|
+
}
|
|
130845
|
+
}
|
|
130846
|
+
return clashing;
|
|
130847
|
+
}
|
|
130091
130848
|
}
|
|
130092
130849
|
exports.SQLFieldListTranspiler = SQLFieldListTranspiler;
|
|
130093
130850
|
//# sourceMappingURL=sql_field_list.js.map
|
|
@@ -133997,6 +134754,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
|
133997
134754
|
exports.Requires = void 0;
|
|
133998
134755
|
const abaplint = __importStar(__webpack_require__(/*! @abaplint/core */ "./node_modules/@abaplint/core/build/src/index.js"));
|
|
133999
134756
|
const program_includes_1 = __webpack_require__(/*! ./program_includes */ "./node_modules/@abaplint/transpiler/build/src/program_includes.js");
|
|
134757
|
+
const constant_value_1 = __webpack_require__(/*! ./constant_value */ "./node_modules/@abaplint/transpiler/build/src/constant_value.js");
|
|
134000
134758
|
class Requires {
|
|
134001
134759
|
reg;
|
|
134002
134760
|
constructor(reg) {
|
|
@@ -134006,7 +134764,7 @@ class Requires {
|
|
|
134006
134764
|
find(obj, _node, filename) {
|
|
134007
134765
|
const ret = [];
|
|
134008
134766
|
if (obj.getType() === "INTF") {
|
|
134009
|
-
return
|
|
134767
|
+
return this.constantSources(obj, filename);
|
|
134010
134768
|
}
|
|
134011
134769
|
const add = function (req) {
|
|
134012
134770
|
if (req === undefined || req.filename === filename) {
|
|
@@ -134099,6 +134857,31 @@ class Requires {
|
|
|
134099
134857
|
}
|
|
134100
134858
|
return ret;
|
|
134101
134859
|
}
|
|
134860
|
+
/** the global objects whose constants an interface reads at load: a constant whose VALUE
|
|
134861
|
+
* leads to a class constant, or to an object no analysis knows (constant_value.ts) */
|
|
134862
|
+
constantSources(obj, filename) {
|
|
134863
|
+
const ret = [];
|
|
134864
|
+
for (const file of obj.getABAPFiles()) {
|
|
134865
|
+
for (const statement of file.getStatements()) {
|
|
134866
|
+
if (!(statement.get() instanceof abaplint.Statements.Constant)) {
|
|
134867
|
+
continue;
|
|
134868
|
+
}
|
|
134869
|
+
const chain = statement.findDirectExpression(abaplint.Expressions.Value)?.getChildren()[1];
|
|
134870
|
+
if (!(chain instanceof abaplint.Nodes.ExpressionNode) || !(chain.get() instanceof abaplint.Expressions.SimpleFieldChain)) {
|
|
134871
|
+
continue;
|
|
134872
|
+
}
|
|
134873
|
+
const source = (0, constant_value_1.constantSource)(this.reg, chain);
|
|
134874
|
+
if (source.kind !== "member" || source.object.getName().toUpperCase() === obj.getName().toUpperCase()) {
|
|
134875
|
+
continue;
|
|
134876
|
+
}
|
|
134877
|
+
const main = source.object.getMainABAPFile()?.getFilename();
|
|
134878
|
+
if (main && main !== filename && ret.some(r => r.filename === main) === false) {
|
|
134879
|
+
ret.push({ filename: main, name: undefined });
|
|
134880
|
+
}
|
|
134881
|
+
}
|
|
134882
|
+
}
|
|
134883
|
+
return ret;
|
|
134884
|
+
}
|
|
134102
134885
|
}
|
|
134103
134886
|
exports.Requires = Requires;
|
|
134104
134887
|
//# sourceMappingURL=requires.js.map
|
|
@@ -140564,6 +141347,7 @@ __exportStar(__webpack_require__(/*! ./replace */ "./node_modules/@abaplint/tran
|
|
|
140564
141347
|
__exportStar(__webpack_require__(/*! ./report */ "./node_modules/@abaplint/transpiler/build/src/statements/report.js"), exports);
|
|
140565
141348
|
__exportStar(__webpack_require__(/*! ./reserve */ "./node_modules/@abaplint/transpiler/build/src/statements/reserve.js"), exports);
|
|
140566
141349
|
__exportStar(__webpack_require__(/*! ./retry */ "./node_modules/@abaplint/transpiler/build/src/statements/retry.js"), exports);
|
|
141350
|
+
__exportStar(__webpack_require__(/*! ./resume */ "./node_modules/@abaplint/transpiler/build/src/statements/resume.js"), exports);
|
|
140567
141351
|
__exportStar(__webpack_require__(/*! ./return */ "./node_modules/@abaplint/transpiler/build/src/statements/return.js"), exports);
|
|
140568
141352
|
__exportStar(__webpack_require__(/*! ./rollback */ "./node_modules/@abaplint/transpiler/build/src/statements/rollback.js"), exports);
|
|
140569
141353
|
__exportStar(__webpack_require__(/*! ./rollback_entities */ "./node_modules/@abaplint/transpiler/build/src/statements/rollback_entities.js"), exports);
|
|
@@ -142350,7 +143134,10 @@ class MoveTranspiler {
|
|
|
142350
143134
|
? this.correspondingGeneric(sourceExpression, targets[0], traversal)
|
|
142351
143135
|
: undefined;
|
|
142352
143136
|
if (source === undefined) {
|
|
142353
|
-
|
|
143137
|
+
let calculation = this.integerCalculation(node, sourceExpression, targetExpressions.length, traversal);
|
|
143138
|
+
if (calculation === "i" && second !== "=") {
|
|
143139
|
+
calculation = undefined;
|
|
143140
|
+
}
|
|
142354
143141
|
source = calculation !== undefined
|
|
142355
143142
|
? new source_1.SourceTranspiler(false, calculation).transpile(sourceExpression, traversal)
|
|
142356
143143
|
: traversal.traverse(sourceExpression);
|
|
@@ -142440,7 +143227,10 @@ class MoveTranspiler {
|
|
|
142440
143227
|
// and operands whose type is known to be i or int8, and not for **, which counts as f.
|
|
142441
143228
|
// With a p, f or decfloat34 target the calculation type is that of the target, and an int8
|
|
142442
143229
|
// result outside the int8 range is no overflow: the operands are converted to decfloat34,
|
|
142443
|
-
// exact for sums, differences and products of int8, so the runtime does not raise for them
|
|
143230
|
+
// exact for sums, differences and products of int8, so the runtime does not raise for them.
|
|
143231
|
+
// With an i target and operands of type i only it is i, and then "+", "-" and "*" raise
|
|
143232
|
+
// CX_SY_ARITHMETIC_OVERFLOW outside the range of i: SourceTranspiler picks the operators that
|
|
143233
|
+
// check it. An expression with "/", DIV or MOD keeps the unchecked operators for now
|
|
142444
143234
|
integerCalculation(node, source, targets, traversal) {
|
|
142445
143235
|
if (source === undefined
|
|
142446
143236
|
|| targets !== 1
|
|
@@ -142456,9 +143246,14 @@ class MoveTranspiler {
|
|
|
142456
143246
|
if (found.int8 === false && wide === false && !(target instanceof abaplint.BasicTypes.IntegerType)) {
|
|
142457
143247
|
return undefined;
|
|
142458
143248
|
}
|
|
142459
|
-
else if (this.integerOperands(source, scope, found) === false
|
|
143249
|
+
else if (this.integerOperands(source, scope, found) === false) {
|
|
142460
143250
|
return undefined;
|
|
142461
143251
|
}
|
|
143252
|
+
else if (found.int8 === false) {
|
|
143253
|
+
const division = source.findAllExpressions(abaplint.Expressions.ArithOperator)
|
|
143254
|
+
.some(o => ["/", "DIV", "MOD"].includes(o.concatTokens().toUpperCase()));
|
|
143255
|
+
return wide === false && division === false ? "i" : undefined;
|
|
143256
|
+
}
|
|
142462
143257
|
else if (wide === true) {
|
|
142463
143258
|
// DIV and MOD of a decfloat34 go through a double in the runtime, they stay int8
|
|
142464
143259
|
const divMod = source.findAllExpressions(abaplint.Expressions.ArithOperator)
|
|
@@ -143328,9 +144123,7 @@ const expressions_1 = __webpack_require__(/*! ../expressions */ "./node_modules/
|
|
|
143328
144123
|
const unique_identifier_1 = __webpack_require__(/*! ../unique_identifier */ "./node_modules/@abaplint/transpiler/build/src/unique_identifier.js");
|
|
143329
144124
|
class RaiseTranspiler {
|
|
143330
144125
|
transpile(node, traversal) {
|
|
143331
|
-
|
|
143332
|
-
throw new Error("RaiseTranspiler, RESUMABLE not implemented");
|
|
143333
|
-
}
|
|
144126
|
+
// RESUMABLE: the exception is raised as any other, a handler that does not RESUME sees no difference
|
|
143334
144127
|
const classNameToken = node.findFirstExpression(abaplint.Expressions.ClassName)?.getFirstToken();
|
|
143335
144128
|
const className = classNameToken?.getStr();
|
|
143336
144129
|
if (className === undefined) {
|
|
@@ -144279,6 +145072,27 @@ exports.ReserveTranspiler = ReserveTranspiler;
|
|
|
144279
145072
|
|
|
144280
145073
|
/***/ },
|
|
144281
145074
|
|
|
145075
|
+
/***/ "./node_modules/@abaplint/transpiler/build/src/statements/resume.js"
|
|
145076
|
+
/*!**************************************************************************!*\
|
|
145077
|
+
!*** ./node_modules/@abaplint/transpiler/build/src/statements/resume.js ***!
|
|
145078
|
+
\**************************************************************************/
|
|
145079
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
145080
|
+
|
|
145081
|
+
"use strict";
|
|
145082
|
+
|
|
145083
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
145084
|
+
exports.ResumeTranspiler = void 0;
|
|
145085
|
+
const chunk_1 = __webpack_require__(/*! ../chunk */ "./node_modules/@abaplint/transpiler/build/src/chunk.js");
|
|
145086
|
+
class ResumeTranspiler {
|
|
145087
|
+
transpile(_node, _traversal) {
|
|
145088
|
+
return new chunk_1.Chunk(`throw new Error("RESUME, not supported, transpiler");`);
|
|
145089
|
+
}
|
|
145090
|
+
}
|
|
145091
|
+
exports.ResumeTranspiler = ResumeTranspiler;
|
|
145092
|
+
//# sourceMappingURL=resume.js.map
|
|
145093
|
+
|
|
145094
|
+
/***/ },
|
|
145095
|
+
|
|
144282
145096
|
/***/ "./node_modules/@abaplint/transpiler/build/src/statements/retry.js"
|
|
144283
145097
|
/*!*************************************************************************!*\
|
|
144284
145098
|
!*** ./node_modules/@abaplint/transpiler/build/src/statements/retry.js ***!
|
|
@@ -144639,7 +145453,7 @@ function escapeRegExp(string) {
|
|
|
144639
145453
|
}
|
|
144640
145454
|
// TODO: currently SELECT into are always handled as CORRESPONDING
|
|
144641
145455
|
class SelectTranspiler {
|
|
144642
|
-
transpile(node, traversal, targetOverride) {
|
|
145456
|
+
transpile(node, traversal, targetOverride, overrideOptions = [], columnsByPosition = false) {
|
|
144643
145457
|
if (node.findDirectTokenByText("UNION") !== undefined) {
|
|
144644
145458
|
return new chunk_1.Chunk(`throw new Error("SELECT UNION, not supported, transpiler, todo");`);
|
|
144645
145459
|
}
|
|
@@ -144678,7 +145492,7 @@ class SelectTranspiler {
|
|
|
144678
145492
|
if (fieldList === undefined) {
|
|
144679
145493
|
throw new Error("SelectTranspiler, field list not found");
|
|
144680
145494
|
}
|
|
144681
|
-
select += new expressions_1.SQLFieldListTranspiler().transpile(fieldList, traversal).getCode() + " ";
|
|
145495
|
+
select += new expressions_1.SQLFieldListTranspiler().transpile(fieldList, traversal, columnsByPosition).getCode() + " ";
|
|
144682
145496
|
const from = node.findFirstExpression(abaplint.Expressions.SQLFrom);
|
|
144683
145497
|
if (from) {
|
|
144684
145498
|
select += new sql_from_1.SQLFromTranspiler().transpile(from, traversal).getCode();
|
|
@@ -144763,7 +145577,10 @@ class SelectTranspiler {
|
|
|
144763
145577
|
select += "UP TO 1 ROWS";
|
|
144764
145578
|
}
|
|
144765
145579
|
let runtimeOptions = "";
|
|
144766
|
-
|
|
145580
|
+
// the SelectLoop structure passes its options for its buffer table
|
|
145581
|
+
const runtimeOptionsList = [...overrideOptions];
|
|
145582
|
+
const appendingOptions = ["appending: true", ...overrideOptions].join(", ");
|
|
145583
|
+
const loopOptions = overrideOptions.length > 0 ? `, {${overrideOptions.join(", ")}}` : "";
|
|
144767
145584
|
if (concat.includes(" APPENDING TABLE ") || concat.includes(" APPENDING CORRESPONDING FIELDS OF TABLE ")) {
|
|
144768
145585
|
runtimeOptionsList.push(`appending: true`);
|
|
144769
145586
|
}
|
|
@@ -144805,12 +145622,12 @@ await abap.statements.deleteInternal(${target}, {adjacent: true, allFields: true
|
|
|
144805
145622
|
// trim after the de-duplicating sort, so that pair stays row by row
|
|
144806
145623
|
if (concat.startsWith("SELECT SINGLE ") || at < 0 || (upTo && orderBy)) {
|
|
144807
145624
|
const code = `if (${faeTranspiled}.array().length === 0) {
|
|
144808
|
-
await abap.statements.select(${target}, {select: "${selectEmpty.trim()}"${extra}});
|
|
145625
|
+
await abap.statements.select(${target}, {select: "${selectEmpty.trim()}"${extra}}${loopOptions});
|
|
144809
145626
|
} else {
|
|
144810
145627
|
const ${unique2} = ${faeTranspiled}.array();
|
|
144811
145628
|
${target}.clear();
|
|
144812
145629
|
for await (const ${unique} of ${unique2}) {
|
|
144813
|
-
await abap.statements.select(${target}, {select: "${select.trim()}"${extra}}, {
|
|
145630
|
+
await abap.statements.select(${target}, {select: "${select.trim()}"${extra}}, {${appendingOptions}});
|
|
144814
145631
|
}
|
|
144815
145632
|
${dedup}
|
|
144816
145633
|
abap.builtin.sy.get().dbcnt.set(${target}.getArrayLength());
|
|
@@ -144841,14 +145658,14 @@ abap.builtin.sy.get().dbcnt.set(${target}.getArrayLength());
|
|
|
144841
145658
|
const unique3 = unique_identifier_1.UniqueIdentifier.get();
|
|
144842
145659
|
const unique4 = unique_identifier_1.UniqueIdentifier.get();
|
|
144843
145660
|
const code = `if (${faeTranspiled}.array().length === 0) {
|
|
144844
|
-
await abap.statements.select(${target}, {select: "${selectEmpty.trim()}"${extra}});
|
|
145661
|
+
await abap.statements.select(${target}, {select: "${selectEmpty.trim()}"${extra}}${loopOptions});
|
|
144845
145662
|
} else {
|
|
144846
145663
|
const ${unique2} = ${faeTranspiled}.array();
|
|
144847
145664
|
${target}.clear();
|
|
144848
145665
|
const ${unique3} = (${unique}) => "(${condition})";
|
|
144849
145666
|
for (let ${unique4} = 0; ${unique4} < ${unique2}.length; ${unique4} += 50) {
|
|
144850
145667
|
const ${unique4}where = ${unique2}.slice(${unique4}, ${unique4} + 50).map(${unique3}).join(" OR ");
|
|
144851
|
-
await abap.statements.select(${target}, {select: "${head}WHERE " + ${unique4}where + " ${tail.trim()}"${extra}}, {
|
|
145668
|
+
await abap.statements.select(${target}, {select: "${head}WHERE " + ${unique4}where + " ${tail.trim()}"${extra}}, {${appendingOptions}});
|
|
144852
145669
|
}
|
|
144853
145670
|
${dedup}
|
|
144854
145671
|
const ${unique4}max = ${upToCode};
|
|
@@ -148723,6 +149540,7 @@ const abaplint = __importStar(__webpack_require__(/*! @abaplint/core */ "./node_
|
|
|
148723
149540
|
const traversal_1 = __webpack_require__(/*! ../traversal */ "./node_modules/@abaplint/transpiler/build/src/traversal.js");
|
|
148724
149541
|
const expressions_1 = __webpack_require__(/*! ../expressions */ "./node_modules/@abaplint/transpiler/build/src/expressions/index.js");
|
|
148725
149542
|
const chunk_1 = __webpack_require__(/*! ../chunk */ "./node_modules/@abaplint/transpiler/build/src/chunk.js");
|
|
149543
|
+
const constant_value_1 = __webpack_require__(/*! ../constant_value */ "./node_modules/@abaplint/transpiler/build/src/constant_value.js");
|
|
148726
149544
|
class InterfaceTranspiler {
|
|
148727
149545
|
transpile(node, traversal) {
|
|
148728
149546
|
let ret = "";
|
|
@@ -148794,10 +149612,26 @@ class InterfaceTranspiler {
|
|
|
148794
149612
|
}
|
|
148795
149613
|
const constantStatement = traversal.findStatementInFile(identifier.getStart());
|
|
148796
149614
|
const valExpression = constantStatement?.findFirstExpression(abaplint.Expressions.Value);
|
|
148797
|
-
|
|
148798
|
-
|
|
148799
|
-
|
|
148800
|
-
|
|
149615
|
+
// VALUE other=>constant: followed to the constant that declares the value
|
|
149616
|
+
// (constant_value.ts). An interface literal is written as the literal, so interfaces
|
|
149617
|
+
// naming each other's constants have no load-time edge; a class constant, which the class
|
|
149618
|
+
// may set at run time, is read at load from that class, which requires.ts loads first
|
|
149619
|
+
const chain = valExpression?.getChildren()[1];
|
|
149620
|
+
if (chain instanceof abaplint.Nodes.ExpressionNode && chain.get() instanceof abaplint.Expressions.SimpleFieldChain) {
|
|
149621
|
+
const source = (0, constant_value_1.constantSource)(traversal.reg, chain);
|
|
149622
|
+
if (source.kind === "literal") {
|
|
149623
|
+
ret += name + ".set(" + expressions_1.ConstantTranspiler.escape(expressions_1.ConstantTranspiler.trimTextFieldLiteral(source.value)) + ");\n";
|
|
149624
|
+
}
|
|
149625
|
+
else if (source.kind === "member") {
|
|
149626
|
+
ret += name + ".set(" + (0, constant_value_1.memberRead)(source) + ");\n";
|
|
149627
|
+
}
|
|
149628
|
+
else if (source.kind === "initial") {
|
|
149629
|
+
ret += name + ".set(" + traversal.toType(source.type) + ");\n";
|
|
149630
|
+
}
|
|
149631
|
+
else {
|
|
149632
|
+
const s = new expressions_1.FieldChainTranspiler().transpile(chain, traversal, false).getCode();
|
|
149633
|
+
ret += name + ".set(" + expressions_1.ConstantTranspiler.escape(s) + ");\n";
|
|
149634
|
+
}
|
|
148801
149635
|
continue;
|
|
148802
149636
|
}
|
|
148803
149637
|
ret += traversal.setValues(identifier, name);
|
|
@@ -149349,8 +150183,60 @@ class SelectTranspiler {
|
|
|
149349
150183
|
// note: this implementation SELECTs everything into memory, which might be bad, and sometimes not correct
|
|
149350
150184
|
const targetName = unique_identifier_1.UniqueIdentifier.get();
|
|
149351
150185
|
const loopName = unique_identifier_1.UniqueIdentifier.get();
|
|
149352
|
-
|
|
149353
|
-
const
|
|
150186
|
+
// the sources of the loop's own FROM, not those of a subquery in its WHERE
|
|
150187
|
+
const sources = selectStatement.findFirstExpression(abaplint.Expressions.SQLFrom)
|
|
150188
|
+
?.findAllExpressions(abaplint.Expressions.SQLFromSource) ?? [];
|
|
150189
|
+
const aliased = sources[0]?.findDirectExpression(abaplint.Expressions.SQLAsName) !== undefined;
|
|
150190
|
+
const table = sources[0]?.findDirectExpression(abaplint.Expressions.DatabaseTable)?.concatTokens().toUpperCase();
|
|
150191
|
+
const intoList = selectStatement.findFirstExpression(abaplint.Expressions.SQLIntoList);
|
|
150192
|
+
const loopOptions = [];
|
|
150193
|
+
let assign;
|
|
150194
|
+
if (intoList) {
|
|
150195
|
+
// INTO (a, b, c): the buffer row has one component per target, filled
|
|
150196
|
+
// from the columns left to right, and every target is assigned per row
|
|
150197
|
+
const targets = intoList.findDirectExpressions(abaplint.Expressions.SQLTarget)
|
|
150198
|
+
.map(t => new expressions_1.SQLTargetTranspiler().transpile(t, traversal).getCode());
|
|
150199
|
+
const components = targets.map((t, i) => `"c${i}": ${this.cloneOf(t)}`);
|
|
150200
|
+
ret.appendString(`let ${targetName} = new abap.types.Table(new abap.types.Structure({${components.join(", ")}}));\n`);
|
|
150201
|
+
loopOptions.push("positional: true");
|
|
150202
|
+
assign = targets.map((t, i) => `${t}.set(${loopName}.get().c${i});\n`).join("");
|
|
150203
|
+
}
|
|
150204
|
+
else {
|
|
150205
|
+
if (aliased && sources.length === 1 && table !== undefined) {
|
|
150206
|
+
// "tab AS a" is no DDIC name, the row type is that of the table
|
|
150207
|
+
ret.appendString(`let ${targetName} = new abap.types.Table(abap.DDIC["${table}"].type());\n`);
|
|
150208
|
+
}
|
|
150209
|
+
else if (aliased && sTarget !== undefined) {
|
|
150210
|
+
const intoTable = selectStatement.findFirstExpression(abaplint.Expressions.SQLIntoTable);
|
|
150211
|
+
if (intoTable) {
|
|
150212
|
+
// PACKAGE SIZE ... INTO TABLE over a join that starts with "tab AS a": the
|
|
150213
|
+
// buffer holds rows of the target table's row type, filled as below
|
|
150214
|
+
ret.appendString(`let ${targetName} = new abap.types.Table(${this.pointerOf(intoName)}.getRowType());\n`);
|
|
150215
|
+
if (intoTable.findDirectTokenByText("CORRESPONDING") === undefined) {
|
|
150216
|
+
loopOptions.push("positional: true");
|
|
150217
|
+
}
|
|
150218
|
+
}
|
|
150219
|
+
else {
|
|
150220
|
+
// a join that starts with "tab AS a" has no row type to look up, the buffer
|
|
150221
|
+
// takes the work area's; without CORRESPONDING it is filled left to right
|
|
150222
|
+
ret.appendString(`let ${targetName} = new abap.types.Table(${this.cloneOf(intoName)});\n`);
|
|
150223
|
+
if (concat.includes(" INTO CORRESPONDING FIELDS OF ") === false) {
|
|
150224
|
+
loopOptions.push("positional: true");
|
|
150225
|
+
}
|
|
150226
|
+
}
|
|
150227
|
+
}
|
|
150228
|
+
else {
|
|
150229
|
+
ret.appendString(`let ${targetName} = new abap.types.Table(abap.DDIC["${from}"].type());\n`);
|
|
150230
|
+
}
|
|
150231
|
+
if (concat.includes(" INTO CORRESPONDING FIELDS OF ")) {
|
|
150232
|
+
assign = `abap.statements.moveCorresponding(${loopName}, ${intoName});\n`;
|
|
150233
|
+
}
|
|
150234
|
+
else {
|
|
150235
|
+
assign = `${intoName}.set(${loopName});\n`;
|
|
150236
|
+
}
|
|
150237
|
+
}
|
|
150238
|
+
// INTO (a, b, c) is filled by position: two columns of one name get an alias
|
|
150239
|
+
const selectHead = new select_1.SelectTranspiler().transpile(selectStatement, traversal, targetName, loopOptions, intoList !== undefined);
|
|
149354
150240
|
ret.appendChunk(selectHead.ensureStartMapping(selectStatement, traversal));
|
|
149355
150241
|
// todo: optimize, it should do real streaming?
|
|
149356
150242
|
const packageSize = selectStatement.findFirstExpression(abaplint.Expressions.SQLPackageSize)
|
|
@@ -149363,13 +150249,22 @@ class SelectTranspiler {
|
|
|
149363
150249
|
abap.statements.append({source: ${targetName}, target: ${intoName}, lines: true});
|
|
149364
150250
|
{\n`);
|
|
149365
150251
|
}
|
|
149366
|
-
else if (concat.includes(" INTO CORRESPONDING FIELDS OF ")) {
|
|
149367
|
-
ret.appendString(`\nfor (const ${loopName} of ${targetName}.array()) {\n`);
|
|
149368
|
-
ret.appendString(`abap.statements.moveCorresponding(${loopName}, ${intoName});\n`);
|
|
149369
|
-
}
|
|
149370
150252
|
else {
|
|
149371
|
-
|
|
149372
|
-
|
|
150253
|
+
// every pass sets sy-dbcnt to the number of rows passed so far and sy-subrc
|
|
150254
|
+
// to 0; ENDSELECT sets both once more when the rows run out, which an EXIT
|
|
150255
|
+
// does not reach
|
|
150256
|
+
const countName = unique_identifier_1.UniqueIdentifier.get();
|
|
150257
|
+
ret.appendString(`\nlet ${countName} = 0;
|
|
150258
|
+
for (;;) {
|
|
150259
|
+
const ${loopName} = ${targetName}.array()[${countName}];
|
|
150260
|
+
if (${loopName} === undefined) {
|
|
150261
|
+
abap.builtin.sy.get().dbcnt.set(${countName});
|
|
150262
|
+
abap.builtin.sy.get().subrc.set(${countName} > 0 ? 0 : 4);
|
|
150263
|
+
break;
|
|
150264
|
+
}
|
|
150265
|
+
abap.builtin.sy.get().dbcnt.set(++${countName});
|
|
150266
|
+
abap.builtin.sy.get().subrc.set(0);\n`);
|
|
150267
|
+
ret.appendString(assign);
|
|
149373
150268
|
}
|
|
149374
150269
|
const body = node.findDirectStructure(abaplint.Structures.Body);
|
|
149375
150270
|
if (body) {
|
|
@@ -149378,6 +150273,13 @@ abap.statements.append({source: ${targetName}, target: ${intoName}, lines: true}
|
|
|
149378
150273
|
ret.appendString("}\n");
|
|
149379
150274
|
return ret;
|
|
149380
150275
|
}
|
|
150276
|
+
// a fresh value of the target's type, also when the target is a field symbol
|
|
150277
|
+
cloneOf(code) {
|
|
150278
|
+
return `${this.pointerOf(code)}.clone()`;
|
|
150279
|
+
}
|
|
150280
|
+
pointerOf(code) {
|
|
150281
|
+
return `(${code} instanceof abap.types.FieldSymbol ? ${code}.getPointer() : ${code})`;
|
|
150282
|
+
}
|
|
149381
150283
|
}
|
|
149382
150284
|
exports.SelectTranspiler = SelectTranspiler;
|
|
149383
150285
|
//# sourceMappingURL=select.js.map
|