@abaplint/core 2.102.44 → 2.102.46

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.
@@ -305,11 +305,10 @@ class TypeUtils {
305
305
  }
306
306
  }
307
307
  else if (source instanceof basic_1.IntegerType) {
308
- if (target instanceof basic_1.StringType
309
- || target instanceof basic_1.PackedType) {
308
+ if (target instanceof basic_1.StringType) {
310
309
  return false;
311
310
  }
312
- else if (target instanceof basic_1.Integer8Type) {
311
+ else if (target instanceof basic_1.Integer8Type || target instanceof basic_1.PackedType) {
313
312
  if (((_h = source.getAbstractTypeData()) === null || _h === void 0 ? void 0 : _h.derivedFromConstant) === true) {
314
313
  return true;
315
314
  }
@@ -6,6 +6,9 @@ const target_1 = require("../expressions/target");
6
6
  const source_1 = require("../expressions/source");
7
7
  const dynamic_1 = require("../expressions/dynamic");
8
8
  const basic_types_1 = require("../basic_types");
9
+ const basic_1 = require("../../types/basic");
10
+ const _typed_identifier_1 = require("../../types/_typed_identifier");
11
+ const _reference_1 = require("../_reference");
9
12
  class CreateData {
10
13
  runSyntax(node, scope, filename) {
11
14
  for (const s of node.findDirectExpressions(Expressions.Source)) {
@@ -19,7 +22,23 @@ class CreateData {
19
22
  }
20
23
  const type = node.findDirectExpression(Expressions.TypeName);
21
24
  if (type) {
22
- new basic_types_1.BasicTypes(filename, scope).resolveTypeName(type);
25
+ const found = new basic_types_1.BasicTypes(filename, scope).resolveTypeName(type);
26
+ if (found instanceof basic_1.UnknownType) {
27
+ if (node.concatTokens().toUpperCase().includes(" REF TO ")) {
28
+ const def = scope.findObjectDefinition(type.concatTokens());
29
+ if (def) {
30
+ scope.addReference(type.getFirstToken(), def, _reference_1.ReferenceType.TypeReference, filename);
31
+ }
32
+ else {
33
+ const identifier = new _typed_identifier_1.TypedIdentifier(type.getFirstToken(), filename, found);
34
+ scope.addReference(type.getFirstToken(), identifier, _reference_1.ReferenceType.TypeReference, filename);
35
+ }
36
+ }
37
+ else {
38
+ const identifier = new _typed_identifier_1.TypedIdentifier(type.getFirstToken(), filename, found);
39
+ scope.addReference(type.getFirstToken(), identifier, _reference_1.ReferenceType.TypeReference, filename);
40
+ }
41
+ }
23
42
  }
24
43
  }
25
44
  }
@@ -65,7 +65,7 @@ class Registry {
65
65
  }
66
66
  static abaplintVersion() {
67
67
  // magic, see build script "version.sh"
68
- return "2.102.44";
68
+ return "2.102.46";
69
69
  }
70
70
  getDDICReferences() {
71
71
  return this.ddicReferences;
@@ -4,14 +4,12 @@ exports.DefinitionsTop = exports.DefinitionsTopConf = void 0;
4
4
  const issue_1 = require("../issue");
5
5
  const _statement_1 = require("../abap/2_statements/statements/_statement");
6
6
  const Statements = require("../abap/2_statements/statements");
7
- const Expressions = require("../abap/2_statements/expressions");
8
7
  const Structures = require("../abap/3_structures/structures");
9
8
  const _abap_rule_1 = require("./_abap_rule");
10
9
  const _basic_rule_config_1 = require("./_basic_rule_config");
11
10
  const _irule_1 = require("./_irule");
12
11
  const edit_helper_1 = require("../edit_helper");
13
12
  const nodes_1 = require("../abap/nodes");
14
- const version_1 = require("../version");
15
13
  class DefinitionsTopConf extends _basic_rule_config_1.BasicRuleConfig {
16
14
  }
17
15
  exports.DefinitionsTopConf = DefinitionsTopConf;
@@ -30,10 +28,16 @@ class DefinitionsTop extends _abap_rule_1.ABAPRule {
30
28
  key: "definitions_top",
31
29
  title: "Place definitions in top of routine",
32
30
  shortDescription: `Checks that definitions are placed at the beginning of METHODs, FORMs and FUNCTIONs.`,
33
- extendedInformation: `If the routine has inline definitions then no issues are reported
34
-
35
- https://docs.abapopenchecks.org/checks/17/`,
31
+ extendedInformation: `https://docs.abapopenchecks.org/checks/17/`,
36
32
  tags: [_irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Quickfix],
33
+ badExample: `FROM foo.
34
+ WRITE 'hello'.
35
+ DATA int TYPE i.
36
+ ENDFORM.`,
37
+ goodExample: `FROM foo.
38
+ DATA int TYPE i.
39
+ WRITE 'hello'.
40
+ ENDFORM.`,
37
41
  };
38
42
  }
39
43
  getMessage() {
@@ -62,10 +66,6 @@ https://docs.abapopenchecks.org/checks/17/`,
62
66
  this.fixed = false;
63
67
  this.mode = DEFINITION;
64
68
  this.moveTo = (_a = r.getFirstStatement()) === null || _a === void 0 ? void 0 : _a.getLastToken().getEnd();
65
- if (this.reg.getConfig().getVersion() !== version_1.Version.v702
66
- && r.findFirstExpression(Expressions.InlineData)) {
67
- continue;
68
- }
69
69
  const found = this.walk(r, file);
70
70
  if (found) {
71
71
  issues.push(found);
@@ -126,16 +126,19 @@ https://docs.abapopenchecks.org/checks/17/`,
126
126
  && (get instanceof Statements.Data
127
127
  || get instanceof Statements.Type
128
128
  || get instanceof Statements.Constant
129
+ || (get instanceof Statements.Move && c.concatTokens().toUpperCase().startsWith("DATA("))
129
130
  || get instanceof Statements.Static
130
131
  || get instanceof Statements.FieldSymbol)) {
131
132
  if (this.mode === AFTER) {
132
133
  // only one fix per routine, as it reorders a lot
133
- let fix = undefined;
134
- if (this.fixed === false && this.moveTo) {
135
- fix = this.buildFix(file, c, this.moveTo);
136
- this.fixed = true;
134
+ if (!(get instanceof Statements.Move && c.concatTokens().toUpperCase().startsWith("DATA("))) {
135
+ let fix = undefined;
136
+ if (this.fixed === false && this.moveTo) {
137
+ fix = this.buildFix(file, c, this.moveTo);
138
+ this.fixed = true;
139
+ }
140
+ return issue_1.Issue.atStatement(file, c, this.getMessage(), this.getMetadata().key, this.conf.severity, fix);
137
141
  }
138
- return issue_1.Issue.atStatement(file, c, this.getMessage(), this.getMetadata().key, this.conf.severity, fix);
139
142
  }
140
143
  else {
141
144
  this.moveTo = c.getLastToken().getEnd();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/core",
3
- "version": "2.102.44",
3
+ "version": "2.102.46",
4
4
  "description": "abaplint - Core API",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/abaplint.d.ts",
@@ -53,9 +53,9 @@
53
53
  "@microsoft/api-extractor": "^7.37.0",
54
54
  "@types/chai": "^4.3.6",
55
55
  "@types/mocha": "^10.0.1",
56
- "@types/node": "^20.6.2",
56
+ "@types/node": "^20.6.5",
57
57
  "chai": "^4.3.8",
58
- "eslint": "^8.49.0",
58
+ "eslint": "^8.50.0",
59
59
  "mocha": "^10.2.0",
60
60
  "c8": "^8.0.1",
61
61
  "source-map-support": "^0.5.21",
@@ -63,7 +63,7 @@
63
63
  "typescript": "^5.2.2"
64
64
  },
65
65
  "dependencies": {
66
- "fast-xml-parser": "^4.2.7",
66
+ "fast-xml-parser": "^4.3.1",
67
67
  "json5": "^2.2.3",
68
68
  "vscode-languageserver-types": "^3.17.3"
69
69
  }