@abaplint/transpiler-cli 2.13.82 → 2.13.84
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 +266 -18
- package/package.json +3 -3
package/build/bundle.js
CHANGED
|
@@ -27940,6 +27940,13 @@ class TypeUtils {
|
|
|
27940
27940
|
|| type instanceof basic_1.UnknownType
|
|
27941
27941
|
|| type instanceof basic_1.VoidType;
|
|
27942
27942
|
}
|
|
27943
|
+
isCharLikeForCompare(type) {
|
|
27944
|
+
return type === undefined
|
|
27945
|
+
|| type instanceof basic_1.StringType
|
|
27946
|
+
|| type instanceof basic_1.CLikeType
|
|
27947
|
+
|| type instanceof basic_1.CSequenceType
|
|
27948
|
+
|| this.isCharLikeField(type);
|
|
27949
|
+
}
|
|
27943
27950
|
isCharLike(type) {
|
|
27944
27951
|
if (type === undefined) {
|
|
27945
27952
|
return false;
|
|
@@ -30281,6 +30288,7 @@ const basic_1 = __webpack_require__(/*! ../../types/basic */ "./node_modules/@ab
|
|
|
30281
30288
|
const _type_utils_1 = __webpack_require__(/*! ../_type_utils */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_type_utils.js");
|
|
30282
30289
|
class Compare {
|
|
30283
30290
|
static runSyntax(node, input) {
|
|
30291
|
+
var _a;
|
|
30284
30292
|
const sourceTypes = [];
|
|
30285
30293
|
const sources = node.findDirectExpressions(Expressions.Source);
|
|
30286
30294
|
for (const t of sources) {
|
|
@@ -30292,8 +30300,16 @@ class Compare {
|
|
|
30292
30300
|
for (const t of node.findDirectExpressions(Expressions.MethodCallChain)) {
|
|
30293
30301
|
method_call_chain_1.MethodCallChain.runSyntax(t, input);
|
|
30294
30302
|
}
|
|
30295
|
-
|
|
30296
|
-
|
|
30303
|
+
const typeUtils = new _type_utils_1.TypeUtils(input.scope);
|
|
30304
|
+
const compareOperator = (_a = node.findDirectExpression(Expressions.CompareOperator)) === null || _a === void 0 ? void 0 : _a.concatTokens().toUpperCase();
|
|
30305
|
+
if (compareOperator === "CS"
|
|
30306
|
+
&& sourceTypes.length === 2
|
|
30307
|
+
&& sourceTypes.some((type) => typeUtils.isCharLikeForCompare(type) === false)) {
|
|
30308
|
+
const message = "CS operands must be character-like (data type C, N, D, T, or STRING)";
|
|
30309
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
|
|
30310
|
+
}
|
|
30311
|
+
else if (node.findDirectExpression(Expressions.CompareOperator)
|
|
30312
|
+
&& typeUtils.isCompareable(sourceTypes[0], sourceTypes[1], sources[0], sources[1]) === false
|
|
30297
30313
|
&& sourceTypes.length === 2) {
|
|
30298
30314
|
let message = "Incompatible types for comparison";
|
|
30299
30315
|
if ((sourceTypes[0] instanceof basic_1.DateType
|
|
@@ -32303,6 +32319,17 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
32303
32319
|
return result;
|
|
32304
32320
|
};
|
|
32305
32321
|
})();
|
|
32322
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
32323
|
+
var t = {};
|
|
32324
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
32325
|
+
t[p] = s[p];
|
|
32326
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
32327
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
32328
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
32329
|
+
t[p[i]] = s[p[i]];
|
|
32330
|
+
}
|
|
32331
|
+
return t;
|
|
32332
|
+
};
|
|
32306
32333
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
32307
32334
|
exports.InlineData = void 0;
|
|
32308
32335
|
const Expressions = __importStar(__webpack_require__(/*! ../../2_statements/expressions */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js"));
|
|
@@ -32335,7 +32362,7 @@ class InlineData {
|
|
|
32335
32362
|
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
|
|
32336
32363
|
type = basic_1.VoidType.get(_syntax_input_1.CheckSyntaxKey);
|
|
32337
32364
|
}
|
|
32338
|
-
const identifier = new _typed_identifier_1.TypedIdentifier(token, input.filename, type, ["inline" /* IdentifierMeta.InlineDefinition */]);
|
|
32365
|
+
const identifier = new _typed_identifier_1.TypedIdentifier(token, input.filename, this.stripDerivedFromConstant(type), ["inline" /* IdentifierMeta.InlineDefinition */]);
|
|
32339
32366
|
input.scope.addIdentifier(identifier);
|
|
32340
32367
|
input.scope.addReference(token, identifier, _reference_1.ReferenceType.DataWriteReference, input.filename);
|
|
32341
32368
|
}
|
|
@@ -32346,6 +32373,26 @@ class InlineData {
|
|
|
32346
32373
|
input.scope.addReference(token, identifier, _reference_1.ReferenceType.DataWriteReference, input.filename);
|
|
32347
32374
|
}
|
|
32348
32375
|
}
|
|
32376
|
+
// The inferred type is taken from the source expression, which might be a literal.
|
|
32377
|
+
// The variable itself is not a constant, so the relaxations that apply to literals
|
|
32378
|
+
// must not be inherited, eg. a "c" variable is not assignable to a "string" parameter
|
|
32379
|
+
static stripDerivedFromConstant(type) {
|
|
32380
|
+
const data = type.getAbstractTypeData();
|
|
32381
|
+
if ((data === null || data === void 0 ? void 0 : data.derivedFromConstant) !== true) {
|
|
32382
|
+
return type;
|
|
32383
|
+
}
|
|
32384
|
+
const { derivedFromConstant } = data, rest = __rest(data, ["derivedFromConstant"]);
|
|
32385
|
+
if (type instanceof basic_1.CharacterType) {
|
|
32386
|
+
return new basic_1.CharacterType(type.getLength(), rest);
|
|
32387
|
+
}
|
|
32388
|
+
else if (type instanceof basic_1.IntegerType) {
|
|
32389
|
+
return basic_1.IntegerType.get(rest);
|
|
32390
|
+
}
|
|
32391
|
+
else if (type instanceof basic_1.StringType) {
|
|
32392
|
+
return basic_1.StringType.get(rest);
|
|
32393
|
+
}
|
|
32394
|
+
return type;
|
|
32395
|
+
}
|
|
32349
32396
|
}
|
|
32350
32397
|
exports.InlineData = InlineData;
|
|
32351
32398
|
//# sourceMappingURL=inline_data.js.map
|
|
@@ -42034,17 +42081,35 @@ const Expressions = __importStar(__webpack_require__(/*! ../../2_statements/expr
|
|
|
42034
42081
|
const inline_data_1 = __webpack_require__(/*! ../expressions/inline_data */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/inline_data.js");
|
|
42035
42082
|
const basic_1 = __webpack_require__(/*! ../../types/basic */ "./node_modules/@abaplint/core/build/src/abap/types/basic/index.js");
|
|
42036
42083
|
const target_1 = __webpack_require__(/*! ../expressions/target */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/target.js");
|
|
42084
|
+
const _syntax_input_1 = __webpack_require__(/*! ../_syntax_input */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_syntax_input.js");
|
|
42037
42085
|
class GetTime {
|
|
42038
42086
|
runSyntax(node, input) {
|
|
42039
42087
|
const target = node.findDirectExpression(Expressions.Target);
|
|
42088
|
+
const stamp = node.findDirectTokenByText("STAMP") !== undefined;
|
|
42040
42089
|
const inline = target === null || target === void 0 ? void 0 : target.findDirectExpression(Expressions.InlineData);
|
|
42041
42090
|
if (inline) {
|
|
42042
42091
|
inline_data_1.InlineData.runSyntax(inline, input, new basic_1.PackedType(8, 0));
|
|
42043
42092
|
}
|
|
42044
42093
|
else if (target) {
|
|
42045
|
-
target_1.Target.runSyntax(target, input);
|
|
42094
|
+
const type = target_1.Target.runSyntax(target, input);
|
|
42095
|
+
if (stamp === true && this.compatibleTimeStamp(type) === false) {
|
|
42096
|
+
const message = "GET TIME STAMP FIELD, target type not compatible";
|
|
42097
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
|
|
42098
|
+
return;
|
|
42099
|
+
}
|
|
42046
42100
|
}
|
|
42047
42101
|
}
|
|
42102
|
+
// the target must be a timestamp, ie. packed(timestamp and timestampl) or utclong
|
|
42103
|
+
compatibleTimeStamp(type) {
|
|
42104
|
+
return type === undefined
|
|
42105
|
+
|| type instanceof basic_1.PackedType
|
|
42106
|
+
|| type instanceof basic_1.UTCLongType
|
|
42107
|
+
|| type instanceof basic_1.VoidType
|
|
42108
|
+
|| type instanceof basic_1.AnyType
|
|
42109
|
+
|| type instanceof basic_1.DataType
|
|
42110
|
+
|| type instanceof basic_1.UnknownType
|
|
42111
|
+
|| type.isGeneric();
|
|
42112
|
+
}
|
|
42048
42113
|
}
|
|
42049
42114
|
exports.GetTime = GetTime;
|
|
42050
42115
|
//# sourceMappingURL=get_time.js.map
|
|
@@ -70812,7 +70877,7 @@ class Registry {
|
|
|
70812
70877
|
}
|
|
70813
70878
|
static abaplintVersion() {
|
|
70814
70879
|
// magic, see build script "version.js"
|
|
70815
|
-
return "2.120.
|
|
70880
|
+
return "2.120.48";
|
|
70816
70881
|
}
|
|
70817
70882
|
getDDICReferences() {
|
|
70818
70883
|
return this.ddicReferences;
|
|
@@ -72443,7 +72508,7 @@ class AllowedObjectNaming {
|
|
|
72443
72508
|
key: "allowed_object_naming",
|
|
72444
72509
|
title: "Allowed object naming",
|
|
72445
72510
|
shortDescription: `Enforces basic name length and namespace restrictions, see note SAP 104010`,
|
|
72446
|
-
tags: [_irule_1.RuleTag.Naming, _irule_1.RuleTag.SingleFile],
|
|
72511
|
+
tags: [_irule_1.RuleTag.Naming, _irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Syntax],
|
|
72447
72512
|
};
|
|
72448
72513
|
}
|
|
72449
72514
|
initialize(_reg) {
|
|
@@ -78300,6 +78365,10 @@ Make sure to test the downported code, it might not always be completely correct
|
|
|
78300
78365
|
if (found) {
|
|
78301
78366
|
return found;
|
|
78302
78367
|
}
|
|
78368
|
+
found = this.outlineTableExpressionKeyBuiltin(low, high, lowFile, highSyntax);
|
|
78369
|
+
if (found) {
|
|
78370
|
+
return found;
|
|
78371
|
+
}
|
|
78303
78372
|
found = this.assignWithTable(low, high, lowFile);
|
|
78304
78373
|
if (found) {
|
|
78305
78374
|
return found;
|
|
@@ -78997,6 +79066,69 @@ ${indentation}`);
|
|
|
78997
79066
|
}
|
|
78998
79067
|
return condition;
|
|
78999
79068
|
}
|
|
79069
|
+
/** A built-in function is only recognized as one in an operand position that admits an
|
|
79070
|
+
* expression, and "WITH KEY comp = ..." does not become such a position until v740. The
|
|
79071
|
+
* table expression rewrites carry the key operand over verbatim, so
|
|
79072
|
+
* "tab[ comp = to_upper( x ) ]" downports to a READ TABLE that a 702 or 731 compiler can
|
|
79073
|
+
* only read as a functional method call - "method TO_UPPER is unknown", reported as a
|
|
79074
|
+
* SYNTAX_ERROR of the whole class pool. Hoist the call into a variable first, an
|
|
79075
|
+
* assignment IS an expression position at 702.
|
|
79076
|
+
*
|
|
79077
|
+
* Built-ins that predate 702 (lines, strlen, numofchar, ...) carry no release in
|
|
79078
|
+
* BuiltIn.methods; they are accepted in the operand as they are and stay untouched. So do
|
|
79079
|
+
* functional method calls, which are exactly the reading that makes the built-in fail, and
|
|
79080
|
+
* the INDEX operand of "tab[ 1 ]", which is not a key operand. */
|
|
79081
|
+
outlineTableExpressionKeyBuiltin(low, high, lowFile, highSyntax) {
|
|
79082
|
+
if (!(low.get() instanceof _statement_1.Unknown)) {
|
|
79083
|
+
return undefined;
|
|
79084
|
+
}
|
|
79085
|
+
for (const tableExpression of high.findAllExpressionsRecursive(Expressions.TableExpression)) {
|
|
79086
|
+
let afterComponent = false;
|
|
79087
|
+
for (const child of tableExpression.getChildren()) {
|
|
79088
|
+
if (child.get() instanceof Expressions.ComponentChainSimple) {
|
|
79089
|
+
afterComponent = true;
|
|
79090
|
+
continue;
|
|
79091
|
+
}
|
|
79092
|
+
else if (afterComponent === false
|
|
79093
|
+
|| !(child.get() instanceof Expressions.Source)
|
|
79094
|
+
|| !(child instanceof nodes_1.ExpressionNode)) {
|
|
79095
|
+
continue;
|
|
79096
|
+
}
|
|
79097
|
+
const type = this.builtinReturnType(child, lowFile, highSyntax);
|
|
79098
|
+
if (type === undefined) {
|
|
79099
|
+
continue;
|
|
79100
|
+
}
|
|
79101
|
+
const uniqueName = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
|
|
79102
|
+
const indentation = " ".repeat(high.getFirstToken().getStart().getCol() - 1);
|
|
79103
|
+
const code = `DATA ${uniqueName} TYPE ${type}.\n` +
|
|
79104
|
+
indentation + `${uniqueName} = ${child.concatTokens()}.\n` +
|
|
79105
|
+
indentation;
|
|
79106
|
+
const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getFirstToken().getStart(), code);
|
|
79107
|
+
const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, child.getFirstToken().getStart(), child.getLastToken().getEnd(), uniqueName);
|
|
79108
|
+
const fix = edit_helper_1.EditHelper.merge(fix2, fix1);
|
|
79109
|
+
return issue_1.Issue.atToken(lowFile, child.getFirstToken(), "Outline built-in function in table expression key", this.getMetadata().key, this.conf.severity, fix);
|
|
79110
|
+
}
|
|
79111
|
+
}
|
|
79112
|
+
return undefined;
|
|
79113
|
+
}
|
|
79114
|
+
/** the ABAP type returned by the built-in function this Source starts with, or undefined
|
|
79115
|
+
* if it does not start with one, or with one that predates 702 */
|
|
79116
|
+
builtinReturnType(source, lowFile, highSyntax) {
|
|
79117
|
+
var _a, _b, _c;
|
|
79118
|
+
const spag = highSyntax.spaghetti.lookupPosition(source.getFirstToken().getStart(), lowFile.getFilename());
|
|
79119
|
+
for (const r of (spag === null || spag === void 0 ? void 0 : spag.getData().references) || []) {
|
|
79120
|
+
if (r.referenceType !== _reference_1.ReferenceType.BuiltinMethodReference
|
|
79121
|
+
|| r.position.getStart().equals(source.getFirstToken().getStart()) === false) {
|
|
79122
|
+
continue;
|
|
79123
|
+
}
|
|
79124
|
+
const name = r.position.getName().toUpperCase();
|
|
79125
|
+
if (((_a = _builtin_1.BuiltIn.methods[name]) === null || _a === void 0 ? void 0 : _a.release) === undefined) {
|
|
79126
|
+
return undefined;
|
|
79127
|
+
}
|
|
79128
|
+
return (_c = (_b = _builtin_1.BuiltIn.searchBuiltin(name)) === null || _b === void 0 ? void 0 : _b.getParameters().getReturning()) === null || _c === void 0 ? void 0 : _c.getType().toABAP();
|
|
79129
|
+
}
|
|
79130
|
+
return undefined;
|
|
79131
|
+
}
|
|
79000
79132
|
outlineCatchSimple(node, lowFile) {
|
|
79001
79133
|
// outlines "CATCH cx_bcs INTO DATA(lx_bcs_excep).", note that this does not need to look at types
|
|
79002
79134
|
var _a, _b;
|
|
@@ -80607,9 +80739,13 @@ ${indentation} output = ${uniqueName}.\n`;
|
|
|
80607
80739
|
continue;
|
|
80608
80740
|
}
|
|
80609
80741
|
const uniqueName = this.uniqueName(i.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
|
|
80610
|
-
const type = this.findType(i, lowFile, highSyntax);
|
|
80611
80742
|
const indent = " ".repeat(high.getFirstToken().getStart().getCol() - 1);
|
|
80612
|
-
|
|
80743
|
+
// the CONV type might just be a component of the row type, so prefer the row type
|
|
80744
|
+
const rowOf = this.findRowTypeOf(high, i);
|
|
80745
|
+
const declaration = rowOf === undefined
|
|
80746
|
+
? `DATA ${uniqueName} TYPE ${this.findType(i, lowFile, highSyntax)}.`
|
|
80747
|
+
: `DATA ${uniqueName} LIKE LINE OF ${rowOf}.`;
|
|
80748
|
+
const abap = declaration + "\n" +
|
|
80613
80749
|
indent + `${uniqueName} = ${body}.\n` +
|
|
80614
80750
|
indent;
|
|
80615
80751
|
const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getFirstToken().getStart(), abap);
|
|
@@ -80619,6 +80755,19 @@ ${indentation} output = ${uniqueName}.\n`;
|
|
|
80619
80755
|
}
|
|
80620
80756
|
return undefined;
|
|
80621
80757
|
}
|
|
80758
|
+
/** if the source expression is the complete source of an INSERT or APPEND statement, then the
|
|
80759
|
+
* outlined variable must be typed via the row type of the table, returns the table name */
|
|
80760
|
+
findRowTypeOf(high, source) {
|
|
80761
|
+
var _a;
|
|
80762
|
+
if (!(high.get() instanceof Statements.InsertInternal)
|
|
80763
|
+
&& !(high.get() instanceof Statements.Append)) {
|
|
80764
|
+
return undefined;
|
|
80765
|
+
}
|
|
80766
|
+
else if (high.getChildren()[1] !== source) {
|
|
80767
|
+
return undefined;
|
|
80768
|
+
}
|
|
80769
|
+
return (_a = high.findDirectExpression(Expressions.Target)) === null || _a === void 0 ? void 0 : _a.concatTokens();
|
|
80770
|
+
}
|
|
80622
80771
|
// "CAST" to "?="
|
|
80623
80772
|
outlineCast(low, high, lowFile, highSyntax) {
|
|
80624
80773
|
var _a;
|
|
@@ -112612,12 +112761,56 @@ exports.CollectTranspiler = CollectTranspiler;
|
|
|
112612
112761
|
|
|
112613
112762
|
"use strict";
|
|
112614
112763
|
|
|
112764
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
112765
|
+
if (k2 === undefined) k2 = k;
|
|
112766
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
112767
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
112768
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
112769
|
+
}
|
|
112770
|
+
Object.defineProperty(o, k2, desc);
|
|
112771
|
+
}) : (function(o, m, k, k2) {
|
|
112772
|
+
if (k2 === undefined) k2 = k;
|
|
112773
|
+
o[k2] = m[k];
|
|
112774
|
+
}));
|
|
112775
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
112776
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
112777
|
+
}) : function(o, v) {
|
|
112778
|
+
o["default"] = v;
|
|
112779
|
+
});
|
|
112780
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
112781
|
+
var ownKeys = function(o) {
|
|
112782
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
112783
|
+
var ar = [];
|
|
112784
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
112785
|
+
return ar;
|
|
112786
|
+
};
|
|
112787
|
+
return ownKeys(o);
|
|
112788
|
+
};
|
|
112789
|
+
return function (mod) {
|
|
112790
|
+
if (mod && mod.__esModule) return mod;
|
|
112791
|
+
var result = {};
|
|
112792
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
112793
|
+
__setModuleDefault(result, mod);
|
|
112794
|
+
return result;
|
|
112795
|
+
};
|
|
112796
|
+
})();
|
|
112615
112797
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
112616
112798
|
exports.CommitTranspiler = void 0;
|
|
112799
|
+
const abaplint = __importStar(__webpack_require__(/*! @abaplint/core */ "./node_modules/@abaplint/core/build/src/index.js"));
|
|
112617
112800
|
const chunk_1 = __webpack_require__(/*! ../chunk */ "./node_modules/@abaplint/transpiler/build/src/chunk.js");
|
|
112801
|
+
const insert_database_1 = __webpack_require__(/*! ./insert_database */ "./node_modules/@abaplint/transpiler/build/src/statements/insert_database.js");
|
|
112618
112802
|
class CommitTranspiler {
|
|
112619
112803
|
transpile(node, traversal) {
|
|
112620
|
-
|
|
112804
|
+
const options = [];
|
|
112805
|
+
const connection = node.findDirectExpression(abaplint.Expressions.DatabaseConnection);
|
|
112806
|
+
if (connection) {
|
|
112807
|
+
options.push(`"connection": ${(0, insert_database_1.findConnection)(connection, traversal)}`);
|
|
112808
|
+
}
|
|
112809
|
+
else if (node.findTokenSequencePosition("AND", "WAIT")) {
|
|
112810
|
+
options.push(`"wait": true`);
|
|
112811
|
+
}
|
|
112812
|
+
const opt = options.length === 0 ? "" : `{${options.join(", ")}}`;
|
|
112813
|
+
return new chunk_1.Chunk().append(`await abap.statements.commit(${opt});`, node, traversal);
|
|
112621
112814
|
}
|
|
112622
112815
|
}
|
|
112623
112816
|
exports.CommitTranspiler = CommitTranspiler;
|
|
@@ -115752,20 +115945,32 @@ class InsertDatabaseTranspiler {
|
|
|
115752
115945
|
}
|
|
115753
115946
|
const connection = node.findDirectExpression(abaplint.Expressions.DatabaseConnection);
|
|
115754
115947
|
if (connection) {
|
|
115755
|
-
const con = findConnection(connection);
|
|
115756
|
-
options.push(`"connection":
|
|
115948
|
+
const con = findConnection(connection, traversal);
|
|
115949
|
+
options.push(`"connection": ${con}`);
|
|
115757
115950
|
}
|
|
115758
115951
|
return new chunk_1.Chunk(`await abap.statements.insertDatabase(${table.getCode()}, {${options.join(", ")}});`);
|
|
115759
115952
|
}
|
|
115760
115953
|
}
|
|
115761
115954
|
exports.InsertDatabaseTranspiler = InsertDatabaseTranspiler;
|
|
115762
|
-
function findConnection(connection) {
|
|
115955
|
+
function findConnection(connection, traversal) {
|
|
115956
|
+
const dynamic = connection.findDirectExpression(abaplint.Expressions.Dynamic);
|
|
115957
|
+
if (dynamic) {
|
|
115958
|
+
const field = dynamic.findFirstExpression(abaplint.Expressions.FieldChain);
|
|
115959
|
+
if (field === undefined) {
|
|
115960
|
+
throw new Error("findConnection: dynamic connection name not found");
|
|
115961
|
+
}
|
|
115962
|
+
const value = traversal.traverse(field).getCode();
|
|
115963
|
+
return `${value}.get().trimEnd().toUpperCase()`;
|
|
115964
|
+
}
|
|
115763
115965
|
let con = connection.getLastToken().getStr().toUpperCase();
|
|
115966
|
+
if (con.startsWith("'") && con.endsWith("'")) {
|
|
115967
|
+
con = con.substring(1, con.length - 1).replace(/''/g, "'");
|
|
115968
|
+
}
|
|
115764
115969
|
if (con === "DEFAULT_") {
|
|
115765
115970
|
// todo, workaround for replacing of keywords,
|
|
115766
115971
|
con = "DEFAULT";
|
|
115767
115972
|
}
|
|
115768
|
-
return con;
|
|
115973
|
+
return JSON.stringify(con);
|
|
115769
115974
|
}
|
|
115770
115975
|
//# sourceMappingURL=insert_database.js.map
|
|
115771
115976
|
|
|
@@ -117170,8 +117375,8 @@ class OpenCursorTranspiler {
|
|
|
117170
117375
|
const options = [];
|
|
117171
117376
|
const connection = node.findDirectExpression(abaplint.Expressions.DatabaseConnection);
|
|
117172
117377
|
if (connection) {
|
|
117173
|
-
const con = (0, insert_database_1.findConnection)(connection);
|
|
117174
|
-
options.push(`"connection":
|
|
117378
|
+
const con = (0, insert_database_1.findConnection)(connection, traversal);
|
|
117379
|
+
options.push(`"connection": ${con}`);
|
|
117175
117380
|
}
|
|
117176
117381
|
return new chunk_1.Chunk().append(`await abap.statements.openCursor(${target}, "${select}", {${options.join(", ")}});`, node, traversal);
|
|
117177
117382
|
}
|
|
@@ -118331,12 +118536,53 @@ exports.ReturnTranspiler = ReturnTranspiler;
|
|
|
118331
118536
|
|
|
118332
118537
|
"use strict";
|
|
118333
118538
|
|
|
118539
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
118540
|
+
if (k2 === undefined) k2 = k;
|
|
118541
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
118542
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
118543
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
118544
|
+
}
|
|
118545
|
+
Object.defineProperty(o, k2, desc);
|
|
118546
|
+
}) : (function(o, m, k, k2) {
|
|
118547
|
+
if (k2 === undefined) k2 = k;
|
|
118548
|
+
o[k2] = m[k];
|
|
118549
|
+
}));
|
|
118550
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
118551
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
118552
|
+
}) : function(o, v) {
|
|
118553
|
+
o["default"] = v;
|
|
118554
|
+
});
|
|
118555
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
118556
|
+
var ownKeys = function(o) {
|
|
118557
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
118558
|
+
var ar = [];
|
|
118559
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
118560
|
+
return ar;
|
|
118561
|
+
};
|
|
118562
|
+
return ownKeys(o);
|
|
118563
|
+
};
|
|
118564
|
+
return function (mod) {
|
|
118565
|
+
if (mod && mod.__esModule) return mod;
|
|
118566
|
+
var result = {};
|
|
118567
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
118568
|
+
__setModuleDefault(result, mod);
|
|
118569
|
+
return result;
|
|
118570
|
+
};
|
|
118571
|
+
})();
|
|
118334
118572
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
118335
118573
|
exports.RollbackTranspiler = void 0;
|
|
118574
|
+
const abaplint = __importStar(__webpack_require__(/*! @abaplint/core */ "./node_modules/@abaplint/core/build/src/index.js"));
|
|
118336
118575
|
const chunk_1 = __webpack_require__(/*! ../chunk */ "./node_modules/@abaplint/transpiler/build/src/chunk.js");
|
|
118576
|
+
const insert_database_1 = __webpack_require__(/*! ./insert_database */ "./node_modules/@abaplint/transpiler/build/src/statements/insert_database.js");
|
|
118337
118577
|
class RollbackTranspiler {
|
|
118338
118578
|
transpile(node, traversal) {
|
|
118339
|
-
|
|
118579
|
+
const options = [];
|
|
118580
|
+
const connection = node.findDirectExpression(abaplint.Expressions.DatabaseConnection);
|
|
118581
|
+
if (connection) {
|
|
118582
|
+
options.push(`"connection": ${(0, insert_database_1.findConnection)(connection, traversal)}`);
|
|
118583
|
+
}
|
|
118584
|
+
const opt = options.length === 0 ? "" : `{${options.join(", ")}}`;
|
|
118585
|
+
return new chunk_1.Chunk().append(`await abap.statements.rollback(${opt});`, node, traversal);
|
|
118340
118586
|
}
|
|
118341
118587
|
}
|
|
118342
118588
|
exports.RollbackTranspiler = RollbackTranspiler;
|
|
@@ -121171,11 +121417,13 @@ class ClassImplementationTranspiler {
|
|
|
121171
121417
|
ret += traversal.setValues(attr.identifier, name);
|
|
121172
121418
|
}
|
|
121173
121419
|
for (const alias of cdef.getAliases()) {
|
|
121174
|
-
|
|
121420
|
+
// note: the component is the raw source casing, so compare case insensitive
|
|
121421
|
+
const component = alias.getComponent().toLowerCase();
|
|
121422
|
+
const isStatic = staticAttributes.some(s => (s.prefix.replace("$", "~") + s.identifier.getName()).toLowerCase() === component);
|
|
121175
121423
|
if (isStatic === false) {
|
|
121176
121424
|
continue;
|
|
121177
121425
|
}
|
|
121178
|
-
ret += traversal_1.Traversal.escapeNamespace(clasName) + "." + alias.getName().toLowerCase() + " = " + traversal_1.Traversal.escapeNamespace(clasName) + "." + traversal_1.Traversal.escapeNamespace(
|
|
121426
|
+
ret += traversal_1.Traversal.escapeNamespace(clasName) + "." + alias.getName().toLowerCase() + " = " + traversal_1.Traversal.escapeNamespace(clasName) + "." + traversal_1.Traversal.escapeNamespace(component.replace("~", "$")) + ";\n";
|
|
121179
121427
|
}
|
|
121180
121428
|
for (const e of cdef.getEvents()) {
|
|
121181
121429
|
if (e.isStatic() === false) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abaplint/transpiler-cli",
|
|
3
|
-
"version": "2.13.
|
|
3
|
+
"version": "2.13.84",
|
|
4
4
|
"description": "Transpiler - Command Line Interface",
|
|
5
5
|
"funding": "https://github.com/sponsors/larshp",
|
|
6
6
|
"bin": {
|
|
@@ -27,8 +27,8 @@
|
|
|
27
27
|
"author": "abaplint",
|
|
28
28
|
"license": "MIT",
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"@abaplint/core": "^2.120.
|
|
31
|
-
"@abaplint/transpiler": "^2.13.
|
|
30
|
+
"@abaplint/core": "^2.120.48",
|
|
31
|
+
"@abaplint/transpiler": "^2.13.84",
|
|
32
32
|
"@types/glob": "^9.0.0",
|
|
33
33
|
"@types/node": "^26.4.1",
|
|
34
34
|
"@types/progress": "^2.0.7",
|