@abaplint/transpiler-cli 2.7.55 → 2.7.56
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 +63 -15
- package/package.json +3 -3
package/build/bundle.js
CHANGED
|
@@ -20911,6 +20911,7 @@ class TypeUtils {
|
|
|
20911
20911
|
return false;
|
|
20912
20912
|
}
|
|
20913
20913
|
else if (target instanceof basic_1.IntegerType
|
|
20914
|
+
|| target instanceof basic_1.CharacterType
|
|
20914
20915
|
|| target instanceof basic_1.StringType) {
|
|
20915
20916
|
if (source instanceof basic_1.TableType && source.isWithHeader() === false) {
|
|
20916
20917
|
return false;
|
|
@@ -47609,7 +47610,7 @@ class Registry {
|
|
|
47609
47610
|
}
|
|
47610
47611
|
static abaplintVersion() {
|
|
47611
47612
|
// magic, see build script "version.sh"
|
|
47612
|
-
return "2.102.
|
|
47613
|
+
return "2.102.14";
|
|
47613
47614
|
}
|
|
47614
47615
|
getDDICReferences() {
|
|
47615
47616
|
return this.ddicReferences;
|
|
@@ -52246,6 +52247,7 @@ const objects_1 = __webpack_require__(/*! ../objects */ "./node_modules/@abaplin
|
|
|
52246
52247
|
const _builtin_1 = __webpack_require__(/*! ../abap/5_syntax/_builtin */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_builtin.js");
|
|
52247
52248
|
const _scope_type_1 = __webpack_require__(/*! ../abap/5_syntax/_scope_type */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_scope_type.js");
|
|
52248
52249
|
const statements_1 = __webpack_require__(/*! ../abap/2_statements/statements */ "./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js");
|
|
52250
|
+
const crypto = __webpack_require__(/*! crypto */ "crypto");
|
|
52249
52251
|
// todo: refactor each sub-rule to new classes?
|
|
52250
52252
|
// todo: add configuration
|
|
52251
52253
|
class DownportConf extends _basic_rule_config_1.BasicRuleConfig {
|
|
@@ -52507,13 +52509,12 @@ Make sure to test the downported code, it might not always be completely correct
|
|
|
52507
52509
|
}
|
|
52508
52510
|
}
|
|
52509
52511
|
}
|
|
52510
|
-
|
|
52512
|
+
if (ret.length === 0 && lowFile.getRaw().includes(" xsdbool( ")) {
|
|
52511
52513
|
for (let i = 0; i < lowStatements.length; i++) {
|
|
52512
52514
|
const high = highStatements[i];
|
|
52513
52515
|
const issue = this.replaceXsdBool(high, lowFile, highSyntax);
|
|
52514
52516
|
if (issue) {
|
|
52515
52517
|
ret.push(issue);
|
|
52516
|
-
break;
|
|
52517
52518
|
}
|
|
52518
52519
|
}
|
|
52519
52520
|
}
|
|
@@ -52548,11 +52549,13 @@ Make sure to test the downported code, it might not always be completely correct
|
|
|
52548
52549
|
return undefined;
|
|
52549
52550
|
}
|
|
52550
52551
|
// downport XSDBOOL() early, as it is valid 702 syntax
|
|
52552
|
+
/*
|
|
52551
52553
|
let found = this.replaceXsdBool(high, lowFile, highSyntax);
|
|
52552
52554
|
if (found) {
|
|
52553
|
-
|
|
52555
|
+
return found;
|
|
52554
52556
|
}
|
|
52555
|
-
|
|
52557
|
+
*/
|
|
52558
|
+
let found = this.downportEnum(low, high, lowFile, highSyntax, highFile);
|
|
52556
52559
|
if (found) {
|
|
52557
52560
|
return found;
|
|
52558
52561
|
}
|
|
@@ -54763,8 +54766,14 @@ ${indentation} output = ${uniqueName}.\n`;
|
|
|
54763
54766
|
this.counter++;
|
|
54764
54767
|
return name;
|
|
54765
54768
|
}
|
|
54769
|
+
let postfix = "";
|
|
54770
|
+
if (spag.getIdentifier().stype === _scope_type_1.ScopeType.ClassDefinition) {
|
|
54771
|
+
// try making sure this name is not used in subclasses
|
|
54772
|
+
const hash = crypto.createHash("sha1").update(spag.getIdentifier().sname).digest("hex");
|
|
54773
|
+
postfix = "_" + hash.substring(0, 10);
|
|
54774
|
+
}
|
|
54766
54775
|
while (true) {
|
|
54767
|
-
const name = "temp" + this.counter;
|
|
54776
|
+
const name = "temp" + this.counter + postfix;
|
|
54768
54777
|
const exists = this.existsRecursive(spag, name);
|
|
54769
54778
|
this.counter++;
|
|
54770
54779
|
if (exists === false) {
|
|
@@ -54772,13 +54781,14 @@ ${indentation} output = ${uniqueName}.\n`;
|
|
|
54772
54781
|
}
|
|
54773
54782
|
}
|
|
54774
54783
|
}
|
|
54784
|
+
// todo, optimize, the findVariable() and findType() does a lot of redundant checks
|
|
54775
54785
|
existsRecursive(spag, name) {
|
|
54776
|
-
const existsDirect = spag.findVariable(name);
|
|
54786
|
+
const existsDirect = spag.findVariable(name) || spag.findType(name);
|
|
54777
54787
|
if (existsDirect) {
|
|
54778
54788
|
return true;
|
|
54779
54789
|
}
|
|
54780
54790
|
for (const child of spag.getChildren()) {
|
|
54781
|
-
if (child.findVariable(name) || this.existsRecursive(child, name)) {
|
|
54791
|
+
if (child.findVariable(name) || child.findType(name) || this.existsRecursive(child, name)) {
|
|
54782
54792
|
return true;
|
|
54783
54793
|
}
|
|
54784
54794
|
}
|
|
@@ -54790,7 +54800,20 @@ ${indentation} output = ${uniqueName}.\n`;
|
|
|
54790
54800
|
if (r.referenceType === _reference_1.ReferenceType.BuiltinMethodReference
|
|
54791
54801
|
&& r.position.getName().toUpperCase() === "XSDBOOL") {
|
|
54792
54802
|
const token = r.position.getToken();
|
|
54793
|
-
|
|
54803
|
+
let source = undefined;
|
|
54804
|
+
for (const s of node.findAllExpressionsRecursive(Expressions.Source)) {
|
|
54805
|
+
if (s.getFirstToken().getStart().equals(token.getStart())) {
|
|
54806
|
+
source = s;
|
|
54807
|
+
break;
|
|
54808
|
+
}
|
|
54809
|
+
}
|
|
54810
|
+
const children = source === null || source === void 0 ? void 0 : source.getChildren();
|
|
54811
|
+
if (source === undefined || (children === null || children === void 0 ? void 0 : children.length) !== 4) {
|
|
54812
|
+
continue;
|
|
54813
|
+
}
|
|
54814
|
+
// make sure to convert to the correct type, RTTI might be used on the result of XSDBOOL
|
|
54815
|
+
const code = "CONV xsdboolean( boolc( " + children[2].concatTokens() + " ) )";
|
|
54816
|
+
const fix = edit_helper_1.EditHelper.replaceRange(lowFile, source.getFirstToken().getStart(), source.getLastToken().getEnd(), code);
|
|
54794
54817
|
return issue_1.Issue.atToken(lowFile, token, "Use BOOLC", this.getMetadata().key, this.conf.severity, fix);
|
|
54795
54818
|
}
|
|
54796
54819
|
}
|
|
@@ -73881,7 +73904,11 @@ class CallFunctionTranspiler {
|
|
|
73881
73904
|
ret.appendString(`await abap.statements.callFunction({name:${fmname},destination:${s.getCode()}${param}});`);
|
|
73882
73905
|
}
|
|
73883
73906
|
else {
|
|
73884
|
-
|
|
73907
|
+
const illegalFunc = traversal.lookupClassOrInterface("'CX_SY_DYN_CALL_ILLEGAL_FUNC'", node.getFirstToken(), true);
|
|
73908
|
+
const call = `abap.FunctionModules[${fmname}]`;
|
|
73909
|
+
ret.appendString(`if (${call} === undefined && ${illegalFunc} === undefined) { throw "CX_SY_DYN_CALL_ILLEGAL_FUNC not found"; }\n`);
|
|
73910
|
+
ret.appendString(`if (${call} === undefined) { throw new ${illegalFunc}(); }\n`);
|
|
73911
|
+
ret.appendString(`await ${call}(${param});`);
|
|
73885
73912
|
}
|
|
73886
73913
|
if (exceptions) {
|
|
73887
73914
|
const build = call_1.CallTranspiler.buildExceptions(exceptions);
|
|
@@ -82067,10 +82094,19 @@ Builder.prototype.j2x = function(jObj, level) {
|
|
|
82067
82094
|
let val = '';
|
|
82068
82095
|
for (let key in jObj) {
|
|
82069
82096
|
if (typeof jObj[key] === 'undefined') {
|
|
82070
|
-
// supress undefined node
|
|
82097
|
+
// supress undefined node only if it is not an attribute
|
|
82098
|
+
if (this.isAttribute(key)) {
|
|
82099
|
+
val += '';
|
|
82100
|
+
}
|
|
82071
82101
|
} else if (jObj[key] === null) {
|
|
82072
|
-
|
|
82073
|
-
|
|
82102
|
+
// null attribute should be ignored by the attribute list, but should not cause the tag closing
|
|
82103
|
+
if (this.isAttribute(key)) {
|
|
82104
|
+
val += '';
|
|
82105
|
+
} else if (key[0] === '?') {
|
|
82106
|
+
val += this.indentate(level) + '<' + key + '?' + this.tagEndChar;
|
|
82107
|
+
} else {
|
|
82108
|
+
val += this.indentate(level) + '<' + key + '/' + this.tagEndChar;
|
|
82109
|
+
}
|
|
82074
82110
|
// val += this.indentate(level) + '<' + key + '/' + this.tagEndChar;
|
|
82075
82111
|
} else if (jObj[key] instanceof Date) {
|
|
82076
82112
|
val += this.buildTextValNode(jObj[key], key, '', level);
|
|
@@ -82163,7 +82199,8 @@ Builder.prototype.buildObjectNode = function(val, key, attrStr, level) {
|
|
|
82163
82199
|
tagEndExp = "";
|
|
82164
82200
|
}
|
|
82165
82201
|
|
|
82166
|
-
|
|
82202
|
+
// attrStr is an empty string in case the attribute came as undefined or null
|
|
82203
|
+
if ((attrStr || attrStr === '') && val.indexOf('<') === -1) {
|
|
82167
82204
|
return ( this.indentate(level) + '<' + key + attrStr + piClosingChar + '>' + val + tagEndExp );
|
|
82168
82205
|
} else if (this.options.commentPropName !== false && key === this.options.commentPropName && piClosingChar.length === 0) {
|
|
82169
82206
|
return this.indentate(level) + `<!--${val}-->` + this.newLine;
|
|
@@ -82236,7 +82273,7 @@ function indentate(level) {
|
|
|
82236
82273
|
}
|
|
82237
82274
|
|
|
82238
82275
|
function isAttribute(name /*, options*/) {
|
|
82239
|
-
if (name.startsWith(this.options.attributeNamePrefix)) {
|
|
82276
|
+
if (name.startsWith(this.options.attributeNamePrefix) && name !== this.options.textNodeName) {
|
|
82240
82277
|
return name.substr(this.attrPrefixLen);
|
|
82241
82278
|
} else {
|
|
82242
82279
|
return false;
|
|
@@ -92548,6 +92585,17 @@ module.exports = require("child_process");
|
|
|
92548
92585
|
|
|
92549
92586
|
/***/ }),
|
|
92550
92587
|
|
|
92588
|
+
/***/ "crypto":
|
|
92589
|
+
/*!*************************!*\
|
|
92590
|
+
!*** external "crypto" ***!
|
|
92591
|
+
\*************************/
|
|
92592
|
+
/***/ ((module) => {
|
|
92593
|
+
|
|
92594
|
+
"use strict";
|
|
92595
|
+
module.exports = require("crypto");
|
|
92596
|
+
|
|
92597
|
+
/***/ }),
|
|
92598
|
+
|
|
92551
92599
|
/***/ "events":
|
|
92552
92600
|
/*!*************************!*\
|
|
92553
92601
|
!*** external "events" ***!
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abaplint/transpiler-cli",
|
|
3
|
-
"version": "2.7.
|
|
3
|
+
"version": "2.7.56",
|
|
4
4
|
"description": "Transpiler - Command Line Interface",
|
|
5
5
|
"funding": "https://github.com/sponsors/larshp",
|
|
6
6
|
"bin": {
|
|
@@ -26,12 +26,12 @@
|
|
|
26
26
|
"author": "abaplint",
|
|
27
27
|
"license": "MIT",
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"@abaplint/transpiler": "^2.7.
|
|
29
|
+
"@abaplint/transpiler": "^2.7.56",
|
|
30
30
|
"@types/glob": "^7.2.0",
|
|
31
31
|
"glob": "=7.2.0",
|
|
32
32
|
"@types/progress": "^2.0.5",
|
|
33
33
|
"@types/node": "^20.4.5",
|
|
34
|
-
"@abaplint/core": "^2.102.
|
|
34
|
+
"@abaplint/core": "^2.102.14",
|
|
35
35
|
"progress": "^2.0.3",
|
|
36
36
|
"webpack": "^5.88.2",
|
|
37
37
|
"webpack-cli": "^5.1.4",
|