@abaplint/transpiler-cli 2.7.98 → 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.
Files changed (2) hide show
  1. package/build/bundle.js +66 -28
  2. 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.44";
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: `If the routine has inline definitions then no issues are reported
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
- let fix = undefined;
52276
- if (this.fixed === false && this.moveTo) {
52277
- fix = this.buildFix(file, c, this.moveTo);
52278
- this.fixed = true;
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();
@@ -81411,12 +81432,6 @@ class Traversal {
81411
81432
  if (def.getSuperClass() !== undefined || def.getName().toUpperCase() === "CX_ROOT") {
81412
81433
  ret += "super();\n";
81413
81434
  }
81414
- /*
81415
- if (def.getSuperClass() !== undefined
81416
- && def.getMethodDefinitions().getByName("CONSTRUCTOR") === undefined) {
81417
- ret += `await super.constructor_(INPUT);\n`;
81418
- }
81419
- */
81420
81435
  const cName = Traversal.escapeNamespace(def.getName().toLowerCase());
81421
81436
  ret += "this.me = new abap.types.ABAPObject();\n";
81422
81437
  ret += "this.me.set(this);\n";
@@ -81433,6 +81448,7 @@ class Traversal {
81433
81448
  // attributes from directly implemented interfaces(not interfaces implemented in super classes)
81434
81449
  for (const i of def.getImplementing()) {
81435
81450
  ret += this.dataFromInterfaces(i.name, scope, cName);
81451
+ ret += this.aliasesFromInterfaces(i.name, scope, cName);
81436
81452
  }
81437
81453
  // handle aliases after initialization of carrier variables
81438
81454
  for (const a of ((_b = def.getAliases()) === null || _b === void 0 ? void 0 : _b.getAll()) || []) {
@@ -81495,6 +81511,20 @@ class Traversal {
81495
81511
  }
81496
81512
  return ret;
81497
81513
  }
81514
+ aliasesFromInterfaces(name, scope, cname) {
81515
+ let ret = "";
81516
+ const intf = this.findInterfaceDefinition(name, scope);
81517
+ for (const a of (intf === null || intf === void 0 ? void 0 : intf.getAliases().getAll()) || []) {
81518
+ const iname = Traversal.escapeNamespace(intf === null || intf === void 0 ? void 0 : intf.getName().toLowerCase());
81519
+ const aname = Traversal.escapeNamespace(a.getName().toLowerCase());
81520
+ const cname = Traversal.escapeNamespace(a.getComponent().toLowerCase().replace("~", "$"));
81521
+ ret += "this." + iname + "$" + aname + " = this." + cname + ";\n";
81522
+ }
81523
+ for (const i of (intf === null || intf === void 0 ? void 0 : intf.getImplementing()) || []) {
81524
+ ret += this.aliasesFromInterfaces(i.name, scope, cname);
81525
+ }
81526
+ return ret;
81527
+ }
81498
81528
  determineType(node, scope) {
81499
81529
  var _a, _b, _c;
81500
81530
  if (scope === undefined) {
@@ -83199,6 +83229,7 @@ Builder.prototype.j2x = function(jObj, level) {
83199
83229
  let attrStr = '';
83200
83230
  let val = '';
83201
83231
  for (let key in jObj) {
83232
+ if(!jObj.hasOwnProperty(key)) continue;
83202
83233
  if (typeof jObj[key] === 'undefined') {
83203
83234
  // supress undefined node only if it is not an attribute
83204
83235
  if (this.isAttribute(key)) {
@@ -83420,6 +83451,8 @@ function arrToStr(arr, options, jPath, indentation) {
83420
83451
  for (let i = 0; i < arr.length; i++) {
83421
83452
  const tagObj = arr[i];
83422
83453
  const tagName = propName(tagObj);
83454
+ if(tagName === undefined) continue;
83455
+
83423
83456
  let newJPath = "";
83424
83457
  if (jPath.length === 0) newJPath = tagName
83425
83458
  else newJPath = `${jPath}.${tagName}`;
@@ -83489,6 +83522,7 @@ function propName(obj) {
83489
83522
  const keys = Object.keys(obj);
83490
83523
  for (let i = 0; i < keys.length; i++) {
83491
83524
  const key = keys[i];
83525
+ if(!obj.hasOwnProperty(key)) continue;
83492
83526
  if (key !== ":@") return key;
83493
83527
  }
83494
83528
  }
@@ -83497,6 +83531,7 @@ function attr_to_str(attrMap, options) {
83497
83531
  let attrStr = "";
83498
83532
  if (attrMap && !options.ignoreAttributes) {
83499
83533
  for (let attr in attrMap) {
83534
+ if(!attrMap.hasOwnProperty(attr)) continue;
83500
83535
  let attrVal = options.attributeValueProcessor(attr, attrMap[attr]);
83501
83536
  attrVal = replaceEntitiesValue(attrVal, options);
83502
83537
  if (attrVal === true && options.suppressBooleanAttributes) {
@@ -84040,6 +84075,7 @@ const parseXml = function(xmlData) {
84040
84075
  }else {//Opening tag
84041
84076
  let result = readTagExp(xmlData,i, this.options.removeNSPrefix);
84042
84077
  let tagName= result.tagName;
84078
+ const rawTagName = result.rawTagName;
84043
84079
  let tagExp = result.tagExp;
84044
84080
  let attrExpPresent = result.attrExpPresent;
84045
84081
  let closeIndex = result.closeIndex;
@@ -84065,7 +84101,7 @@ const parseXml = function(xmlData) {
84065
84101
  if(tagName !== xmlObj.tagname){
84066
84102
  jPath += jPath ? "." + tagName : tagName;
84067
84103
  }
84068
- if (this.isItStopNode(this.options.stopNodes, jPath, tagName)) { //TODO: namespace
84104
+ if (this.isItStopNode(this.options.stopNodes, jPath, tagName)) {
84069
84105
  let tagContent = "";
84070
84106
  //self-closing tag
84071
84107
  if(tagExp.length > 0 && tagExp.lastIndexOf("/") === tagExp.length - 1){
@@ -84078,8 +84114,8 @@ const parseXml = function(xmlData) {
84078
84114
  //normal tag
84079
84115
  else{
84080
84116
  //read until closing tag is found
84081
- const result = this.readStopNodeData(xmlData, tagName, closeIndex + 1);
84082
- if(!result) throw new Error(`Unexpected end of ${tagName}`);
84117
+ const result = this.readStopNodeData(xmlData, rawTagName, closeIndex + 1);
84118
+ if(!result) throw new Error(`Unexpected end of ${rawTagName}`);
84083
84119
  i = result.i;
84084
84120
  tagContent = result.tagContent;
84085
84121
  }
@@ -84264,6 +84300,7 @@ function readTagExp(xmlData,i, removeNSPrefix, closingChar = ">"){
84264
84300
  tagExp = tagExp.substr(separatorIndex + 1);
84265
84301
  }
84266
84302
 
84303
+ const rawTagName = tagName;
84267
84304
  if(removeNSPrefix){
84268
84305
  const colonIndex = tagName.indexOf(":");
84269
84306
  if(colonIndex !== -1){
@@ -84277,6 +84314,7 @@ function readTagExp(xmlData,i, removeNSPrefix, closingChar = ">"){
84277
84314
  tagExp: tagExp,
84278
84315
  closeIndex: closeIndex,
84279
84316
  attrExpPresent: attrExpPresent,
84317
+ rawTagName: rawTagName,
84280
84318
  }
84281
84319
  }
84282
84320
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/transpiler-cli",
3
- "version": "2.7.98",
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.98",
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.3",
34
- "@abaplint/core": "^2.102.44",
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",