@abaplint/cli 2.102.10 → 2.102.12

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/cli.js +20 -8
  2. package/package.json +2 -2
package/build/cli.js CHANGED
@@ -21858,6 +21858,7 @@ class TypeUtils {
21858
21858
  return false;
21859
21859
  }
21860
21860
  else if (target instanceof basic_1.IntegerType
21861
+ || target instanceof basic_1.CharacterType
21861
21862
  || target instanceof basic_1.StringType) {
21862
21863
  if (source instanceof basic_1.TableType && source.isWithHeader() === false) {
21863
21864
  return false;
@@ -48556,7 +48557,7 @@ class Registry {
48556
48557
  }
48557
48558
  static abaplintVersion() {
48558
48559
  // magic, see build script "version.sh"
48559
- return "2.102.10";
48560
+ return "2.102.12";
48560
48561
  }
48561
48562
  getDDICReferences() {
48562
48563
  return this.ddicReferences;
@@ -55720,13 +55721,14 @@ ${indentation} output = ${uniqueName}.\n`;
55720
55721
  }
55721
55722
  }
55722
55723
  }
55724
+ // todo, optimize, the findVariable() and findType() does a lot of redundant checks
55723
55725
  existsRecursive(spag, name) {
55724
- const existsDirect = spag.findVariable(name);
55726
+ const existsDirect = spag.findVariable(name) || spag.findType(name);
55725
55727
  if (existsDirect) {
55726
55728
  return true;
55727
55729
  }
55728
55730
  for (const child of spag.getChildren()) {
55729
- if (child.findVariable(name) || this.existsRecursive(child, name)) {
55731
+ if (child.findVariable(name) || child.findType(name) || this.existsRecursive(child, name)) {
55730
55732
  return true;
55731
55733
  }
55732
55734
  }
@@ -70994,10 +70996,19 @@ Builder.prototype.j2x = function(jObj, level) {
70994
70996
  let val = '';
70995
70997
  for (let key in jObj) {
70996
70998
  if (typeof jObj[key] === 'undefined') {
70997
- // supress undefined node
70999
+ // supress undefined node only if it is not an attribute
71000
+ if (this.isAttribute(key)) {
71001
+ val += '';
71002
+ }
70998
71003
  } else if (jObj[key] === null) {
70999
- if(key[0] === "?") val += this.indentate(level) + '<' + key + '?' + this.tagEndChar;
71000
- else val += this.indentate(level) + '<' + key + '/' + this.tagEndChar;
71004
+ // null attribute should be ignored by the attribute list, but should not cause the tag closing
71005
+ if (this.isAttribute(key)) {
71006
+ val += '';
71007
+ } else if (key[0] === '?') {
71008
+ val += this.indentate(level) + '<' + key + '?' + this.tagEndChar;
71009
+ } else {
71010
+ val += this.indentate(level) + '<' + key + '/' + this.tagEndChar;
71011
+ }
71001
71012
  // val += this.indentate(level) + '<' + key + '/' + this.tagEndChar;
71002
71013
  } else if (jObj[key] instanceof Date) {
71003
71014
  val += this.buildTextValNode(jObj[key], key, '', level);
@@ -71090,7 +71101,8 @@ Builder.prototype.buildObjectNode = function(val, key, attrStr, level) {
71090
71101
  tagEndExp = "";
71091
71102
  }
71092
71103
 
71093
- if (attrStr && val.indexOf('<') === -1) {
71104
+ // attrStr is an empty string in case the attribute came as undefined or null
71105
+ if ((attrStr || attrStr === '') && val.indexOf('<') === -1) {
71094
71106
  return ( this.indentate(level) + '<' + key + attrStr + piClosingChar + '>' + val + tagEndExp );
71095
71107
  } else if (this.options.commentPropName !== false && key === this.options.commentPropName && piClosingChar.length === 0) {
71096
71108
  return this.indentate(level) + `<!--${val}-->` + this.newLine;
@@ -71163,7 +71175,7 @@ function indentate(level) {
71163
71175
  }
71164
71176
 
71165
71177
  function isAttribute(name /*, options*/) {
71166
- if (name.startsWith(this.options.attributeNamePrefix)) {
71178
+ if (name.startsWith(this.options.attributeNamePrefix) && name !== this.options.textNodeName) {
71167
71179
  return name.substr(this.attrPrefixLen);
71168
71180
  } else {
71169
71181
  return false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/cli",
3
- "version": "2.102.10",
3
+ "version": "2.102.12",
4
4
  "description": "abaplint - Command Line Interface",
5
5
  "funding": "https://github.com/sponsors/larshp",
6
6
  "bin": {
@@ -38,7 +38,7 @@
38
38
  },
39
39
  "homepage": "https://abaplint.org",
40
40
  "devDependencies": {
41
- "@abaplint/core": "^2.102.10",
41
+ "@abaplint/core": "^2.102.12",
42
42
  "@types/chai": "^4.3.5",
43
43
  "@types/glob": "^7.2.0",
44
44
  "@types/minimist": "^1.2.2",