@abaplint/core 2.113.80 → 2.113.82

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.
@@ -155,7 +155,12 @@ class Source {
155
155
  return foundType;
156
156
  }
157
157
  case "EXACT":
158
- return this.determineType(node, input, targetType);
158
+ {
159
+ const foundType = this.determineType(node, input, targetType);
160
+ new Source().runSyntax(node.findDirectExpression(Expressions.Source), input, foundType);
161
+ this.addIfInferred(node, input, foundType);
162
+ return foundType;
163
+ }
159
164
  case "VALUE":
160
165
  {
161
166
  const foundType = this.determineType(node, input, targetType);
@@ -7,8 +7,8 @@ class CDSCase extends combi_1.Expression {
7
7
  getRunnable() {
8
8
  const name = (0, combi_1.seq)(_1.CDSName, (0, combi_1.optPrio)((0, combi_1.seq)(".", _1.CDSName)));
9
9
  const value = (0, combi_1.alt)(name, _1.CDSString, _1.CDSFunction, CDSCase, _1.CDSCast, _1.CDSArithmetics);
10
- const simple = (0, combi_1.seq)("CASE", (0, combi_1.alt)(name, _1.CDSFunction), (0, combi_1.plus)((0, combi_1.seq)("WHEN", value, "THEN", value)), "ELSE", value, "END");
11
- const complex = (0, combi_1.seq)("CASE", (0, combi_1.plus)((0, combi_1.seq)("WHEN", _1.CDSCondition, "THEN", value)), (0, combi_1.opt)((0, combi_1.seq)("ELSE", value)), "END");
10
+ const simple = (0, combi_1.seq)("CASE", (0, combi_1.alt)(name, _1.CDSFunction), (0, combi_1.plusPrio)((0, combi_1.seq)("WHEN", value, "THEN", value)), "ELSE", value, "END");
11
+ const complex = (0, combi_1.seq)("CASE", (0, combi_1.plusPrio)((0, combi_1.seq)("WHEN", _1.CDSCondition, "THEN", value)), (0, combi_1.opt)((0, combi_1.seq)("ELSE", value)), "END");
12
12
  return (0, combi_1.altPrio)(simple, complex);
13
13
  }
14
14
  }
@@ -67,7 +67,7 @@ class Registry {
67
67
  }
68
68
  static abaplintVersion() {
69
69
  // magic, see build script "version.sh"
70
- return "2.113.80";
70
+ return "2.113.82";
71
71
  }
72
72
  getDDICReferences() {
73
73
  return this.ddicReferences;
@@ -2,32 +2,32 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Downport = exports.DownportConf = void 0;
4
4
  /* eslint-disable max-len */
5
- const Statements = require("../abap/2_statements/statements");
5
+ const crypto = require("crypto");
6
+ const tokens_1 = require("../abap/1_lexer/tokens");
6
7
  const Expressions = require("../abap/2_statements/expressions");
7
- const Structures = require("../abap/3_structures/structures");
8
- const _basic_rule_config_1 = require("./_basic_rule_config");
9
- const issue_1 = require("../issue");
10
- const _irule_1 = require("./_irule");
8
+ const Statements = require("../abap/2_statements/statements");
9
+ const statements_1 = require("../abap/2_statements/statements");
11
10
  const _statement_1 = require("../abap/2_statements/statements/_statement");
12
- const nodes_1 = require("../abap/nodes");
13
- const edit_helper_1 = require("../edit_helper");
14
- const position_1 = require("../position");
15
- const virtual_position_1 = require("../virtual_position");
16
- const _abap_object_1 = require("../objects/_abap_object");
17
- const version_1 = require("../version");
18
- const registry_1 = require("../registry");
19
- const syntax_1 = require("../abap/5_syntax/syntax");
11
+ const Structures = require("../abap/3_structures/structures");
12
+ const _builtin_1 = require("../abap/5_syntax/_builtin");
20
13
  const _reference_1 = require("../abap/5_syntax/_reference");
14
+ const _scope_type_1 = require("../abap/5_syntax/_scope_type");
15
+ const syntax_1 = require("../abap/5_syntax/syntax");
16
+ const nodes_1 = require("../abap/nodes");
21
17
  const _typed_identifier_1 = require("../abap/types/_typed_identifier");
22
18
  const basic_1 = require("../abap/types/basic");
23
19
  const config_1 = require("../config");
24
- const tokens_1 = require("../abap/1_lexer/tokens");
25
- const include_graph_1 = require("../utils/include_graph");
20
+ const edit_helper_1 = require("../edit_helper");
21
+ const issue_1 = require("../issue");
26
22
  const objects_1 = require("../objects");
27
- const _builtin_1 = require("../abap/5_syntax/_builtin");
28
- const _scope_type_1 = require("../abap/5_syntax/_scope_type");
29
- const statements_1 = require("../abap/2_statements/statements");
30
- const crypto = require("crypto");
23
+ const _abap_object_1 = require("../objects/_abap_object");
24
+ const position_1 = require("../position");
25
+ const registry_1 = require("../registry");
26
+ const include_graph_1 = require("../utils/include_graph");
27
+ const version_1 = require("../version");
28
+ const virtual_position_1 = require("../virtual_position");
29
+ const _basic_rule_config_1 = require("./_basic_rule_config");
30
+ const _irule_1 = require("./_irule");
31
31
  // todo: refactor each sub-rule to new classes?
32
32
  // todo: add configuration
33
33
  class DownportConf extends _basic_rule_config_1.BasicRuleConfig {
@@ -1780,24 +1780,33 @@ ${indentation} output = ${uniqueName}.\n`;
1780
1780
  return issue_1.Issue.atToken(lowFile, high.getFirstToken(), "Outline LOOP input", this.getMetadata().key, this.conf.severity, fix);
1781
1781
  }
1782
1782
  outlineLoopTarget(node, lowFile, highSyntax) {
1783
- var _a, _b, _c, _d, _e, _f, _g;
1783
+ var _a, _b, _c, _d, _e, _f;
1784
1784
  // also allows outlining of voided types
1785
1785
  if (!(node.get() instanceof Statements.Loop)) {
1786
1786
  return undefined;
1787
1787
  }
1788
- const sourceName = (_a = node.findDirectExpression(Expressions.SimpleSource2)) === null || _a === void 0 ? void 0 : _a.concatTokens();
1788
+ const source = node.findDirectExpression(Expressions.SimpleSource2);
1789
+ if (source === undefined) {
1790
+ return undefined;
1791
+ }
1792
+ const sourceName = source === null || source === void 0 ? void 0 : source.concatTokens();
1789
1793
  if (sourceName === undefined) {
1790
1794
  return undefined;
1791
1795
  }
1796
+ let foundType = undefined;
1797
+ const spag = highSyntax.spaghetti.lookupPosition(source.getFirstToken().getStart(), lowFile.getFilename());
1798
+ if (spag) {
1799
+ foundType = spag.findVariable(source.concatTokens());
1800
+ }
1792
1801
  const concat = node.concatTokens().toUpperCase();
1793
1802
  if (concat.includes(" GROUP BY ") || concat.startsWith("LOOP AT GROUP ")) {
1794
1803
  return undefined;
1795
1804
  }
1796
1805
  const isReference = concat.includes(" REFERENCE INTO ");
1797
1806
  const indentation = " ".repeat(node.getFirstToken().getStart().getCol() - 1);
1798
- const dataTarget = (_c = (_b = node.findDirectExpression(Expressions.LoopTarget)) === null || _b === void 0 ? void 0 : _b.findDirectExpression(Expressions.Target)) === null || _c === void 0 ? void 0 : _c.findDirectExpression(Expressions.InlineData);
1807
+ const dataTarget = (_b = (_a = node.findDirectExpression(Expressions.LoopTarget)) === null || _a === void 0 ? void 0 : _a.findDirectExpression(Expressions.Target)) === null || _b === void 0 ? void 0 : _b.findDirectExpression(Expressions.InlineData);
1799
1808
  if (dataTarget) {
1800
- const targetName = ((_d = dataTarget.findDirectExpression(Expressions.TargetField)) === null || _d === void 0 ? void 0 : _d.concatTokens()) || "DOWNPORT_ERROR";
1809
+ const targetName = ((_c = dataTarget.findDirectExpression(Expressions.TargetField)) === null || _c === void 0 ? void 0 : _c.concatTokens()) || "DOWNPORT_ERROR";
1801
1810
  let code = `DATA ${targetName} LIKE LINE OF ${sourceName}.\n${indentation}`;
1802
1811
  if (isReference) {
1803
1812
  const likeName = this.uniqueName(node.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
@@ -1808,10 +1817,15 @@ ${indentation} output = ${uniqueName}.\n`;
1808
1817
  const fix = edit_helper_1.EditHelper.merge(fix2, fix1);
1809
1818
  return issue_1.Issue.atToken(lowFile, node.getFirstToken(), "Outline LOOP data target", this.getMetadata().key, this.conf.severity, fix);
1810
1819
  }
1811
- const fsTarget = (_f = (_e = node.findDirectExpression(Expressions.LoopTarget)) === null || _e === void 0 ? void 0 : _e.findDirectExpression(Expressions.FSTarget)) === null || _f === void 0 ? void 0 : _f.findDirectExpression(Expressions.InlineFS);
1820
+ const fsTarget = (_e = (_d = node.findDirectExpression(Expressions.LoopTarget)) === null || _d === void 0 ? void 0 : _d.findDirectExpression(Expressions.FSTarget)) === null || _e === void 0 ? void 0 : _e.findDirectExpression(Expressions.InlineFS);
1812
1821
  if (fsTarget) {
1813
- const targetName = ((_g = fsTarget.findDirectExpression(Expressions.TargetFieldSymbol)) === null || _g === void 0 ? void 0 : _g.concatTokens()) || "DOWNPORT_ERROR";
1814
- const code = `FIELD-SYMBOLS ${targetName} LIKE LINE OF ${sourceName}.\n${indentation}`;
1822
+ const targetName = ((_f = fsTarget.findDirectExpression(Expressions.TargetFieldSymbol)) === null || _f === void 0 ? void 0 : _f.concatTokens()) || "DOWNPORT_ERROR";
1823
+ let type = `LIKE LINE OF ${sourceName}`;
1824
+ const f = foundType === null || foundType === void 0 ? void 0 : foundType.getType();
1825
+ if (f instanceof basic_1.TableType && f.getRowType() instanceof basic_1.AnyType) {
1826
+ type = "TYPE ANY";
1827
+ }
1828
+ const code = `FIELD-SYMBOLS ${targetName} ${type}.\n${indentation}`;
1815
1829
  const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, node.getFirstToken().getStart(), code);
1816
1830
  const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, fsTarget.getFirstToken().getStart(), fsTarget.getLastToken().getEnd(), targetName);
1817
1831
  const fix = edit_helper_1.EditHelper.merge(fix2, fix1);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/core",
3
- "version": "2.113.80",
3
+ "version": "2.113.82",
4
4
  "description": "abaplint - Core API",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/abaplint.d.ts",
@@ -50,12 +50,12 @@
50
50
  },
51
51
  "homepage": "https://abaplint.org",
52
52
  "devDependencies": {
53
- "@microsoft/api-extractor": "^7.48.0",
53
+ "@microsoft/api-extractor": "^7.48.1",
54
54
  "@types/chai": "^4.3.20",
55
55
  "@types/mocha": "^10.0.10",
56
- "@types/node": "^22.10.1",
56
+ "@types/node": "^22.10.2",
57
57
  "chai": "^4.5.0",
58
- "eslint": "^9.16.0",
58
+ "eslint": "^9.17.0",
59
59
  "mocha": "^11.0.1",
60
60
  "c8": "^10.1.3",
61
61
  "source-map-support": "^0.5.21",
@@ -63,7 +63,7 @@
63
63
  "typescript": "^5.7.2"
64
64
  },
65
65
  "dependencies": {
66
- "fast-xml-parser": "^4.5.0",
66
+ "fast-xml-parser": "^4.5.1",
67
67
  "json5": "^2.2.3",
68
68
  "vscode-languageserver-types": "^3.17.5"
69
69
  }