@abaplint/transpiler-cli 2.7.99 → 2.7.100
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 +51 -22
- package/package.json +4 -4
package/build/bundle.js
CHANGED
|
@@ -20846,11 +20846,10 @@ class TypeUtils {
|
|
|
20846
20846
|
}
|
|
20847
20847
|
}
|
|
20848
20848
|
else if (source instanceof basic_1.IntegerType) {
|
|
20849
|
-
if (target instanceof basic_1.StringType
|
|
20850
|
-
|| target instanceof basic_1.PackedType) {
|
|
20849
|
+
if (target instanceof basic_1.StringType) {
|
|
20851
20850
|
return false;
|
|
20852
20851
|
}
|
|
20853
|
-
else if (target instanceof basic_1.Integer8Type) {
|
|
20852
|
+
else if (target instanceof basic_1.Integer8Type || target instanceof basic_1.PackedType) {
|
|
20854
20853
|
if (((_h = source.getAbstractTypeData()) === null || _h === void 0 ? void 0 : _h.derivedFromConstant) === true) {
|
|
20855
20854
|
return true;
|
|
20856
20855
|
}
|
|
@@ -27228,6 +27227,9 @@ const target_1 = __webpack_require__(/*! ../expressions/target */ "./node_module
|
|
|
27228
27227
|
const source_1 = __webpack_require__(/*! ../expressions/source */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/source.js");
|
|
27229
27228
|
const dynamic_1 = __webpack_require__(/*! ../expressions/dynamic */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/dynamic.js");
|
|
27230
27229
|
const basic_types_1 = __webpack_require__(/*! ../basic_types */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/basic_types.js");
|
|
27230
|
+
const basic_1 = __webpack_require__(/*! ../../types/basic */ "./node_modules/@abaplint/core/build/src/abap/types/basic/index.js");
|
|
27231
|
+
const _typed_identifier_1 = __webpack_require__(/*! ../../types/_typed_identifier */ "./node_modules/@abaplint/core/build/src/abap/types/_typed_identifier.js");
|
|
27232
|
+
const _reference_1 = __webpack_require__(/*! ../_reference */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_reference.js");
|
|
27231
27233
|
class CreateData {
|
|
27232
27234
|
runSyntax(node, scope, filename) {
|
|
27233
27235
|
for (const s of node.findDirectExpressions(Expressions.Source)) {
|
|
@@ -27241,7 +27243,23 @@ class CreateData {
|
|
|
27241
27243
|
}
|
|
27242
27244
|
const type = node.findDirectExpression(Expressions.TypeName);
|
|
27243
27245
|
if (type) {
|
|
27244
|
-
new basic_types_1.BasicTypes(filename, scope).resolveTypeName(type);
|
|
27246
|
+
const found = new basic_types_1.BasicTypes(filename, scope).resolveTypeName(type);
|
|
27247
|
+
if (found instanceof basic_1.UnknownType) {
|
|
27248
|
+
if (node.concatTokens().toUpperCase().includes(" REF TO ")) {
|
|
27249
|
+
const def = scope.findObjectDefinition(type.concatTokens());
|
|
27250
|
+
if (def) {
|
|
27251
|
+
scope.addReference(type.getFirstToken(), def, _reference_1.ReferenceType.TypeReference, filename);
|
|
27252
|
+
}
|
|
27253
|
+
else {
|
|
27254
|
+
const identifier = new _typed_identifier_1.TypedIdentifier(type.getFirstToken(), filename, found);
|
|
27255
|
+
scope.addReference(type.getFirstToken(), identifier, _reference_1.ReferenceType.TypeReference, filename);
|
|
27256
|
+
}
|
|
27257
|
+
}
|
|
27258
|
+
else {
|
|
27259
|
+
const identifier = new _typed_identifier_1.TypedIdentifier(type.getFirstToken(), filename, found);
|
|
27260
|
+
scope.addReference(type.getFirstToken(), identifier, _reference_1.ReferenceType.TypeReference, filename);
|
|
27261
|
+
}
|
|
27262
|
+
}
|
|
27245
27263
|
}
|
|
27246
27264
|
}
|
|
27247
27265
|
}
|
|
@@ -47969,7 +47987,7 @@ class Registry {
|
|
|
47969
47987
|
}
|
|
47970
47988
|
static abaplintVersion() {
|
|
47971
47989
|
// magic, see build script "version.sh"
|
|
47972
|
-
return "2.102.
|
|
47990
|
+
return "2.102.46";
|
|
47973
47991
|
}
|
|
47974
47992
|
getDDICReferences() {
|
|
47975
47993
|
return this.ddicReferences;
|
|
@@ -52146,14 +52164,12 @@ exports.DefinitionsTop = exports.DefinitionsTopConf = void 0;
|
|
|
52146
52164
|
const issue_1 = __webpack_require__(/*! ../issue */ "./node_modules/@abaplint/core/build/src/issue.js");
|
|
52147
52165
|
const _statement_1 = __webpack_require__(/*! ../abap/2_statements/statements/_statement */ "./node_modules/@abaplint/core/build/src/abap/2_statements/statements/_statement.js");
|
|
52148
52166
|
const Statements = __webpack_require__(/*! ../abap/2_statements/statements */ "./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js");
|
|
52149
|
-
const Expressions = __webpack_require__(/*! ../abap/2_statements/expressions */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js");
|
|
52150
52167
|
const Structures = __webpack_require__(/*! ../abap/3_structures/structures */ "./node_modules/@abaplint/core/build/src/abap/3_structures/structures/index.js");
|
|
52151
52168
|
const _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ "./node_modules/@abaplint/core/build/src/rules/_abap_rule.js");
|
|
52152
52169
|
const _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ "./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js");
|
|
52153
52170
|
const _irule_1 = __webpack_require__(/*! ./_irule */ "./node_modules/@abaplint/core/build/src/rules/_irule.js");
|
|
52154
52171
|
const edit_helper_1 = __webpack_require__(/*! ../edit_helper */ "./node_modules/@abaplint/core/build/src/edit_helper.js");
|
|
52155
52172
|
const nodes_1 = __webpack_require__(/*! ../abap/nodes */ "./node_modules/@abaplint/core/build/src/abap/nodes/index.js");
|
|
52156
|
-
const version_1 = __webpack_require__(/*! ../version */ "./node_modules/@abaplint/core/build/src/version.js");
|
|
52157
52173
|
class DefinitionsTopConf extends _basic_rule_config_1.BasicRuleConfig {
|
|
52158
52174
|
}
|
|
52159
52175
|
exports.DefinitionsTopConf = DefinitionsTopConf;
|
|
@@ -52172,10 +52188,16 @@ class DefinitionsTop extends _abap_rule_1.ABAPRule {
|
|
|
52172
52188
|
key: "definitions_top",
|
|
52173
52189
|
title: "Place definitions in top of routine",
|
|
52174
52190
|
shortDescription: `Checks that definitions are placed at the beginning of METHODs, FORMs and FUNCTIONs.`,
|
|
52175
|
-
extendedInformation: `
|
|
52176
|
-
|
|
52177
|
-
https://docs.abapopenchecks.org/checks/17/`,
|
|
52191
|
+
extendedInformation: `https://docs.abapopenchecks.org/checks/17/`,
|
|
52178
52192
|
tags: [_irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Quickfix],
|
|
52193
|
+
badExample: `FROM foo.
|
|
52194
|
+
WRITE 'hello'.
|
|
52195
|
+
DATA int TYPE i.
|
|
52196
|
+
ENDFORM.`,
|
|
52197
|
+
goodExample: `FROM foo.
|
|
52198
|
+
DATA int TYPE i.
|
|
52199
|
+
WRITE 'hello'.
|
|
52200
|
+
ENDFORM.`,
|
|
52179
52201
|
};
|
|
52180
52202
|
}
|
|
52181
52203
|
getMessage() {
|
|
@@ -52204,10 +52226,6 @@ https://docs.abapopenchecks.org/checks/17/`,
|
|
|
52204
52226
|
this.fixed = false;
|
|
52205
52227
|
this.mode = DEFINITION;
|
|
52206
52228
|
this.moveTo = (_a = r.getFirstStatement()) === null || _a === void 0 ? void 0 : _a.getLastToken().getEnd();
|
|
52207
|
-
if (this.reg.getConfig().getVersion() !== version_1.Version.v702
|
|
52208
|
-
&& r.findFirstExpression(Expressions.InlineData)) {
|
|
52209
|
-
continue;
|
|
52210
|
-
}
|
|
52211
52229
|
const found = this.walk(r, file);
|
|
52212
52230
|
if (found) {
|
|
52213
52231
|
issues.push(found);
|
|
@@ -52268,16 +52286,19 @@ https://docs.abapopenchecks.org/checks/17/`,
|
|
|
52268
52286
|
&& (get instanceof Statements.Data
|
|
52269
52287
|
|| get instanceof Statements.Type
|
|
52270
52288
|
|| get instanceof Statements.Constant
|
|
52289
|
+
|| (get instanceof Statements.Move && c.concatTokens().toUpperCase().startsWith("DATA("))
|
|
52271
52290
|
|| get instanceof Statements.Static
|
|
52272
52291
|
|| get instanceof Statements.FieldSymbol)) {
|
|
52273
52292
|
if (this.mode === AFTER) {
|
|
52274
52293
|
// only one fix per routine, as it reorders a lot
|
|
52275
|
-
|
|
52276
|
-
|
|
52277
|
-
|
|
52278
|
-
|
|
52294
|
+
if (!(get instanceof Statements.Move && c.concatTokens().toUpperCase().startsWith("DATA("))) {
|
|
52295
|
+
let fix = undefined;
|
|
52296
|
+
if (this.fixed === false && this.moveTo) {
|
|
52297
|
+
fix = this.buildFix(file, c, this.moveTo);
|
|
52298
|
+
this.fixed = true;
|
|
52299
|
+
}
|
|
52300
|
+
return issue_1.Issue.atStatement(file, c, this.getMessage(), this.getMetadata().key, this.conf.severity, fix);
|
|
52279
52301
|
}
|
|
52280
|
-
return issue_1.Issue.atStatement(file, c, this.getMessage(), this.getMetadata().key, this.conf.severity, fix);
|
|
52281
52302
|
}
|
|
52282
52303
|
else {
|
|
52283
52304
|
this.moveTo = c.getLastToken().getEnd();
|
|
@@ -83208,6 +83229,7 @@ Builder.prototype.j2x = function(jObj, level) {
|
|
|
83208
83229
|
let attrStr = '';
|
|
83209
83230
|
let val = '';
|
|
83210
83231
|
for (let key in jObj) {
|
|
83232
|
+
if(!jObj.hasOwnProperty(key)) continue;
|
|
83211
83233
|
if (typeof jObj[key] === 'undefined') {
|
|
83212
83234
|
// supress undefined node only if it is not an attribute
|
|
83213
83235
|
if (this.isAttribute(key)) {
|
|
@@ -83429,6 +83451,8 @@ function arrToStr(arr, options, jPath, indentation) {
|
|
|
83429
83451
|
for (let i = 0; i < arr.length; i++) {
|
|
83430
83452
|
const tagObj = arr[i];
|
|
83431
83453
|
const tagName = propName(tagObj);
|
|
83454
|
+
if(tagName === undefined) continue;
|
|
83455
|
+
|
|
83432
83456
|
let newJPath = "";
|
|
83433
83457
|
if (jPath.length === 0) newJPath = tagName
|
|
83434
83458
|
else newJPath = `${jPath}.${tagName}`;
|
|
@@ -83498,6 +83522,7 @@ function propName(obj) {
|
|
|
83498
83522
|
const keys = Object.keys(obj);
|
|
83499
83523
|
for (let i = 0; i < keys.length; i++) {
|
|
83500
83524
|
const key = keys[i];
|
|
83525
|
+
if(!obj.hasOwnProperty(key)) continue;
|
|
83501
83526
|
if (key !== ":@") return key;
|
|
83502
83527
|
}
|
|
83503
83528
|
}
|
|
@@ -83506,6 +83531,7 @@ function attr_to_str(attrMap, options) {
|
|
|
83506
83531
|
let attrStr = "";
|
|
83507
83532
|
if (attrMap && !options.ignoreAttributes) {
|
|
83508
83533
|
for (let attr in attrMap) {
|
|
83534
|
+
if(!attrMap.hasOwnProperty(attr)) continue;
|
|
83509
83535
|
let attrVal = options.attributeValueProcessor(attr, attrMap[attr]);
|
|
83510
83536
|
attrVal = replaceEntitiesValue(attrVal, options);
|
|
83511
83537
|
if (attrVal === true && options.suppressBooleanAttributes) {
|
|
@@ -84049,6 +84075,7 @@ const parseXml = function(xmlData) {
|
|
|
84049
84075
|
}else {//Opening tag
|
|
84050
84076
|
let result = readTagExp(xmlData,i, this.options.removeNSPrefix);
|
|
84051
84077
|
let tagName= result.tagName;
|
|
84078
|
+
const rawTagName = result.rawTagName;
|
|
84052
84079
|
let tagExp = result.tagExp;
|
|
84053
84080
|
let attrExpPresent = result.attrExpPresent;
|
|
84054
84081
|
let closeIndex = result.closeIndex;
|
|
@@ -84074,7 +84101,7 @@ const parseXml = function(xmlData) {
|
|
|
84074
84101
|
if(tagName !== xmlObj.tagname){
|
|
84075
84102
|
jPath += jPath ? "." + tagName : tagName;
|
|
84076
84103
|
}
|
|
84077
|
-
if (this.isItStopNode(this.options.stopNodes, jPath, tagName)) {
|
|
84104
|
+
if (this.isItStopNode(this.options.stopNodes, jPath, tagName)) {
|
|
84078
84105
|
let tagContent = "";
|
|
84079
84106
|
//self-closing tag
|
|
84080
84107
|
if(tagExp.length > 0 && tagExp.lastIndexOf("/") === tagExp.length - 1){
|
|
@@ -84087,8 +84114,8 @@ const parseXml = function(xmlData) {
|
|
|
84087
84114
|
//normal tag
|
|
84088
84115
|
else{
|
|
84089
84116
|
//read until closing tag is found
|
|
84090
|
-
const result = this.readStopNodeData(xmlData,
|
|
84091
|
-
if(!result) throw new Error(`Unexpected end of ${
|
|
84117
|
+
const result = this.readStopNodeData(xmlData, rawTagName, closeIndex + 1);
|
|
84118
|
+
if(!result) throw new Error(`Unexpected end of ${rawTagName}`);
|
|
84092
84119
|
i = result.i;
|
|
84093
84120
|
tagContent = result.tagContent;
|
|
84094
84121
|
}
|
|
@@ -84273,6 +84300,7 @@ function readTagExp(xmlData,i, removeNSPrefix, closingChar = ">"){
|
|
|
84273
84300
|
tagExp = tagExp.substr(separatorIndex + 1);
|
|
84274
84301
|
}
|
|
84275
84302
|
|
|
84303
|
+
const rawTagName = tagName;
|
|
84276
84304
|
if(removeNSPrefix){
|
|
84277
84305
|
const colonIndex = tagName.indexOf(":");
|
|
84278
84306
|
if(colonIndex !== -1){
|
|
@@ -84286,6 +84314,7 @@ function readTagExp(xmlData,i, removeNSPrefix, closingChar = ">"){
|
|
|
84286
84314
|
tagExp: tagExp,
|
|
84287
84315
|
closeIndex: closeIndex,
|
|
84288
84316
|
attrExpPresent: attrExpPresent,
|
|
84317
|
+
rawTagName: rawTagName,
|
|
84289
84318
|
}
|
|
84290
84319
|
}
|
|
84291
84320
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abaplint/transpiler-cli",
|
|
3
|
-
"version": "2.7.
|
|
3
|
+
"version": "2.7.100",
|
|
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.100",
|
|
30
30
|
"@types/glob": "^7.2.0",
|
|
31
31
|
"glob": "=7.2.0",
|
|
32
32
|
"@types/progress": "^2.0.5",
|
|
33
|
-
"@types/node": "^20.6.
|
|
34
|
-
"@abaplint/core": "^2.102.
|
|
33
|
+
"@types/node": "^20.6.5",
|
|
34
|
+
"@abaplint/core": "^2.102.46",
|
|
35
35
|
"progress": "^2.0.3",
|
|
36
36
|
"webpack": "^5.88.2",
|
|
37
37
|
"webpack-cli": "^5.1.4",
|