@abaplint/transpiler-cli 2.12.23 → 2.12.25
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/abap_transpile +1 -1
- package/build/bundle.js +282 -51
- package/package.json +4 -4
package/abap_transpile
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
1
|
+
#!/usr/bin/env node
|
|
2
2
|
require("./build/bundle");
|
package/build/bundle.js
CHANGED
|
@@ -7157,7 +7157,7 @@ class SQLCompare extends combi_1.Expression {
|
|
|
7157
7157
|
const nul = (0, combi_1.seq)("IS", (0, combi_1.optPrio)("NOT"), (0, combi_1.altPrio)("NULL", (0, combi_1.ver)(version_1.Version.v753, "INITIAL")));
|
|
7158
7158
|
const source = new _1.SQLSource();
|
|
7159
7159
|
const sub = (0, combi_1.seq)((0, combi_1.optPrio)((0, combi_1.altPrio)("ALL", "ANY", "SOME")), (0, combi_1.altPrio)(subSelect, subSelectDouble));
|
|
7160
|
-
const arith = (0, combi_1.ver)(version_1.Version.v750, (0, combi_1.plusPrio)((0, combi_1.seq)((0, combi_1.altPrio)("+", "-", "*", "/"), _1.SQLFieldName)));
|
|
7160
|
+
const arith = (0, combi_1.ver)(version_1.Version.v750, (0, combi_1.plusPrio)((0, combi_1.seq)((0, combi_1.altPrio)("+", "-", "*", "/"), _1.SQLFieldName)), version_1.Version.OpenABAP);
|
|
7161
7161
|
const paren = (0, combi_1.seq)((0, combi_1.tok)(tokens_1.ParenLeftW), _1.Source, (0, combi_1.tok)(tokens_1.WParenRightW));
|
|
7162
7162
|
const at = (0, combi_1.ver)(version_1.Version.v740sp05, (0, combi_1.seq)((0, combi_1.tok)(tokens_1.WAt), (0, combi_1.altPrio)(_1.SimpleSource3, paren)), version_1.Version.OpenABAP);
|
|
7163
7163
|
const rett = (0, combi_1.seq)((0, combi_1.altPrio)(_1.SQLFunction, _1.ConstantString, (0, combi_1.seq)((0, combi_1.altPrio)(_1.SQLPath, _1.SQLFieldName), (0, combi_1.optPrio)(arith)), at), (0, combi_1.altPrio)((0, combi_1.seq)(_1.SQLCompareOperator, (0, combi_1.altPrio)(sub, source)), (0, combi_1.seq)((0, combi_1.optPrio)("NOT"), (0, combi_1.altPrio)(_1.SQLIn, like, between)), nul));
|
|
@@ -8913,13 +8913,14 @@ class StatementParser {
|
|
|
8913
8913
|
lazyUnknown(wa) {
|
|
8914
8914
|
const result = [];
|
|
8915
8915
|
for (let statement of wa.statements) {
|
|
8916
|
-
// dont use CALL METHOD, when executing lazy, it easily gives a Move for the last
|
|
8916
|
+
// dont use CALL METHOD, when executing lazy, it easily gives a Move for the last statement if lazy logic is evaluated
|
|
8917
8917
|
if (statement.get() instanceof _statement_1.Unknown) {
|
|
8918
8918
|
const concat = statement.concatTokens().toUpperCase();
|
|
8919
8919
|
if (concat.startsWith("CALL METHOD ") === false
|
|
8920
8920
|
&& concat.startsWith("RAISE EXCEPTION TYPE ") === false
|
|
8921
8921
|
&& concat.startsWith("READ TABLE ") === false
|
|
8922
8922
|
&& concat.startsWith("LOOP AT ") === false
|
|
8923
|
+
&& concat.startsWith("SELECT SINGLE ") === false
|
|
8923
8924
|
&& concat.startsWith("CALL FUNCTION ") === false) {
|
|
8924
8925
|
for (const { first, second } of this.buildSplits(statement.getTokens())) {
|
|
8925
8926
|
if (second.length === 1) {
|
|
@@ -22208,8 +22209,25 @@ class Procedural {
|
|
|
22208
22209
|
}
|
|
22209
22210
|
return undefined;
|
|
22210
22211
|
}
|
|
22212
|
+
findFunctionGroupScope(fg) {
|
|
22213
|
+
var _a, _b, _c;
|
|
22214
|
+
for (const module of fg.getModules()) {
|
|
22215
|
+
if (module.isGlobalParameters() === false) {
|
|
22216
|
+
continue;
|
|
22217
|
+
}
|
|
22218
|
+
// console.dir(fg.getSequencedFiles());
|
|
22219
|
+
const fmFile = fg.getSequencedFiles().find((f) => { return f.getFilename().endsWith(".fugr." + module.getName().toLowerCase().replace(/\//g, "#") + ".abap"); });
|
|
22220
|
+
if (fmFile === undefined) {
|
|
22221
|
+
continue;
|
|
22222
|
+
}
|
|
22223
|
+
const nameToken = (_c = (_b = (_a = fmFile.getStructure()) === null || _a === void 0 ? void 0 : _a.findFirstStatement(Statements.FunctionModule)) === null || _b === void 0 ? void 0 : _b.findFirstExpression(Expressions.Field)) === null || _c === void 0 ? void 0 : _c.getFirstToken();
|
|
22224
|
+
if (nameToken === undefined) {
|
|
22225
|
+
continue;
|
|
22226
|
+
}
|
|
22227
|
+
this.addFunctionScope(module, nameToken, fmFile.getFilename(), true);
|
|
22228
|
+
}
|
|
22229
|
+
}
|
|
22211
22230
|
findFunctionScope(obj, node, filename) {
|
|
22212
|
-
var _a, _b, _c, _d, _e;
|
|
22213
22231
|
if (!(obj instanceof objects_1.FunctionGroup)) {
|
|
22214
22232
|
throw new Error("findFunctionScope, expected function group input");
|
|
22215
22233
|
}
|
|
@@ -22220,6 +22238,13 @@ class Procedural {
|
|
|
22220
22238
|
if (definition === undefined) {
|
|
22221
22239
|
throw new Error("Function module definition \"" + name + "\" not found");
|
|
22222
22240
|
}
|
|
22241
|
+
if (definition.isGlobalParameters() === true) {
|
|
22242
|
+
return; // already added at global level
|
|
22243
|
+
}
|
|
22244
|
+
this.addFunctionScope(definition, nameToken, filename);
|
|
22245
|
+
}
|
|
22246
|
+
addFunctionScope(definition, nameToken, filename, ignoreIfAlreadyExists = false) {
|
|
22247
|
+
var _a, _b, _c, _d, _e;
|
|
22223
22248
|
const ddic = new ddic_1.DDIC(this.reg);
|
|
22224
22249
|
const allNames = new Set();
|
|
22225
22250
|
for (const param of definition.getParameters()) {
|
|
@@ -22305,7 +22330,15 @@ class Procedural {
|
|
|
22305
22330
|
}
|
|
22306
22331
|
else {
|
|
22307
22332
|
const type = new _typed_identifier_1.TypedIdentifier(nameToken, filename, found);
|
|
22308
|
-
|
|
22333
|
+
if (ignoreIfAlreadyExists === true) {
|
|
22334
|
+
const exists = this.scope.findVariable(param.name);
|
|
22335
|
+
if (exists === undefined) {
|
|
22336
|
+
this.scope.addNamedIdentifier(param.name, type);
|
|
22337
|
+
}
|
|
22338
|
+
}
|
|
22339
|
+
else {
|
|
22340
|
+
this.scope.addNamedIdentifier(param.name, type);
|
|
22341
|
+
}
|
|
22309
22342
|
allNames.add(param.name.toUpperCase());
|
|
22310
22343
|
}
|
|
22311
22344
|
}
|
|
@@ -22629,6 +22662,22 @@ class TypeUtils {
|
|
|
22629
22662
|
// todo
|
|
22630
22663
|
return true;
|
|
22631
22664
|
}
|
|
22665
|
+
isCompareable(source1, source2, node1, node2) {
|
|
22666
|
+
/*
|
|
22667
|
+
console.dir(source1);
|
|
22668
|
+
console.dir(source2);
|
|
22669
|
+
*/
|
|
22670
|
+
if (source1 === undefined || source2 === undefined) {
|
|
22671
|
+
return true;
|
|
22672
|
+
}
|
|
22673
|
+
if (source1 instanceof basic_1.HexType && this.isCalculated(node1) && source2 instanceof basic_1.IntegerType) {
|
|
22674
|
+
return false;
|
|
22675
|
+
}
|
|
22676
|
+
if (source2 instanceof basic_1.HexType && this.isCalculated(node2) && source1 instanceof basic_1.IntegerType) {
|
|
22677
|
+
return false;
|
|
22678
|
+
}
|
|
22679
|
+
return true;
|
|
22680
|
+
}
|
|
22632
22681
|
structureContainsString(structure) {
|
|
22633
22682
|
for (const c of structure.getComponents()) {
|
|
22634
22683
|
if (c.type instanceof basic_1.StringType) {
|
|
@@ -22658,6 +22707,13 @@ class TypeUtils {
|
|
|
22658
22707
|
|| node.findFirstExpression(Expressions.ArithOperator) !== undefined;
|
|
22659
22708
|
return calculated;
|
|
22660
22709
|
}
|
|
22710
|
+
isAssignableNew(source, target, node) {
|
|
22711
|
+
const calculated = (node === null || node === void 0 ? void 0 : node.findFirstExpression(Expressions.ArithOperator)) !== undefined;
|
|
22712
|
+
if (calculated && source instanceof basic_1.HexType && target instanceof basic_1.IntegerType) {
|
|
22713
|
+
return false;
|
|
22714
|
+
}
|
|
22715
|
+
return this.isAssignable(source, target);
|
|
22716
|
+
}
|
|
22661
22717
|
isAssignableStrict(source, target, node) {
|
|
22662
22718
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
22663
22719
|
const calculated = node ? this.isCalculated(node) : false;
|
|
@@ -24257,10 +24313,14 @@ const Expressions = __webpack_require__(/*! ../../2_statements/expressions */ ".
|
|
|
24257
24313
|
const source_1 = __webpack_require__(/*! ./source */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/source.js");
|
|
24258
24314
|
const method_call_chain_1 = __webpack_require__(/*! ./method_call_chain */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/method_call_chain.js");
|
|
24259
24315
|
const source_field_symbol_1 = __webpack_require__(/*! ./source_field_symbol */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/source_field_symbol.js");
|
|
24316
|
+
const _syntax_input_1 = __webpack_require__(/*! ../_syntax_input */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_syntax_input.js");
|
|
24317
|
+
const _type_utils_1 = __webpack_require__(/*! ../_type_utils */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_type_utils.js");
|
|
24260
24318
|
class Compare {
|
|
24261
24319
|
static runSyntax(node, input) {
|
|
24262
|
-
|
|
24263
|
-
|
|
24320
|
+
const sourceTypes = [];
|
|
24321
|
+
const sources = node.findDirectExpressions(Expressions.Source);
|
|
24322
|
+
for (const t of sources) {
|
|
24323
|
+
sourceTypes.push(source_1.Source.runSyntax(t, input));
|
|
24264
24324
|
}
|
|
24265
24325
|
for (const t of node.findDirectExpressions(Expressions.SourceFieldSymbolChain)) {
|
|
24266
24326
|
source_field_symbol_1.SourceFieldSymbol.runSyntax(t, input);
|
|
@@ -24268,6 +24328,12 @@ class Compare {
|
|
|
24268
24328
|
for (const t of node.findDirectExpressions(Expressions.MethodCallChain)) {
|
|
24269
24329
|
method_call_chain_1.MethodCallChain.runSyntax(t, input);
|
|
24270
24330
|
}
|
|
24331
|
+
if (node.findDirectExpression(Expressions.CompareOperator)
|
|
24332
|
+
&& new _type_utils_1.TypeUtils(input.scope).isCompareable(sourceTypes[0], sourceTypes[1], sources[0], sources[1]) === false
|
|
24333
|
+
&& sourceTypes.length === 2) {
|
|
24334
|
+
const message = "Incompatible types for comparison";
|
|
24335
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
|
|
24336
|
+
}
|
|
24271
24337
|
}
|
|
24272
24338
|
}
|
|
24273
24339
|
exports.Compare = Compare;
|
|
@@ -27626,6 +27692,9 @@ class Source {
|
|
|
27626
27692
|
if (context instanceof basic_1.FloatType && found instanceof basic_1.IntegerType) {
|
|
27627
27693
|
return context;
|
|
27628
27694
|
}
|
|
27695
|
+
else if (context instanceof basic_1.IntegerType && (found === null || found === void 0 ? void 0 : found.isGeneric())) {
|
|
27696
|
+
return context;
|
|
27697
|
+
}
|
|
27629
27698
|
else {
|
|
27630
27699
|
return found;
|
|
27631
27700
|
}
|
|
@@ -28047,53 +28116,84 @@ exports.SQLSource = SQLSource;
|
|
|
28047
28116
|
|
|
28048
28117
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
28049
28118
|
exports.StringTemplate = void 0;
|
|
28119
|
+
const nodes_1 = __webpack_require__(/*! ../../nodes */ "./node_modules/@abaplint/core/build/src/abap/nodes/index.js");
|
|
28050
28120
|
const basic_1 = __webpack_require__(/*! ../../types/basic */ "./node_modules/@abaplint/core/build/src/abap/types/basic/index.js");
|
|
28051
28121
|
const Expressions = __webpack_require__(/*! ../../2_statements/expressions */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js");
|
|
28052
28122
|
const source_1 = __webpack_require__(/*! ./source */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/source.js");
|
|
28053
28123
|
const _type_utils_1 = __webpack_require__(/*! ../_type_utils */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_type_utils.js");
|
|
28054
28124
|
const _syntax_input_1 = __webpack_require__(/*! ../_syntax_input */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_syntax_input.js");
|
|
28125
|
+
const Tokens = __webpack_require__(/*! ../../1_lexer/tokens */ "./node_modules/@abaplint/core/build/src/abap/1_lexer/tokens/index.js");
|
|
28055
28126
|
class StringTemplate {
|
|
28056
28127
|
static runSyntax(node, input) {
|
|
28057
28128
|
const typeUtils = new _type_utils_1.TypeUtils(input.scope);
|
|
28058
28129
|
const ret = basic_1.StringType.get();
|
|
28059
|
-
for (const
|
|
28060
|
-
|
|
28061
|
-
|
|
28062
|
-
|
|
28063
|
-
|
|
28064
|
-
|
|
28065
|
-
|
|
28066
|
-
|
|
28067
|
-
|
|
28068
|
-
|
|
28069
|
-
|
|
28070
|
-
|
|
28071
|
-
|
|
28072
|
-
|
|
28073
|
-
|
|
28130
|
+
for (const child of node.getChildren()) {
|
|
28131
|
+
if (child instanceof nodes_1.ExpressionNode && child.get() instanceof Expressions.StringTemplateSource) {
|
|
28132
|
+
const s = child.findDirectExpression(Expressions.Source);
|
|
28133
|
+
const type = source_1.Source.runSyntax(s, input, ret);
|
|
28134
|
+
if (type === undefined) {
|
|
28135
|
+
const message = "No target type determined";
|
|
28136
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
|
|
28137
|
+
return basic_1.VoidType.get(_syntax_input_1.CheckSyntaxKey);
|
|
28138
|
+
}
|
|
28139
|
+
else if ((typeUtils.isCharLike(type) === false
|
|
28140
|
+
&& typeUtils.isHexLike(type) === false
|
|
28141
|
+
&& !(type instanceof basic_1.UTCLongType))
|
|
28142
|
+
|| type instanceof basic_1.StructureType) {
|
|
28143
|
+
const message = "String template, not character like, " + type.constructor.name;
|
|
28144
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
|
|
28145
|
+
return basic_1.VoidType.get(_syntax_input_1.CheckSyntaxKey);
|
|
28146
|
+
}
|
|
28147
|
+
const format = child.findDirectExpression(Expressions.StringTemplateFormatting);
|
|
28148
|
+
const formatConcat = format === null || format === void 0 ? void 0 : format.concatTokens();
|
|
28149
|
+
for (const formatSource of (format === null || format === void 0 ? void 0 : format.findAllExpressions(Expressions.Source)) || []) {
|
|
28150
|
+
source_1.Source.runSyntax(formatSource, input);
|
|
28151
|
+
}
|
|
28152
|
+
if (format
|
|
28153
|
+
&& (formatConcat === null || formatConcat === void 0 ? void 0 : formatConcat.includes("ALPHA = "))
|
|
28154
|
+
&& !(type instanceof basic_1.UnknownType)
|
|
28155
|
+
&& !(type instanceof basic_1.VoidType)
|
|
28156
|
+
&& !(type instanceof basic_1.StringType)
|
|
28157
|
+
&& !(type instanceof basic_1.CLikeType)
|
|
28158
|
+
&& !(type instanceof basic_1.CharacterType)
|
|
28159
|
+
&& !(type instanceof basic_1.NumericGenericType)
|
|
28160
|
+
&& !(type instanceof basic_1.NumericType)
|
|
28161
|
+
&& !(type instanceof basic_1.AnyType)) {
|
|
28162
|
+
const message = `Cannot apply ALPHA to this type (${type.constructor.name})`;
|
|
28163
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, format.getFirstToken(), message));
|
|
28164
|
+
return basic_1.VoidType.get(_syntax_input_1.CheckSyntaxKey);
|
|
28165
|
+
}
|
|
28074
28166
|
}
|
|
28075
|
-
|
|
28076
|
-
|
|
28077
|
-
|
|
28078
|
-
|
|
28079
|
-
|
|
28080
|
-
|
|
28081
|
-
|
|
28082
|
-
|
|
28083
|
-
|
|
28084
|
-
|
|
28085
|
-
|
|
28086
|
-
|
|
28087
|
-
&& !(type instanceof basic_1.NumericGenericType)
|
|
28088
|
-
&& !(type instanceof basic_1.NumericType)
|
|
28089
|
-
&& !(type instanceof basic_1.AnyType)) {
|
|
28090
|
-
const message = `Cannot apply ALPHA to this type (${type.constructor.name})`;
|
|
28091
|
-
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, format.getFirstToken(), message));
|
|
28092
|
-
return basic_1.VoidType.get(_syntax_input_1.CheckSyntaxKey);
|
|
28167
|
+
else if (child instanceof nodes_1.TokenNode) {
|
|
28168
|
+
const token = child.get();
|
|
28169
|
+
if (token instanceof Tokens.StringTemplate
|
|
28170
|
+
|| token instanceof Tokens.StringTemplateBegin
|
|
28171
|
+
|| token instanceof Tokens.StringTemplateMiddle
|
|
28172
|
+
|| token instanceof Tokens.StringTemplateEnd) {
|
|
28173
|
+
const issue = this.validateEscapeSequences(token.getStr(), input, child);
|
|
28174
|
+
if (issue) {
|
|
28175
|
+
input.issues.push(issue);
|
|
28176
|
+
return basic_1.VoidType.get(_syntax_input_1.CheckSyntaxKey);
|
|
28177
|
+
}
|
|
28178
|
+
}
|
|
28093
28179
|
}
|
|
28094
28180
|
}
|
|
28095
28181
|
return ret;
|
|
28096
28182
|
}
|
|
28183
|
+
static validateEscapeSequences(str, input, node) {
|
|
28184
|
+
// Valid escape sequences in ABAP string templates: \|, \{, \}, \\, \n, \r, \t
|
|
28185
|
+
const validEscapes = new Set(["\\|", "\\{", "\\}", "\\\\", "\\n", "\\r", "\\t"]);
|
|
28186
|
+
for (let i = 0; i < str.length; i++) {
|
|
28187
|
+
if (str[i] === "\\") {
|
|
28188
|
+
const escape = str.substring(i, i + 2);
|
|
28189
|
+
if (!validEscapes.has(escape)) {
|
|
28190
|
+
return (0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), `Invalid escape sequence "${escape}" in string template`);
|
|
28191
|
+
}
|
|
28192
|
+
i++; // skip the next character as it's part of the escape sequence
|
|
28193
|
+
}
|
|
28194
|
+
}
|
|
28195
|
+
return undefined;
|
|
28196
|
+
}
|
|
28097
28197
|
}
|
|
28098
28198
|
exports.StringTemplate = StringTemplate;
|
|
28099
28199
|
//# sourceMappingURL=string_template.js.map
|
|
@@ -30404,8 +30504,9 @@ class CreateObject {
|
|
|
30404
30504
|
target_1.Target.runSyntax(t, input);
|
|
30405
30505
|
}
|
|
30406
30506
|
const t = node.findDirectExpression(Expressions.Target);
|
|
30507
|
+
let found = undefined;
|
|
30407
30508
|
if (t) {
|
|
30408
|
-
|
|
30509
|
+
found = target_1.Target.runSyntax(t, input);
|
|
30409
30510
|
if (found instanceof basic_1.VoidType) {
|
|
30410
30511
|
// do nothing
|
|
30411
30512
|
}
|
|
@@ -30457,7 +30558,11 @@ class CreateObject {
|
|
|
30457
30558
|
for (const t of node.findDirectExpressions(Expressions.Dynamic)) {
|
|
30458
30559
|
dynamic_1.Dynamic.runSyntax(t, input);
|
|
30459
30560
|
}
|
|
30460
|
-
|
|
30561
|
+
let ooName = cdef === null || cdef === void 0 ? void 0 : cdef.getName();
|
|
30562
|
+
if (ooName === undefined && found instanceof basic_1.VoidType) {
|
|
30563
|
+
ooName = found.getVoided();
|
|
30564
|
+
}
|
|
30565
|
+
input.scope.addReference(t === null || t === void 0 ? void 0 : t.getFirstToken(), cdef, _reference_1.ReferenceType.ConstructorReference, input.filename, { ooName: ooName });
|
|
30461
30566
|
this.validateParameters(cdef, node, input);
|
|
30462
30567
|
}
|
|
30463
30568
|
validateParameters(cdef, node, input) {
|
|
@@ -32466,7 +32571,7 @@ class Move {
|
|
|
32466
32571
|
return;
|
|
32467
32572
|
}
|
|
32468
32573
|
}
|
|
32469
|
-
else if (new _type_utils_1.TypeUtils(input.scope).
|
|
32574
|
+
else if (new _type_utils_1.TypeUtils(input.scope).isAssignableNew(sourceType, targetType, source) === false) {
|
|
32470
32575
|
const message = "Incompatible types";
|
|
32471
32576
|
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
|
|
32472
32577
|
return;
|
|
@@ -35426,6 +35531,9 @@ class SyntaxLogic {
|
|
|
35426
35531
|
stype = _scope_type_1.ScopeType.FunctionGroup;
|
|
35427
35532
|
}
|
|
35428
35533
|
this.scope.push(stype, this.object.getName(), new position_1.Position(1, 1), main.getFilename());
|
|
35534
|
+
if (this.object instanceof objects_1.FunctionGroup) {
|
|
35535
|
+
this.helpers.proc.findFunctionGroupScope(this.object);
|
|
35536
|
+
}
|
|
35429
35537
|
}
|
|
35430
35538
|
}
|
|
35431
35539
|
else if (this.object instanceof objects_1.TypePool) {
|
|
@@ -39091,7 +39199,7 @@ exports.FormDefinition = FormDefinition;
|
|
|
39091
39199
|
"use strict";
|
|
39092
39200
|
|
|
39093
39201
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
39094
|
-
exports.FunctionModuleDefinition = exports.FunctionModuleParameterDirection = void 0;
|
|
39202
|
+
exports.FunctionModuleDefinition = exports.FunctionModuleType = exports.FunctionModuleParameterDirection = void 0;
|
|
39095
39203
|
const xml_utils_1 = __webpack_require__(/*! ../../xml_utils */ "./node_modules/@abaplint/core/build/src/xml_utils.js");
|
|
39096
39204
|
var FunctionModuleParameterDirection;
|
|
39097
39205
|
(function (FunctionModuleParameterDirection) {
|
|
@@ -39100,6 +39208,12 @@ var FunctionModuleParameterDirection;
|
|
|
39100
39208
|
FunctionModuleParameterDirection["changing"] = "changing";
|
|
39101
39209
|
FunctionModuleParameterDirection["tables"] = "tables";
|
|
39102
39210
|
})(FunctionModuleParameterDirection || (exports.FunctionModuleParameterDirection = FunctionModuleParameterDirection = {}));
|
|
39211
|
+
var FunctionModuleType;
|
|
39212
|
+
(function (FunctionModuleType) {
|
|
39213
|
+
FunctionModuleType["regular"] = "regular";
|
|
39214
|
+
FunctionModuleType["remote"] = "remoteEnabled";
|
|
39215
|
+
FunctionModuleType["update"] = "update";
|
|
39216
|
+
})(FunctionModuleType || (exports.FunctionModuleType = FunctionModuleType = {}));
|
|
39103
39217
|
class FunctionModuleDefinition {
|
|
39104
39218
|
constructor(data) {
|
|
39105
39219
|
this.parse(data);
|
|
@@ -39107,12 +39221,18 @@ class FunctionModuleDefinition {
|
|
|
39107
39221
|
getParameters() {
|
|
39108
39222
|
return this.parameters;
|
|
39109
39223
|
}
|
|
39224
|
+
getModuleType() {
|
|
39225
|
+
return this.moduleType;
|
|
39226
|
+
}
|
|
39110
39227
|
getDescription() {
|
|
39111
39228
|
return this.description;
|
|
39112
39229
|
}
|
|
39113
39230
|
getName() {
|
|
39114
39231
|
return this.name;
|
|
39115
39232
|
}
|
|
39233
|
+
isGlobalParameters() {
|
|
39234
|
+
return this.globalParameters;
|
|
39235
|
+
}
|
|
39116
39236
|
///////////////
|
|
39117
39237
|
parse(data) {
|
|
39118
39238
|
if (data.FUNCNAME === undefined) {
|
|
@@ -39121,6 +39241,14 @@ class FunctionModuleDefinition {
|
|
|
39121
39241
|
this.name = data.FUNCNAME;
|
|
39122
39242
|
this.description = data.SHORT_TEXT;
|
|
39123
39243
|
this.parameters = [];
|
|
39244
|
+
this.globalParameters = data.GLOBAL_FLAG === "X";
|
|
39245
|
+
this.moduleType = FunctionModuleType.regular;
|
|
39246
|
+
if (data.REMOTE_CALL === "R") {
|
|
39247
|
+
this.moduleType = FunctionModuleType.remote;
|
|
39248
|
+
}
|
|
39249
|
+
else if (data.UPDATE_TASK !== undefined) {
|
|
39250
|
+
this.moduleType = FunctionModuleType.update;
|
|
39251
|
+
}
|
|
39124
39252
|
if (data.IMPORT) {
|
|
39125
39253
|
for (const param of (0, xml_utils_1.xmlToArray)(data.IMPORT.RSIMP)) {
|
|
39126
39254
|
if (param.PARAMETER === undefined) {
|
|
@@ -54211,7 +54339,7 @@ class Registry {
|
|
|
54211
54339
|
}
|
|
54212
54340
|
static abaplintVersion() {
|
|
54213
54341
|
// magic, see build script "version.sh"
|
|
54214
|
-
return "2.115.
|
|
54342
|
+
return "2.115.16";
|
|
54215
54343
|
}
|
|
54216
54344
|
getDDICReferences() {
|
|
54217
54345
|
return this.ddicReferences;
|
|
@@ -63265,6 +63393,68 @@ exports.Exporting = Exporting;
|
|
|
63265
63393
|
|
|
63266
63394
|
/***/ },
|
|
63267
63395
|
|
|
63396
|
+
/***/ "./node_modules/@abaplint/core/build/src/rules/fm_global_parameters_obsolete.js"
|
|
63397
|
+
/*!**************************************************************************************!*\
|
|
63398
|
+
!*** ./node_modules/@abaplint/core/build/src/rules/fm_global_parameters_obsolete.js ***!
|
|
63399
|
+
\**************************************************************************************/
|
|
63400
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
63401
|
+
|
|
63402
|
+
"use strict";
|
|
63403
|
+
|
|
63404
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
63405
|
+
exports.FMGlobalParametersObsolete = exports.FMGlobalParametersObsoleteConf = void 0;
|
|
63406
|
+
const issue_1 = __webpack_require__(/*! ../issue */ "./node_modules/@abaplint/core/build/src/issue.js");
|
|
63407
|
+
const Objects = __webpack_require__(/*! ../objects */ "./node_modules/@abaplint/core/build/src/objects/index.js");
|
|
63408
|
+
const _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ "./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js");
|
|
63409
|
+
const position_1 = __webpack_require__(/*! ../position */ "./node_modules/@abaplint/core/build/src/position.js");
|
|
63410
|
+
class FMGlobalParametersObsoleteConf extends _basic_rule_config_1.BasicRuleConfig {
|
|
63411
|
+
}
|
|
63412
|
+
exports.FMGlobalParametersObsoleteConf = FMGlobalParametersObsoleteConf;
|
|
63413
|
+
class FMGlobalParametersObsolete {
|
|
63414
|
+
constructor() {
|
|
63415
|
+
this.conf = new FMGlobalParametersObsoleteConf();
|
|
63416
|
+
}
|
|
63417
|
+
getMetadata() {
|
|
63418
|
+
return {
|
|
63419
|
+
key: "fm_global_parameters_obsolete",
|
|
63420
|
+
title: "FM Global Parameters Obsolete",
|
|
63421
|
+
shortDescription: `Check for function modules with global parameteers`,
|
|
63422
|
+
extendedInformation: `https://help.sap.com/doc/abapdocu_750_index_htm/7.50/en-US/abenglobal_parameters_obsolete.htm`,
|
|
63423
|
+
tags: [],
|
|
63424
|
+
};
|
|
63425
|
+
}
|
|
63426
|
+
initialize(_reg) {
|
|
63427
|
+
return this;
|
|
63428
|
+
}
|
|
63429
|
+
getConfig() {
|
|
63430
|
+
return this.conf;
|
|
63431
|
+
}
|
|
63432
|
+
setConfig(conf) {
|
|
63433
|
+
this.conf = conf;
|
|
63434
|
+
}
|
|
63435
|
+
run(obj) {
|
|
63436
|
+
if (!(obj instanceof Objects.FunctionGroup)) {
|
|
63437
|
+
return [];
|
|
63438
|
+
}
|
|
63439
|
+
const issues = [];
|
|
63440
|
+
for (const module of obj.getModules()) {
|
|
63441
|
+
if (module.isGlobalParameters() === true) {
|
|
63442
|
+
const file = obj.getMainABAPFile();
|
|
63443
|
+
if (file === undefined) {
|
|
63444
|
+
continue;
|
|
63445
|
+
}
|
|
63446
|
+
const message = `Function Module "${module.getName()}" uses obsolete global parameters`;
|
|
63447
|
+
issues.push(issue_1.Issue.atPosition(file, new position_1.Position(1, 1), message, this.getMetadata().key, this.conf.severity));
|
|
63448
|
+
}
|
|
63449
|
+
}
|
|
63450
|
+
return issues;
|
|
63451
|
+
}
|
|
63452
|
+
}
|
|
63453
|
+
exports.FMGlobalParametersObsolete = FMGlobalParametersObsolete;
|
|
63454
|
+
//# sourceMappingURL=fm_global_parameters_obsolete.js.map
|
|
63455
|
+
|
|
63456
|
+
/***/ },
|
|
63457
|
+
|
|
63268
63458
|
/***/ "./node_modules/@abaplint/core/build/src/rules/forbidden_identifier.js"
|
|
63269
63459
|
/*!*****************************************************************************!*\
|
|
63270
63460
|
!*** ./node_modules/@abaplint/core/build/src/rules/forbidden_identifier.js ***!
|
|
@@ -65635,6 +65825,7 @@ __exportStar(__webpack_require__(/*! ./empty_structure */ "./node_modules/@abapl
|
|
|
65635
65825
|
__exportStar(__webpack_require__(/*! ./exit_or_check */ "./node_modules/@abaplint/core/build/src/rules/exit_or_check.js"), exports);
|
|
65636
65826
|
__exportStar(__webpack_require__(/*! ./expand_macros */ "./node_modules/@abaplint/core/build/src/rules/expand_macros.js"), exports);
|
|
65637
65827
|
__exportStar(__webpack_require__(/*! ./exporting */ "./node_modules/@abaplint/core/build/src/rules/exporting.js"), exports);
|
|
65828
|
+
__exportStar(__webpack_require__(/*! ./fm_global_parameters_obsolete */ "./node_modules/@abaplint/core/build/src/rules/fm_global_parameters_obsolete.js"), exports);
|
|
65638
65829
|
__exportStar(__webpack_require__(/*! ./forbidden_identifier */ "./node_modules/@abaplint/core/build/src/rules/forbidden_identifier.js"), exports);
|
|
65639
65830
|
__exportStar(__webpack_require__(/*! ./forbidden_pseudo_and_pragma */ "./node_modules/@abaplint/core/build/src/rules/forbidden_pseudo_and_pragma.js"), exports);
|
|
65640
65831
|
__exportStar(__webpack_require__(/*! ./forbidden_void_type */ "./node_modules/@abaplint/core/build/src/rules/forbidden_void_type.js"), exports);
|
|
@@ -65648,6 +65839,7 @@ __exportStar(__webpack_require__(/*! ./identical_conditions */ "./node_modules/@
|
|
|
65648
65839
|
__exportStar(__webpack_require__(/*! ./identical_contents */ "./node_modules/@abaplint/core/build/src/rules/identical_contents.js"), exports);
|
|
65649
65840
|
__exportStar(__webpack_require__(/*! ./identical_descriptions */ "./node_modules/@abaplint/core/build/src/rules/identical_descriptions.js"), exports);
|
|
65650
65841
|
__exportStar(__webpack_require__(/*! ./identical_form_names */ "./node_modules/@abaplint/core/build/src/rules/identical_form_names.js"), exports);
|
|
65842
|
+
__exportStar(__webpack_require__(/*! ./identical_move */ "./node_modules/@abaplint/core/build/src/rules/identical_move.js"), exports);
|
|
65651
65843
|
__exportStar(__webpack_require__(/*! ./if_in_if */ "./node_modules/@abaplint/core/build/src/rules/if_in_if.js"), exports);
|
|
65652
65844
|
__exportStar(__webpack_require__(/*! ./implement_methods */ "./node_modules/@abaplint/core/build/src/rules/implement_methods.js"), exports);
|
|
65653
65845
|
__exportStar(__webpack_require__(/*! ./implicit_start_of_selection */ "./node_modules/@abaplint/core/build/src/rules/implicit_start_of_selection.js"), exports);
|
|
@@ -65659,7 +65851,6 @@ __exportStar(__webpack_require__(/*! ./intf_referencing_clas */ "./node_modules/
|
|
|
65659
65851
|
__exportStar(__webpack_require__(/*! ./invalid_table_index */ "./node_modules/@abaplint/core/build/src/rules/invalid_table_index.js"), exports);
|
|
65660
65852
|
__exportStar(__webpack_require__(/*! ./keep_single_parameter_on_one_line */ "./node_modules/@abaplint/core/build/src/rules/keep_single_parameter_on_one_line.js"), exports);
|
|
65661
65853
|
__exportStar(__webpack_require__(/*! ./keyword_case */ "./node_modules/@abaplint/core/build/src/rules/keyword_case.js"), exports);
|
|
65662
|
-
__exportStar(__webpack_require__(/*! ./identical_move */ "./node_modules/@abaplint/core/build/src/rules/identical_move.js"), exports);
|
|
65663
65854
|
__exportStar(__webpack_require__(/*! ./line_break_multiple_parameters */ "./node_modules/@abaplint/core/build/src/rules/line_break_multiple_parameters.js"), exports);
|
|
65664
65855
|
__exportStar(__webpack_require__(/*! ./line_break_style */ "./node_modules/@abaplint/core/build/src/rules/line_break_style.js"), exports);
|
|
65665
65856
|
__exportStar(__webpack_require__(/*! ./line_length */ "./node_modules/@abaplint/core/build/src/rules/line_length.js"), exports);
|
|
@@ -80050,7 +80241,10 @@ class ConstantTranspiler {
|
|
|
80050
80241
|
this.addGet = addGet;
|
|
80051
80242
|
}
|
|
80052
80243
|
handleInteger(int, traversal) {
|
|
80053
|
-
|
|
80244
|
+
let concat = int.concatTokens().trim().replace(/^0+/, "");
|
|
80245
|
+
if (concat === "") {
|
|
80246
|
+
concat = "0";
|
|
80247
|
+
}
|
|
80054
80248
|
const parsed = Number.parseInt(concat, 10);
|
|
80055
80249
|
let code = "";
|
|
80056
80250
|
if (concat.length > 18) {
|
|
@@ -81316,6 +81510,7 @@ const abaplint = __webpack_require__(/*! @abaplint/core */ "./node_modules/@abap
|
|
|
81316
81510
|
const chunk_1 = __webpack_require__(/*! ../chunk */ "./node_modules/@abaplint/transpiler/build/src/chunk.js");
|
|
81317
81511
|
const type_name_or_infer_1 = __webpack_require__(/*! ./type_name_or_infer */ "./node_modules/@abaplint/transpiler/build/src/expressions/type_name_or_infer.js");
|
|
81318
81512
|
const transpile_types_1 = __webpack_require__(/*! ../transpile_types */ "./node_modules/@abaplint/transpiler/build/src/transpile_types.js");
|
|
81513
|
+
const types_1 = __webpack_require__(/*! ../types */ "./node_modules/@abaplint/transpiler/build/src/types.js");
|
|
81319
81514
|
class NewObjectTranspiler {
|
|
81320
81515
|
transpile(node, traversal) {
|
|
81321
81516
|
const ret = new chunk_1.Chunk();
|
|
@@ -81328,8 +81523,26 @@ class NewObjectTranspiler {
|
|
|
81328
81523
|
if (parameters) {
|
|
81329
81524
|
para = traversal.traverse(parameters).getCode();
|
|
81330
81525
|
}
|
|
81331
|
-
|
|
81332
|
-
if (type
|
|
81526
|
+
let type = new type_name_or_infer_1.TypeNameOrInfer().findTypeOrUndefined(typeNameOrInfer, traversal);
|
|
81527
|
+
if (type === undefined) {
|
|
81528
|
+
const scope = traversal.findCurrentScopeByToken(node.getFirstToken());
|
|
81529
|
+
try {
|
|
81530
|
+
type = traversal.lookupType(typeNameOrInfer, scope);
|
|
81531
|
+
}
|
|
81532
|
+
catch {
|
|
81533
|
+
// ignore
|
|
81534
|
+
}
|
|
81535
|
+
}
|
|
81536
|
+
if (type === undefined) {
|
|
81537
|
+
if (traversal.options?.unknownTypes === types_1.UnknownTypesEnum.runtimeError) {
|
|
81538
|
+
ret.appendString(`(function() { throw new Error("Void type: ${typeNameOrInfer.concatTokens().toUpperCase()}") })()`);
|
|
81539
|
+
return ret;
|
|
81540
|
+
}
|
|
81541
|
+
else {
|
|
81542
|
+
throw new Error("NewObjectTranspiler, type not found: " + node.concatTokens() + ", " + traversal.getCurrentObject().getName() + " line " + node.getFirstToken().getStart().getRow());
|
|
81543
|
+
}
|
|
81544
|
+
}
|
|
81545
|
+
else if (type instanceof abaplint.BasicTypes.ObjectReferenceType) {
|
|
81333
81546
|
if (node.getChildren()[3].get() instanceof abaplint.Expressions.Source) {
|
|
81334
81547
|
// single default parameter
|
|
81335
81548
|
const scope = traversal.findCurrentScopeByToken(typeNameOrInfer.getFirstToken());
|
|
@@ -81342,7 +81555,13 @@ class NewObjectTranspiler {
|
|
|
81342
81555
|
ret.appendString(transpile_types_1.TranspileTypes.toType(type) + ".set(await (new " + clas + "()).constructor_(" + para + "))");
|
|
81343
81556
|
}
|
|
81344
81557
|
else {
|
|
81345
|
-
|
|
81558
|
+
const source = node.findFirstExpression(abaplint.Expressions.Source);
|
|
81559
|
+
if (source === undefined) {
|
|
81560
|
+
throw new Error("NewObjectTranspiler: DataReference source not found");
|
|
81561
|
+
}
|
|
81562
|
+
const typeCode = transpile_types_1.TranspileTypes.toType(type);
|
|
81563
|
+
const sourceCode = traversal.traverse(source).getCode();
|
|
81564
|
+
ret.appendString("((() => {const r = new abap.types.DataReference(" + typeCode + "); r.assign(" + sourceCode + "); return r; })())");
|
|
81346
81565
|
}
|
|
81347
81566
|
return ret;
|
|
81348
81567
|
}
|
|
@@ -83159,6 +83378,11 @@ class TypeNameOrInfer {
|
|
|
83159
83378
|
}
|
|
83160
83379
|
return type;
|
|
83161
83380
|
}
|
|
83381
|
+
findTypeOrUndefined(node, traversal) {
|
|
83382
|
+
const scope = traversal.findCurrentScopeByToken(node.getFirstToken());
|
|
83383
|
+
const type = traversal.lookupInferred(node, scope);
|
|
83384
|
+
return type;
|
|
83385
|
+
}
|
|
83162
83386
|
transpile(node, traversal) {
|
|
83163
83387
|
const type = this.findType(node, traversal);
|
|
83164
83388
|
const ret = new chunk_1.Chunk();
|
|
@@ -92974,7 +93198,13 @@ this.INTERNAL_ID = abap.internalIdCounter++;\n`;
|
|
|
92974
93198
|
}
|
|
92975
93199
|
// handle aliases after initialization of carrier variables
|
|
92976
93200
|
for (const a of def.getAliases() || []) {
|
|
92977
|
-
|
|
93201
|
+
const thisName = `this.${a.getName().toLowerCase()}`;
|
|
93202
|
+
const aliasName = "this." + Traversal.escapeNamespace(a.getComponent().replace("~", "$").toLowerCase());
|
|
93203
|
+
ret += `if (${thisName} === undefined)\n`;
|
|
93204
|
+
ret += thisName + " = " + aliasName + ";\n";
|
|
93205
|
+
// or the method(if its a method) might be implemented as its aliased name
|
|
93206
|
+
ret += `else if (${aliasName} === undefined)\n`;
|
|
93207
|
+
ret += aliasName + " = " + thisName + ";\n";
|
|
92978
93208
|
}
|
|
92979
93209
|
// constants can be accessed both statically and via reference
|
|
92980
93210
|
for (const c of def.getAttributes()?.getConstants() || []) {
|
|
@@ -93073,7 +93303,8 @@ this.INTERNAL_ID = abap.internalIdCounter++;\n`;
|
|
|
93073
93303
|
if (scope === undefined) {
|
|
93074
93304
|
return undefined;
|
|
93075
93305
|
}
|
|
93076
|
-
else if (!(node.get() instanceof abaplint.Expressions.TypeName)
|
|
93306
|
+
else if (!(node.get() instanceof abaplint.Expressions.TypeName)
|
|
93307
|
+
&& !(node.get() instanceof abaplint.Expressions.TypeNameOrInfer)) {
|
|
93077
93308
|
throw new Error("lookupType, node is not a TypeName, " + node.get());
|
|
93078
93309
|
}
|
|
93079
93310
|
const name = node.concatTokens().toLowerCase();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abaplint/transpiler-cli",
|
|
3
|
-
"version": "2.12.
|
|
3
|
+
"version": "2.12.25",
|
|
4
4
|
"description": "Transpiler - Command Line Interface",
|
|
5
5
|
"funding": "https://github.com/sponsors/larshp",
|
|
6
6
|
"bin": {
|
|
@@ -27,10 +27,10 @@
|
|
|
27
27
|
"author": "abaplint",
|
|
28
28
|
"license": "MIT",
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"@abaplint/core": "^2.115.
|
|
31
|
-
"@abaplint/transpiler": "^2.12.
|
|
30
|
+
"@abaplint/core": "^2.115.16",
|
|
31
|
+
"@abaplint/transpiler": "^2.12.25",
|
|
32
32
|
"@types/glob": "^8.1.0",
|
|
33
|
-
"@types/node": "^24.10.
|
|
33
|
+
"@types/node": "^24.10.8",
|
|
34
34
|
"@types/progress": "^2.0.7",
|
|
35
35
|
"glob": "=7.2.0",
|
|
36
36
|
"progress": "^2.0.3",
|