@abaplint/core 2.83.21 → 2.83.22

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.
@@ -6,10 +6,10 @@ const expressions_1 = require("../../2_statements/expressions");
6
6
  class Constant {
7
7
  runSyntax(node) {
8
8
  if (node.findDirectExpression(expressions_1.Integer)) {
9
- return new basic_1.IntegerType();
9
+ return new basic_1.IntegerType("I");
10
10
  }
11
11
  else {
12
- return new basic_1.StringType();
12
+ return new basic_1.StringType("STRING");
13
13
  }
14
14
  }
15
15
  }
@@ -58,12 +58,15 @@ class Source {
58
58
  const method = new _builtin_1.BuiltIn().searchBuiltin(tok);
59
59
  scope.addReference(token, method, _reference_1.ReferenceType.BuiltinMethodReference, filename);
60
60
  new cond_1.Cond().runSyntax(node.findDirectExpression(Expressions.Cond), scope, filename);
61
- return new basic_1.CharacterType(1);
61
+ return new basic_1.CharacterType(1, "ABAP_BOOL");
62
62
  }
63
63
  case "REDUCE":
64
64
  {
65
65
  const foundType = this.determineType(node, scope, filename, targetType);
66
66
  const bodyType = new reduce_body_1.ReduceBody().runSyntax(node.findDirectExpression(Expressions.ReduceBody), scope, filename);
67
+ if (foundType === undefined) {
68
+ this.addIfInferred(node, scope, filename, bodyType);
69
+ }
67
70
  return foundType ? foundType : bodyType;
68
71
  }
69
72
  case "SWITCH":
@@ -75,7 +78,11 @@ class Source {
75
78
  case "COND":
76
79
  {
77
80
  const foundType = this.determineType(node, scope, filename, targetType);
78
- return new cond_body_1.CondBody().runSyntax(node.findDirectExpression(Expressions.CondBody), scope, filename, foundType);
81
+ const bodyType = new cond_body_1.CondBody().runSyntax(node.findDirectExpression(Expressions.CondBody), scope, filename, foundType);
82
+ if (foundType === undefined) {
83
+ this.addIfInferred(node, scope, filename, bodyType);
84
+ }
85
+ return foundType ? foundType : bodyType;
79
86
  }
80
87
  case "CONV":
81
88
  {
@@ -155,6 +162,18 @@ class Source {
155
162
  return context;
156
163
  }
157
164
  ////////////////////////////////
165
+ addIfInferred(node, scope, filename, inferredType) {
166
+ const basic = new basic_types_1.BasicTypes(filename, scope);
167
+ const typeExpression = node.findFirstExpression(Expressions.TypeNameOrInfer);
168
+ const typeToken = typeExpression === null || typeExpression === void 0 ? void 0 : typeExpression.getFirstToken();
169
+ const typeName = typeToken === null || typeToken === void 0 ? void 0 : typeToken.getStr();
170
+ if (typeName === "#" && inferredType) {
171
+ const found = basic.lookupQualifiedName(inferredType.getQualifiedName());
172
+ if (found) {
173
+ scope.addReference(typeToken, found, _reference_1.ReferenceType.InferredType, filename);
174
+ }
175
+ }
176
+ }
158
177
  determineType(node, scope, filename, targetType) {
159
178
  const basic = new basic_types_1.BasicTypes(filename, scope);
160
179
  const typeExpression = node.findFirstExpression(Expressions.TypeNameOrInfer);
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.AbstractObject = void 0;
4
- const fastxmlparser = require("fast-xml-parser");
4
+ const fast_xml_parser_1 = require("fast-xml-parser");
5
5
  const _identifier_1 = require("../abap/4_file_information/_identifier");
6
6
  const identifier_1 = require("../abap/1_lexer/tokens/identifier");
7
7
  const position_1 = require("../position");
@@ -100,7 +100,7 @@ class AbstractObject {
100
100
  return undefined;
101
101
  }
102
102
  try {
103
- return fastxmlparser.parse(xml, { parseNodeValue: false, ignoreAttributes: true, trimValues: false });
103
+ return new fast_xml_parser_1.XMLParser({ parseTagValue: false, ignoreAttributes: true, trimValues: false }).parse(xml);
104
104
  }
105
105
  catch (_a) {
106
106
  return undefined;
@@ -4,7 +4,7 @@ exports.FunctionGroup = void 0;
4
4
  const _abap_object_1 = require("./_abap_object");
5
5
  const types_1 = require("../abap/types");
6
6
  const xml_utils_1 = require("../xml_utils");
7
- const fastxmlparser = require("fast-xml-parser");
7
+ const fast_xml_parser_1 = require("fast-xml-parser");
8
8
  class FunctionGroup extends _abap_object_1.ABAPObject {
9
9
  constructor() {
10
10
  super(...arguments);
@@ -123,7 +123,7 @@ class FunctionGroup extends _abap_object_1.ABAPObject {
123
123
  if (found === undefined) {
124
124
  return {};
125
125
  }
126
- const parsed = fastxmlparser.parse(found.getRaw(), { parseNodeValue: false, ignoreAttributes: true, trimValues: false });
126
+ const parsed = new fast_xml_parser_1.XMLParser({ parseTagValue: false, ignoreAttributes: true, trimValues: false }).parse(found.getRaw());
127
127
  this.findTexts(parsed);
128
128
  }
129
129
  return this.texts;
@@ -68,7 +68,7 @@ class Registry {
68
68
  }
69
69
  static abaplintVersion() {
70
70
  // magic, see build script "version.sh"
71
- return "2.83.21";
71
+ return "2.83.22";
72
72
  }
73
73
  getDDICReferences() {
74
74
  return this.references;
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.RemoveDescriptions = exports.RemoveDescriptionsConf = void 0;
4
4
  const issue_1 = require("../issue");
5
- const fastxmlparser = require("fast-xml-parser");
5
+ const fast_xml_parser_1 = require("fast-xml-parser");
6
6
  const Objects = require("../objects");
7
7
  const _basic_rule_config_1 = require("./_basic_rule_config");
8
8
  const position_1 = require("../position");
@@ -95,7 +95,7 @@ Consider using ABAP Doc for documentation.`,
95
95
  return this.checkXML(xml, file);
96
96
  }
97
97
  checkXML(xml, file) {
98
- const parsed = fastxmlparser.parse(xml, { parseNodeValue: false, ignoreAttributes: true, trimValues: false });
98
+ const parsed = new fast_xml_parser_1.XMLParser({ parseTagValue: false, ignoreAttributes: true, trimValues: false }).parse(xml);
99
99
  if (parsed === undefined || parsed.abapGit["asx:abap"]["asx:values"] === undefined) {
100
100
  return [];
101
101
  }
@@ -5,7 +5,7 @@ const issue_1 = require("../issue");
5
5
  const _irule_1 = require("./_irule");
6
6
  const Objects = require("../objects");
7
7
  const _basic_rule_config_1 = require("./_basic_rule_config");
8
- const fastxmlparser = require("fast-xml-parser");
8
+ const fast_xml_parser_1 = require("fast-xml-parser");
9
9
  class XMLConsistencyConf extends _basic_rule_config_1.BasicRuleConfig {
10
10
  }
11
11
  exports.XMLConsistencyConf = XMLConsistencyConf;
@@ -39,7 +39,7 @@ class XMLConsistency {
39
39
  }
40
40
  const xml = obj.getXML();
41
41
  if (xml) {
42
- const res = fastxmlparser.validate(xml);
42
+ const res = fast_xml_parser_1.XMLValidator.validate(xml);
43
43
  if (res !== true) {
44
44
  issues.push(issue_1.Issue.atRow(file, 1, "XML parser error: " + res.err.msg, this.getMetadata().key, this.conf.severity));
45
45
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/core",
3
- "version": "2.83.21",
3
+ "version": "2.83.22",
4
4
  "description": "abaplint - Core API",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/abaplint.d.ts",
@@ -45,7 +45,7 @@
45
45
  },
46
46
  "homepage": "https://abaplint.org",
47
47
  "devDependencies": {
48
- "@microsoft/api-extractor": "^7.19.3",
48
+ "@microsoft/api-extractor": "^7.19.4",
49
49
  "@types/chai": "^4.3.0",
50
50
  "@types/mocha": "^9.0.0",
51
51
  "@types/node": "^17.0.8",
@@ -58,7 +58,7 @@
58
58
  "typescript": "^4.5.4"
59
59
  },
60
60
  "dependencies": {
61
- "fast-xml-parser": "^3.21.1",
61
+ "fast-xml-parser": "^4.0.1",
62
62
  "json5": "^2.2.0",
63
63
  "vscode-languageserver-protocol": "^3.16.0",
64
64
  "vscode-languageserver-types": "^3.16.0"